cybele 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/README.md +16 -2
  4. data/dump.rdb +1 -0
  5. data/lib/cybele/app_builder.rb +213 -220
  6. data/lib/cybele/generators/app_generator.rb +31 -20
  7. data/lib/cybele/version.rb +2 -2
  8. data/templates/.env.local.erb +11 -0
  9. data/templates/.env.production.erb +11 -0
  10. data/templates/.env.staging.erb +11 -0
  11. data/templates/README.md.erb +22 -0
  12. data/templates/app/assets/javascripts/application.js.coffee +63 -1
  13. data/templates/app/assets/javascripts/hq/application.js.coffee +93 -0
  14. data/templates/app/assets/stylesheets/application.css.sass +15 -4
  15. data/templates/app/assets/stylesheets/hq/application.css.sass +92 -0
  16. data/templates/app/controllers/application_controller.rb.erb +48 -0
  17. data/templates/app/controllers/concerns/basic_authentication.rb +18 -0
  18. data/templates/app/controllers/hq/admins_controller.rb +64 -0
  19. data/templates/app/controllers/hq/application_controller.rb +11 -0
  20. data/templates/app/controllers/hq/audits_controller.rb +16 -0
  21. data/templates/app/controllers/hq/cities_controller.rb +54 -0
  22. data/templates/app/controllers/hq/countries_controller.rb +54 -0
  23. data/templates/app/controllers/hq/dashboard_controller.rb +4 -1
  24. data/templates/app/controllers/hq/passwords_controller.rb +10 -0
  25. data/templates/app/controllers/hq/registrations_controller.rb +21 -0
  26. data/templates/app/controllers/hq/sessions_controller.rb +1 -1
  27. data/templates/app/controllers/hq/users_controller.rb +64 -0
  28. data/templates/app/controllers/user/dashboard_controller.rb +8 -0
  29. data/templates/app/controllers/user/passwords_controller.rb +10 -0
  30. data/templates/app/controllers/user/profiles_controller.rb +34 -0
  31. data/templates/app/controllers/user/registrations_controller.rb +20 -0
  32. data/templates/app/controllers/user/sessions_controller.rb +16 -0
  33. data/templates/app/controllers/user/user_application_controller.rb +20 -0
  34. data/templates/app/helpers/application_helper.rb.erb +27 -0
  35. data/templates/app/mailers/admin_mailer.rb +10 -0
  36. data/templates/app/mailers/base_mailer.rb +4 -0
  37. data/templates/app/mailers/user_mailer.rb +10 -0
  38. data/templates/app/models/admin.rb +51 -0
  39. data/templates/app/models/audit.rb +3 -0
  40. data/templates/app/models/city.rb +12 -0
  41. data/templates/app/models/country.rb +12 -0
  42. data/templates/app/models/user.rb +54 -0
  43. data/templates/app/views/admin_mailer/login_info.html.haml +13 -0
  44. data/templates/app/views/devise/confirmations/new.html.haml +6 -5
  45. data/templates/app/views/devise/mailer/confirmation_instructions.html.haml +5 -3
  46. data/templates/app/views/devise/mailer/reset_password_instructions.html.haml +2 -2
  47. data/templates/app/views/devise/passwords/edit.html.haml +3 -3
  48. data/templates/app/views/devise/passwords/new.html.haml +3 -3
  49. data/templates/app/views/devise/registrations/edit.html.haml +5 -11
  50. data/templates/app/views/devise/registrations/new.html.haml +18 -6
  51. data/templates/app/views/devise/sessions/new.html.haml +1 -1
  52. data/templates/app/views/devise/shared/_links.haml +3 -1
  53. data/templates/app/views/devise/unlocks/new.html.haml +4 -4
  54. data/templates/app/views/hq/admins/_admin.html.haml +21 -0
  55. data/templates/app/views/hq/admins/_blank.html.haml +9 -0
  56. data/templates/app/views/hq/admins/_filters.html.haml +20 -0
  57. data/templates/app/views/hq/admins/_form.html.haml +17 -0
  58. data/templates/app/views/hq/admins/_list.html.haml +15 -0
  59. data/templates/app/views/hq/admins/edit.html.haml +3 -0
  60. data/templates/app/views/hq/admins/index.html.haml +18 -0
  61. data/templates/app/views/hq/admins/new.html.haml +5 -0
  62. data/templates/app/views/hq/admins/show.html.haml +19 -0
  63. data/templates/app/views/hq/audits/_filters.html.haml +32 -0
  64. data/templates/app/views/hq/audits/_list.html.haml +37 -0
  65. data/templates/app/views/hq/audits/index.html.haml +5 -0
  66. data/templates/app/views/hq/audits/show.html.haml +5 -0
  67. data/templates/app/views/hq/cities/_blank.html.haml +9 -0
  68. data/templates/app/views/hq/cities/_city.html.haml +12 -0
  69. data/templates/app/views/hq/cities/_filters.html.haml +15 -0
  70. data/templates/app/views/hq/cities/_form.html.haml +15 -0
  71. data/templates/app/views/hq/cities/_list.html.haml +13 -0
  72. data/templates/app/views/hq/cities/edit.html.haml +3 -0
  73. data/templates/app/views/hq/cities/index.html.haml +18 -0
  74. data/templates/app/views/hq/cities/new.html.haml +3 -0
  75. data/templates/app/views/hq/cities/show.html.haml +13 -0
  76. data/templates/app/views/hq/countries/_blank.html.haml +9 -0
  77. data/templates/app/views/hq/countries/_country.html.haml +11 -0
  78. data/templates/app/views/hq/countries/_filters.html.haml +14 -0
  79. data/templates/app/views/hq/countries/_form.html.haml +14 -0
  80. data/templates/app/views/hq/countries/_list.html.haml +12 -0
  81. data/templates/app/views/hq/countries/edit.html.haml +3 -0
  82. data/templates/app/views/hq/countries/index.html.haml +18 -0
  83. data/templates/app/views/hq/countries/new.html.haml +3 -0
  84. data/templates/app/views/hq/countries/show.html.haml +14 -0
  85. data/templates/app/views/hq/dashboard/index.html.haml +8 -0
  86. data/templates/app/views/hq/passwords/edit.html.haml +12 -0
  87. data/templates/app/views/hq/passwords/new.html.haml +9 -0
  88. data/templates/app/views/hq/registrations/edit.html.haml +19 -0
  89. data/templates/app/views/hq/sessions/new.html.haml +7 -5
  90. data/templates/app/views/hq/users/_blank.html.haml +9 -0
  91. data/templates/app/views/hq/users/_filters.html.haml +20 -0
  92. data/templates/app/views/hq/users/_form.html.haml +18 -0
  93. data/templates/app/views/hq/users/_list.html.haml +15 -0
  94. data/templates/app/views/hq/users/_user.html.haml +20 -0
  95. data/templates/app/views/hq/users/edit.html.haml +3 -0
  96. data/templates/app/views/hq/users/index.html.haml +18 -0
  97. data/templates/app/views/hq/users/new.html.haml +5 -0
  98. data/templates/app/views/hq/users/show.html.haml +20 -0
  99. data/templates/app/views/layouts/application.html.haml.erb +16 -8
  100. data/templates/app/views/layouts/hq/application.html.haml.erb +55 -0
  101. data/templates/app/views/layouts/hq/login.html.haml.erb +35 -0
  102. data/templates/app/views/layouts/hq/partials/_dock.html.haml.erb +36 -0
  103. data/templates/app/views/layouts/hq/partials/_footer.html.haml.erb +0 -0
  104. data/templates/app/views/layouts/hq/partials/_navbar.html.haml.erb +22 -0
  105. data/templates/app/views/layouts/hq/partials/_trackers.html.haml.erb +0 -0
  106. data/templates/app/views/layouts/mailer.html.haml.erb +321 -0
  107. data/templates/app/views/layouts/mailer.text.haml +1 -0
  108. data/templates/app/views/layouts/partials/_footer.html.haml.erb +0 -0
  109. data/templates/app/views/layouts/partials/_trackers.html.haml.erb +0 -0
  110. data/templates/app/views/layouts/partials/_warnings.html.haml.erb +3 -0
  111. data/templates/app/views/user/dashboard/index.html.haml +8 -0
  112. data/templates/app/views/user/passwords/edit.html.haml +12 -0
  113. data/templates/app/views/user/passwords/new.html.haml +10 -0
  114. data/templates/app/views/{user_profiles → user/profiles}/_form.html.haml +4 -5
  115. data/templates/app/views/user/profiles/edit.html.haml +3 -0
  116. data/templates/app/views/user/profiles/show.html.haml +15 -0
  117. data/templates/app/views/user/registrations/edit.html.haml +19 -0
  118. data/templates/app/views/user/sessions/new.html.haml +11 -0
  119. data/templates/app/views/user_mailer/login_info.html.haml +13 -0
  120. data/templates/app/views/welcome/index.html.haml.erb +4 -4
  121. data/templates/config/initializers/devise_async.rb +6 -0
  122. data/templates/config/initializers/sidekiq.rb +13 -0
  123. data/templates/config/locales/email.tr.yml +28 -0
  124. data/templates/config/locales/models.tr.yml +72 -41
  125. data/templates/config/locales/responders.tr.yml +4 -1
  126. data/templates/config/locales/show_for.tr.yml +1 -3
  127. data/templates/config/locales/simple_form.tr.yml +8 -22
  128. data/templates/config/locales/tr.yml +33 -2
  129. data/templates/config/locales/view.tr.yml +64 -18
  130. data/templates/config/routes.erb +51 -0
  131. data/templates/config/schedule.yml +16 -0
  132. data/templates/config/settings/production.yml +0 -17
  133. data/templates/config/settings/staging.yml +0 -17
  134. data/templates/config/sidekiq.yml +13 -0
  135. data/templates/cybele_Gemfile +42 -5
  136. data/templates/cybele_gitignore +3 -1
  137. data/templates/cybele_version.txt +1 -0
  138. data/templates/env.sample.erb +11 -0
  139. data/templates/lib/data/cities.yml +163 -0
  140. data/templates/lib/tasks/dev.rake +29 -5
  141. data/templates/lib/tasks/sidekiq.rake +26 -0
  142. data/templates/lib/templates/rails/responders_controller/controller.rb +27 -22
  143. data/templates/public/images/favicon.png +0 -0
  144. data/templates/public/images/mail-logo.png +0 -0
  145. data/templates/public/images/missing_cover.png +0 -0
  146. data/templates/public/images/missing_cover@2x.png +0 -0
  147. data/templates/public/images/missing_logo.png +0 -0
  148. data/templates/public/images/missing_logo@2x.png +0 -0
  149. data/templates/public/images/sprite.png +0 -0
  150. data/templates/ruby-version +1 -1
  151. data/templates/vendor/assets/javascripts/jquery.datetimepicker.js +1871 -0
  152. data/templates/vendor/assets/javascripts/jquery.maskedinput.min.js +7 -0
  153. data/templates/vendor/assets/javascripts/nprogress.js +491 -0
  154. data/templates/vendor/assets/javascripts/trix.js +25 -0
  155. data/templates/vendor/assets/stylesheets/jquery.datetimepicker.css +418 -0
  156. data/templates/vendor/assets/stylesheets/nprogress.css +74 -0
  157. data/templates/vendor/assets/stylesheets/trix.css +209 -0
  158. metadata +125 -24
  159. data/templates/app/controllers/application_controller.rb +0 -19
  160. data/templates/app/controllers/hq/admin_profiles_controller.rb +0 -56
  161. data/templates/app/controllers/user_profiles_controller.rb +0 -56
  162. data/templates/app/views/hq/admin_profiles/_form.html.haml +0 -15
  163. data/templates/app/views/hq/admin_profiles/edit.html.haml +0 -3
  164. data/templates/app/views/hq/admin_profiles/new.html.haml +0 -3
  165. data/templates/app/views/hq/admin_profiles/show.html.haml +0 -13
  166. data/templates/app/views/hq/dashboard/index.html.haml.erb +0 -3
  167. data/templates/app/views/user_profiles/edit.html.haml +0 -3
  168. data/templates/app/views/user_profiles/new.html.haml +0 -3
  169. data/templates/app/views/user_profiles/show.html.haml +0 -13
  170. data/templates/config/locales/en.yml +0 -2
  171. data/templates/config/locales/models.en.yml +0 -54
  172. data/templates/config/locales/responders.en.yml +0 -10
  173. data/templates/config/locales/show_for.en.yml +0 -7
  174. data/templates/config/locales/simple_form.en.yml +0 -30
  175. data/templates/config/locales/view.en.yml +0 -51
@@ -0,0 +1,48 @@
1
+ require 'application_responder'
2
+
3
+ class ApplicationController < ActionController::Base
4
+ include BasicAuthentication
5
+
6
+ rescue_from Exception, with: :server_error if Rails.env.production? or Rails.env.staging?
7
+ rescue_from ActiveRecord::RecordNotFound, with: :page_not_found if Rails.env.production? or Rails.env.staging?
8
+ rescue_from ActionController::RoutingError, with: :page_not_found if Rails.env.production? or Rails.env.staging?
9
+
10
+ self.responder = ApplicationResponder
11
+ respond_to :html, :json
12
+
13
+ # Prevent CSRF attacks by raising an exception.
14
+ # For APIs, you may want to use :null_session instead.
15
+ before_filter :set_audit_user
16
+ protect_from_forgery with: :exception
17
+
18
+ def server_error(exception)
19
+ Rollbar.error "ApplicationController#server_error --exception: #{exception}"
20
+ render template: 'errors/internal_server_error', status: 500
21
+ end
22
+
23
+ def page_not_found
24
+ render template: 'errors/not_found', status: 404
25
+ end
26
+
27
+ protected
28
+
29
+ def set_user_time_zone
30
+ Time.zone = current_user.time_zone if student_signed_in? && current_student.time_zone.present?
31
+ end
32
+
33
+ def devise_parameter_sanitizer
34
+ if resource_class == User
35
+ User::ParameterSanitizer.new(User, :user, params)
36
+ else
37
+ super # Use the default one
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def set_audit_user
44
+ # Set audit current user
45
+ Audited.current_user_method = :current_user
46
+ end
47
+
48
+ end
@@ -0,0 +1,18 @@
1
+ module BasicAuthentication
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ before_filter :authenticate
6
+ end
7
+
8
+ private
9
+
10
+ def authenticate
11
+ if Rails.env.staging? and ENV['BASIC_AUTH_IS_ACTIVE'] == 'yes'
12
+ authenticate_or_request_with_http_basic do |username, password|
13
+ username == Settings.basic_auth.username && password == Settings.basic_auth.password
14
+ end
15
+ end
16
+ end
17
+
18
+ end
@@ -0,0 +1,64 @@
1
+ class Hq::AdminsController < Hq::ApplicationController
2
+
3
+ before_action :set_admin, only: [:show, :edit, :update, :destroy, :toggle_is_active]
4
+ add_breadcrumb I18n.t('activerecord.models.admins'), :hq_admins_path
5
+
6
+ def index
7
+ @search = Admin.order(id: :desc).search(params[:q])
8
+ @admins = @search.result(distinct: true).paginate(page: params[:page])
9
+ respond_with(@admins)
10
+ end
11
+
12
+ def show
13
+ add_breadcrumb @admin.name, hq_admin_path(@admin)
14
+ respond_with(@admin)
15
+ end
16
+
17
+ def new
18
+ add_breadcrumb t('tooltips.new'), new_hq_admin_path
19
+ @admin = Admin.new
20
+ respond_with(@admin)
21
+ end
22
+
23
+ def edit
24
+ add_breadcrumb @admin.name, hq_admin_path(@admin)
25
+ add_breadcrumb t('tooltips.edit'), edit_hq_admin_path
26
+ end
27
+
28
+ def create
29
+ @admin = Admin.new(admin_params)
30
+ @admin.save
31
+ respond_with(:hq, @admin)
32
+ end
33
+
34
+ def update
35
+ @admin.update(admin_params)
36
+ respond_with(:hq, @admin)
37
+ end
38
+
39
+ def destroy
40
+ @admin.destroy
41
+ respond_with(:hq, @admin, location: request.referer)
42
+ end
43
+
44
+ def toggle_is_active
45
+ if @admin.update( is_active: !@admin.is_active )
46
+ @admin.is_active ?
47
+ flash[:info] = t('flash.actions.toggle_is_active.active', resource_name: Admin.model_name.human) :
48
+ flash[:info] = t('flash.actions.toggle_is_active.passive', resource_name: Admin.model_name.human)
49
+ else
50
+ flash[:danger] = t('flash.messages.error_occurred')
51
+ end
52
+ respond_with(:hq, @admin, location: request.referer)
53
+ end
54
+
55
+ private
56
+
57
+ def set_admin
58
+ @admin = Admin.find(params[:id])
59
+ end
60
+
61
+ def admin_params
62
+ params.require(:admin).permit(:email, :name, :surname)
63
+ end
64
+ end
@@ -1,7 +1,18 @@
1
1
  require 'application_responder'
2
2
 
3
3
  class Hq::ApplicationController < ActionController::Base
4
+
5
+ before_filter :set_audit_user
4
6
  before_action :authenticate_admin!
7
+
5
8
  self.responder = ApplicationResponder
6
9
  respond_to :html, :json
10
+
11
+ private
12
+
13
+ def set_audit_user
14
+ # Set audit current user
15
+ Audited.current_user_method = :current_admin
16
+ end
17
+
7
18
  end
@@ -0,0 +1,16 @@
1
+ class Hq::AuditsController < Hq::ApplicationController
2
+
3
+ add_breadcrumb I18n.t('activerecord.models.audits'), :hq_audits_path
4
+
5
+ def index
6
+ @search = Audit.includes(:user).reorder('id DESC').search(params[:q])
7
+ @audits = @search.result(distinct: true).paginate(page: params[:page])
8
+ @auditable_types = Audited::Adapters::ActiveRecord::Audit.select('auditable_type').group('auditable_type').reorder('')
9
+ end
10
+
11
+ def show
12
+ @audit = Audit.find(params[:id])
13
+ add_breadcrumb @audit.id, hq_audit_path(id: @audit)
14
+ end
15
+
16
+ end
@@ -0,0 +1,54 @@
1
+ class Hq::CitiesController < Hq::ApplicationController
2
+
3
+ before_action :set_city, only: [:show, :edit, :update, :destroy]
4
+ add_breadcrumb I18n.t('activerecord.models.cities'), :hq_cities_path
5
+
6
+ def index
7
+ @search = City.includes(:country).order(id: :desc).search(params[:q])
8
+ @cities = @search.result(distinct: true).paginate(page: params[:page])
9
+ respond_with(@cities)
10
+ end
11
+
12
+ def show
13
+ add_breadcrumb @city.name, hq_city_path(@city)
14
+ respond_with(@city)
15
+ end
16
+
17
+ def new
18
+ add_breadcrumb t('tooltips.new'), new_hq_city_path
19
+ @city = City.new
20
+ respond_with(@city)
21
+ end
22
+
23
+ def edit
24
+ add_breadcrumb @city.name, hq_city_path(@city)
25
+ add_breadcrumb t('tooltips.edit'), edit_hq_city_path
26
+ end
27
+
28
+ def create
29
+ @city = City.new(city_params)
30
+ @city.save
31
+ respond_with(:hq, @city)
32
+ end
33
+
34
+ def update
35
+ @city.update(city_params)
36
+ respond_with(:hq, @city)
37
+ end
38
+
39
+ def destroy
40
+ @city.destroy
41
+ respond_with(:hq, @city, location: request.referer)
42
+ end
43
+
44
+ private
45
+
46
+ def city_params
47
+ params.require(:city).permit(:name, :country_id)
48
+ end
49
+
50
+ def set_city
51
+ @city = City.find(params[:id])
52
+ end
53
+
54
+ end
@@ -0,0 +1,54 @@
1
+ class Hq::CountriesController < Hq::ApplicationController
2
+
3
+ before_action :set_country, only: [:show, :edit, :update, :destroy]
4
+ add_breadcrumb I18n.t('activerecord.models.countries'), :hq_countries_path
5
+
6
+ def index
7
+ @search = Country.order(id: :desc).search(params[:q])
8
+ @countries = @search.result(distinct: true).paginate(page: params[:page])
9
+ respond_with(@countries)
10
+ end
11
+
12
+ def show
13
+ add_breadcrumb @country.name, hq_country_path(@country)
14
+ respond_with(@country)
15
+ end
16
+
17
+ def new
18
+ add_breadcrumb t('tooltips.new'), new_hq_country_path
19
+ @country = Country.new
20
+ respond_with(@country)
21
+ end
22
+
23
+ def edit
24
+ add_breadcrumb @country.name, hq_country_path(@country)
25
+ add_breadcrumb t('tooltips.edit'), edit_hq_country_path
26
+ end
27
+
28
+ def create
29
+ @country = Country.new(country_params)
30
+ @country.save
31
+ respond_with(:hq, @country)
32
+ end
33
+
34
+ def update
35
+ @country.update(country_params)
36
+ respond_with(:hq, @country)
37
+ end
38
+
39
+ def destroy
40
+ @country.destroy
41
+ respond_with(:hq, @country, location: request.referer)
42
+ end
43
+
44
+ private
45
+
46
+ def country_params
47
+ params.require(:country).permit(:name)
48
+ end
49
+
50
+ def set_country
51
+ @country = Country.find(params[:id])
52
+ end
53
+
54
+ end
@@ -1,5 +1,8 @@
1
1
  class Hq::DashboardController < Hq::ApplicationController
2
- def index
3
2
 
3
+ add_breadcrumb I18n.t('dock.dashboard'), :hq_dashboard_index_path
4
+
5
+ def index
4
6
  end
7
+
5
8
  end
@@ -0,0 +1,10 @@
1
+ class Hq::PasswordsController < Devise::PasswordsController
2
+ layout 'hq/login'
3
+
4
+ private
5
+
6
+ def after_resetting_password_path_for(resource)
7
+ hq_root_path
8
+ end
9
+
10
+ end
@@ -0,0 +1,21 @@
1
+ class Hq::RegistrationsController < Devise::RegistrationsController
2
+ layout 'hq/application'
3
+ before_action :authenticate_admin!
4
+ before_action :redirect_admin, only: [:new, :create, :destroy]
5
+ add_breadcrumb I18n.t('dock.dashboard'), :hq_dashboard_index_path
6
+
7
+ def edit
8
+ add_breadcrumb I18n.t('tt.edit', resource_name: Admin.model_name.human)
9
+ end
10
+
11
+ private
12
+
13
+ def redirect_admin
14
+ redirect_to hq_root_path
15
+ end
16
+
17
+ def after_update_path_for(resource)
18
+ hq_root_path
19
+ end
20
+
21
+ end
@@ -1,5 +1,5 @@
1
1
  class Hq::SessionsController < Devise::SessionsController
2
- layout 'login'
2
+ layout 'hq/login'
3
3
 
4
4
  private
5
5
 
@@ -0,0 +1,64 @@
1
+ class Hq::UsersController < Hq::ApplicationController
2
+
3
+ before_action :set_user, only: [:show, :edit, :update, :destroy, :toggle_is_active]
4
+ add_breadcrumb I18n.t('activerecord.models.users'), :hq_users_path
5
+
6
+ def index
7
+ @search = User.order(id: :desc).search(params[:q])
8
+ @users = @search.result(distinct: true).paginate(page: params[:page])
9
+ respond_with(@users)
10
+ end
11
+
12
+ def show
13
+ add_breadcrumb @user.name, hq_user_path(@user)
14
+ respond_with(@user)
15
+ end
16
+
17
+ def new
18
+ add_breadcrumb t('tooltips.new'), new_hq_user_path
19
+ @user = User.new
20
+ respond_with(@user)
21
+ end
22
+
23
+ def edit
24
+ add_breadcrumb @user.name, hq_user_path(@user)
25
+ add_breadcrumb t('tooltips.edit'), edit_hq_user_path
26
+ end
27
+
28
+ def create
29
+ @user = User.new(user_params)
30
+ @user.save
31
+ respond_with(:hq, @user)
32
+ end
33
+
34
+ def update
35
+ @user.update(user_params)
36
+ respond_with(:hq, @user)
37
+ end
38
+
39
+ def destroy
40
+ @user.destroy
41
+ respond_with(:hq, @user, location: request.referer)
42
+ end
43
+
44
+ def toggle_is_active
45
+ if @user.update( is_active: !@user.is_active )
46
+ @user.is_active ?
47
+ flash[:info] = t('flash.actions.toggle_is_active.active', resource_name: User.model_name.human) :
48
+ flash[:info] = t('flash.actions.toggle_is_active.passive', resource_name: User.model_name.human)
49
+ else
50
+ flash[:danger] = t('flash.messages.error_occurred')
51
+ end
52
+ respond_with(:hq, @user, location: request.referer)
53
+ end
54
+
55
+ private
56
+
57
+ def set_user
58
+ @user = User.find(params[:id])
59
+ end
60
+
61
+ def user_params
62
+ params.require(:user).permit(:email, :name, :surname, :time_zone)
63
+ end
64
+ end
@@ -0,0 +1,8 @@
1
+ class User::DashboardController < User::UserApplicationController
2
+
3
+ add_breadcrumb I18n.t('dock.dashboard'), :user_dashboard_index_path
4
+
5
+ def index
6
+ end
7
+
8
+ end
@@ -0,0 +1,10 @@
1
+ class User::PasswordsController < Devise::PasswordsController
2
+ # layout 'user/login'
3
+
4
+ private
5
+
6
+ def after_resetting_password_path_for(resource)
7
+ user_root_path
8
+ end
9
+
10
+ end
@@ -0,0 +1,34 @@
1
+ class User::ProfilesController < User::UserApplicationController
2
+
3
+ before_action :set_profile, only: [:show, :edit, :update]
4
+ add_breadcrumb I18n.t('dock.profile'), :user_profile_path
5
+
6
+ def show
7
+ add_breadcrumb @profile.full_name, user_profile_path
8
+ respond_with([:user, @profile])
9
+ end
10
+
11
+ def edit
12
+ add_breadcrumb t('tooltips.edit'), edit_user_profile_path
13
+ end
14
+
15
+ def update
16
+ @profile.update(profile_params)
17
+ respond_with([:user, @profile], location: user_profile_path)
18
+ end
19
+
20
+ private
21
+
22
+ def set_profile
23
+ @profile = current_user
24
+ end
25
+
26
+ def profile_params
27
+ params.require(:user)
28
+ .permit(
29
+ :name,
30
+ :surname,
31
+ :time_zone
32
+ )
33
+ end
34
+ end