diff --git a/lib/cybele.rb b/lib/cybele.rb index d0cc6a1..8596d9c 100644 --- a/lib/cybele.rb +++ b/lib/cybele.rb @@ -17,7 +17,14 @@ require 'cybele/helpers/devise' require 'cybele/helpers/docker' require 'cybele/helpers/error_pages' -require 'cybele/helpers/view_files/assets_files' -require 'cybele/helpers/view_files/view_gems' +require 'cybele/helpers/audited' +require 'cybele/helpers/routes' +require 'cybele/helpers/app_files/assets_files' +require 'cybele/helpers/app_files/controller_files' +require 'cybele/helpers/app_files/model_files' +require 'cybele/helpers/app_files/mailer_files' +require 'cybele/helpers/app_files/helper_files' +require 'cybele/helpers/app_files/view_files' +require 'cybele/helpers/app_files/view_gems' require 'cybele/helpers/pronto' require 'cybele/app_builder' diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index 0550ec3..f8045e7 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Cybele - class AppBuilder < Rails::AppBuilder + class AppBuilder < Rails::AppBuilder # rubocop:disable Metrics/ClassLength include Cybele::Helpers include Cybele::Helpers::Staging include Cybele::Helpers::Sidekiq @@ -16,8 +16,15 @@ class AppBuilder < Rails::AppBuilder include Cybele::Helpers::Paperclip include Cybele::Helpers::Devise include Cybele::Helpers::ErrorPages - include Cybele::Helpers::ViewFiles::AssetsFiles - include Cybele::Helpers::ViewFiles::ViewGems + include Cybele::Helpers::Audited + include Cybele::Helpers::Routes + include Cybele::Helpers::AppFiles::AssetsFiles + include Cybele::Helpers::AppFiles::ControllerFiles + include Cybele::Helpers::AppFiles::ModelFiles + include Cybele::Helpers::AppFiles::MailerFiles + include Cybele::Helpers::AppFiles::HelperFiles + include Cybele::Helpers::AppFiles::ViewFiles + include Cybele::Helpers::AppFiles::ViewGems include Cybele::Helpers::Docker include Cybele::Helpers::Pronto diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index cf634e4..80811d5 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -216,9 +216,8 @@ def setup_paperclip_and_add_aws def setup_devise say 'Generate devise' build :generate_devise_settings - say 'Adding devise user model' - build :generate_devise_user - build :generate_devise_views + say 'Adding devise models' + build :generate_devise_models say 'Generate devise' end @@ -239,12 +238,6 @@ def configure_error_pages build :configure_error_pages end - def customize_view_files - return if @options[:skip_view_files] - say 'Customize view files', :green - build :customize_assets_files - end - def setup_git_and_git_flow say 'Initialize git and git flow' build :git_and_git_flow_commands @@ -261,6 +254,26 @@ def setup_pronto_config build :configure_pronto end + def setup_audited + say 'Setup audited gem', :green + build :configure_audited + end + + def customize_app_files + build :customize_model_files + build :customize_mailer_files + build :customize_default_view_files + return if @options[:skip_view_files] + say 'Customize app files', :green + build :customize_assets_files + build :customize_helper_files + build :customize_view_files_with_option + build :generate_devise_views + build :configure_routes + build :customize_controller_files + build :add_devise_authenticate_admin + end + def goodbye say 'Congratulations! That\'s all...', :green end diff --git a/lib/cybele/helpers/view_files/assets_files.rb b/lib/cybele/helpers/app_files/assets_files.rb similarity index 70% rename from lib/cybele/helpers/view_files/assets_files.rb rename to lib/cybele/helpers/app_files/assets_files.rb index 5d83818..d532996 100644 --- a/lib/cybele/helpers/view_files/assets_files.rb +++ b/lib/cybele/helpers/app_files/assets_files.rb @@ -2,28 +2,28 @@ module Cybele module Helpers - module ViewFiles + module AppFiles module AssetsFiles def customize_assets_files # Javascript Assets files remove_file 'app/assets/javascripts/application.js', force: true - template 'view_files/app/assets/javascripts/application.js', + template 'app_files/app/assets/javascripts/application.js', 'app/assets/javascripts/application.js', force: true - template 'view_files/app/assets/javascripts/hq/application.js', + template 'app_files/app/assets/javascripts/hq/application.js', 'app/assets/javascripts/hq/application.js', force: true # Css Assets files remove_file 'app/assets/stylesheets/application.css', force: true - template 'view_files/app/assets/stylesheets/application.css.sass', + template 'app_files/app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass', force: true - template 'view_files/app/assets/stylesheets/hq/application.css.sass', + template 'app_files/app/assets/stylesheets/hq/application.css.sass', 'app/assets/stylesheets/hq/application.css.sass', force: true end diff --git a/lib/cybele/helpers/app_files/controller_files.rb b/lib/cybele/helpers/app_files/controller_files.rb new file mode 100644 index 0000000..2bf1631 --- /dev/null +++ b/lib/cybele/helpers/app_files/controller_files.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module ControllerFiles + def customize_controller_files + # HQ controller files + directory 'app_files/app/controllers/hq', 'app/controllers/hq' + end + end + end + end +end diff --git a/lib/cybele/helpers/app_files/helper_files.rb b/lib/cybele/helpers/app_files/helper_files.rb new file mode 100644 index 0000000..5ef20ba --- /dev/null +++ b/lib/cybele/helpers/app_files/helper_files.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module HelperFiles + def customize_helper_files + # Helper files + remove_file 'app/helpers/application_helper.rb', force: true + template 'app_files/app/helpers/application_helper.rb.erb', 'app/helpers/application_helper.rb' + end + end + end + end +end diff --git a/lib/cybele/helpers/app_files/mailer_files.rb b/lib/cybele/helpers/app_files/mailer_files.rb new file mode 100644 index 0000000..90ec2b3 --- /dev/null +++ b/lib/cybele/helpers/app_files/mailer_files.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module MailerFiles + def customize_mailer_files + # Model files + remove_file 'app/mailers/application_mailer.rb', force: true + directory 'app_files/app/mailers', 'app/mailers' + end + end + end + end +end diff --git a/lib/cybele/helpers/app_files/model_files.rb b/lib/cybele/helpers/app_files/model_files.rb new file mode 100644 index 0000000..4c5c63f --- /dev/null +++ b/lib/cybele/helpers/app_files/model_files.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module ModelFiles + def customize_model_files + # Model files + remove_file 'app/models/admin.rb', force: true + directory 'app_files/app/models', 'app/models' + end + end + end + end +end diff --git a/lib/cybele/helpers/app_files/view_files.rb b/lib/cybele/helpers/app_files/view_files.rb new file mode 100644 index 0000000..460c1f9 --- /dev/null +++ b/lib/cybele/helpers/app_files/view_files.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module ViewFiles + def customize_view_files_with_option + # View files with option + directory 'app_files/app/views/hq', 'app/views/hq' + directory 'app_files/app/views/layouts/hq', 'app/views/layouts/hq' + directory 'app_files/app/views/layouts/partials', 'app/views/layouts/partials' + end + + def customize_default_view_files + # Default view files + directory 'app_files/app/views/admin_mailer', 'app/views/admin_mailer' + end + end + end + end +end diff --git a/lib/cybele/helpers/app_files/view_gems.rb b/lib/cybele/helpers/app_files/view_gems.rb new file mode 100644 index 0000000..c8527af --- /dev/null +++ b/lib/cybele/helpers/app_files/view_gems.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module AppFiles + module ViewGems + def add_required_view_gems + # Add bootstrap gem + append_file('Gemfile', template_content('app_files/bootstrap_Gemfile.erb')) + + # Add blankable gem + append_file('Gemfile', template_content('app_files/blankable_Gemfile.erb')) + + # Add breadcrumb gem + append_file('Gemfile', template_content('app_files/breadcrumb_Gemfile.erb')) + + # Add fontawesome gem + append_file('Gemfile', template_content('app_files/fontawesome_Gemfile.erb')) + end + end + end + end +end diff --git a/lib/cybele/helpers/audited.rb b/lib/cybele/helpers/audited.rb new file mode 100644 index 0000000..43e54a3 --- /dev/null +++ b/lib/cybele/helpers/audited.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module Audited + def configure_audited + # Generate Audited + generate 'audited:install' + end + end + end +end diff --git a/lib/cybele/helpers/devise.rb b/lib/cybele/helpers/devise.rb index 7b7d525..d58b2a4 100644 --- a/lib/cybele/helpers/devise.rb +++ b/lib/cybele/helpers/devise.rb @@ -14,13 +14,20 @@ def generate_devise_settings end end - def generate_devise_user + def generate_devise_models generate 'devise User name:string surname:string is_active:boolean time_zone:string' + generate 'devise Admin name:string surname:string is_active:boolean time_zone:string' remove_file 'config/locales/devise.en.yml', force: true end def generate_devise_views - generate 'devise:views' + directory 'devise/devise_views', 'app/views/devise' + end + + def add_devise_authenticate_admin + inject_into_file 'app/controllers/hq/application_controller.rb', + template_content('devise/devise_authenticate_admin.rb.erb'), + after: 'class Hq::ApplicationController < ApplicationController' end end end diff --git a/lib/cybele/helpers/locale_language.rb b/lib/cybele/helpers/locale_language.rb index f8c0179..4042cb2 100644 --- a/lib/cybele/helpers/locale_language.rb +++ b/lib/cybele/helpers/locale_language.rb @@ -5,10 +5,11 @@ module Helpers module LocaleLanguage def configure_locale_language copy_file 'config/locales/tr.yml', 'config/locales/tr.yml' - copy_file 'config/locales/email.tr.yml', 'config/locales/email.tr.yml' + copy_file 'config/locales/en.yml', 'config/locales/en.yml' + copy_file 'config/locales/mailer.tr.yml', 'config/locales/mailer.tr.yml' copy_file 'config/locales/models.tr.yml', 'config/locales/models.tr.yml' copy_file 'config/locales/view.tr.yml', 'config/locales/view.tr.yml' - copy_file 'config/locales/email.en.yml', 'config/locales/email.en.yml' + copy_file 'config/locales/mailer.en.yml', 'config/locales/mailer.en.yml' copy_file 'config/locales/models.en.yml', 'config/locales/models.en.yml' copy_file 'config/locales/view.en.yml', 'config/locales/view.en.yml' end diff --git a/lib/cybele/helpers/routes.rb b/lib/cybele/helpers/routes.rb new file mode 100644 index 0000000..563077b --- /dev/null +++ b/lib/cybele/helpers/routes.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module Cybele + module Helpers + module Routes + def configure_routes + # HQ routes + replace_in_file 'config/routes.rb', + 'devise_for :admins', + '' + + inject_into_file 'config/routes.rb', template_content('config/routes.rb.erb'), + before: 'if Rails.env.production? || Rails.env.staging?' + end + end + end +end diff --git a/lib/cybele/helpers/view_files/view_gems.rb b/lib/cybele/helpers/view_files/view_gems.rb deleted file mode 100644 index ce34421..0000000 --- a/lib/cybele/helpers/view_files/view_gems.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Cybele - module Helpers - module ViewFiles - module ViewGems - def add_required_view_gems - # Add bootstrap gem - append_file('Gemfile', template_content('view_files/bootstrap_Gemfile.erb')) - end - end - end - end -end diff --git a/spec/features/new_default_project_spec.rb b/spec/features/new_default_project_spec.rb index 6b941ce..0b7393c 100644 --- a/spec/features/new_default_project_spec.rb +++ b/spec/features/new_default_project_spec.rb @@ -74,6 +74,7 @@ it 'uses will_paginate' do gemfile_file = content('Gemfile') expect(gemfile_file).to match(/^gem 'will_paginate'/) + expect(gemfile_file).to match(/^gem 'will_paginate-bootstrap'/) end it 'uses to_xls' do @@ -216,7 +217,7 @@ git_ignore_test end - it 'uses assets files' do + it 'uses asset files' do gemfile_file = content('Gemfile') expect(gemfile_file).to match(/^gem 'bootstrap'/) @@ -235,6 +236,106 @@ expect(hq_application_js_file).to match('require bootstrap') end + it 'uses controller files' do + application_controller = content('app/controllers/application_controller.rb') + expect(application_controller).to match('class ApplicationController') + + hq_admins_controller = content('app/controllers/hq/admins_controller.rb') + expect(hq_admins_controller).to match('class AdminsController') + + hq_application_controller = content('app/controllers/hq/application_controller.rb') + expect(hq_application_controller).to match('class ApplicationController') + + hq_audits_controller = content('app/controllers/hq/audits_controller.rb') + expect(hq_audits_controller).to match('class AuditsController') + + hq_dashboard_controller = content('app/controllers/hq/dashboard_controller.rb') + expect(hq_dashboard_controller).to match('class DashboardController') + + hq_passwords_controller = content('app/controllers/hq/passwords_controller.rb') + expect(hq_passwords_controller).to match('class PasswordsController') + + hq_registrations_controller = content('app/controllers/hq/registrations_controller.rb') + expect(hq_registrations_controller).to match('class RegistrationsController') + + hq_sessions_controller = content('app/controllers/hq/sessions_controller.rb') + expect(hq_sessions_controller).to match('class SessionsController') + + hq_users_controller = content('app/controllers/hq/users_controller.rb') + expect(hq_users_controller).to match('class UsersController') + end + + it 'uses view files with option' do + # HQ files + hq_admins_view = content('app/views/hq/admins/index.html.haml') + expect(hq_admins_view).to match('@admins') + + hq_audits_view = content('app/views/hq/audits/index.html.haml') + expect(hq_audits_view).to match('@audits') + + hq_dashboard_view = content('app/views/hq/dashboard/index.html.haml') + expect(hq_dashboard_view).to match('current_admin.email') + + hq_passwords_view = content('app/views/hq/passwords/new.html.haml') + expect(hq_passwords_view).to match('password_path') + + hq_registrations_view = content('app/views/hq/registrations/edit.html.haml') + expect(hq_registrations_view).to match('admin_registration_path') + + hq_sessions_view = content('app/views/hq/sessions/new.html.haml') + expect(hq_sessions_view).to match('session_path') + + hq_users_view = content('app/views/hq/users/index.html.haml') + expect(hq_users_view).to match('@users') + + # Layouts + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_dock.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_breadcrumb.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_footer.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_navbar.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_toolbar.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/hq/partials/_trackers.html.haml')) + + expect(File).to exist(file_project_path('app/views/layouts/partials/_messages.html.haml')) + expect(File).to exist(file_project_path('app/views/layouts/partials/_warnings.html.haml')) + + # Devise view files + expect(File).to exist(file_project_path('app/views/devise/confirmations')) + expect(File).to exist(file_project_path('app/views/devise/mailer')) + expect(File).to exist(file_project_path('app/views/devise/passwords')) + expect(File).to exist(file_project_path('app/views/devise/registrations')) + expect(File).to exist(file_project_path('app/views/devise/sessions')) + expect(File).to exist(file_project_path('app/views/devise/shared')) + expect(File).to exist(file_project_path('app/views/devise/unlocks')) + end + + it 'uses default view files' do + # Mailer files + hq_admins_view = content('app/views/admin_mailer/login_info.html.haml') + expect(hq_admins_view).to match('@admin') + end + + it 'configure routes file' do + route_file = content('config/routes.rb') + expect(route_file).to match('concern :activeable') + end + + it 'uses model files' do + admin_model = content('app/models/admin.rb') + expect(admin_model).to match('AdminMailer.login_info') + + audit_model = content('app/models/audit.rb') + expect(audit_model).to match('class Audit') + end + + it 'uses mailer files' do + admin_mailer = content('app/mailers/admin_mailer.rb') + expect(admin_mailer).to match('class AdminMailer') + + application_mailer = content('app/mailers/application_mailer.rb') + expect(application_mailer).to match('Settings.email.noreply') + end + it 'uses ssl_setting' do force_ssl end diff --git a/spec/features/new_not_default_project_spec.rb b/spec/features/new_not_default_project_spec.rb index d02ebc5..21f01ae 100644 --- a/spec/features/new_not_default_project_spec.rb +++ b/spec/features/new_not_default_project_spec.rb @@ -61,6 +61,7 @@ it 'uses will_paginate' do gemfile_file = content('Gemfile') expect(gemfile_file).to match(/^gem 'will_paginate'/) + expect(gemfile_file).to match(/^gem 'will_paginate-bootstrap'/) end it 'uses to_xls' do @@ -196,7 +197,7 @@ git_ignore_test end - it 'do not use assets files' do + it 'do not use asset files' do gemfile_file = content('Gemfile') expect(gemfile_file).not_to match(/^gem 'bootstrap'/) @@ -208,6 +209,76 @@ expect(File).not_to exist(file_project_path('app/assets/javascripts/hq/application.js')) end + it 'do not use controller files' do + expect(File).to exist(file_project_path('app/controllers/application_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/admins_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/application_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/audits_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/dashboard_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/passwords_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/registrations_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/sessions_controller.rb')) + expect(File).not_to exist(file_project_path('app/controllers/hq/users_controller.rb')) + end + + it 'do not use view files with option' do + # HQ files + expect(File).not_to exist(file_project_path('app/views/hq/admins/index.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/audits/index.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/dashboard/index.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/passwords/new.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/registrations/edit.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/sessions/new.html.haml')) + expect(File).not_to exist(file_project_path('app/views/hq/users/index.html.haml')) + + # Layouts + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_breadcrumb.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_dock.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_footer.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_navbar.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_toolbar.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/hq/partials/_trackers.html.haml')) + + expect(File).not_to exist(file_project_path('app/views/layouts/partials/_messages.html.haml')) + expect(File).not_to exist(file_project_path('app/views/layouts/partials/_warnings.html.haml')) + + # Devise view files + expect(File).not_to exist(file_project_path('app/views/devise/confirmations')) + expect(File).not_to exist(file_project_path('app/views/devise/mailer')) + expect(File).not_to exist(file_project_path('app/views/devise/passwords')) + expect(File).not_to exist(file_project_path('app/views/devise/registrations')) + expect(File).not_to exist(file_project_path('app/views/devise/sessions')) + expect(File).not_to exist(file_project_path('app/views/devise/shared')) + expect(File).not_to exist(file_project_path('app/views/devise/unlocks')) + end + + it 'uses default view files' do + # Mailer files + hq_admins_view = content('app/views/admin_mailer/login_info.html.haml') + expect(hq_admins_view).to match('@admin') + end + + it 'not configure routes file' do + route_file = content('config/routes.rb') + expect(route_file).not_to match('concern :activeable') + end + + it 'uses model files' do + admin_model = content('app/models/admin.rb') + expect(admin_model).to match('AdminMailer.login_info') + + audit_model = content('app/models/audit.rb') + expect(audit_model).to match('class Audit') + end + + it 'uses mailer files' do + admin_mailer = content('app/mailers/admin_mailer.rb') + expect(admin_mailer).to match('class AdminMailer') + + application_mailer = content('app/mailers/application_mailer.rb') + expect(application_mailer).to match('Settings.email.noreply') + end + it 'uses ssl_setting' do force_ssl end diff --git a/spec/support/devise_test_helper.rb b/spec/support/devise_test_helper.rb index bbc34e8..f71ab99 100644 --- a/spec/support/devise_test_helper.rb +++ b/spec/support/devise_test_helper.rb @@ -38,15 +38,7 @@ def devise_model_file_test # rubocop:disable Metrics/AbcSize expect(devise_model_file).to match(':validatable') end - def file_control_test # rubocop:disable Metrics/AbcSize - expect(File).to exist(file_project_path('app/views/devise/confirmations')) - expect(File).to exist(file_project_path('app/views/devise/mailer')) - expect(File).to exist(file_project_path('app/views/devise/passwords')) - expect(File).to exist(file_project_path('app/views/devise/registrations')) - expect(File).to exist(file_project_path('app/views/devise/sessions')) - expect(File).to exist(file_project_path('app/views/devise/shared')) - expect(File).to exist(file_project_path('app/views/devise/unlocks')) - + def file_control_test expect(File).not_to exist(file_project_path('config/locales/devise.en.yml')) end end diff --git a/spec/support/locale_language_test_helper.rb b/spec/support/locale_language_test_helper.rb index cb87255..5c07d36 100644 --- a/spec/support/locale_language_test_helper.rb +++ b/spec/support/locale_language_test_helper.rb @@ -20,8 +20,8 @@ def file_content_control_test end def english_file_test - locale_file = content('config/locales/email.en.yml') - expect(locale_file).to match('email:') + locale_file = content('config/locales/mailer.en.yml') + expect(locale_file).to match('mailer:') locale_file = content('config/locales/models.en.yml') expect(locale_file).to match('activerecord:') @@ -31,8 +31,8 @@ def english_file_test end def turkish_file_test - locale_file = content('config/locales/email.tr.yml') - expect(locale_file).to match('email:') + locale_file = content('config/locales/mailer.tr.yml') + expect(locale_file).to match('mailer:') locale_file = content('config/locales/models.tr.yml') expect(locale_file).to match('activerecord:') diff --git a/templates/Gemfile.erb b/templates/Gemfile.erb index f1687c3..cbe1809 100644 --- a/templates/Gemfile.erb +++ b/templates/Gemfile.erb @@ -15,6 +15,7 @@ gem 'rollbar', '~> 2.15', '>= 2.15.4' gem 'ransack', '~> 1.8', '>= 1.8.4' gem 'will_paginate', '~> 3.1', '>= 3.1.6' +gem 'will_paginate-bootstrap', '~> 1.0', '>= 1.0.1' # Excell export gem 'to_xls', '~> 1.5', '>= 1.5.3' @@ -40,4 +41,7 @@ end gem 'rails-i18n', '~> 5.0', '>= 5.0.4' # Flexible authentication solution for Rails with Warden -gem 'devise', '~> 4.3' \ No newline at end of file +gem 'devise', '~> 4.3' + +# Audited is an ORM extension that logs all changes to your models +gem 'audited', '~> 4.5' \ No newline at end of file diff --git a/templates/view_files/app/assets/javascripts/application.js b/templates/app_files/app/assets/javascripts/application.js similarity index 100% rename from templates/view_files/app/assets/javascripts/application.js rename to templates/app_files/app/assets/javascripts/application.js diff --git a/templates/view_files/app/assets/javascripts/hq/application.js b/templates/app_files/app/assets/javascripts/hq/application.js similarity index 100% rename from templates/view_files/app/assets/javascripts/hq/application.js rename to templates/app_files/app/assets/javascripts/hq/application.js diff --git a/templates/view_files/app/assets/stylesheets/application.css.sass b/templates/app_files/app/assets/stylesheets/application.css.sass similarity index 100% rename from templates/view_files/app/assets/stylesheets/application.css.sass rename to templates/app_files/app/assets/stylesheets/application.css.sass diff --git a/templates/view_files/app/assets/stylesheets/hq/application.css.sass b/templates/app_files/app/assets/stylesheets/hq/application.css.sass similarity index 100% rename from templates/view_files/app/assets/stylesheets/hq/application.css.sass rename to templates/app_files/app/assets/stylesheets/hq/application.css.sass diff --git a/templates/app_files/app/controllers/hq/admins_controller.rb b/templates/app_files/app/controllers/hq/admins_controller.rb new file mode 100644 index 0000000..d4a1036 --- /dev/null +++ b/templates/app_files/app/controllers/hq/admins_controller.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Hq + class AdminsController < Hq::ApplicationController + before_action :set_admin, only: %i[show edit update destroy toggle_is_active] + add_breadcrumb I18n.t('activerecord.models.admins'), :hq_admins_path + + def index + @search = Admin.order(id: :desc).search(params[:q]) + @admins = @search.result(distinct: true).paginate(page: params[:page]) + respond_with(@admins) + end + + def show + add_breadcrumb @admin.name, hq_admin_path(@admin) + respond_with(@admin) + end + + def new + add_breadcrumb t('view.tooltips.new'), new_hq_admin_path + @admin = Admin.new + respond_with(@admin) + end + + def edit + add_breadcrumb @admin.name, hq_admin_path(@admin) + add_breadcrumb t('view.tooltips.edit'), edit_hq_admin_path + end + + def create + @admin = Admin.new(admin_params) + @admin.save + respond_with(:hq, @admin) + end + + def update + @admin.update(admin_params) + respond_with(:hq, @admin) + end + + def destroy + @admin.destroy + respond_with(:hq, @admin, location: request.referer) + end + + def toggle_is_active + if @admin.update(is_active: !@admin.is_active) + flash[:info] = t("flash.actions.toggle_is_active.#{@admin.is_active ? 'active' : 'passive'}", + resource_name: Admin.model_name.human) + else + flash[:danger] = t('flash.messages.error_occurred') + end + respond_with(:hq, @admin, location: request.referer) + end + + private + + def set_admin + @admin = Admin.find(params[:id]) + end + + def admin_params + params.require(:admin).permit(:email, :name, :surname) + end + end +end diff --git a/templates/app_files/app/controllers/hq/application_controller.rb b/templates/app_files/app/controllers/hq/application_controller.rb new file mode 100644 index 0000000..95bf082 --- /dev/null +++ b/templates/app_files/app/controllers/hq/application_controller.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Hq + class ApplicationController < ApplicationController + before_action :set_audit_user + layout 'hq/application' + + private + + def set_audit_user + Audited.current_user_method = :current_admin + end + end +end diff --git a/templates/app_files/app/controllers/hq/audits_controller.rb b/templates/app_files/app/controllers/hq/audits_controller.rb new file mode 100644 index 0000000..6ff62f0 --- /dev/null +++ b/templates/app_files/app/controllers/hq/audits_controller.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +module Hq + class AuditsController < Hq::ApplicationController + add_breadcrumb I18n.t('activerecord.models.audits'), :hq_audits_path + + def index + @search = Audit.includes(:user).reorder('id DESC').search(params[:q]) + @audits = @search.result(distinct: true).paginate(page: params[:page]) + @auditable_types = Audit.select('auditable_type').group('auditable_type').reorder('') + end + + def show + @audit = Audit.find(params[:id]) + add_breadcrumb @audit.id, hq_audit_path(id: @audit) + end + end +end diff --git a/templates/app_files/app/controllers/hq/dashboard_controller.rb b/templates/app_files/app/controllers/hq/dashboard_controller.rb new file mode 100644 index 0000000..ea60ab1 --- /dev/null +++ b/templates/app_files/app/controllers/hq/dashboard_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Hq + class DashboardController < ApplicationController + add_breadcrumb I18n.t('view.dock.dashboard'), :hq_dashboard_index_path + + def index; end + end +end diff --git a/templates/app_files/app/controllers/hq/passwords_controller.rb b/templates/app_files/app/controllers/hq/passwords_controller.rb new file mode 100644 index 0000000..61366a1 --- /dev/null +++ b/templates/app_files/app/controllers/hq/passwords_controller.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Hq + class PasswordsController < Devise::PasswordsController + layout 'hq/login' + + private + + def after_resetting_password_path_for + hq_root_path + end + end +end diff --git a/templates/app_files/app/controllers/hq/registrations_controller.rb b/templates/app_files/app/controllers/hq/registrations_controller.rb new file mode 100644 index 0000000..8a055de --- /dev/null +++ b/templates/app_files/app/controllers/hq/registrations_controller.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Hq + class RegistrationsController < Devise::RegistrationsController + layout 'hq/application' + before_action :authenticate_admin! + before_action :redirect_admin, only: %i[new create destroy] + add_breadcrumb I18n.t('view.dock.dashboard'), :hq_dashboard_index_path + + def edit + add_breadcrumb I18n.t('view.title.edit', resource_name: Admin.model_name.human) + end + + private + + def redirect_admin + redirect_to hq_root_path + end + + def after_update_path_for + hq_root_path + end + end +end diff --git a/templates/app_files/app/controllers/hq/sessions_controller.rb b/templates/app_files/app/controllers/hq/sessions_controller.rb new file mode 100644 index 0000000..61777e4 --- /dev/null +++ b/templates/app_files/app/controllers/hq/sessions_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Hq + class SessionsController < Devise::SessionsController + layout 'hq/login' + + private + + # Overwriting the sign_out redirect path method + def after_sign_in_path_for(_resource_or_scope) + hq_root_path + end + + # Overwriting the sign_out redirect path method + def after_sign_out_path_for(_resource_or_scope) + new_admin_session_path + end + end +end diff --git a/templates/app_files/app/controllers/hq/users_controller.rb b/templates/app_files/app/controllers/hq/users_controller.rb new file mode 100644 index 0000000..cf7ddb1 --- /dev/null +++ b/templates/app_files/app/controllers/hq/users_controller.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +module Hq + class UsersController < Hq::ApplicationController + before_action :set_user, only: %i[show edit update destroy toggle_is_active] + add_breadcrumb I18n.t('activerecord.models.users'), :hq_users_path + + def index + @search = User.order(id: :desc).search(params[:q]) + @users = @search.result(distinct: true).paginate(page: params[:page]) + respond_with(@users) + end + + def show + add_breadcrumb @user.name, hq_user_path(@user) + respond_with(@user) + end + + def new + add_breadcrumb t('view.tooltips.new'), new_hq_user_path + @user = User.new + respond_with(@user) + end + + def edit + add_breadcrumb @user.name, hq_user_path(@user) + add_breadcrumb t('view.tooltips.edit'), edit_hq_user_path + end + + def create + @user = User.new(user_params) + @user.save + respond_with(:hq, @user) + end + + def update + @user.update(user_params) + respond_with(:hq, @user) + end + + def destroy + @user.destroy + respond_with(:hq, @user, location: request.referer) + end + + def toggle_is_active + if @user.update(is_active: !@user.is_active) + flash[:info] = t("flash.actions.toggle_is_active.#{@user.is_active ? 'active' : 'passive'}", + resource_name: User.model_name.human) + else + flash[:danger] = t('flash.messages.error_occurred') + end + respond_with(:hq, @user, location: request.referer) + end + + private + + def set_user + @user = User.find(params[:id]) + end + + def user_params + params.require(:user).permit(:email, :name, :surname, :time_zone) + end + end +end diff --git a/templates/app_files/app/helpers/application_helper.rb.erb b/templates/app_files/app/helpers/application_helper.rb.erb new file mode 100644 index 0000000..0e4040b --- /dev/null +++ b/templates/app_files/app/helpers/application_helper.rb.erb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module ApplicationHelper + def get_active_users + User.active.map{|c| ["#{c.email} - #{c.full_name}", c.id] } + end + + def get_users + User.all.map{|c| ["#{c.email} - #{c.full_name}", c.id] } + end + + def get_admins + Admin.all.map{|c| ["#{c.email} - #{c.full_name}", c.id] } + end + + def get_audit_users + [[t('activerecord.models.admin'), 'Admin'], [t('activerecord.models.user'), 'User']] + end +end diff --git a/templates/app_files/app/mailers/admin_mailer.rb b/templates/app_files/app/mailers/admin_mailer.rb new file mode 100644 index 0000000..cbe660f --- /dev/null +++ b/templates/app_files/app/mailers/admin_mailer.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AdminMailer < ApplicationMailer + def login_info(admin_id, password) + @admin = Admin.find admin_id + @password = password + @subject = t('mailer.admin.login_info.title') + mail(to: @admin.email, subject: @subject) + end +end diff --git a/templates/app_files/app/mailers/application_mailer.rb b/templates/app_files/app/mailers/application_mailer.rb new file mode 100644 index 0000000..8495f06 --- /dev/null +++ b/templates/app_files/app/mailers/application_mailer.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class ApplicationMailer < ActionMailer::Base + default from: Settings.email.noreply + layout 'mailer' +end diff --git a/templates/app_files/app/models/admin.rb b/templates/app_files/app/models/admin.rb new file mode 100644 index 0000000..acb06b9 --- /dev/null +++ b/templates/app_files/app/models/admin.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +class Admin < ApplicationRecord + # Virtual attributes + attr_accessor :is_generated_password + + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, + :recoverable, + :rememberable, + :trackable, + :validatable + + # Send devise emails with background job + def send_devise_notification(notification, *args) + devise_mailer.send(notification, self, *args).deliver_later + end + + # Helpers + audited except: [:password] + + # Validations + validates_presence_of :name, :email, :surname + validates :email, uniqueness: true + + # Callbacks + after_commit :send_login_info, on: :create + before_validation :create_password, on: :create + after_initialize do |obj| + obj.is_generated_password = false + end + + def active_for_authentication? + super && is_active + end + + def full_name + "#{name} #{surname}" + end + + private + + def create_password + return unless password.nil? + password = Devise.friendly_token.first(8) + self.password = password + self.password_confirmation = password + self.is_generated_password = true + end + + def send_login_info + AdminMailer.login_info(id, password).deliver_later! if is_generated_password + end +end diff --git a/templates/app_files/app/models/audit.rb b/templates/app_files/app/models/audit.rb new file mode 100644 index 0000000..556c19a --- /dev/null +++ b/templates/app_files/app/models/audit.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +class Audit < Audited::Audit +end diff --git a/templates/app_files/app/views/admin_mailer/login_info.html.haml b/templates/app_files/app/views/admin_mailer/login_info.html.haml new file mode 100644 index 0000000..4b04032 --- /dev/null +++ b/templates/app_files/app/views/admin_mailer/login_info.html.haml @@ -0,0 +1,13 @@ +%h2= t('mailer.hello') + +%p= t('mailer.admin.login_info.first_info') +%p= "#{t('mailer.admin.login_info.second_info')} :" +%p + %strong= "#{t('activerecord.attributes.admin.email')} :" + = @admin.email +%p + %strong= "#{t('activerecord.attributes.admin.password')} :" + = @password +%p= link_to t('mailer.admin.login_info.btn_login'), new_admin_session_url + +%p= t('mailer.admin.login_info.last_info', link: new_admin_session_url ).html_safe \ No newline at end of file diff --git a/templates/app_files/app/views/hq/admins/_admin.html.haml b/templates/app_files/app/views/hq/admins/_admin.html.haml new file mode 100644 index 0000000..cab6d62 --- /dev/null +++ b/templates/app_files/app/views/hq/admins/_admin.html.haml @@ -0,0 +1,21 @@ +%tr{class: admin.is_active ? 'active' : 'passive'} + %td= admin.id + %td= admin.full_name + %td= mail_to admin.email, admin.email + %td=l admin.current_sign_in_at if admin.current_sign_in_at.present? + %td=l admin.last_sign_in_at if admin.last_sign_in_at.present? + %td= admin.is_active ? t('view.active') : t('view.passive') + %td.action + = link_to([:hq, admin], class: 'btn btn-success', data: { toggle: :tooltip}, title: t('view.tooltips.zoom')) do + %i.icon-zoom-in + = link_to(edit_hq_admin_path(admin) , class: 'btn btn-info', data: { toggle: :tooltip }, title: t('view.tooltips.edit')) do + %i.icon-edit + - if admin.id != current_admin.id + = link_to([:hq, admin], class: 'btn btn-danger', method: :delete, data: { confirm: t('view.tooltips.are_you_sure'), toggle: :tooltip }, title: t('view.tooltips.delete')) do + %i.icon-trash + - if admin.is_active + = link_to(toggle_is_active_hq_admin_path(admin), class: 'btn btn-danger', method: :post, data: { toggle: :tooltip}, title: t('view.make_passive') ) do + %i.icon-ban-circle + - else + = link_to(toggle_is_active_hq_admin_path(admin), class: 'btn btn-info', method: :post, data: { toggle: :tooltip}, title: t('view.make_active')) do + %i.icon-check diff --git a/templates/app_files/app/views/hq/admins/_blank.html.haml b/templates/app_files/app/views/hq/admins/_blank.html.haml new file mode 100644 index 0000000..a5910cb --- /dev/null +++ b/templates/app_files/app/views/hq/admins/_blank.html.haml @@ -0,0 +1,9 @@ +- if params[:q].present? + = render 'list' +- else + .alert.alert-warning + %p + %h3= t('view.there_is_no_data', resource: Admin.model_name.human.downcase) + = link_to new_hq_admin_path, class: 'btn btn-primary' do + = t('action_button.new', resource_name: Admin.model_name.human) + = t('view.btn.add') \ No newline at end of file diff --git a/templates/app_files/app/views/hq/admins/_filters.html.haml b/templates/app_files/app/views/hq/admins/_filters.html.haml new file mode 100644 index 0000000..1258558 --- /dev/null +++ b/templates/app_files/app/views/hq/admins/_filters.html.haml @@ -0,0 +1,20 @@ +.table-header.row + .col-lg-3 + = link_to hq_admins_path(q: {is_active_true: 1}), class: 'btn btn-success' do + = t('view.active') + %span.badge= Admin.where(is_active: true).count + = link_to hq_admins_path(q: {is_active_false: 1}), class: 'btn btn-warning' do + = t('view.passive') + %span.badge= Admin.where(is_active: false).count + - if params[:q].present? && (params[:q][:is_active_true].present? || params[:q][:is_active_false].present? || params[:q][:name_or_surname_cont].present?) + = link_to hq_admins_path, class: 'btn btn-info' do + = t('view.all') + %span.badge= Admin.count + .col-lg-9 + = search_form_for [:hq, @search], builder: SimpleForm::FormBuilder, html: {class: 'form-inline', data: { turboform: true }} do |f| + .pull-right + .input-group + = f.input_field :name_or_surname_cont, label: false, class: 'form-control', placeholder: t('view.quick_search') + %span.input-group-btn + = button_tag( class: 'btn btn-primary') do + %i.icon-search \ No newline at end of file diff --git a/templates/app_files/app/views/hq/admins/_form.html.haml b/templates/app_files/app/views/hq/admins/_form.html.haml new file mode 100644 index 0000000..b510366 --- /dev/null +++ b/templates/app_files/app/views/hq/admins/_form.html.haml @@ -0,0 +1,17 @@ +.panel.panel-default + .panel-heading + %i.icon-edit.icon-large + = yield :form_title + .panel-body + = simple_form_for([:hq, @admin], validate: true) do |f| + = f.error_notification + + .form-inputs + = f.input :name + = f.input :surname + = f.input :email + + .form-actions + - text = @admin.id.present? ? t('view.btn.update') : t('view.btn.add') + = f.button :submit, text, class: 'btn btn-primary' + = link_to t('view.cancel'), hq_admins_path, class: 'btn' diff --git a/templates/app_files/app/views/hq/admins/_list.html.haml b/templates/app_files/app/views/hq/admins/_list.html.haml new file mode 100644 index 0000000..f565f6c --- /dev/null +++ b/templates/app_files/app/views/hq/admins/_list.html.haml @@ -0,0 +1,15 @@ +.panel-body.filters + = render 'filters' +%table.table + %thead + %tr + %th= sort_link(@search, :id, t('activerecord.attributes.admin.id')) + %th= sort_link(@search, :name, t('activerecord.attributes.admin.name')) + %th= sort_link(@search, :email, t('activerecord.attributes.admin.email')) + %th= sort_link(@search, :current_sign_in_at, t('activerecord.attributes.admin.current_sign_in_at')) + %th= sort_link(@search, :last_sign_in_at, t('activerecord.attributes.admin.last_sign_in_at')) + %th= sort_link(@search, :is_active, t('activerecord.attributes.admin.is_active')) + %th.actions + = t('view.actions') + %tbody.admins + = render @admins diff --git a/templates/app_files/app/views/hq/admins/edit.html.haml b/templates/app_files/app/views/hq/admins/edit.html.haml new file mode 100644 index 0000000..d438c76 --- /dev/null +++ b/templates/app_files/app/views/hq/admins/edit.html.haml @@ -0,0 +1,3 @@ +- content_for :form_title do + = t('view.tooltips.edit', resource_name: t('view.admin_info')) += render 'form' diff --git a/templates/app_files/app/views/hq/admins/index.html.haml b/templates/app_files/app/views/hq/admins/index.html.haml new file mode 100644 index 0000000..05d8121 --- /dev/null +++ b/templates/app_files/app/views/hq/admins/index.html.haml @@ -0,0 +1,18 @@ +- content_for :toolbar do + = link_to new_hq_admin_path, class: 'btn btn-default' do + %i.icon-plus + = t('action_button.new', resource_name: Admin.model_name.human) + +.panel.panel-default.grid + .panel-heading + %i.fa.fa-table.icon-large + = t('activerecord.models.admins') + .panel-tools + .btn-group + %a.btn{href: hq_admins_path, data: {toggle: 'toolbar-tooltip'}, title: t('view.reload')} + %i.fa.fa-refresh + .badge= @admins.total_entries + =blankable(@admins) + .panel-footer + .pagination.pagination-sm + = will_paginate @admins, renderer: BootstrapPagination::Rails, bootstrap: 3 diff --git a/templates/app_files/app/views/hq/admins/new.html.haml b/templates/app_files/app/views/hq/admins/new.html.haml new file mode 100644 index 0000000..c8ea82a --- /dev/null +++ b/templates/app_files/app/views/hq/admins/new.html.haml @@ -0,0 +1,5 @@ +- content_for :form_title do + = t('view.tooltips.new', resource_name: Admin.model_name.human) +.alert.alert-info + = t('view.create_resource_mail_info', resource: Admin.model_name.human.downcase) += render 'form' diff --git a/templates/app_files/app/views/hq/admins/show.html.haml b/templates/app_files/app/views/hq/admins/show.html.haml new file mode 100644 index 0000000..056e08d --- /dev/null +++ b/templates/app_files/app/views/hq/admins/show.html.haml @@ -0,0 +1,19 @@ +- content_for :toolbar do + = link_to edit_hq_admin_path(@admin ), class: 'btn btn-default' do + %i.icon-pencil + = t('view.edit') +.panel.panel-default + .panel-heading + %i.icon-edit.icon-large + = t('view.tooltips.show', resource_name: Admin.model_name.human) + .panel-body + = show_for @admin do |s| + = s.attribute :name + = s.attribute :surname + = s.attribute :email do + = mail_to @admin.email, @admin.email + = s.attribute :is_active + = s.attribute :current_sign_in_at + = s.attribute :last_sign_in_at + = s.attribute :created_at + = s.attribute :updated_at diff --git a/templates/app_files/app/views/hq/audits/_filters.html.haml b/templates/app_files/app/views/hq/audits/_filters.html.haml new file mode 100644 index 0000000..4aa5c62 --- /dev/null +++ b/templates/app_files/app/views/hq/audits/_filters.html.haml @@ -0,0 +1,46 @@ +.table-header.row + .col-lg-2 + - if params[:q].present? + = link_to hq_audits_path, class: 'btn btn-info' do + = t('view.all') + %span.badge= Audit.count + .col-lg-10 + .pull-right + = search_form_for @search, builder: SimpleForm::FormBuilder, + html: {class: 'form-inline', data: { turboform: true }}, url: hq_audits_path do |f| + .form-group + = f.label :user_type, label: t('activerecord.attributes.audits.user_type') + = f.input_field :user_type_eq, label: false, class: 'form-control chosen-select', + placeholder: t('activerecord.attributes.audits.user'), + collection: get_audit_users, include_blank: t('view.select') + + - if params[:q].present? and params[:q][:user_type_eq].present? + - type = params[:q][:user_type_eq] + - if type == 'Admin' + = f.label :user, label: t('activerecord.attributes.audits.user') + = f.input_field :user_id_eq, label: false, class: 'form-control chosen-select', + placeholder: t('activerecord.attributes.audits.user'), + collection: get_admins, include_blank: t('view.select') + - elsif type == 'User' + = f.label :user, label: t('activerecord.attributes.audits.user') + = f.input_field :user_id_eq, label: false, class: 'form-control chosen-select', + placeholder: t('activerecord.attributes.audits.user'), + collection: get_users, include_blank: t('view.select') + + = f.label :auditable_type, label: t('activerecord.attributes.audits.auditable_type') + = f.input_field :auditable_type_eq, label: false, class: 'form-control chosen-select', + placeholder: t('activerecord.attributes.audits.auditable_type'), + collection: @auditable_types.map{|a| [t("activerecord.models.#{a.auditable_type.try(:underscore)}"), a.auditable_type]}, + include_blank: t('view.select') + + = f.label :user, label: t('activerecord.attributes.audits.auditable_id') + = f.input_field :auditable_id_eq, label: false, class: 'form-control', + placeholder: t('activerecord.attributes.audits.auditable_id') + + = f.label :user, label: t('activerecord.attributes.audits.action') + = f.input_field :action_eq, label: false, class: 'form-control chosen-select', + placeholder: t('activerecord.attributes.audits.action'), + collection: %w(create update destroy).map{|a| [t("actions.#{a}"), a]}, + include_blank: t('view.select') + = button_tag( class: 'btn btn-success btn-group') do + %i.fa.fa-search \ No newline at end of file diff --git a/templates/app_files/app/views/hq/audits/_list.html.haml b/templates/app_files/app/views/hq/audits/_list.html.haml new file mode 100644 index 0000000..8458aad --- /dev/null +++ b/templates/app_files/app/views/hq/audits/_list.html.haml @@ -0,0 +1,37 @@ +.panel-heading + %i.fa.fa-list + = t('activerecord.models.audits') + .panel-tools + .btn-group + %a.btn{href: hq_audits_path, data: {toggle: 'toolbar-tooltip'}, title: t('view.reload')} + %i.icon-refresh + .badge= @audits.total_entries +.panel-body.filters + = render 'filters' +.table-responsive + %table.table + %thead + %tr + %th= sort_link(@search, :id, t('activerecord.attributes.audits.id')) + %th= sort_link(@search, :user_type, t('activerecord.attributes.audits.user_type')) + %th= sort_link(@search, :user_id, t('activerecord.attributes.audits.user')) + %th= sort_link(@search, :auditable_type, t('activerecord.attributes.audits.auditable_type')) + %th= sort_link(@search, :auditable_id, t('activerecord.attributes.audits.auditable_id')) + %th= sort_link(@search, :auditable_id, t('activerecord.attributes.audits.created_at')) + %th= sort_link(@search, :action, t('activerecord.attributes.audits.action')) + %th.actions + = t('view.actions') + %tbody + - @audits.each do |audit| + %tr + %td= audit.id + %td + = t("activerecord.models.#{audit.try(:user_type).try(:downcase)}") if audit.try(:user_type).present? + %td= "#{audit.try(:user).try(:full_name)} - #{audit.try(:user).try(:email)}" + %td= t("activerecord.models.#{audit.try(:auditable_type).try(:underscore)}") if audit.try(:auditable_type).present? + %td= audit.auditable_id + %td= l audit.created_at + %td= t("actions.#{audit.action}") + %td.actions + = link_to(hq_audit_path(id: audit), class: 'btn btn-success btn-xs', 'data-toggle' => 'tooltip', title: t('view.tooltips.zoom')) do + %i.fa.fa-eye \ No newline at end of file diff --git a/templates/app_files/app/views/hq/audits/index.html.haml b/templates/app_files/app/views/hq/audits/index.html.haml new file mode 100644 index 0000000..eac51e8 --- /dev/null +++ b/templates/app_files/app/views/hq/audits/index.html.haml @@ -0,0 +1,5 @@ +.panel.panel-default.grid + = render 'list' + .panel-footer + .pagination.pagination-sm + = will_paginate @audits, renderer: BootstrapPagination::Rails, bootstrap: 3 diff --git a/templates/app_files/app/views/hq/audits/show.html.haml b/templates/app_files/app/views/hq/audits/show.html.haml new file mode 100644 index 0000000..b1d45d6 --- /dev/null +++ b/templates/app_files/app/views/hq/audits/show.html.haml @@ -0,0 +1,5 @@ +- @audit.audited_changes.keys.each do |key| + %p + %strong + = t("activerecord.attributes.#{@audit.try(:auditable_type).try(:underscore)}.#{key}") if @audit.try(:auditable_type).present? + = @audit.audited_changes[key] diff --git a/templates/app_files/app/views/hq/dashboard/index.html.haml b/templates/app_files/app/views/hq/dashboard/index.html.haml new file mode 100644 index 0000000..e9cf4af --- /dev/null +++ b/templates/app_files/app/views/hq/dashboard/index.html.haml @@ -0,0 +1,8 @@ +.panel.panel-default + .panel-body + .row + .col-lg-12 + .alert.alert-danger + = t('view.hello', user: current_admin.email) + = link_to t('view.navbar.sign_out'), destroy_admin_session_path, method: :delete, class: 'btn btn-danger' + = link_to t('view.navbar.edit_login_info'), edit_admin_registration_path, class: 'btn btn-primary' diff --git a/templates/app_files/app/views/hq/passwords/edit.html.haml b/templates/app_files/app/views/hq/passwords/edit.html.haml new file mode 100644 index 0000000..ab5f3fc --- /dev/null +++ b/templates/app_files/app/views/hq/passwords/edit.html.haml @@ -0,0 +1,12 @@ +%h2= t('devise.password.edit.title') += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + = f.error_notification + = f.input :reset_password_token, as: :hidden + = f.full_error :reset_password_token + .form-inputs + = f.input :password, required: true, autofocus: true + = f.input :password_confirmation, required: true + .form-actions + = f.button :submit, t('devise.password.edit.button') , class: 'btn btn-primary' +%br/ += render 'devise/shared/links' diff --git a/templates/app_files/app/views/hq/passwords/new.html.haml b/templates/app_files/app/views/hq/passwords/new.html.haml new file mode 100644 index 0000000..7300b17 --- /dev/null +++ b/templates/app_files/app/views/hq/passwords/new.html.haml @@ -0,0 +1,9 @@ +%h2= t('devise.password.new.title') += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + .form-inputs + = f.input :email, required: true, autofocus: true + .form-actions + = f.button :submit, t('devise.password.reset.instructions'), class: 'btn btn-primary' +%br/ += render 'devise/shared/links' diff --git a/templates/app_files/app/views/hq/registrations/edit.html.haml b/templates/app_files/app/views/hq/registrations/edit.html.haml new file mode 100644 index 0000000..bc234d1 --- /dev/null +++ b/templates/app_files/app/views/hq/registrations/edit.html.haml @@ -0,0 +1,22 @@ +.panel.panel-default + .panel-heading + %i.icon-edit.icon-large + = t('devise.registration.edit.title', model: resource.class.model_name.human) + .panel-body + = simple_form_for(resource, as: resource_name, url: admin_registration_path, html: { method: :put }) do |f| + = f.error_notification + .form-inputs + = f.input :email, required: true, autofocus: true + - if devise_mapping.confirmable? && resource.pending_reconfirmation? + %p + = t('devise.registration.waiting_confirmation', email: resource.unconfirmed_email ) + %hr + = f.input :password, label: t('activerecord.attributes.admin.password'), autocomplete: 'off', + hint: t('devise.registration.hint_password'), required: false + = f.input :password_confirmation, label: t('activerecord.attributes.admin.password_confirmation'), + required: false + %hr + = f.input :current_password, label: t('activerecord.attributes.admin.current_password'), + hint: t('devise.registration.hint_current_password'), required: true + .form-actions + = f.button :submit, t('view.btn.update'), class: 'btn btn-primary' diff --git a/templates/app_files/app/views/hq/sessions/new.html.haml b/templates/app_files/app/views/hq/sessions/new.html.haml new file mode 100644 index 0000000..8138934 --- /dev/null +++ b/templates/app_files/app/views/hq/sessions/new.html.haml @@ -0,0 +1,11 @@ +%h2 + = t('devise.session.title', model: resource.class.model_name.human ) += simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + .form-inputs + = f.input :email, required: false, autofocus: true + = f.input :password, required: false + = f.input :remember_me, as: :boolean,label: t('devise.session.remember_me') if devise_mapping.rememberable? + .form-actions + = f.button :submit, t('devise.session.button'), class: 'btn btn-primary' +%br/ += render 'devise/shared/links' \ No newline at end of file diff --git a/templates/app_files/app/views/hq/users/_blank.html.haml b/templates/app_files/app/views/hq/users/_blank.html.haml new file mode 100644 index 0000000..716b252 --- /dev/null +++ b/templates/app_files/app/views/hq/users/_blank.html.haml @@ -0,0 +1,9 @@ +- if params[:q].present? + = render 'list' +- else + .alert.alert-warning + %p + %h3= t('view.there_is_no_data', resource: User.model_name.human.downcase) + = link_to new_hq_user_path, class: 'btn btn-primary' do + = t('action_button.new', resource_name: User.model_name.human) + = t('view.btn.add') \ No newline at end of file diff --git a/templates/app_files/app/views/hq/users/_filters.html.haml b/templates/app_files/app/views/hq/users/_filters.html.haml new file mode 100644 index 0000000..f9966a3 --- /dev/null +++ b/templates/app_files/app/views/hq/users/_filters.html.haml @@ -0,0 +1,20 @@ +.table-header.row + .col-lg-3 + = link_to hq_users_path(q: {is_active_true: 1}), class: 'btn btn-success' do + = t('view.active') + %span.badge= User.where(is_active: true).count + = link_to hq_users_path(q: {is_active_false: 1}), class: 'btn btn-warning' do + = t('view.passive') + %span.badge= User.where(is_active: false).count + - if params[:q].present? && (params[:q][:is_active_true].present? || params[:q][:is_active_false].present? || params[:q][:name_or_surname_cont].present?) + = link_to hq_users_path, class: 'btn btn-info' do + = t('view.all') + %span.badge= User.count + .col-lg-9 + = search_form_for [:hq, @search], builder: SimpleForm::FormBuilder, html: {class: 'form-inline', data: { turboform: true }} do |f| + .pull-right + .input-group + = f.input_field :name_or_surname_cont, label: false, class: 'form-control', placeholder: t('view.quick_search') + %span.input-group-btn + = button_tag( class: 'btn btn-primary') do + %i.icon-search \ No newline at end of file diff --git a/templates/app_files/app/views/hq/users/_form.html.haml b/templates/app_files/app/views/hq/users/_form.html.haml new file mode 100644 index 0000000..ac5739b --- /dev/null +++ b/templates/app_files/app/views/hq/users/_form.html.haml @@ -0,0 +1,18 @@ +.panel.panel-default + .panel-heading + %i.icon-edit.icon-large + = yield :form_title + .panel-body + = simple_form_for([:hq, @user], validate: true) do |f| + = f.error_notification + + .form-inputs + = f.input :name + = f.input :surname + = f.input :email + = f.input :time_zone, input_html: { class: 'chosen-select'}, include_blank: t('view.select') + + .form-actions + - text = @user.id.present? ? t('view.btn.update') : t('view.btn.add') + = f.button :submit, text, class: 'btn btn-primary' + = link_to t('view.cancel'), hq_users_path, class: 'btn' diff --git a/templates/app_files/app/views/hq/users/_list.html.haml b/templates/app_files/app/views/hq/users/_list.html.haml new file mode 100644 index 0000000..90978a3 --- /dev/null +++ b/templates/app_files/app/views/hq/users/_list.html.haml @@ -0,0 +1,15 @@ +.panel-body.filters + = render 'filters' +%table.table + %thead + %tr + %th= sort_link(@search, :id, t('activerecord.attributes.user.id')) + %th= sort_link(@search, :name, t('activerecord.attributes.user.name')) + %th= sort_link(@search, :email, t('activerecord.attributes.user.email')) + %th= sort_link(@search, :current_sign_in_at, t('activerecord.attributes.user.current_sign_in_at')) + %th= sort_link(@search, :last_sign_in_at, t('activerecord.attributes.user.last_sign_in_at')) + %th= sort_link(@search, :is_active, t('activerecord.attributes.user.is_active')) + %th.actions + = t('view.actions') + %tbody.users + = render @users diff --git a/templates/app_files/app/views/hq/users/_user.html.haml b/templates/app_files/app/views/hq/users/_user.html.haml new file mode 100644 index 0000000..d916481 --- /dev/null +++ b/templates/app_files/app/views/hq/users/_user.html.haml @@ -0,0 +1,26 @@ +%tr{class: user.is_active ? 'active' : 'passive'} + %td= user.id + %td= user.full_name + %td= mail_to user.email, user.email + %td=l user.current_sign_in_at if user.current_sign_in_at.present? + %td=l user.last_sign_in_at if user.last_sign_in_at.present? + %td= user.is_active ? t('view.active') : t('view.passive') + %td.action + = link_to([:hq, user], class: 'btn btn-success', data: { toggle: :tooltip}, title: t('view.tooltips.zoom')) do + %i.icon-zoom-in + = link_to(edit_hq_user_path(user) , class: 'btn btn-info', data: { toggle: :tooltip }, title: t('view.tooltips.edit')) do + %i.icon-edit + = link_to([:hq, user], class: 'btn btn-danger', method: :delete, + data: { confirm: t('view.tooltips.are_you_sure'), toggle: :tooltip }, + title: t('view.tooltips.delete')) do + %i.icon-trash + - if user.is_active + = link_to(toggle_is_active_hq_user_path(user), class: 'btn btn-danger', method: :post, + data: { toggle: :tooltip}, + title: t('view.make_passive') ) do + %i.icon-ban-circle + - else + = link_to(toggle_is_active_hq_user_path(user), class: 'btn btn-info', method: :post, + data: { toggle: :tooltip}, + title: t('view.make_active')) do + %i.icon-check diff --git a/templates/app_files/app/views/hq/users/edit.html.haml b/templates/app_files/app/views/hq/users/edit.html.haml new file mode 100644 index 0000000..b8fb1d3 --- /dev/null +++ b/templates/app_files/app/views/hq/users/edit.html.haml @@ -0,0 +1,3 @@ +- content_for :form_title do + = t('view.title.edit', resource_name: t('view.admin_info')) += render 'form' diff --git a/templates/app_files/app/views/hq/users/index.html.haml b/templates/app_files/app/views/hq/users/index.html.haml new file mode 100644 index 0000000..0e87a41 --- /dev/null +++ b/templates/app_files/app/views/hq/users/index.html.haml @@ -0,0 +1,18 @@ +- content_for :toolbar do + = link_to new_hq_user_path, class: 'btn btn-default' do + %i.icon-plus + = t('action_button.new', resource_name: User.model_name.human) + +.panel.panel-default.grid + .panel-heading + %i.fa.fa-table.icon-large + = t('activerecord.models.users') + .panel-tools + .btn-group + %a.btn{href: hq_users_path, data: {toggle: 'toolbar-tooltip'}, title: t('view.reload')} + %i.fa.fa-refresh + .badge= @users.total_entries + =blankable(@users) + .panel-footer + .pagination.pagination-sm + = will_paginate @users, renderer: BootstrapPagination::Rails, bootstrap: 3 diff --git a/templates/app_files/app/views/hq/users/new.html.haml b/templates/app_files/app/views/hq/users/new.html.haml new file mode 100644 index 0000000..e17c468 --- /dev/null +++ b/templates/app_files/app/views/hq/users/new.html.haml @@ -0,0 +1,5 @@ +- content_for :form_title do + = t('view.title.new', resource_name: User.model_name.human) +.alert.alert-info + = t('view.create_resource_mail_info', resource: User.model_name.human.downcase) += render 'form' diff --git a/templates/app_files/app/views/hq/users/show.html.haml b/templates/app_files/app/views/hq/users/show.html.haml new file mode 100644 index 0000000..a03907b --- /dev/null +++ b/templates/app_files/app/views/hq/users/show.html.haml @@ -0,0 +1,20 @@ +- content_for :toolbar do + = link_to edit_hq_user_path(@user ), class: 'btn btn-default' do + %i.icon-pencil + = t('view.edit') +.panel.panel-default + .panel-heading + %i.icon-edit.icon-large + = t('view.title.show', resource_name: User.model_name.human) + .panel-body + = show_for @user do |s| + = s.attribute :name + = s.attribute :surname + = s.attribute :email do + = mail_to @user.email, @user.email + = s.attribute :is_active + = s.attribute :time_zone + = s.attribute :current_sign_in_at + = s.attribute :last_sign_in_at + = s.attribute :created_at + = s.attribute :updated_at diff --git a/templates/app_files/app/views/layouts/hq/application.html.haml b/templates/app_files/app/views/layouts/hq/application.html.haml new file mode 100644 index 0000000..8fb9be8 --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/application.html.haml @@ -0,0 +1,55 @@ +!!! 5 +/[if IE 8] +/[if IE 9] +/[if lt IE 10] +%html{lang: I18n.locale, class: 'no-js'} + %head + %title= content_for?(:title) ? "#{yield(:title)} - <%= app_name.capitalize %>" : '<%= app_name.capitalize %>' + %meta(http-equiv="content-type" content="text/html" charset="utf-8") + %meta(http-equiv="x-ua-compatible" content="ie=edge,chrome=1") + %meta(name="description" content="<%= app_name.capitalize %>") + %meta(name="author" content="<%= app_name.capitalize %>") + %meta{content: 'initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width', name: 'viewport'} + %meta(name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)") + %meta(name='apple-mobile-web-app-capable' content='yes') + %meta(name='apple-mobile-web-app-status-bar-style' content='translucent-black') + + %link(rel="shortcut icon" href="/images/favicon.png") + + = csrf_meta_tags + + / Stylesheets (Don't change include order) + = stylesheet_link_tag 'hq/application', + '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css', + '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', + media: 'all', 'data-turbolinks-track' => true + + / Javascripts + = javascript_include_tag '//cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js', + 'hq/application', 'data-turbolinks-track' => true + = yield :head + + %body.main + + / Navbar + = render partial: 'layouts/hq/partials/navbar' + + #wrapper + + / Sidebar + %section#sidebar + = render partial: 'layouts/hq/partials/dock' + + / Tools + %section#tools + = render partial: 'layouts/hq/partials/breadcrumb' + = render partial: 'layouts/hq/partials/toolbar' + + / Content + #content + = render 'layouts/partials/warnings' + = render partial: 'layouts/partials/messages' + = yield + + / Footer + = render partial: 'layouts/hq/partials/footer' \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/hq/login.html.haml b/templates/app_files/app/views/layouts/hq/login.html.haml new file mode 100644 index 0000000..4dd276d --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/login.html.haml @@ -0,0 +1,35 @@ +!!! 5 +/[if IE 8] +/[if IE 9] +/[if lt IE 10] +%html{lang: I18n.locale, class: 'no-js'} + %head + %title= content_for?(:title) ? "#{yield(:title)} - <%= app_name.capitalize %>" : '<%= app_name.capitalize %>' + %meta(http-equiv="content-type" content="text/html" charset="utf-8") + %meta(http-equiv="x-ua-compatible" content="ie=edge,chrome=1") + %meta(name="description" content="<%= app_name.capitalize %>") + %meta(name="author" content="<%= app_name.capitalize %>") + %meta{content: 'initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width', name: 'viewport'} + %meta(name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)") + %meta(name='apple-mobile-web-app-capable' content='yes') + %meta(name='apple-mobile-web-app-status-bar-style' content='translucent-black') + + %link(rel="shortcut icon" href="/images/favicon.png") + + / Stylesheets (Don't change include order) + = stylesheet_link_tag 'hq/application', + '//netdna.bootstrapcdn.com/font-awesome/3.2.0/css/font-awesome.min.css', + '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', + media: 'all', 'data-turbolinks-track' => true + = yield :head + + %body.login + = render 'layouts/partials/warnings' + .wrapper + = render partial: 'layouts/partials/messages' + = yield + + %br/ + .text-center.text-muted + = render partial: 'layouts/hq/partials/footer' + = render file: 'public/VERSION.txt' diff --git a/templates/app_files/app/views/layouts/hq/partials/_breadcrumb.html.haml b/templates/app_files/app/views/layouts/hq/partials/_breadcrumb.html.haml new file mode 100644 index 0000000..9d8f800 --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/partials/_breadcrumb.html.haml @@ -0,0 +1,3 @@ +- unless controller_name == 'sessions' + %ul#breadcrumb.breadcrumb.tools-bottom-line + = render_breadcrumbs :separator => ' / ' \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/hq/partials/_dock.html.haml b/templates/app_files/app/views/layouts/hq/partials/_dock.html.haml new file mode 100644 index 0000000..792dd0d --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/partials/_dock.html.haml @@ -0,0 +1,27 @@ +%i#toggle.icon-align-justify.icon-large + +%ul#dock + + %li.launcher + %i.icon-dashboard + =link_to t('dock.dashboard'), hq_dashboard_index_path + + %li.launcher.dropdown.hover + %i.fa.fa-list + %a{href: '#'}= t('dock.system_users') + %ul.dropdown-menu + %li + = link_to hq_admins_path do + %i.fa.fa-users + = t('activerecord.models.admins') + %li + = link_to hq_users_path do + %i.fa.fa-users + = t('activerecord.models.users') + + %br/ + %li.launcher.dropdown.hover + %i.fa.fa-list + %a{href: '#'}= t('dock.system_datas') + +#beaker{data: {toggle: 'tooltip'}, title: 'Made by lab2023'} \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/hq/partials/_footer.html.haml b/templates/app_files/app/views/layouts/hq/partials/_footer.html.haml new file mode 100644 index 0000000..e69de29 diff --git a/templates/app_files/app/views/layouts/hq/partials/_navbar.html.haml b/templates/app_files/app/views/layouts/hq/partials/_navbar.html.haml new file mode 100644 index 0000000..037310a --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/partials/_navbar.html.haml @@ -0,0 +1,22 @@ +#navbar.navbar.navbar-default + %a.navbar-brand{href: hq_dashboard_index_path} + %i.icon-beer + <%= app_name.capitalize %> + = t('navbar.admin_portal') + %ul.nav.navbar-nav.pull-right + %li + = link_to hq_audits_path do + %i.icon-cog + = t('activerecord.models.audits') + %li.dropdown.user + %a.dropdown-toggle{'data-toggle' => 'dropdown', href: '#'} + %i.icon-user + %strong + = current_admin.email + %b.caret + %ul.dropdown-menu + %li + =link_to t('navbar.edit_login_info'), edit_admin_registration_path + %li.divider + %li + =link_to t('navbar.signout'), destroy_admin_session_path, method: :delete diff --git a/templates/app_files/app/views/layouts/hq/partials/_toolbar.html.haml b/templates/app_files/app/views/layouts/hq/partials/_toolbar.html.haml new file mode 100644 index 0000000..970c687 --- /dev/null +++ b/templates/app_files/app/views/layouts/hq/partials/_toolbar.html.haml @@ -0,0 +1,3 @@ +#toolbar + .btn-group + = yield :toolbar \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/hq/partials/_trackers.html.haml b/templates/app_files/app/views/layouts/hq/partials/_trackers.html.haml new file mode 100644 index 0000000..e69de29 diff --git a/templates/app_files/app/views/layouts/partials/_messages.html.haml b/templates/app_files/app/views/layouts/partials/_messages.html.haml new file mode 100644 index 0000000..212e427 --- /dev/null +++ b/templates/app_files/app/views/layouts/partials/_messages.html.haml @@ -0,0 +1,12 @@ +- flash.each do |key, value| + - if key.to_s == 'notice' + - key = 'success' + - if key.to_s == 'alert' + - key = 'danger' + %div{:class => "alert alert-dismissable alert-#{key}"} + - if key.to_s == 'danger' || key.to_s == 'warning' + %i.fa.fa-exclamation-triangle.fs-25 + + - else + %i.fa.fa-smile-o.fs-25{:style => 'padding: 0px 5px;'} + = value \ No newline at end of file diff --git a/templates/app_files/app/views/layouts/partials/_warnings.html.haml b/templates/app_files/app/views/layouts/partials/_warnings.html.haml new file mode 100644 index 0000000..e69de29 diff --git a/templates/app_files/blankable_Gemfile.erb b/templates/app_files/blankable_Gemfile.erb new file mode 100644 index 0000000..1ea290c --- /dev/null +++ b/templates/app_files/blankable_Gemfile.erb @@ -0,0 +1,3 @@ + +# Adds blank slates to index view +gem 'blankable', '~> 0.2.0' \ No newline at end of file diff --git a/templates/view_files/bootstrap_Gemfile.erb b/templates/app_files/bootstrap_Gemfile.erb similarity index 100% rename from templates/view_files/bootstrap_Gemfile.erb rename to templates/app_files/bootstrap_Gemfile.erb diff --git a/templates/app_files/breadcrumb_Gemfile.erb b/templates/app_files/breadcrumb_Gemfile.erb new file mode 100644 index 0000000..ce8a261 --- /dev/null +++ b/templates/app_files/breadcrumb_Gemfile.erb @@ -0,0 +1,4 @@ + +# BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and managing +# a breadcrumb navigation for a Rails project. +gem 'breadcrumbs_on_rails', '~> 3.0', '>= 3.0.1' \ No newline at end of file diff --git a/templates/app_files/fontawesome_Gemfile.erb b/templates/app_files/fontawesome_Gemfile.erb new file mode 100644 index 0000000..9e723af --- /dev/null +++ b/templates/app_files/fontawesome_Gemfile.erb @@ -0,0 +1,3 @@ + +# Font-awesome-rails provides the Font-Awesome web fonts and stylesheets +gem 'font-awesome-rails', '~> 4.7', '>= 4.7.0.2' \ No newline at end of file diff --git a/templates/config/locales/email.en.yml b/templates/config/locales/email.en.yml deleted file mode 100644 index 3e175ae..0000000 --- a/templates/config/locales/email.en.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -en: - email: - salut: 'Hello %{user};' - hello: 'Hello;' \ No newline at end of file diff --git a/templates/config/locales/email.tr.yml b/templates/config/locales/email.tr.yml deleted file mode 100644 index 563d85c..0000000 --- a/templates/config/locales/email.tr.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -tr: - email: - salut: 'Merhaba %{user};' - hello: 'Merhaba;' \ No newline at end of file diff --git a/templates/config/locales/en.yml b/templates/config/locales/en.yml new file mode 100644 index 0000000..9a06e7b --- /dev/null +++ b/templates/config/locales/en.yml @@ -0,0 +1,34 @@ +--- +en: + phone: + formats: + long: '+99 (999) 999-9999' + date: + formats: + excel: + rails: '%d/%m/%Y' + datepicker: + rails: '%d/%m/%Y' + js: 'd/m/Y' + default: "%d/%m/%Y" + year_month: "%Y-%B" + date: '%d %B %Y' + time: + formats: + certificate_completed_at_english: '%m/%d/%Y' + certificate_completed_at: '%d/%m/%Y' + datetimepicker_rails: '%d/%m/%Y %H:%M' + datetimepicker: + rails: '%d/%m/%Y %H:%M' + js: 'd/m/Y H:i' + default: "%d/%m/%Y %H:%M" + year_month: "%Y-%B" + date: '%d %B %Y' + due_at: + rails: '%d/%m/%Y %H:%M' + js: 'd/m/Y H:i' + number: + currency: + format: + format: "%u %n" + unit: "₺" diff --git a/templates/config/locales/mailer.en.yml b/templates/config/locales/mailer.en.yml new file mode 100644 index 0000000..6dba1a0 --- /dev/null +++ b/templates/config/locales/mailer.en.yml @@ -0,0 +1,20 @@ +en: + mailer: + salut: 'Hello %{email},' + hello: 'Welcome,' + devise: + confirmation_instruction: + desc1: "You can confirm your account email through the link below:" + btn_confirm: "Confirm my account" + reset_password: + desc1: "Someone has requested a link to change your password. You can do this through the link below." + change: "Change my password" + desc2: "If you didn't request this, please ignore this email." + desc3: "Your password won't change until you access the link above and create a new one." + admin: + login_info: + title: Your Administrator Login Information + first_info: Your admin account has been created. You can now log in to the admin portal. + second_info: Your login information is + btn_login: Click to login + last_info: "If you can not use 'Login' button, your login
Link : %{link}
Copy this link and paste it into your browser." \ No newline at end of file diff --git a/templates/config/locales/mailer.tr.yml b/templates/config/locales/mailer.tr.yml new file mode 100644 index 0000000..6ffa919 --- /dev/null +++ b/templates/config/locales/mailer.tr.yml @@ -0,0 +1,20 @@ +tr: + mailer: + salut: 'Merhaba %{user};' + hello: 'Merhaba;' + devise: + confirmation_instruction: + desc1: E-posta adresinizi aşağıdaki link ile doğrulayabilirsiniz + btn_confirm: Hesabımı doğrula + reset_password: + desc1: Parolanızı değiştirmek için link isteğinde bulundunuz. Aşağıdaki link ile bunu yapabilirsiniz. + change: Parolamı değiştir + desc2: Eğer bu isteği siz yapmadıysanız bu e-posta'yı yok sayınız. + desc3: Parolanız yukarıdaki link'e erişip yeni bir parola oluşturmadığınız sürece değişmeyecektir. + admin: + login_info: + title: Yönetici Giriş Bilgileriniz + first_info: Portal üzerinden yönetici hesabınız oluşturuldu. Artık yönetici portalına giriş yapabilirsiniz. + second_info: Giriş bilgileriniz şu şekildedir + btn_login: Giriş yapmak için tıklayınız + last_info: "Eğer 'Giriş Yap' butonunu kullanamıyorsanız giriş linkiniz şu şekildedir
Link : %{link}
Bu linki kopyalayıp tarayıcınıza yapıştırınız.." \ No newline at end of file diff --git a/templates/config/locales/models.en.yml b/templates/config/locales/models.en.yml index 2525bca..1ec1ab7 100644 --- a/templates/config/locales/models.en.yml +++ b/templates/config/locales/models.en.yml @@ -1,2 +1,48 @@ en: - activerecord: \ No newline at end of file + timestamp_fields: ×tamp + created_at: Creation date + updated_at: Updated date + activerecord: + models: + schemamigration: Schemamigration + admin: Admin + admins: Admins + audit: Transaction history + audits: Transaction histories + attributes: + audits: + id: ID + user_type: User type + user: User + type: Type + type_id: Type ID + action: Action + actions: Actions + user_id: User ID + auditable_type: Auditable type + auditable_id: Auditable ID + action: Action type + <<: *timestamp + admin: + id: ID + email: Email Address + password: Password + current_password: Current password + password_confirmation: Password again + remember_me: Remember me + encrypted_password: Encrypted password + reset_password_token: Reset password token + reset_password_sent_at: Reset password sent date + remember_created_at: remember me creation date + sign_in_count: Sign in count + current_sign_in_at: Last login date + last_sign_in_at: Previous login date + last_seen_at: Last seen date + current_sign_in_ip: Current Sign in IP + last_sign_in_ip: last sign in IP + authentication_token: Authentication IP + name: First name + surname: Last name + is_active: Active? + is_blocked: Blocked? + <<: *timestamp \ No newline at end of file diff --git a/templates/config/locales/models.tr.yml b/templates/config/locales/models.tr.yml index 5862307..a9a6f7c 100644 --- a/templates/config/locales/models.tr.yml +++ b/templates/config/locales/models.tr.yml @@ -1,2 +1,46 @@ tr: - activerecord: \ No newline at end of file + timestamp_fields: ×tamp + created_at: Oluşturulma tarihi + updated_at: Güncellenme tarihi + activerecord: + models: + schemamigration: Schemamigration + admin: Yönetici + admins: Yöneticiler + audit: İşlem Geçmişi + audits: İşlem Geçmişleri + attributes: + admin: + id: ID + email: E-posta + password: Parola + current_password: Şu anki parolanız + password_confirmation: Parola tekrarı + remember_me: Beni hatırla + encrypted_password: Şifrelenmiş parola + reset_password_token: Parola sıfırlama token'ı + reset_password_sent_at: Parola sıfırlama isteği gönderilme zamanı + remember_created_at: Beni hatırla oluşturulma zamanı + sign_in_count: Giriş sayısı + current_sign_in_at: Güncel giriş tarihi + last_sign_in_at: Son giriş tarihi + last_seen_at: Son görülme tarihi + current_sign_in_ip: Güncel girişe ait IP + last_sign_in_ip: Son giriş işlemine ait IP + authentication_token: Giriş token'ı + name: İsim + surname: Soyisim + is_active: Aktif mi? + <<: *timestamp + audits: + id: ID + user_type: İşlemi yapan kullanıcı tipi + user: İşlemi yapan kullanıcı + type: Tip + type_id: Tip ID + action: İşlem + user_id: İşlemi yapan + auditable_type: İşlem yapılan + auditable_id: İşlem yapılan ID + action: İşlem Türü + <<: *timestamp \ No newline at end of file diff --git a/templates/config/locales/responders.en.yml b/templates/config/locales/responders.en.yml new file mode 100644 index 0000000..a577727 --- /dev/null +++ b/templates/config/locales/responders.en.yml @@ -0,0 +1,14 @@ +--- +en: + flash: + actions: + toggle_is_active: + passive: '%{resource_name} was set passive successfully.' + active: '%{resource_name} was set active successfully.' + create: + notice: '%{resource_name} created successfully.' + update: + notice: '%{resource_name} updated successfully.' + destroy: + notice: '%{resource_name} deleted successfully.' + alert: 'Cannot delete %{resource_name}' \ No newline at end of file diff --git a/templates/config/locales/view.en.yml b/templates/config/locales/view.en.yml index 3373fc5..c9e1105 100644 --- a/templates/config/locales/view.en.yml +++ b/templates/config/locales/view.en.yml @@ -1,5 +1,110 @@ en: view: + excel_export: Export as Excel + make_passive: Make Passive + make_active: Make Active + actions: Actions + edit: Edit + select: Select + active: Active + passive: Passive + start: Start + end: End + used: Used + not_used: Not Used + cancel: Cancel + all: All + reset: Reset + quick_search: Search... + reload: Reload + hello: "Hello %{user}" + there_is_no_data: "There is no %{resource}." + create_resource_mail_info: "When you add a new %{resource}, login information will be sent to your e-mail address." + admin_info: Admin Info + title: + edit: "Edit %{resource_name}" + show: "Detail %{resource_name}" + new: "Add %{resource_name}" + actions: + update: Update + create: Create + destroy: Destroy + delete: Delete + navbar: + settings: Settings + signup: Sign Up + signin: Sign In + sign_out: Sign Out + edit_login_info: Edit Login Info + edit_profile_info: Edit Profile Info + home_page: Home Page + admin_portal: Admin Portal + profile: Profile + tooltips: + zoom: "Detail" + edit: "Edit" + delete: "Delete" + new: "New" + are_you_sure: "Are you sure you want to continue?" + choose: "Select" + show: "Show" + btn: + add: Add + update: Update + back: Back + detail: Detail + delete: Delete + dock: + dashboard: "Control Panel" + profile: "Profile" + system_users: "System users" + system_datas: "System data" + system: "System" error: internal_server_error: "We are sorry. An error occured. Our engineers are working on it. We will solve it as soon as possible." - not_found: "We are sorry. Page was not found. It may have been moved." \ No newline at end of file + not_found: "We are sorry. Page was not found. It may have been moved." + devise: + shared: + links: + login: "Log in" + sign_up: "Sign up" + forgot_your_password: "Forgot your password?" + did_not_receive_confirmation_instructions: "Resend confirmation email" + did_not_receive_unlock_instructions: "Resend confirmation email" + sign_in_with: "Sign in with %{name}" + sign_up_with: "Sign up with %{name}" + sessions: + new: + title: "Log in" + submit_button: "Log in" + unlocks: + new: + title: "Resend unlock instructions" + submit_button: "Resend unlock instructions" + registrations: + new: + submit_button: "Sign up" + title: "Sign up" + no_model_title: "Sign up for Free" + title: "%{model} Sign up" + password_hint: "%{length} characters minimum" + edit: + title: "Edit log in info" + password_hint: "Leave it blank if you don't want to change it" + current_password_hint: "we need your current password to confirm your changes" + submit_button: "Update" + unconfirmed_email: "Currently waiting confirmation for: %{email}" + passwords: + new: + title: "Forgot your password?" + submit_button: "Send me reset password instructions" + password_hint: "%{length} characters minimum" + edit: + title: "Change your password" + submit_button: "Change my password" + new_password: "New password" + confirm_new_password: "Confirm your new password" + confirmations: + new: + title: "Resend confirmation instructions" + submit_button: "Resend confirmation instructions" \ No newline at end of file diff --git a/templates/config/locales/view.tr.yml b/templates/config/locales/view.tr.yml index ce108f7..a8c0ddb 100644 --- a/templates/config/locales/view.tr.yml +++ b/templates/config/locales/view.tr.yml @@ -1,5 +1,101 @@ tr: view: + excel_export: Excel Olarak Çıkart + make_passive: Pasif et + make_active: Aktif et + actions: İşlemler + select: Seçiniz + active: Aktif + passive: Pasif + start: Başlangıç + end: Bitiş + used: Kullanılan + not_used: Kullanılmayan + cancel: İptal et + all: Hepsi + reset: Temizle + quick_search: Arama yap.. + reload: Yeniden yükle + hello: "Merhaba %{user}" + there_is_no_data: "Hiç %{resource} eklenmemiş." + create_resource_mail_info: "Yeni bir %{resource} eklediğinizde e-posta adresine giriş bilgileri gönderilecektir." + admin_info: Yönetici Bilgilerini + title: + edit: "%{resource_name} Düzenle" + show: "%{resource_name} Detay" + new: "%{resource_name} Ekle" + actions: + update: Güncelleme + create: Oluşturma + destroy: Silme + delete: Silme + navbar: + settings: Ayarlar + signup: Kayıt ol + signin: Giriş Yap + sign_out: Çıkış yap + edit_login_info: Giriş bilgilerini güncelle + edit_profile_info: Profil bilgilerini güncelle + home_page: Anasayfa + admin_portal: Yönetici Portalı + profile: Profil + tooltips: + delete: Sil + are_you_sure: Devam etmek istedğinize emin misiniz? + choose: Seç + btn: + add: Ekle + update: Güncelle + back: Geri + detail: Detaylar + delete: Sil + dock: + dashboard: Kontrol Paneli + dashboard: Kontrol paneli + profile: Profil + system_users: Sistem kullanıcıları + system_datas: Sistem verileri error: internal_server_error: "Üzgünüz. Şu anda bir hata var. Mühendislerimiz bu hata üzerinde çalışma yapıyorlar. En kısa sürede çözeceğiz." - not_found: "Üzgünüz. Bu sayfa bulunamadı. Taşınmış olabilir. Buraya gitmek istediğinizden emin olun." \ No newline at end of file + not_found: "Üzgünüz. Bu sayfa bulunamadı. Taşınmış olabilir. Buraya gitmek istediğinizden emin olun." + devise: + session: + title: '%{model} Girişi' + button: Giriş Yap + remember_me: Beni Hatırla + deactivated: Üzgünüz, bu hesap pasif hale getirilmiştir. + registration: + title: '%{model} Giriş Bilgilerini Güncelle' + waiting_confirmation: 'E-posta addresi onayı için bekleniyor: %{email}' + hint_password: Değiştirmek istemiyorsanız boş bırakınız + hint_current_password: Değişiklikleri onaylamak için şuan ki parolanız girmelisiniz + new: + title: '%{model} Kayıt İşlemi' + character_hint: 'Minimum %{length} karakter' + button: Kayıt Ol + edit: + title: '%{model} Giriş Bilgilerini Güncelle' + shared: + links: + signup: Kayıt Ol + signin: Giriş Yap + forgot_password: Parolanızı mı unuttunuz? + confirmation_instructions: Onaylama yönergesini mi almadınız? + unlock_instructions: Kapatma yönergesini mi almadınız? + signin_with: '%{name} ile Giriş Yap' + signup_with: '%{name} ile Kayıt Ol' + confirmation: + new: + title: Onaylama Talimatlarını Yeniden Gönder + btn: + resend: Gönder + password: + new: + title: Parolanızı mı unuttunuz? + reset: + instructions: Parola sıfırlama talimatlarını gönder + edit: + title: Parolanızı Değiştiriniz + new_password: Yeni parolanız + confirmation: Yeni parola doğrulması + button: Parolamı Değiştir \ No newline at end of file diff --git a/templates/config/routes.rb.erb b/templates/config/routes.rb.erb new file mode 100644 index 0000000..3d465d1 --- /dev/null +++ b/templates/config/routes.rb.erb @@ -0,0 +1,23 @@ + + concern :activeable do + post :toggle_is_active, on: :member + end + + # Admins + devise_for :admins, controllers: { sessions: 'hq/sessions', registrations: 'hq/registrations', passwords: 'hq/passwords' }, + path: 'hq', + path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret', confirmation: 'verification' } + + as :admin do + get 'hq/edit' => 'hq/registrations#edit', as: 'edit_admin_registration' + put 'hq' => 'hq/registrations#update', as: 'admin_registration' + end + + namespace :hq do + root to: 'dashboard#index' + resources :dashboard, only: [:index] + resources :admins, concerns: [:activeable] + resources :users, concerns: [:activeable] + resources :audits, only: [:index, :show] + end + diff --git a/templates/devise/devise_authenticate_admin.rb.erb b/templates/devise/devise_authenticate_admin.rb.erb new file mode 100644 index 0000000..d35d67c --- /dev/null +++ b/templates/devise/devise_authenticate_admin.rb.erb @@ -0,0 +1,2 @@ + + before_action :authenticate_admin! \ No newline at end of file diff --git a/templates/devise/devise_views/confirmations/new.html.haml b/templates/devise/devise_views/confirmations/new.html.haml new file mode 100644 index 0000000..75479be --- /dev/null +++ b/templates/devise/devise_views/confirmations/new.html.haml @@ -0,0 +1,10 @@ +%h2 + = t('devise.confirmation.new.title') += simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + = f.full_error :confirmation_token + .form-inputs + = f.input :email, required: true, autofocus: true + .form-actions + = f.button :submit, t('devise.confirmation.btn.resend'), class: 'btn btn-primary' += render 'devise/shared/links' diff --git a/templates/devise/devise_views/mailer/confirmation_instructions.html.haml b/templates/devise/devise_views/mailer/confirmation_instructions.html.haml new file mode 100644 index 0000000..b24d0d0 --- /dev/null +++ b/templates/devise/devise_views/mailer/confirmation_instructions.html.haml @@ -0,0 +1,6 @@ +%p + = t( 'mailer.salut', user: @resource.email ) +%p + = "#{t( 'mailer.devise.confirmation_instruction.desc1')} :" +%p + = link_to t( 'mailer.devise.confirmation_instruction.btn_confirm'), confirmation_url(@resource, confirmation_token: @token) diff --git a/templates/devise/devise_views/mailer/reset_password_instructions.html.haml b/templates/devise/devise_views/mailer/reset_password_instructions.html.haml new file mode 100644 index 0000000..f2897a5 --- /dev/null +++ b/templates/devise/devise_views/mailer/reset_password_instructions.html.haml @@ -0,0 +1,9 @@ +%p + = t( 'mailer.salut', user: @resource.email ) +%p + = t( 'mailer.devise.reset_password.desc1') +%p= link_to t( 'mailer.devise.reset_password.change'), edit_password_url(@resource, reset_password_token: @token) +%p + = t( 'mailer.devise.reset_password.desc2') +%p + = t( 'mailer.devise.reset_password.desc3') diff --git a/templates/devise/devise_views/mailer/unlock_instructions.html.haml b/templates/devise/devise_views/mailer/unlock_instructions.html.haml new file mode 100644 index 0000000..72f6a0b --- /dev/null +++ b/templates/devise/devise_views/mailer/unlock_instructions.html.haml @@ -0,0 +1,5 @@ +%p + Hello #{@resource.email}! +%p Your account has been locked due to an excessive number of unsuccessful sign in attempts. +%p Click the link below to unlock your account: +%p= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) diff --git a/templates/devise/devise_views/passwords/edit.html.haml b/templates/devise/devise_views/passwords/edit.html.haml new file mode 100644 index 0000000..0b4cf7d --- /dev/null +++ b/templates/devise/devise_views/passwords/edit.html.haml @@ -0,0 +1,11 @@ +%h2= t('devise.password.edit.title') += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| + = f.error_notification + = f.input :reset_password_token, as: :hidden + = f.full_error :reset_password_token + .form-inputs + = f.input :password, label: t('devise.password.edit.new_password'), required: true, autofocus: true + = f.input :password_confirmation, label: t('devise.password.edit.confirmation'), required: true + .form-actions + = f.button :submit, t('devise.password.edit.button'), class: 'btn btn-primary' += render 'devise/shared/links' diff --git a/templates/devise/devise_views/passwords/new.html.haml b/templates/devise/devise_views/passwords/new.html.haml new file mode 100644 index 0000000..a6b3fe9 --- /dev/null +++ b/templates/devise/devise_views/passwords/new.html.haml @@ -0,0 +1,9 @@ +%h2= t('devise.password.reset.title') += simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + .form-inputs + = f.input :email, required: true, autofocus: true + .form-actions + = f.button :submit, t('devise.password.reset.instructions'), class: 'btn btn-primary' +%br += render 'devise/shared/links' \ No newline at end of file diff --git a/templates/devise/devise_views/registrations/edit.html.haml b/templates/devise/devise_views/registrations/edit.html.haml new file mode 100644 index 0000000..0b743ba --- /dev/null +++ b/templates/devise/devise_views/registrations/edit.html.haml @@ -0,0 +1,13 @@ +%h2 + = t('devise.registration.title', model: resource.class.model_name.human ) += simple_form_for(resource, as: resource_name, url: registration_path(resource_name), + html: { method: :put }, validate: true) do |f| + = f.error_notification + .form-inputs + = f.input :email, required: true, autofocus: true + = f.input :password, autocomplete: 'off', hint: t('devise.registration.hint_password'), required: false + = f.input :password_confirmation, required: false + = f.input :current_password, hint: t('devise.registration.hint_current_password'), required: true + .form-actions + = f.button :submit, t('btn.update'), class: 'btn btn-primary' += link_to t('btn.back'), :back diff --git a/templates/devise/devise_views/registrations/new.html.haml b/templates/devise/devise_views/registrations/new.html.haml new file mode 100644 index 0000000..5c19721 --- /dev/null +++ b/templates/devise/devise_views/registrations/new.html.haml @@ -0,0 +1,24 @@ +%h2 + = t('devise.registration.new.title', model: resource.class.model_name.human) +%hr/ +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to omniauth_authorize_path(resource_name, provider), class: 'btn btn-lg btn-primary btn-block' do + %i.fa.fa-facebook + = t('devise.shared.links.signup_with', name: provider.to_s.titleize) + %hr/ + %h3.text-center + = t('view.or') + %hr/ += simple_form_for(resource, as: resource_name, url: registration_path(resource_name), validate: true) do |f| + = f.error_notification + .form-inputs + = f.input :email + = f.input :password + = f.input :password_confirmation + = f.input :name + = f.input :surname + = f.input :time_zone, input_html: { class: 'chosen-select'}, include_blank: t('view.select') + .form-actions + = f.button :submit, t('devise.registration.new.button'), class: 'btn btn-primary' += render 'devise/shared/links' diff --git a/templates/devise/devise_views/sessions/new.html.haml b/templates/devise/devise_views/sessions/new.html.haml new file mode 100644 index 0000000..ce058de --- /dev/null +++ b/templates/devise/devise_views/sessions/new.html.haml @@ -0,0 +1,10 @@ +%h2 + = t('devise.session.title', model: resource.class.model_name.human ) += simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| + .form-inputs + = f.input :email, required: false, autofocus: true + = f.input :password, required: false + = f.input :remember_me, label: t('devise.session.remember_me'), as: :boolean if devise_mapping.rememberable? + .form-actions + = f.button :submit, t('devise.session.button'), class: 'btn btn-primary' += render 'devise/shared/links' diff --git a/templates/devise/devise_views/shared/_links.haml b/templates/devise/devise_views/shared/_links.haml new file mode 100644 index 0000000..c2aca8f --- /dev/null +++ b/templates/devise/devise_views/shared/_links.haml @@ -0,0 +1,22 @@ +%br +- if controller_name != 'sessions' + = link_to t('devise.shared.links.signin'), new_session_path(resource_name) + %br/ +- if devise_mapping.registerable? && controller_name != 'registrations' + = link_to t('devise.shared.links.signup'), new_registration_path(resource_name) + %br/ +- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' + = link_to t('devise.shared.links.forgot_password'), new_password_path(resource_name) + %br/ +- if devise_mapping.confirmable? && controller_name != 'confirmations' + = link_to t('devise.shared.links.confirmation_instructions'), new_confirmation_path(resource_name) + %br/ +- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' + = link_to t('devise.shared.links.unlock_instructions'), new_unlock_path(resource_name) + %br/ +- if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to t('devise.shared.links.signin_with', name: provider.to_s.titleize), omniauth_authorize_path(resource_name, provider) + %br/ += link_to t('navbar.home_page'), root_path +%br/ \ No newline at end of file diff --git a/templates/devise/devise_views/unlocks/new.html.haml b/templates/devise/devise_views/unlocks/new.html.haml new file mode 100644 index 0000000..c4dd03f --- /dev/null +++ b/templates/devise/devise_views/unlocks/new.html.haml @@ -0,0 +1,9 @@ +%h2 Resend unlock instructions += simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| + = f.error_notification + = f.full_error :unlock_token + .form-inputs + = f.input :email, required: true, autofocus: true + .form-actions + = f.button :submit, 'Resend unlock instructions' += render 'devise/shared/links' diff --git a/templates/docker/docker_env_local.erb b/templates/docker/docker_env_local.erb index df04f73..707604d 100644 --- a/templates/docker/docker_env_local.erb +++ b/templates/docker/docker_env_local.erb @@ -6,5 +6,5 @@ REDISTOGO_URL=redis://redis:6379/0 # Set Rails/Rack environment RACK_ENV=development -POSTGRESQL_HOST=postgres +# POSTGRESQL_HOST=postgres REDIS_HOST=redis \ No newline at end of file