From c5b21f87019744450669befe5288e83c1ace4c79 Mon Sep 17 00:00:00 2001 From: 127 Date: Thu, 9 Jan 2020 14:42:45 +0200 Subject: [PATCH] cleanup code --- Gemfile | 2 +- app/assets/stylesheets/application.css.erb | 411 +- app/controllers/account_controller.rb | 49 +- app/controllers/admin/accounts_controller.rb | 17 +- app/controllers/admin/admin_controller.rb | 15 +- app/controllers/admin/roles_controller.rb | 17 +- .../admin/subscriptions_controller.rb | 19 +- app/controllers/admin/users_controller.rb | 56 +- app/controllers/application_controller.rb | 40 +- app/controllers/pages_controller.rb | 4 +- app/controllers/registrations_controller.rb | 27 +- app/controllers/subscriptions_controller.rb | 14 +- app/helpers/application_helper.rb | 23 +- app/inputs/datepicker_input.rb | 4 +- app/javascript/channels/consumer.js | 2 +- app/javascript/channels/index.js | 4 +- app/javascript/packs/application.js | 10 +- app/models/account.rb | 21 +- app/models/subscription.rb | 4 +- app/models/user.rb | 43 +- app/views/account/index.html.erb | 70 +- app/views/admin/accounts/_form.html.erb | 6 +- app/views/admin/accounts/edit.html.erb | 2 +- app/views/admin/accounts/index.html.erb | 60 +- app/views/admin/accounts/new.html.erb | 2 +- app/views/admin/accounts/show.html.erb | 16 +- app/views/admin/roles/_form.html.erb | 6 +- app/views/admin/roles/edit.html.erb | 2 +- app/views/admin/roles/index.html.erb | 60 +- app/views/admin/roles/new.html.erb | 2 +- app/views/admin/roles/show.html.erb | 4 +- app/views/admin/shared/_menu.html.erb | 43 +- app/views/admin/subscriptions/_form.html.erb | 6 +- app/views/admin/subscriptions/edit.html.erb | 2 +- app/views/admin/subscriptions/index.html.erb | 64 +- app/views/admin/subscriptions/new.html.erb | 2 +- app/views/admin/subscriptions/show.html.erb | 6 +- app/views/admin/users/edit.html.erb | 10 +- app/views/admin/users/index.html.erb | 72 +- app/views/admin/users/new.html.erb | 12 +- app/views/admin/users/show.html.erb | 14 +- app/views/devise/confirmations/new.html.erb | 6 +- app/views/devise/invitations/edit.html.erb | 4 +- app/views/devise/invitations/new.html.erb | 8 +- .../confirmation_instructions.ru.html.erb | 2 +- .../reset_password_instructions.ru.html.erb | 2 +- .../mailer/unlock_instructions.ru.html.erb | 2 +- app/views/devise/passwords/edit.html.erb | 10 +- app/views/devise/passwords/new.html.erb | 8 +- app/views/devise/registrations/edit.html.erb | 25 +- app/views/devise/registrations/new.html.erb | 16 +- app/views/devise/sessions/new.html.erb | 14 +- app/views/devise/shared/_agree.html.erb | 4 +- .../devise/shared/_flash_messages.html.erb | 4 +- app/views/devise/shared/_links.html.erb | 10 +- app/views/devise/unlocks/new.html.erb | 10 +- app/views/layouts/application.html.erb | 180 +- app/views/layouts/mailer.html.erb | 1753 ++++---- app/views/pages/contacts.en.html.erb | 6 +- app/views/pages/index.en.html.erb | 871 ++-- app/views/pages/privacy.en.html.erb | 46 +- app/views/pages/terms.en.html.erb | 189 +- app/views/shared/_pagination_form.html.erb | 4 +- app/views/subscriptions/_form.html.erb | 6 +- app/views/subscriptions/new.html.erb | 2 +- babel.config.js | 140 +- bin/bundle | 14 +- bin/webpack | 4 +- bin/webpack-dev-server | 4 +- config/database.yml | 2 +- config/environments/development.rb | 10 +- config/environments/production.rb | 28 +- config/environments/test.rb | 12 +- config/initializers/devise.rb | 2 +- config/initializers/recaptcha.rb | 2 +- config/initializers/simple_form.rb | 6 +- config/initializers/simple_form_bootstrap.rb | 54 +- config/locales/en.yml | 46 +- config/locales/ru.yml | 120 +- config/locales/simple_form.ru.yml | 68 +- config/puma.rb | 2 +- config/routes.rb | 38 +- config/spring.rb | 8 +- config/webpack/development.js | 6 +- config/webpack/environment.js | 4 +- config/webpack/production.js | 6 +- config/webpack/test.js | 6 +- db/seeds.rb | 22 +- postcss.config.js | 22 +- public/404.html | 104 +- public/422.html | 104 +- public/500.html | 102 +- vendor/assets/fonts/icomoon.svg | 1327 +++--- vendor/assets/fonts/ionicons.svg | 3771 +++++++++-------- vendor/assets/stylesheets/icomoon.css.erb | 1098 +++-- .../assets/stylesheets/ionicons.min.css.erb | 2958 ++++++++++++- 96 files changed, 9155 insertions(+), 5360 deletions(-) diff --git a/Gemfile b/Gemfile index 160779a..2f31176 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ end gem 'bootstrap4-kaminari-views' gem 'devise' -gem 'devise_invitable'#, '~> 2.0.0' +gem 'devise_invitable' #, '~> 2.0.0' gem 'omniauth-facebook' # use very carefuylly gem 'omniauth-twitter' diff --git a/app/assets/stylesheets/application.css.erb b/app/assets/stylesheets/application.css.erb index f3e2950..45da048 100644 --- a/app/assets/stylesheets/application.css.erb +++ b/app/assets/stylesheets/application.css.erb @@ -16,90 +16,93 @@ *= require_self */ -body {padding-top: 100px!important;} +body { + padding-top: 100px !important; +} + /* ========================================================================== Wrap Sections ========================================================================== */ #headerwrap { - background: url(<%= asset_path 'header_bg.jpg' %>) no-repeat center top; - margin-top: -50px; - padding-top:120px; - text-align:center; - background-attachment: relative; - background-position: center center; - min-height: 650px; - width: 100%; - - -webkit-background-size: 100%; - -moz-background-size: 100%; - -o-background-size: 100%; - background-size: 100%; - - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; + background: url(<%= asset_path 'header_bg.jpg' %>) no-repeat center top; + margin-top: -50px; + padding-top: 120px; + text-align: center; + background-attachment: relative; + background-position: center center; + min-height: 650px; + width: 100%; + + -webkit-background-size: 100%; + -moz-background-size: 100%; + -o-background-size: 100%; + background-size: 100%; + + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; } #headerwrap h1 { - color:#ffffff; - margin-top: 90px; - padding-bottom: 30px; - letter-spacing: 8px; - font-size: 100px; - font-weight: bold; - text-shadow: 2px 2px 2px #000; + color: #ffffff; + margin-top: 90px; + padding-bottom: 30px; + letter-spacing: 8px; + font-size: 100px; + font-weight: bold; + text-shadow: 2px 2px 2px #000; } #headerwrap p { - color:#ffffff; - font-size: 40px; - font-weight: 400; - text-align: center; - line-height: 40px; - letter-spacing: 3px; - margin-left: 15px; - text-shadow: 1px 1px 1px #000; + color: #ffffff; + font-size: 40px; + font-weight: 400; + text-align: center; + line-height: 40px; + letter-spacing: 3px; + margin-left: 15px; + text-shadow: 1px 1px 1px #000; } #greywrap { - background: #f5f5f5; - margin-top: 0px; - padding-top: 40px; - border-bottom: 1px solid #ddd; - text-align: center; + background: #f5f5f5; + margin-top: 0px; + padding-top: 40px; + border-bottom: 1px solid #ddd; + text-align: center; } #greywrap .callout { - margin-bottom: 20px; + margin-bottom: 20px; } #greywrap p { - margin-left: 30px; - margin-right: 30px; - letter-spacing: 1px; - padding-top: 15px; - padding-bottom: 15px; + margin-left: 30px; + margin-right: 30px; + letter-spacing: 1px; + padding-top: 15px; + padding-bottom: 15px; } #greywrap .icon { - font-size: 60px; - line-height: 30px; - margin-bottom: 10px; + font-size: 60px; + line-height: 30px; + margin-bottom: 10px; } #footerwrap { - background: #2b2b2b; - margin-top: 0px; - padding-top: 40px; - padding-bottom: 20px; - border-bottom: 1px solid #ddd; - text-align: center; + background: #2b2b2b; + margin-top: 0px; + padding-top: 40px; + padding-bottom: 20px; + border-bottom: 1px solid #ddd; + text-align: center; } #footerwrap h4 { - color: white; + color: white; } @@ -108,129 +111,128 @@ body {padding-top: 100px!important;} ========================================================================== */ .white h1 { - padding-top: 35px; + padding-top: 35px; } .white p { - padding-top: 25px; + padding-top: 25px; } /* Section Dividers */ .section-divider { - z-index: 999; - width: 100%; - display: table; - max-height: 450px; - border-bottom: 2px solid #E6EAED; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - padding-top: 30px; - padding-bottom: 70px; - margin-top: 45px; + z-index: 999; + width: 100%; + display: table; + max-height: 450px; + border-bottom: 2px solid #E6EAED; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + padding-top: 30px; + padding-bottom: 70px; + margin-top: 45px; - background-position: center center; + background-position: center center; - -webkit-background-size: 100%; - -moz-background-size: 100%; - -o-background-size: 100%; - background-size: 100%; + -webkit-background-size: 100%; + -moz-background-size: 100%; + -o-background-size: 100%; + background-size: 100%; - -webkit-background-size: cover; - -moz-background-size: cover; - -o-background-size: cover; - background-size: cover; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; - background-attachment: relative; - - text-align: center; + background-attachment: relative; + + text-align: center; } .textdivider h1 { - padding-top: 70px; - color: white; - font-size: 40px; + padding-top: 70px; + color: white; + font-size: 40px; } .textdivider p { - color: white; - font-size: 25px; + color: white; + font-size: 25px; } /* Section Dividers Backgrounds */ .divider1 { - background-image: url(<%= asset_path 'divider1.jpg' %>) + background-image: url(<%= asset_path 'divider1.jpg' %>) } .divider2 { - background-image: url(<%= asset_path 'divider2.jpg' %>) + background-image: url(<%= asset_path 'divider2.jpg' %>) } .divider3 { - background-image: url(<%= asset_path 'divider3.jpg' %>); - margin-top: 0px; + background-image: url(<%= asset_path 'divider3.jpg' %>); + margin-top: 0px; } .divider4 { - background-image: url(<%= asset_path 'divider4.jpg' %>) + background-image: url(<%= asset_path 'divider4.jpg' %>) } .divider6 { - background-image: url(<%= asset_path 'divider6.jpg' %>) + background-image: url(<%= asset_path 'divider6.jpg' %>) } - /* ========================================================================== Services Section ========================================================================== */ .service-trigger { - display: block; - position: relative; - margin-bottom: 15px; - color: white; - font-size: 20px; - text-align: center; - height: 168px; - cursor: pointer; - padding: 90px 20px 50px 20px; - border: none; - background: #333; + display: block; + position: relative; + margin-bottom: 15px; + color: white; + font-size: 20px; + text-align: center; + height: 168px; + cursor: pointer; + padding: 90px 20px 50px 20px; + border: none; + background: #333; } .service-trigger:before { - width: 100%; - top: 50px; - color: #3498db; - font-size: 36px; - text-align: center; - position: absolute; - left: 0; + width: 100%; + top: 50px; + color: #3498db; + font-size: 36px; + text-align: center; + position: absolute; + left: 0; } .service-active .service-trigger { - background: #222; + background: #222; } .service-active p { - font-family: 'Lato', sans-serif; - padding-top: 10px; + font-family: 'Lato', sans-serif; + padding-top: 10px; } .service-content { - padding: 15px 20px; - background: #e6eaed; - display: block; - height: auto + padding: 15px 20px; + background: #e6eaed; + display: block; + height: auto } .service-content p:last-child { - margin: 0; + margin: 0; } @@ -239,98 +241,98 @@ body {padding-top: 100px!important;} ========================================================================== */ .grid figure { - margin: 0; - position: relative; + margin: 0; + position: relative; } .grid figure img { - width: 100%; - display: block; - position: relative; + width: 100%; + display: block; + position: relative; } .grid figcaption { - position: absolute; - top: 0; - left: 0; - padding: 20px; - color: #fff; - background: #3498db; + position: absolute; + top: 0; + left: 0; + padding: 20px; + color: #fff; + background: #3498db; } .grid figcaption h5 { - margin: 0; - padding-top: 0px; - padding-left: 20px; - padding-bottom: 5px; - color: #fff; - font-weight: 700; - text-align: left; - letter-spacing: 2px; - + margin: 0; + padding-top: 0px; + padding-left: 20px; + padding-bottom: 5px; + color: #fff; + font-weight: 700; + text-align: left; + letter-spacing: 2px; + } .grid figcaption a { - text-align: left; - padding: 5px 10px; - margin-left: 20px; - display: inline-block; - background: #2f2f2f; - color: #fff; - font-size: 13px; + text-align: left; + padding: 5px 10px; + margin-left: 20px; + display: inline-block; + background: #2f2f2f; + color: #fff; + font-size: 13px; } /* Caption Style */ .mask figure { - overflow: hidden; + overflow: hidden; } .mask figure img { - -webkit-transition: -webkit-transform 0.4s; - -moz-transition: -moz-transform 0.4s; - transition: transform 0.4s; + -webkit-transition: -webkit-transform 0.4s; + -moz-transition: -moz-transform 0.4s; + transition: transform 0.4s; } .no-touch .mask figure:hover img, .mask figure.cs-hover img { - -webkit-transform: translateY(-30px); - -moz-transform: translateY(-30px); - -ms-transform: translateY(-30px); - transform: translateY(-30px); + -webkit-transform: translateY(-30px); + -moz-transform: translateY(-30px); + -ms-transform: translateY(-30px); + transform: translateY(-30px); } .mask figcaption { - height: 50px; - width: 100%; - top: auto; - bottom: 0; - opacity: 0; - -webkit-transform: translateY(100%); - -moz-transform: translateY(100%); - -ms-transform: translateY(100%); - transform: translateY(100%); - -webkit-transition: -webkit-transform 0.4s, opacity 0.1s 0.3s; - -moz-transition: -moz-transform 0.4s, opacity 0.1s 0.3s; - transition: transform 0.4s, opacity 0.1s 0.3s; + height: 50px; + width: 100%; + top: auto; + bottom: 0; + opacity: 0; + -webkit-transform: translateY(100%); + -moz-transform: translateY(100%); + -ms-transform: translateY(100%); + transform: translateY(100%); + -webkit-transition: -webkit-transform 0.4s, opacity 0.1s 0.3s; + -moz-transition: -moz-transform 0.4s, opacity 0.1s 0.3s; + transition: transform 0.4s, opacity 0.1s 0.3s; } .no-touch .mask figure:hover figcaption, .mask figure.cs-hover figcaption { - opacity: 1; - -webkit-transform: translateY(0px); - -moz-transform: translateY(0px); - -ms-transform: translateY(0px); - transform: translateY(0px); - -webkit-transition: -webkit-transform 0.4s, opacity 0.1s; - -moz-transition: -moz-transform 0.4s, opacity 0.1s; - transition: transform 0.4s, opacity 0.1s; + opacity: 1; + -webkit-transform: translateY(0px); + -moz-transform: translateY(0px); + -ms-transform: translateY(0px); + transform: translateY(0px); + -webkit-transition: -webkit-transform 0.4s, opacity 0.1s; + -moz-transition: -moz-transform 0.4s, opacity 0.1s; + transition: transform 0.4s, opacity 0.1s; } .mask figcaption a { - position: absolute; - top:10px; - bottom: 10px; - right: 30px; + position: absolute; + top: 10px; + bottom: 10px; + right: 30px; } @@ -339,25 +341,25 @@ body {padding-top: 100px!important;} ========================================================================== */ .blog-bg { - background: #2b2b2b; - padding-right: 0px; - padding-left: 0px; - + background: #2b2b2b; + padding-right: 0px; + padding-left: 0px; + } .blog-bg h4 { - color: #dadada; - padding-top: 0px; + color: #dadada; + padding-top: 0px; } .blog-bg h5 { - color: #dadada; - font-size: 11px; + color: #dadada; + font-size: 11px; } .blog-content { - padding-top: 10px; - background: #f2f2f2; + padding-top: 10px; + background: #f2f2f2; } @@ -366,24 +368,31 @@ body {padding-top: 100px!important;} ========================================================================== */ -@media screen and (max-width:1050px), screen and (max-device-width:1050px){ - body .header{background-attachment: scroll;} +@media screen and (max-width: 1050px), screen and (max-device-width: 1050px) { + body .header { + background-attachment: scroll; + } } /*ipad portrait*/ -@media only screen and (min-device-width:768px) and (max-device-width : 1024px) and (orientation : portrait){ - .header{background-attachment: scroll;} +@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) { + .header { + background-attachment: scroll; + } } -@media screen and (max-width:769px) { - #headerwrap h1 { - font-size: 80px; - } - #headerwrap p { - font-size: 30px; - line-height: 38px; - } +@media screen and (max-width: 769px) { + #headerwrap h1 { + font-size: 80px; + } + + #headerwrap p { + font-size: 30px; + line-height: 38px; + } } -.simple_form {margin-bottom: 30px;} \ No newline at end of file +.simple_form { + margin-bottom: 30px; +} \ No newline at end of file diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 60f1472..9b6b509 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -1,33 +1,34 @@ # TODO refactor account number creation class AccountController < ApplicationController before_action :authenticate_user! - + def index @users = set_users if current_user.role? :owner end - def remove - params[:id]= params[:id].to_i - if(current_user.role?(:owner) && current_user.id != params[:id]) - user = set_users.find params[:id] - if user - user.roles.clear - user.account = Account.create - user.save! - msg = 'User was removed from account.' - end - else - msg = 'Owner cannot remove himself from account' - end - - respond_to do |format| - format.html { redirect_to account_index_url, notice: msg } - format.json { head :no_content } - end - end - - private - def set_users - current_user.account.users + def remove + params[:id] = params[:id].to_i + if (current_user.role?(:owner) && current_user.id != params[:id]) + user = set_users.find params[:id] + if user + user.roles.clear + user.account = Account.create + user.save! + msg = 'User was removed from account.' + end + else + msg = 'Owner cannot remove himself from account' + end + + respond_to do |format| + format.html { redirect_to account_index_url, notice: msg } + format.json { head :no_content } end + end + + private + + def set_users + current_user.account.users + end end diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index 2ff94c4..96c9122 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -62,13 +62,14 @@ def destroy end private - # Use callbacks to share common setup or constraints between actions. - def set_account - @account = Account.find(params[:id]) - end - # Never trust parameters from the scary internet, only allow the white list through. - def account_params - params.require(:account).permit(:number) - end + # Use callbacks to share common setup or constraints between actions. + def set_account + @account = Account.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def account_params + params.require(:account).permit(:number) + end end diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb index 449439a..5bbf691 100644 --- a/app/controllers/admin/admin_controller.rb +++ b/app/controllers/admin/admin_controller.rb @@ -1,11 +1,12 @@ -class Admin::AdminController < ApplicationController +class Admin::AdminController < ApplicationController before_action :authenticate_user! before_action :check_auth - + private - def check_auth - if !current_user.role? :admin - render 'shared/prohibited' - end - end + + def check_auth + if !current_user.role? :admin + render 'shared/prohibited' + end + end end \ No newline at end of file diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index 4eb977f..2ffa876 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -62,13 +62,14 @@ def destroy end private - # Use callbacks to share common setup or constraints between actions. - def set_role - @role = Role.find(params[:id]) - end - # Never trust parameters from the scary internet, only allow the white list through. - def role_params - params.require(:role).permit(:name) - end + # Use callbacks to share common setup or constraints between actions. + def set_role + @role = Role.find(params[:id]) + end + + # Never trust parameters from the scary internet, only allow the white list through. + def role_params + params.require(:role).permit(:name) + end end diff --git a/app/controllers/admin/subscriptions_controller.rb b/app/controllers/admin/subscriptions_controller.rb index 7a8dced..a96534a 100644 --- a/app/controllers/admin/subscriptions_controller.rb +++ b/app/controllers/admin/subscriptions_controller.rb @@ -1,4 +1,4 @@ -class Admin::SubscriptionsController < Admin::AdminController +class Admin::SubscriptionsController < Admin::AdminController before_action :set_subscription, only: [:show, :edit, :update, :destroy] # GET /subscriptions @@ -62,13 +62,14 @@ def destroy end private - # Use callbacks to share common setup or constraints between actions. - def set_subscription - @subscription = Subscription.find params[:id] - end - # Never trust parameters from the scary internet, only allow the white list through. - def subscription_params - params.require(:subscription).permit(:email, :name, :status) - end + # Use callbacks to share common setup or constraints between actions. + def set_subscription + @subscription = Subscription.find params[:id] + end + + # Never trust parameters from the scary internet, only allow the white list through. + def subscription_params + params.require(:subscription).permit(:email, :name, :status) + end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 553a748..41ec785 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -27,15 +27,15 @@ def edit def create @user = User.new(user_params) respond_to do |format| - if @user.save - @user.confirm - format.html { redirect_to [:admin, @user], notice: 'Document was successfully created.' } - format.json { render action: 'show', status: :created, location: @user } - else - format.html { render action: 'new' } - format.json { render json: @user.errors, status: :unprocessable_entity } - end - end + if @user.save + @user.confirm + format.html { redirect_to [:admin, @user], notice: 'Document was successfully created.' } + format.json { render action: 'show', status: :created, location: @user } + else + format.html { render action: 'new' } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end end # PATCH/PUT /users/1 @@ -53,8 +53,8 @@ def update end end - # DELETE /users/1 - # DELETE /users/1.json + # DELETE /users/1 + # DELETE /users/1.json def destroy @user.destroy respond_to do |format| @@ -64,24 +64,24 @@ def destroy end private - - def set_user - @user = User.find(params[:id]) - end - - def check_role - @admin = false - current_user.roles.each do |role| - if role.name.to_s == 'admin' - @admin = true - break - end + + def set_user + @user = User.find(params[:id]) + end + + def check_role + @admin = false + current_user.roles.each do |role| + if role.name.to_s == 'admin' + @admin = true + break end - render 'shared/prohibited' if @admin == false - end - - def user_params - params.require(:user).permit(:email, :password, :password_confirmation, :account_id) end + render 'shared/prohibited' if @admin == false + end + + def user_params + params.require(:user).permit(:email, :password, :password_confirmation, :account_id) + end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 517245c..a4b8635 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,29 +4,29 @@ class ApplicationController < ActionController::Base def set_locale # params[:locale] || - I18n.locale = params[:locale] || I18n.default_locale || extract_locale_from_accept_language_header #|| I18n.default_locale + I18n.locale = params[:locale] || I18n.default_locale || extract_locale_from_accept_language_header #|| I18n.default_locale end - def default_url_options(options={}) - { :locale => I18n.locale } + def default_url_options(options = {}) + {:locale => I18n.locale} end - + private - def extract_locale_from_accept_language_header - request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first - end - - # def after_inactive_sign_up_path_for resource - # new_user_session_path - # end - - # Overwriting the sign_out redirect path method - def after_sign_out_path_for resource - new_user_session_path :locale => I18n.locale - end - - def after_sign_up_path_for resource - root_path :locale => I18n.locale - end + def extract_locale_from_accept_language_header + request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first + end + + # def after_inactive_sign_up_path_for resource + # new_user_session_path + # end + + # Overwriting the sign_out redirect path method + def after_sign_out_path_for resource + new_user_session_path :locale => I18n.locale + end + + def after_sign_up_path_for resource + root_path :locale => I18n.locale + end end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 5c50c92..ce72444 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,9 +1,9 @@ class PagesController < ApplicationController def index - if !params[:page] && user_signed_in? + if !params[:page] && user_signed_in? # will cause test:system error if enabled here # redirect_to root_path - else + else @subscription = Subscription.new render params[:page] || 'index' end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 27b20e5..915741f 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -4,19 +4,20 @@ class RegistrationsController < Devise::RegistrationsController prepend_before_action :check_captcha, only: [:create] private - def after_inactive_sign_up_path_for resource - new_user_session_path - end - def check_captcha - return if Rails.env.test? - unless verify_recaptcha - self.resource = resource_class.new sign_up_params - resource.validate # Look for any other validation errors besides Recaptcha - set_minimum_password_length - respond_with resource - end + def after_inactive_sign_up_path_for resource + new_user_session_path + end + + def check_captcha + return if Rails.env.test? + unless verify_recaptcha + self.resource = resource_class.new sign_up_params + resource.validate # Look for any other validation errors besides Recaptcha + set_minimum_password_length + respond_with resource end - - + end + + end diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index d1004b3..945c229 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -4,10 +4,11 @@ class SubscriptionsController < ApplicationController def new @subscription = Subscription.new end - + def show @subscription = Subscription.find params[:id] end + # POST /subscriptions # POST /subscriptions.json def create @@ -23,10 +24,11 @@ def create end end end - + private - # Never trust parameters from the scary internet, only allow the white list through. - def subscription_params - params.require(:subscription).permit(:email, :name) - end + + # Never trust parameters from the scary internet, only allow the white list through. + def subscription_params + params.require(:subscription).permit(:email, :name) + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a26f8b5..0b95e6d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,19 +5,20 @@ def avatar_url(email) gravatar_id = Digest::MD5::hexdigest(email).downcase "https://gravatar.com/avatar/#{gravatar_id}?s=20&d=#{default_url}" #{CGI.escape(default_url)}" end + def bootstrap_class_for(flash_type) case flash_type - when "success" - "alert-success" # Green - when "error" - when "recaptcha_error" - "alert-danger" # Red - when "alert" - "alert-warning" # Yellow - when "notice" - "alert-info" # Blue - else - flash_type.to_s + when "success" + "alert-success" # Green + when "error" + when "recaptcha_error" + "alert-danger" # Red + when "alert" + "alert-warning" # Yellow + when "notice" + "alert-info" # Blue + else + flash_type.to_s end end end diff --git a/app/inputs/datepicker_input.rb b/app/inputs/datepicker_input.rb index 26a81b0..e248f35 100644 --- a/app/inputs/datepicker_input.rb +++ b/app/inputs/datepicker_input.rb @@ -8,9 +8,9 @@ class DatepickerInput < SimpleForm::Inputs::Base def input wrapper_options value = object.send(attribute_name) if object.respond_to? attribute_name - input_html_options[:value] = value.present? ? I18n.localize(value, { :format => "%Y-%m-%d" }) : Time.now.to_date + input_html_options[:value] = value.present? ? I18n.localize(value, {:format => "%Y-%m-%d"}) : Time.now.to_date input_html_options[:class] << 'form-control' - @builder.text_field(attribute_name,input_html_options) + \ + @builder.text_field(attribute_name, input_html_options) + \ @builder.hidden_field(attribute_name, {:id => 'datepicker-hidden', :class => attribute_name.to_s + "-alt", :value => input_html_options[:value]}) end end diff --git a/app/javascript/channels/consumer.js b/app/javascript/channels/consumer.js index 0eceb59..1ff8853 100644 --- a/app/javascript/channels/consumer.js +++ b/app/javascript/channels/consumer.js @@ -1,6 +1,6 @@ // Action Cable provides the framework to deal with WebSockets in Rails. // You can generate new channels where WebSocket features live using the `rails generate channel` command. -import { createConsumer } from "@rails/actioncable" +import {createConsumer} from "@rails/actioncable" export default createConsumer() diff --git a/app/javascript/channels/index.js b/app/javascript/channels/index.js index 0cfcf74..298a304 100644 --- a/app/javascript/channels/index.js +++ b/app/javascript/channels/index.js @@ -1,5 +1,5 @@ // Load all the channels within this directory and all subdirectories. // Channel files must be named *_channel.js. -const channels = require.context('.', true, /_channel\.js$/) -channels.keys().forEach(channels) +const channels = require.context('.', true, /_channel\.js$/); +channels.keys().forEach(channels); diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 711f993..ec50b28 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -5,10 +5,10 @@ // TODO https://www.youtube.com/watch?reload=9&v=Hz8d6zPDSrk // https://bibwild.wordpress.com/2019/08/01/dealing-with-legacy-and-externally-loaded-code-in-webpacker/ -require("@rails/ujs").start() -require("turbolinks").start() -require("@rails/activestorage").start() -require("channels") +require("@rails/ujs").start(); +require("turbolinks").start(); +require("@rails/activestorage").start(); +require("channels"); document.addEventListener("turbolinks:load", () => { // $ -> @@ -17,7 +17,7 @@ document.addEventListener("turbolinks:load", () => { // altFormat: "dd-mm-yy" // dateFormat: "yy-mm-dd" // altField: $(this).next() -}) +}); // Uncomment to copy all static images under ../images to the output folder and reference // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) diff --git a/app/models/account.rb b/app/models/account.rb index 31545fe..23437d3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,18 +1,19 @@ class Account < ApplicationRecord acts_as_paranoid before_validation :setup_number, on: :create - + has_many :users, :dependent => :destroy # has_many :wallets, :dependent => :destroy paginates_per 25 - + private - def setup_number - begin - self.number = Random.new.rand(0..999999999) - rescue ActiveRecord::RecordNotUnique - retry - # end - end while self.class.exists?(number: number) - end + + def setup_number + begin + self.number = Random.new.rand(0..999999999) + rescue ActiveRecord::RecordNotUnique + retry + # end + end while self.class.exists?(number: number) + end end diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 68fa331..b8d1270 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -2,7 +2,7 @@ class Subscription < ApplicationRecord acts_as_paranoid validates_presence_of :email # validates_presence_of :name - validates :email, uniqueness: true - validates_format_of :email,:with => Devise::email_regexp + validates :email, uniqueness: true + validates_format_of :email, :with => Devise::email_regexp paginates_per 10 end diff --git a/app/models/user.rb b/app/models/user.rb index eb9dfd4..25e5479 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,11 +1,11 @@ class User < ApplicationRecord acts_as_paranoid - before_validation :setup_role, on: :create + before_validation :setup_role, on: :create before_validation :setup_account, on: :create - + TEMP_EMAIL_PREFIX = 'change@me' TEMP_EMAIL_REGEX = /\Achange@me/ - + belongs_to :account has_and_belongs_to_many :roles has_many :identities, :dependent => :destroy @@ -15,15 +15,15 @@ class User < ApplicationRecord paginates_per 10 - devise :invitable, :database_authenticatable, :registerable, :confirmable, - :lockable, :recoverable, :rememberable, :trackable, :validatable, + devise :invitable, :database_authenticatable, :registerable, :confirmable, + :lockable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :omniauth_providers => [:facebook, :twitter] # before_invitation_created :setup_role # before_invitation_created :setup_account #:facebook, :twitter, :linkedin] def role? role - return !!self.roles.find_by_name(role.to_s) + return !!self.roles.find_by_name(role.to_s) end def self.find_for_oauth(auth, signed_in_resource = nil) @@ -50,9 +50,9 @@ def self.find_for_oauth(auth, signed_in_resource = nil) # Создать пользователя, если это новая запись if user.nil? user = User.new( - name: auth.extra.raw_info.name, - email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com", - password: Devise.friendly_token[0,20] + name: auth.extra.raw_info.name, + email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com", + password: Devise.friendly_token[0, 20] ) user.skip_confirmation! user.save! @@ -70,19 +70,20 @@ def self.find_for_oauth(auth, signed_in_resource = nil) def email_verified? self.email && self.email !~ TEMP_EMAIL_REGEX end - + #Protected methods do not invoke in devise_invitable + protected - - def setup_role - self.role_ids = [3] if self.invited_by_id != nil && self.role_ids.empty? - self.role_ids = [2] if self.role_ids.empty? - end - # Default role is "Registered" - def setup_account - self.account = self.invited_by.account if self.invited_by_id != nil && self.account_id == nil - self.account = Account.create if self.account_id == nil - end - + def setup_role + self.role_ids = [3] if self.invited_by_id != nil && self.role_ids.empty? + self.role_ids = [2] if self.role_ids.empty? + end + + # Default role is "Registered" + def setup_account + self.account = self.invited_by.account if self.invited_by_id != nil && self.account_id == nil + self.account = Account.create if self.account_id == nil + end + end diff --git a/app/views/account/index.html.erb b/app/views/account/index.html.erb index 677482b..5c19b79 100644 --- a/app/views/account/index.html.erb +++ b/app/views/account/index.html.erb @@ -2,52 +2,52 @@ <% if notice %> -

<%= notice %>

+

<%= notice %>

<% end %> -<% if !@users || @users.length==0 %> -

Nothing's here!

+<% if !@users || @users.length == 0 %> +

Nothing's here!

<% else %> -
+
- - - - - - - - - - - - - <% @users.each do |user| %> +
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:role) %><%= model_class.human_attribute_name(:email) %><%= model_class.human_attribute_name(:name) %><%=t '.actions', :default => t("helpers.actions") %>
+ - - - - - + + + + + - <% end %> - -
<%= user.id %><%= user.roles.map {|role| role.name }.join(', ') %><%= user.email %><%= user.name ? user.name : '—' %> - <% if(current_user.role?(:owner) && user.id!=current_user.id) %> - <%= link_to t('.destroy', :default => t("helpers.links.remove")), - 'account/'+user.account.id.to_s+'/user/'+user.id.to_s, - :method => :delete, - :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, - :class => 'btn btn-xs btn-danger' %> - <% end %> - <%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:role) %><%= model_class.human_attribute_name(:email) %><%= model_class.human_attribute_name(:name) %><%= t '.actions', :default => t("helpers.actions") %>
+ -
+ + <% @users.each do |user| %> + + <%= user.id %> + <%= user.roles.map { |role| role.name }.join(', ') %> + <%= user.email %> + <%= user.name ? user.name : '—' %> + + <% if (current_user.role?(:owner) && user.id != current_user.id) %> + <%= link_to t('.destroy', :default => t("helpers.links.remove")), + 'account/' + user.account.id.to_s + '/user/' + user.id.to_s, + :method => :delete, + :data => {:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?'))}, + :class => 'btn btn-xs btn-danger' %> + <% end %> + + + <% end %> + + + +
<%# paginate @users, :theme => 'twitter-bootstrap-3' %> <% end %> diff --git a/app/views/admin/accounts/_form.html.erb b/app/views/admin/accounts/_form.html.erb index 6a7a28b..eb304ce 100644 --- a/app/views/admin/accounts/_form.html.erb +++ b/app/views/admin/accounts/_form.html.erb @@ -1,7 +1,7 @@ -<%= simple_form_for([:admin, @account], :html => {:class => 'form-horizontal' }) do |f| %> +<%= simple_form_for([:admin, @account], :html => {:class => 'form-horizontal'}) do |f| %> <%= f.error_notification %> <%= f.input :number %> <%= f.button :submit, class: 'btn-primary' %> - <%= link_to t('.cancel', :default => t("helpers.links.cancel")), - admin_accounts_path, :class => 'btn btn-default' %> + <%= link_to t('.cancel', :default => t("helpers.links.cancel")), + admin_accounts_path, :class => 'btn btn-default' %> <% end %> \ No newline at end of file diff --git a/app/views/admin/accounts/edit.html.erb b/app/views/admin/accounts/edit.html.erb index 0445f62..33b9a62 100644 --- a/app/views/admin/accounts/edit.html.erb +++ b/app/views/admin/accounts/edit.html.erb @@ -1,5 +1,5 @@ <%- model_class = Account -%> <%= render 'form' %> \ No newline at end of file diff --git a/app/views/admin/accounts/index.html.erb b/app/views/admin/accounts/index.html.erb index b46d1b2..cb22c99 100644 --- a/app/views/admin/accounts/index.html.erb +++ b/app/views/admin/accounts/index.html.erb @@ -1,41 +1,41 @@ <%- model_class = Account -%> - - - - - - - - + + + + + + + + - <% @accounts.each do |account| %> - - - - - - - - - <% end %> + <% @accounts.each do |account| %> + + + + + + + + + <% end %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:number) %><%= model_class.human_attribute_name(:users) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%=t '.actions', :default => t("helpers.actions") %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:number) %><%= model_class.human_attribute_name(:users) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%= t '.actions', :default => t("helpers.actions") %>
<%= account.id %><%= link_to account.number, admin_account_path(account) %><%= account.users.collect{|u| link_to(u.email, admin_user_path(u)) }.join(', ').html_safe %><%= account.created_at %><%= account.updated_at %> - <%= link_to t('.edit', :default => t("helpers.links.edit")), - edit_admin_account_path(account), :class => 'btn btn-default btn-xs' %> - <%= link_to t('.destroy', :default => t("helpers.links.destroy")), - admin_account_path(account), - :method => :delete, - :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, - :class => 'btn btn-xs btn-danger' %> -
<%= account.id %><%= link_to account.number, admin_account_path(account) %><%= account.users.collect { |u| link_to(u.email, admin_user_path(u)) }.join(', ').html_safe %><%= account.created_at %><%= account.updated_at %> + <%= link_to t('.edit', :default => t("helpers.links.edit")), + edit_admin_account_path(account), :class => 'btn btn-default btn-xs' %> + <%= link_to t('.destroy', :default => t("helpers.links.destroy")), + admin_account_path(account), + :method => :delete, + :data => {:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?'))}, + :class => 'btn btn-xs btn-danger' %> +
diff --git a/app/views/admin/accounts/new.html.erb b/app/views/admin/accounts/new.html.erb index 2b992b3..77e5079 100644 --- a/app/views/admin/accounts/new.html.erb +++ b/app/views/admin/accounts/new.html.erb @@ -1,5 +1,5 @@ <%- model_class = Account -%> <%= render 'form' %> diff --git a/app/views/admin/accounts/show.html.erb b/app/views/admin/accounts/show.html.erb index 1a11b39..937c6f1 100644 --- a/app/views/admin/accounts/show.html.erb +++ b/app/views/admin/accounts/show.html.erb @@ -12,15 +12,15 @@
<%= @account.updated_at %> 
<%= model_class.human_attribute_name(:users) %>
- -
+ + <%= link_to t('.back', :default => t("helpers.links.back")), - admin_accounts_path, :class => 'btn btn-default' %> + admin_accounts_path, :class => 'btn btn-default' %> <%= link_to t('.edit', :default => t("helpers.links.edit")), - edit_admin_account_path(@account), :class => 'btn btn-default' %> \ No newline at end of file + edit_admin_account_path(@account), :class => 'btn btn-default' %> \ No newline at end of file diff --git a/app/views/admin/roles/_form.html.erb b/app/views/admin/roles/_form.html.erb index 55af836..63d9d02 100644 --- a/app/views/admin/roles/_form.html.erb +++ b/app/views/admin/roles/_form.html.erb @@ -1,8 +1,8 @@ -<%= simple_form_for([:admin, @role], :html => {:class => 'form-horizontal' }) do |f| %> +<%= simple_form_for([:admin, @role], :html => {:class => 'form-horizontal'}) do |f| %> <%= f.error_notification %> <%= f.input :name %> <%= f.button :submit, class: 'btn-primary' %> - <%= link_to t('.cancel', :default => t("helpers.links.cancel")), - admin_roles_path, :class => 'btn btn-default' %> + <%= link_to t('.cancel', :default => t("helpers.links.cancel")), + admin_roles_path, :class => 'btn btn-default' %> <% end %> <% #console %> \ No newline at end of file diff --git a/app/views/admin/roles/edit.html.erb b/app/views/admin/roles/edit.html.erb index 880ddf4..f5d0445 100644 --- a/app/views/admin/roles/edit.html.erb +++ b/app/views/admin/roles/edit.html.erb @@ -1,5 +1,5 @@ <%- model_class = Role -%> <%= render 'form' %> \ No newline at end of file diff --git a/app/views/admin/roles/index.html.erb b/app/views/admin/roles/index.html.erb index 5a5f438..816c11b 100644 --- a/app/views/admin/roles/index.html.erb +++ b/app/views/admin/roles/index.html.erb @@ -1,42 +1,42 @@ <%- model_class = Role -%> - - - - - - - - + + + + + + + + - <% @roles.each do |role| %> - - - - - - - - - <% end %> + <% @roles.each do |role| %> + + + + + + + + + <% end %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:name) %><%= model_class.human_attribute_name(:users) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%=t '.actions', :default => t("helpers.actions") %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:name) %><%= model_class.human_attribute_name(:users) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%= t '.actions', :default => t("helpers.actions") %>
<%= role.id %><%= link_to role.name, admin_role_path(role) %><%= role.users.count %><%= role.created_at %><%= role.updated_at %> - <%= link_to t('.edit', :default => t("helpers.links.edit")), - edit_admin_role_path(role), :class => 'btn btn-default btn-xs' %> - <%= link_to t('.destroy', :default => t("helpers.links.destroy")), - admin_role_path(role), - :method => :delete, - :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, - :class => 'btn btn-xs btn-danger' %> -
<%= role.id %><%= link_to role.name, admin_role_path(role) %><%= role.users.count %><%= role.created_at %><%= role.updated_at %> + <%= link_to t('.edit', :default => t("helpers.links.edit")), + edit_admin_role_path(role), :class => 'btn btn-default btn-xs' %> + <%= link_to t('.destroy', :default => t("helpers.links.destroy")), + admin_role_path(role), + :method => :delete, + :data => {:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?'))}, + :class => 'btn btn-xs btn-danger' %> +
diff --git a/app/views/admin/roles/new.html.erb b/app/views/admin/roles/new.html.erb index 932f903..eede963 100644 --- a/app/views/admin/roles/new.html.erb +++ b/app/views/admin/roles/new.html.erb @@ -1,5 +1,5 @@ <%- model_class = Role -%> <%= render 'form' %> diff --git a/app/views/admin/roles/show.html.erb b/app/views/admin/roles/show.html.erb index 21e0a55..6c711fc 100644 --- a/app/views/admin/roles/show.html.erb +++ b/app/views/admin/roles/show.html.erb @@ -15,6 +15,6 @@ <%= link_to t('.back', :default => t("helpers.links.back")), - admin_roles_path, :class => 'btn btn-default' %> + admin_roles_path, :class => 'btn btn-default' %> <%= link_to t('.edit', :default => t("helpers.links.edit")), - edit_admin_role_path(@role), :class => 'btn btn-default' %> \ No newline at end of file + edit_admin_role_path(@role), :class => 'btn btn-default' %> \ No newline at end of file diff --git a/app/views/admin/shared/_menu.html.erb b/app/views/admin/shared/_menu.html.erb index e90dd23..86974df 100644 --- a/app/views/admin/shared/_menu.html.erb +++ b/app/views/admin/shared/_menu.html.erb @@ -1,21 +1,22 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/admin/subscriptions/_form.html.erb b/app/views/admin/subscriptions/_form.html.erb index 5403151..6710ae5 100644 --- a/app/views/admin/subscriptions/_form.html.erb +++ b/app/views/admin/subscriptions/_form.html.erb @@ -1,8 +1,8 @@ -<%= simple_form_for([:admin, @subscription], :html => {:class => 'form-horizontal' }) do |f| %> +<%= simple_form_for([:admin, @subscription], :html => {:class => 'form-horizontal'}) do |f| %> <%= f.error_notification %> <%= f.input :email %> <%= f.input :name %> <%= f.button :submit, class: 'btn-primary' %> - <%= link_to t('.cancel', :default => t("helpers.links.cancel")), - admin_subscriptions_path, :class => 'btn btn-default' %> + <%= link_to t('.cancel', :default => t("helpers.links.cancel")), + admin_subscriptions_path, :class => 'btn btn-default' %> <% end %> diff --git a/app/views/admin/subscriptions/edit.html.erb b/app/views/admin/subscriptions/edit.html.erb index a92a298..80aa260 100644 --- a/app/views/admin/subscriptions/edit.html.erb +++ b/app/views/admin/subscriptions/edit.html.erb @@ -1,5 +1,5 @@ <%- model_class = Subscription -%> <%= render 'form' %> \ No newline at end of file diff --git a/app/views/admin/subscriptions/index.html.erb b/app/views/admin/subscriptions/index.html.erb index 3034d22..cf80981 100644 --- a/app/views/admin/subscriptions/index.html.erb +++ b/app/views/admin/subscriptions/index.html.erb @@ -1,44 +1,44 @@ <%- model_class = Subscription -%> - - - - - - - - - + + + + + + + + + - <% @subscriptions.each do |subscription| %> - - - - - - - - - - <% end %> + <% @subscriptions.each do |subscription| %> + + + + + + + + + + <% end %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:name) %><%= model_class.human_attribute_name(:email) %><%= model_class.human_attribute_name(:status) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%=t '.actions', :default => t("helpers.actions") %>
<%= model_class.human_attribute_name(:id) %><%= model_class.human_attribute_name(:name) %><%= model_class.human_attribute_name(:email) %><%= model_class.human_attribute_name(:status) %><%= model_class.human_attribute_name(:created_at) %><%= model_class.human_attribute_name(:updated_at) %><%= t '.actions', :default => t("helpers.actions") %>
<%= subscription.id %><%= subscription.name %><%= link_to subscription.email, admin_subscription_path(subscription) %><%= subscription.status %><%= subscription.created_at %><%= subscription.updated_at %> - <%= link_to t('.edit', :default => t("helpers.links.edit")), - edit_admin_subscription_path(subscription), :class => 'btn btn-default btn-xs' %> - <%= link_to t('.destroy', :default => t("helpers.links.destroy")), - admin_subscription_path(subscription), - :method => :delete, - :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) }, - :class => 'btn btn-xs btn-danger' %> -
<%= subscription.id %><%= subscription.name %><%= link_to subscription.email, admin_subscription_path(subscription) %><%= subscription.status %><%= subscription.created_at %><%= subscription.updated_at %> + <%= link_to t('.edit', :default => t("helpers.links.edit")), + edit_admin_subscription_path(subscription), :class => 'btn btn-default btn-xs' %> + <%= link_to t('.destroy', :default => t("helpers.links.destroy")), + admin_subscription_path(subscription), + :method => :delete, + :data => {:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?'))}, + :class => 'btn btn-xs btn-danger' %> +
diff --git a/app/views/admin/subscriptions/new.html.erb b/app/views/admin/subscriptions/new.html.erb index 6d9c65c..bba8dec 100644 --- a/app/views/admin/subscriptions/new.html.erb +++ b/app/views/admin/subscriptions/new.html.erb @@ -1,5 +1,5 @@ <%- model_class = Subscription -%> <%= render 'form' %> diff --git a/app/views/admin/subscriptions/show.html.erb b/app/views/admin/subscriptions/show.html.erb index 91bab7c..bb2a0d1 100644 --- a/app/views/admin/subscriptions/show.html.erb +++ b/app/views/admin/subscriptions/show.html.erb @@ -17,8 +17,8 @@
-<%= link_to t('.back', :default => t("helpers.links.back")), - admin_subscriptions_path, :class => 'btn btn-default' %> -<%= link_to t('.edit', :default => t("helpers.links.edit")), + <%= link_to t('.back', :default => t("helpers.links.back")), + admin_subscriptions_path, :class => 'btn btn-default' %> + <%= link_to t('.edit', :default => t("helpers.links.edit")), edit_admin_subscription_path(@subscription), :class => 'btn btn-default' %>
\ No newline at end of file diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb index 4dc113c..7e9f2d1 100644 --- a/app/views/admin/users/edit.html.erb +++ b/app/views/admin/users/edit.html.erb @@ -1,11 +1,11 @@ <%- model_class = User -%>