adminos 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +25 -0
- data/.gitlab-ci.yml +18 -0
- data/.rspec +2 -0
- data/.rubocop.yml +120 -0
- data/.rubocop_todo.yml +58 -0
- data/Gemfile +25 -0
- data/Guardfile +70 -0
- data/LICENSE.txt +22 -0
- data/README.md +88 -0
- data/Rakefile +20 -0
- data/adminos.gemspec +37 -0
- data/adminos.png +0 -0
- data/app/assets/images/.keep +0 -0
- data/app/assets/images/apple-touch-icon.png +0 -0
- data/app/assets/images/favicon-16x16.png +0 -0
- data/app/assets/images/favicon-32x32.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/safari-pinned-tab.svg +23 -0
- data/app/inputs/cropp_input.rb +45 -0
- data/bin/bundle +105 -0
- data/bin/gem +39 -0
- data/bin/rspec +29 -0
- data/exe/adminos +5 -0
- data/lib/adminos/cli.rb +71 -0
- data/lib/adminos/controllers/admin_extension.rb +34 -0
- data/lib/adminos/controllers/helpers.rb +24 -0
- data/lib/adminos/controllers/resource.rb +169 -0
- data/lib/adminos/extensions/globalize_actiontext.rb +28 -0
- data/lib/adminos/extensions/globalize_fields.rb +19 -0
- data/lib/adminos/extensions/nested_set.rb +27 -0
- data/lib/adminos/extensions/string.rb +5 -0
- data/lib/adminos/generators/gemfile_merge.rb +85 -0
- data/lib/adminos/generators/utilities.rb +87 -0
- data/lib/adminos/helpers/admin.rb +190 -0
- data/lib/adminos/helpers/bootstrap.rb +64 -0
- data/lib/adminos/helpers/models/apply_sortable_order.rb +10 -0
- data/lib/adminos/helpers/models/array_attrs.rb +17 -0
- data/lib/adminos/helpers/models/cropped.rb +20 -0
- data/lib/adminos/helpers/models/dom_id.rb +16 -0
- data/lib/adminos/helpers/models/flag_attrs.rb +43 -0
- data/lib/adminos/helpers/models/if_blank_set_to_nil_params.rb +19 -0
- data/lib/adminos/helpers/models/move_to.rb +17 -0
- data/lib/adminos/helpers/models/nested_set/duplication.rb +31 -0
- data/lib/adminos/helpers/models/nested_set/materialize_path.rb +50 -0
- data/lib/adminos/helpers/models/nested_set/place_to.rb +35 -0
- data/lib/adminos/helpers/models/nested_set/safe_destroy.rb +34 -0
- data/lib/adminos/helpers/models/recognizable.rb +28 -0
- data/lib/adminos/helpers/models/slugged.rb +20 -0
- data/lib/adminos/helpers/models/soft_destroy.rb +61 -0
- data/lib/adminos/helpers/models/wysiwyg.rb +105 -0
- data/lib/adminos/helpers/view.rb +137 -0
- data/lib/adminos/operations/check_environment.rb +18 -0
- data/lib/adminos/operations/extract_environment.rb +42 -0
- data/lib/adminos/operations/load_environment.rb +30 -0
- data/lib/adminos/stateful_link/action_any_of.rb +76 -0
- data/lib/adminos/stateful_link/helper.rb +31 -0
- data/lib/adminos.rb +42 -0
- data/lib/adminos_template.rb +15 -0
- data/lib/generators/adminos/adminos_generator.rb +164 -0
- data/lib/generators/adminos/ci_generator.rb +124 -0
- data/lib/generators/adminos/field_generator.rb +105 -0
- data/lib/generators/adminos/i18n_generator.rb +76 -0
- data/lib/generators/adminos/install_generator.rb +238 -0
- data/lib/generators/templates/adminos/adminos.ru.yml +15 -0
- data/lib/generators/templates/adminos/fields.slim +21 -0
- data/lib/generators/templates/adminos/locales/general_fields.slim +7 -0
- data/lib/generators/templates/adminos/locales/locale_fields.slim +10 -0
- data/lib/generators/templates/adminos/locales/migration.rb.erb +18 -0
- data/lib/generators/templates/adminos/locales/model.rb.erb +6 -0
- data/lib/generators/templates/adminos/sidebar.slim +2 -0
- data/lib/generators/templates/adminos/sorts/body.slim +3 -0
- data/lib/generators/templates/adminos/sorts/headers.slim +3 -0
- data/lib/generators/templates/adminos/types/default/controller.rb.erb +18 -0
- data/lib/generators/templates/adminos/types/default/migration.rb +5 -0
- data/lib/generators/templates/adminos/types/default/model.rb +20 -0
- data/lib/generators/templates/adminos/types/default/model_includes.rb +4 -0
- data/lib/generators/templates/adminos/types/default/views/index.slim +14 -0
- data/lib/generators/templates/adminos/types/section/controller.rb.erb +10 -0
- data/lib/generators/templates/adminos/types/section/migration.rb +12 -0
- data/lib/generators/templates/adminos/types/section/model.rb +62 -0
- data/lib/generators/templates/adminos/types/section/model_includes.rb +7 -0
- data/lib/generators/templates/adminos/types/section/views/_object.slim +24 -0
- data/lib/generators/templates/adminos/types/section/views/_objects.slim +6 -0
- data/lib/generators/templates/adminos/types/section/views/index.slim +7 -0
- data/lib/generators/templates/adminos/types/sortable/controller.rb.erb +10 -0
- data/lib/generators/templates/adminos/types/sortable/migration.rb +9 -0
- data/lib/generators/templates/adminos/types/sortable/model.rb +35 -0
- data/lib/generators/templates/adminos/types/sortable/model_includes.rb +6 -0
- data/lib/generators/templates/adminos/types/sortable/views/_object.slim +17 -0
- data/lib/generators/templates/adminos/types/sortable/views/_objects.slim +6 -0
- data/lib/generators/templates/adminos/types/sortable/views/index.slim +7 -0
- data/lib/generators/templates/adminos/types/table/controller.rb.erb +19 -0
- data/lib/generators/templates/adminos/types/table/views/index.slim +31 -0
- data/lib/generators/templates/ci/.gitlab-ci.yml +40 -0
- data/lib/generators/templates/ci/audit/Gemfile +3 -0
- data/lib/generators/templates/ci/lint/Gemfile +3 -0
- data/lib/generators/templates/ci/lint/rubocop.yml +116 -0
- data/lib/generators/templates/ci/rakelib/audit.rake +13 -0
- data/lib/generators/templates/ci/rakelib/lint.rake +13 -0
- data/lib/generators/templates/ci/spec/Gemfile +9 -0
- data/lib/generators/templates/field/locales/locale_fields.slim +4 -0
- data/lib/generators/templates/field/locales/migration.rb.erb +13 -0
- data/lib/generators/templates/field/locales/model.rb.erb +6 -0
- data/lib/generators/templates/i18n/Gemfile +1 -0
- data/lib/generators/templates/i18n/add_translation_table_to_page.rb +15 -0
- data/lib/generators/templates/i18n/auto/app/validators/locale_validator.rb +23 -0
- data/lib/generators/templates/i18n/auto/app/views/admin/base/_fields.slim +1 -0
- data/lib/generators/templates/i18n/auto/app/views/admin/base/_pills.slim +19 -0
- data/lib/generators/templates/i18n/auto/app/views/admin/pages/_general_fields.slim +8 -0
- data/lib/generators/templates/i18n/auto/app/views/admin/pages/_locale_fields.slim +13 -0
- data/lib/generators/templates/i18n/auto/config/initializers/globalize_fields.rb +1 -0
- data/lib/generators/templates/i18n/controller.rb +12 -0
- data/lib/generators/templates/i18n/devise/devise.ru.yml +60 -0
- data/lib/generators/templates/i18n/devise/views/_links.erb +25 -0
- data/lib/generators/templates/i18n/devise/views/confirmations/new.slim +8 -0
- data/lib/generators/templates/i18n/devise/views/mailer/confirmation_instructions.slim +4 -0
- data/lib/generators/templates/i18n/devise/views/mailer/reset_password_instructions.slim +5 -0
- data/lib/generators/templates/i18n/devise/views/mailer/unlock_instructions.slim +4 -0
- data/lib/generators/templates/i18n/devise/views/passwords/edit.slim +7 -0
- data/lib/generators/templates/i18n/devise/views/passwords/new.slim +5 -0
- data/lib/generators/templates/i18n/devise/views/registrations/edit.slim +25 -0
- data/lib/generators/templates/i18n/devise/views/registrations/new.slim +7 -0
- data/lib/generators/templates/i18n/devise/views/sessions/new.slim +22 -0
- data/lib/generators/templates/i18n/devise/views/unlocks/new.slim +11 -0
- data/lib/generators/templates/i18n/locales.slim +3 -0
- data/lib/generators/templates/i18n/page.rb +5 -0
- data/lib/generators/templates/install/.gitignore +11 -0
- data/lib/generators/templates/install/Gemfile +57 -0
- data/lib/generators/templates/install/Procfile +1 -0
- data/lib/generators/templates/install/_sidebar.slim.erb +44 -0
- data/lib/generators/templates/install/add_authentications/authentication.rb +7 -0
- data/lib/generators/templates/install/add_authentications/authentications_controller.rb +95 -0
- data/lib/generators/templates/install/add_authentications/authentications_migration.rb +12 -0
- data/lib/generators/templates/install/add_authentications/views/authentications/_form.slim +5 -0
- data/lib/generators/templates/install/add_authentications/views/authentications/_modal.slim +7 -0
- data/lib/generators/templates/install/add_pages/page.rb +116 -0
- data/lib/generators/templates/install/add_pages/pages_controller.rb +6 -0
- data/lib/generators/templates/install/add_pages/pages_migration.rb +25 -0
- data/lib/generators/templates/install/add_pages/views/pages/show.slim +4 -0
- data/lib/generators/templates/install/admin.slim +36 -0
- data/lib/generators/templates/install/admin_panel/pages/admin_pages_controller.rb +9 -0
- data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_fields.slim +26 -0
- data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_object.slim +25 -0
- data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_objects.slim +6 -0
- data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/index.slim +7 -0
- data/lib/generators/templates/install/admin_panel/users/admin_users_controller.rb +29 -0
- data/lib/generators/templates/install/admin_panel/users/views/admin_users/_fields.slim +4 -0
- data/lib/generators/templates/install/admin_panel/users/views/admin_users/index.slim +33 -0
- data/lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb +29 -0
- data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/index.slim +47 -0
- data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/show.slim +18 -0
- data/lib/generators/templates/install/application.slim.erb +31 -0
- data/lib/generators/templates/install/auto/.editorconfig +14 -0
- data/lib/generators/templates/install/auto/.env.staging +2 -0
- data/lib/generators/templates/install/auto/Capfile +14 -0
- data/lib/generators/templates/install/auto/Guardfile +18 -0
- data/lib/generators/templates/install/auto/Procfile +1 -0
- data/lib/generators/templates/install/auto/Procfile.local +2 -0
- data/lib/generators/templates/install/auto/app/assets/javascripts/admin/application.js +3 -0
- data/lib/generators/templates/install/auto/app/assets/javascripts/admin/cocoon_fields.js +43 -0
- data/lib/generators/templates/install/auto/app/assets/javascripts/application.js +1 -0
- data/lib/generators/templates/install/auto/app/assets/stylesheets/admin/application.scss +1 -0
- data/lib/generators/templates/install/auto/app/controllers/admin/base_controller.rb +16 -0
- data/lib/generators/templates/install/auto/app/controllers/admin/helps_controller.rb +4 -0
- data/lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb +26 -0
- data/lib/generators/templates/install/auto/app/controllers/application_controller.rb +50 -0
- data/lib/generators/templates/install/auto/app/controllers/index_controller.rb +2 -0
- data/lib/generators/templates/install/auto/app/helpers/nested_helper.rb +75 -0
- data/lib/generators/templates/install/auto/app/helpers/versions_helper.rb +33 -0
- data/lib/generators/templates/install/auto/app/inputs/carrierwave_input.rb +52 -0
- data/lib/generators/templates/install/auto/app/inputs/checkbox_input.rb +13 -0
- data/lib/generators/templates/install/auto/app/inputs/rich_text_input.rb +9 -0
- data/lib/generators/templates/install/auto/app/mailers/notifier.rb +9 -0
- data/lib/generators/templates/install/auto/app/models/settings.rb +27 -0
- data/lib/generators/templates/install/auto/app/services/export_xlsx.rb +76 -0
- data/lib/generators/templates/install/auto/app/views/active_storage/blobs/_blob.html.erb +17 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/_form.slim +33 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/_object.slim +27 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/_objects.slim +19 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/drop.js.erb +1 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/edit.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/index.slim +14 -0
- data/lib/generators/templates/install/auto/app/views/admin/base/new.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/admin/helps/index.slim +29 -0
- data/lib/generators/templates/install/auto/app/views/admin/settings/edit.slim +27 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_first_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_gap.slim +7 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_last_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_next_page.slim +9 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_paginator.slim +16 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/_prev_page.slim +9 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_first_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_gap.slim +8 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_last_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_next_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_paginator.slim +16 -0
- data/lib/generators/templates/install/auto/app/views/kaminari/admin/_prev_page.slim +10 -0
- data/lib/generators/templates/install/auto/app/views/layouts/admin/base.slim +17 -0
- data/lib/generators/templates/install/auto/app/views/shared/admin/_back_button.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/admin/_footer.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/admin/_search_form.slim +6 -0
- data/lib/generators/templates/install/auto/app/views/shared/admin/_topbar.slim +11 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_alert_close.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_contacts_page_link_tag.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_link_button_to.slim +2 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_method_ajax_request_link_to.slim +2 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_method_link_to.slim +12 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_navigation_menu.html.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_print_tag.slim +2 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_search_tag_for.slim +16 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_show_breadcrumbs.slim +7 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_show_flash_alert.slim +9 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_sortable_column.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_span_link_to.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/_sub_navigation.slim +14 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_batch_actions_tag.slim +16 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_button_new.slim +5 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_header.slim +4 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_locked_sign.slim +3 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_nav_published_sign.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_children.slim +2 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_duplication.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_edit.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_new.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_page_header.slim +5 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_published_sign.slim +1 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_show_breadcrumbs.slim +6 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_top_menu_item.slim +5 -0
- data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_unpublished_sign.slim +1 -0
- data/lib/generators/templates/install/auto/browserslist +3 -0
- data/lib/generators/templates/install/auto/config/deploy/shared/database.yml.erb +10 -0
- data/lib/generators/templates/install/auto/config/deploy/shared/nginx.conf.erb +28 -0
- data/lib/generators/templates/install/auto/config/deploy/shared/unicorn.rb.erb +35 -0
- data/lib/generators/templates/install/auto/config/deploy/staging.rb +12 -0
- data/lib/generators/templates/install/auto/config/environments/staging.rb +84 -0
- data/lib/generators/templates/install/auto/config/initializers/awesome_nested_set.rb +1 -0
- data/lib/generators/templates/install/auto/config/initializers/content_security_policy.rb +26 -0
- data/lib/generators/templates/install/auto/config/initializers/friendly_id.rb +1 -0
- data/lib/generators/templates/install/auto/config/initializers/kaminari_config.rb +15 -0
- data/lib/generators/templates/install/auto/config/initializers/simple_form.rb +238 -0
- data/lib/generators/templates/install/auto/config/initializers/slim.rb +2 -0
- data/lib/generators/templates/install/auto/config/locales/adminos.en.yml +164 -0
- data/lib/generators/templates/install/auto/config/locales/adminos.ru.yml +292 -0
- data/lib/generators/templates/install/auto/lib/capistrano/substitute_strings.rb +12 -0
- data/lib/generators/templates/install/auto/lib/capistrano/tasks/setup_config.cap +39 -0
- data/lib/generators/templates/install/auto/lib/capistrano/template.rb +33 -0
- data/lib/generators/templates/install/auto/public/404.html +26 -0
- data/lib/generators/templates/install/auto/public/500.html +25 -0
- data/lib/generators/templates/install/database.yml +19 -0
- data/lib/generators/templates/install/deploy.rb.erb +21 -0
- data/lib/generators/templates/install/install_devise/ability.rb +49 -0
- data/lib/generators/templates/install/install_devise/application.rb +7 -0
- data/lib/generators/templates/install/install_devise/prepare_users.rb +1 -0
- data/lib/generators/templates/install/install_devise/user.rb +21 -0
- data/lib/generators/templates/install/prepare_settings.rb +4 -0
- data/lib/generators/templates/install/routes/pages.rb +18 -0
- data/lib/generators/templates/install/routes.rb.erb +53 -0
- data/lib/generators/templates/install/settings_migration.rb +16 -0
- data/lib/generators/templates/install/webpack/custom.js +36 -0
- data/lib/generators/templates/install/webpack/environment.js +4 -0
- data/lib/generators/templates/install/webpack/javascript/admin/js/index.js +2 -0
- data/lib/generators/templates/install/webpack/javascript/admin/styles/admin.scss +2 -0
- data/lib/generators/templates/install/webpack/javascript/packs/admin.js +2 -0
- data/package-lock.json +3 -0
- data/spec/config/database.yml +2 -0
- data/spec/db/schema.rb +0 -0
- data/spec/lib/adminos/helpers/models/apply_sortable_order.rb +26 -0
- data/spec/lib/adminos/helpers/models/array_attrs_spec.rb +38 -0
- data/spec/lib/adminos/helpers/models/dom_id_spec.rb +41 -0
- data/spec/lib/adminos/helpers/models/flag_attrs_spec.rb +115 -0
- data/spec/lib/adminos/helpers/models/if_blank_set_to_nil_params_spec.rb +36 -0
- data/spec/lib/adminos/helpers/models/recognizable_spec.rb +40 -0
- data/spec/lib/adminos/helpers/models/slugged.rb +40 -0
- data/spec/lib/generators/adminos/adminos_generator_spec.rb +106 -0
- data/spec/lib/generators/adminos/ci_generator_spec.rb +88 -0
- data/spec/lib/generators/adminos/i18n_generator_spec.rb +31 -0
- data/spec/lib/generators/adminos/install_generator_rspec.rb +322 -0
- data/spec/spec_helper.rb +122 -0
- data/spec/support/ammeter.rb +14 -0
- data/spec/support/database.rb +29 -0
- data/spec/support/generators.rb +99 -0
- data/spec/support/post.rb +8 -0
- data/spec/support/shared/generator.rb +35 -0
- metadata +632 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rails', '~> 5.2'
|
4
|
+
gem 'pg'
|
5
|
+
gem 'puma', '~> 3.7'
|
6
|
+
|
7
|
+
gem 'jbuilder', '~> 2.5'
|
8
|
+
gem 'role_model'
|
9
|
+
gem 'webpacker', '~> 3.5'
|
10
|
+
gem "actiontext", github: "rails/actiontext", require: "action_text"
|
11
|
+
gem "image_processing", "~> 1.2" # for Active Storage variants
|
12
|
+
|
13
|
+
group :production, :staging do
|
14
|
+
gem 'unicorn'
|
15
|
+
end
|
16
|
+
|
17
|
+
group :development do
|
18
|
+
# gem 'spring'
|
19
|
+
gem 'capistrano', require: false
|
20
|
+
gem 'capistrano-bundler', require: false
|
21
|
+
gem 'capistrano-rails', require: false
|
22
|
+
gem 'capistrano-rvm', require: false
|
23
|
+
gem 'capistrano3-unicorn', require: false
|
24
|
+
|
25
|
+
gem 'guard'
|
26
|
+
gem 'guard-livereload', '~> 2.5', require: false
|
27
|
+
|
28
|
+
gem 'listen', '~> 3.0.5'
|
29
|
+
end
|
30
|
+
|
31
|
+
group :development, :test do
|
32
|
+
# gem 'spring-commands-rspec' #for spring speed test
|
33
|
+
gem 'pry'
|
34
|
+
gem 'shoulda-matchers'
|
35
|
+
end
|
36
|
+
|
37
|
+
gem 'whenever', require: false
|
38
|
+
|
39
|
+
gem 'capistrano-db-tasks', require: false
|
40
|
+
|
41
|
+
gem 'sanitize'
|
42
|
+
|
43
|
+
gem 'mini_magick'
|
44
|
+
|
45
|
+
gem 'paper_trail'
|
46
|
+
|
47
|
+
gem 'postal-rails', '~> 1.0'
|
48
|
+
|
49
|
+
gem 'scoped_search'
|
50
|
+
|
51
|
+
gem 'omniauth'
|
52
|
+
gem 'omniauth-facebook'
|
53
|
+
gem 'omniauth-twitter'
|
54
|
+
gem 'omniauth-vkontakte'
|
55
|
+
|
56
|
+
gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
|
57
|
+
gem 'spreadsheet_architect'
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bin/rails server -p $PORT -e $RAILS_ENV
|
@@ -0,0 +1,44 @@
|
|
1
|
+
.sidebar#sidebar(data-turbolinks-permanent)
|
2
|
+
.optiscroll.sidebar__wrapper
|
3
|
+
.sidebar__header
|
4
|
+
a.sidebar__header-title href="#{admin_root_path}"
|
5
|
+
= t('layouts.application.title')
|
6
|
+
.sidebar__header-content
|
7
|
+
.nav
|
8
|
+
.nav__item
|
9
|
+
a.nav__link href="#{root_path}" data-turbolinks="false"
|
10
|
+
span.link.link--home
|
11
|
+
= t('labels.admin.go_to_root')
|
12
|
+
.user
|
13
|
+
.user__name
|
14
|
+
= current_user.email
|
15
|
+
.user__role Админ
|
16
|
+
= link_to destroy_user_session_path, class: 'user__logout', title: t('labels.admin.logout'), method: :delete do
|
17
|
+
|
18
|
+
.sidebar__nav
|
19
|
+
.nav
|
20
|
+
.nav__section
|
21
|
+
/ links
|
22
|
+
<% if @settings[:add_pages] %>= top_menu_item active: 'admin/pages#' do
|
23
|
+
= link_to t('admin.pages.actions.index.header'), admin_pages_path, class: 'nav__link'<% end %>
|
24
|
+
- if current_user.has_role? :admin
|
25
|
+
.nav__section
|
26
|
+
.nav__group
|
27
|
+
.nav__group-title.js-nav-group-toggle= t('labels.admin.other')
|
28
|
+
.nav__group-content.nav__group-content--other
|
29
|
+
/ links
|
30
|
+
<% if @settings[:add_users_to_admin_panel] %>= top_menu_item active: 'admin/users#' do
|
31
|
+
= link_to t('admin.users.actions.index.header'), admin_users_path, class: 'nav__link'<% end %>
|
32
|
+
<% if @settings[:add_versions_to_admin_panel] %>= top_menu_item active: 'admin/versions#' do
|
33
|
+
= link_to t('admin.paper_trail/versions.actions.index.header'), admin_versions_path, class: 'nav__link'<% end %>
|
34
|
+
.sidebar__footer
|
35
|
+
.nav
|
36
|
+
= top_menu_item active: 'admin/settings#' do
|
37
|
+
= link_to edit_admin_settings_path, class: 'nav__link' do
|
38
|
+
span.link.link--settings
|
39
|
+
= t('admin.settings.actions.index.header')
|
40
|
+
/= top_menu_item active: 'admin/helps#' do
|
41
|
+
= link_to admin_helps_path, class: 'nav__link' do
|
42
|
+
span.link.link--info
|
43
|
+
= t('labels.admin.info')
|
44
|
+
.sidebar__toggle.js-sidebar-toggle
|
@@ -0,0 +1,95 @@
|
|
1
|
+
class AuthenticationsController < Devise::OmniauthCallbacksController
|
2
|
+
def callback
|
3
|
+
if current_user
|
4
|
+
create_auth_for_current_user
|
5
|
+
elsif found_auth
|
6
|
+
sign_in_found_auth
|
7
|
+
elsif matching_user
|
8
|
+
create_auth_and_sign_in_matching_user
|
9
|
+
else
|
10
|
+
create_user_and_sign_in
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
alias twitter callback
|
15
|
+
alias facebook callback
|
16
|
+
alias vkontakte callback
|
17
|
+
alias google callback
|
18
|
+
|
19
|
+
def link
|
20
|
+
user = User.find_by_email params[:email].try(:downcase)
|
21
|
+
return head 401 unless user && user.valid_password?(params[:password])
|
22
|
+
|
23
|
+
if (auth = current_user.authentications.first)
|
24
|
+
flash[:notice] = t('social.bind_success', provider: auth.provider.capitalize)
|
25
|
+
end
|
26
|
+
|
27
|
+
cookies.delete :link_auth_modal
|
28
|
+
auth.update_attribute :user, user
|
29
|
+
current_user.destroy
|
30
|
+
|
31
|
+
sign_in :user, user
|
32
|
+
head :ok
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def omni
|
38
|
+
request.env['omniauth.auth'].except('extra')
|
39
|
+
end
|
40
|
+
|
41
|
+
def omni_key
|
42
|
+
@omni_key ||= { provider: omni.provider, uid: omni.uid.to_s }
|
43
|
+
end
|
44
|
+
|
45
|
+
def omni_key_with_nickname
|
46
|
+
omni_key.merge(nickname: omni.info.nickname)
|
47
|
+
end
|
48
|
+
|
49
|
+
def found_auth
|
50
|
+
@found_auth ||= Authentication.where(omni_key).first
|
51
|
+
end
|
52
|
+
|
53
|
+
def new_auth
|
54
|
+
@new_auth ||= Authentication.new params[:authentication] || omni_key
|
55
|
+
end
|
56
|
+
|
57
|
+
def matching_user
|
58
|
+
@matching_user ||= begin
|
59
|
+
if omni.info.email
|
60
|
+
User.find_by_email omni.info.email.downcase
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_auth_for_current_user
|
66
|
+
if found_auth
|
67
|
+
flash[:alert] = t('social.already_bound')
|
68
|
+
redirect_to :root
|
69
|
+
else
|
70
|
+
current_user.authentications.create! omni_key_with_nickname
|
71
|
+
flash[:notice] = t('social.bind_success', provider: found_auth.provider.capitalize)
|
72
|
+
redirect_to :root
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def sign_in_found_auth
|
77
|
+
flash[:notice] = t('social.login_success', provider: found_auth.provider.capitalize)
|
78
|
+
sign_in_and_redirect found_auth.user, event: :authentication
|
79
|
+
end
|
80
|
+
|
81
|
+
def create_auth_and_sign_in_matching_user
|
82
|
+
new_auth.update_attribute :user, matching_user
|
83
|
+
flash[:notice] = t('social.email_bind_success', provider: omni.provider.capitalize)
|
84
|
+
sign_in_and_redirect new_auth.user, event: :authentication
|
85
|
+
end
|
86
|
+
|
87
|
+
def create_user_and_sign_in
|
88
|
+
new_auth.build_user(email: omni.info.email)
|
89
|
+
new_auth.save! validate: false
|
90
|
+
|
91
|
+
cookies[:link_auth_modal] = true
|
92
|
+
flash[:notice] = t('social.signup_success', provider: new_auth.provider.capitalize)
|
93
|
+
sign_in_and_redirect new_auth.user, event: :authentication
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
= form_tag authentications_link_path, class: 'form-inline', id: 'link_auth' do
|
2
|
+
= email_field_tag :email, nil, placeholder: 'Email', class: 'input-medium'
|
3
|
+
= password_field_tag :password, nil, placeholder: 'Пароль', class: 'input-medium'
|
4
|
+
= submit_tag 'Привязать к аккаунту', class: 'btn'
|
5
|
+
.link_auth-message
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.modal.fade id="authenticationModal" tabindex="-1" role="dialog"
|
2
|
+
.modal-header
|
3
|
+
button.close(type="button" role="dialog" data-dismiss="modal") x
|
4
|
+
h3 Регистрация через социальные сети
|
5
|
+
.modal-body
|
6
|
+
p <strong>Если</strong> у вас уже есть активная учетная запись, вы можете привязать к ней профиль социальной сети, <strong>иначе</strong> просто закройте это окно.
|
7
|
+
= render 'authentications/form'
|
@@ -0,0 +1,116 @@
|
|
1
|
+
class Page < ApplicationRecord
|
2
|
+
include Adminos::NestedSet::MaterializePath
|
3
|
+
include Adminos::NestedSet::PlaceTo
|
4
|
+
include Adminos::NestedSet::SafeDestroy
|
5
|
+
include Adminos::NestedSet::Duplication
|
6
|
+
include Adminos::Slugged
|
7
|
+
include Adminos::FlagAttrs
|
8
|
+
|
9
|
+
has_rich_text :content
|
10
|
+
|
11
|
+
MAX_DEPTH = 3
|
12
|
+
BEHAVIORS = [
|
13
|
+
'pages'
|
14
|
+
]
|
15
|
+
|
16
|
+
# has_paper_trail
|
17
|
+
materialize_path
|
18
|
+
acts_as_nested_set
|
19
|
+
slugged :recognizable_name
|
20
|
+
flag_attrs :published, :nav_published
|
21
|
+
|
22
|
+
after_save :update_descendants_states
|
23
|
+
after_save :increment_routes
|
24
|
+
|
25
|
+
validates :behavior, presence: true
|
26
|
+
validates :name, presence: true
|
27
|
+
validate :depth_validator
|
28
|
+
|
29
|
+
scope :sorted, -> { order('lft ASC') }
|
30
|
+
scope :for_routes, -> { order('behavior ASC, lft DESC') }
|
31
|
+
scope :navigation, -> { where(published: true, nav_published: true).where.not(name: '') }
|
32
|
+
scope :navigation_top, -> { navigation.where(depth: 0).sorted }
|
33
|
+
scope :reverse_sorted, -> { order('lft DESC') }
|
34
|
+
scope :with_behavior, -> { proc { |b| where(behavior: b.to_s) } }
|
35
|
+
|
36
|
+
def reasonable_name
|
37
|
+
if self.respond_to?(:translations)
|
38
|
+
name.presence || translations.detect { |t| t.name.present? }.try(:name)
|
39
|
+
else
|
40
|
+
name
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def recognizable_name
|
45
|
+
slug.present? ? slug : reasonable_name
|
46
|
+
end
|
47
|
+
|
48
|
+
def breadcrumbs
|
49
|
+
ancestors.navigation
|
50
|
+
end
|
51
|
+
|
52
|
+
def absolute_path
|
53
|
+
"/#{path}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_descendants_states
|
57
|
+
if saved_change_to_published? && !published?
|
58
|
+
self.class.unscoped.where(parent_id: id).set_each_published_off #FIXME: Unscoped workaround. Descendants method always return empty collection
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
alias_method :destroy_orig, :destroy
|
63
|
+
def destroy
|
64
|
+
safe_destroy(children_to: :parent, without_destroy: true)
|
65
|
+
destroy_orig
|
66
|
+
end
|
67
|
+
|
68
|
+
def default_behavior?
|
69
|
+
behavior == self.class.default_behavior
|
70
|
+
end
|
71
|
+
|
72
|
+
def editable_behavior?
|
73
|
+
[self.class.default_behavior].include? behavior
|
74
|
+
end
|
75
|
+
|
76
|
+
def human_behavior_name
|
77
|
+
I18n.t "#{self.class.table_name}.behaviors.#{behavior}"
|
78
|
+
end
|
79
|
+
|
80
|
+
def default_route(*actions)
|
81
|
+
[behavior, { path: absolute_path, only: actions, page_id: id }]
|
82
|
+
end
|
83
|
+
|
84
|
+
class << self
|
85
|
+
def sitemap
|
86
|
+
navigation.where('behavior != ? OR behavior IS NULL', 'sitemaps').arrange
|
87
|
+
end
|
88
|
+
|
89
|
+
def default_behavior
|
90
|
+
'pages'
|
91
|
+
end
|
92
|
+
|
93
|
+
def human_behavior_name(behavior)
|
94
|
+
I18n.t "pages.behaviors.#{behavior}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def increment_routes
|
101
|
+
Rails.cache.write(:routes_version, (Rails.cache.read(:routes_version) || 0) + 1)
|
102
|
+
end
|
103
|
+
|
104
|
+
def depth_validator
|
105
|
+
return true unless self.saved_change_to_parent_id?
|
106
|
+
# Итоговый уровень вложенности считается так:
|
107
|
+
# Уровeнь вложенносить родителя + максимальный уровень вложености
|
108
|
+
# детей относительно самого объекта + 1
|
109
|
+
parent = self.parent.try(:depth) || 0
|
110
|
+
child = self.descendants.map(&:depth).max
|
111
|
+
child = child ? child - self.depth : 0
|
112
|
+
if (parent + child + 1) > (MAX_DEPTH - 1)
|
113
|
+
self.errors.add(:parent, :too_much_nesting, count: MAX_DEPTH)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreatePages < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :pages do |t|
|
4
|
+
t.string :behavior, default: 'pages', null: false
|
5
|
+
t.integer :parent_id
|
6
|
+
t.integer :lft
|
7
|
+
t.integer :rgt
|
8
|
+
t.integer :depth, default: 0, null: false
|
9
|
+
t.string :slug
|
10
|
+
t.string :path
|
11
|
+
t.boolean :nav_published, default: false, null: false
|
12
|
+
t.boolean :published, default: false, null: false
|
13
|
+
t.string :name
|
14
|
+
t.string :nav_name
|
15
|
+
t.text :body
|
16
|
+
t.text :meta_description
|
17
|
+
t.string :meta_title
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
|
22
|
+
add_index :pages, :rgt
|
23
|
+
add_index :pages, :parent_id
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
doctype html
|
2
|
+
html#no-js lang="ru"
|
3
|
+
head
|
4
|
+
meta charset="utf-8"
|
5
|
+
|
6
|
+
title= show_title || '<%= application_name.camelize %>'
|
7
|
+
|
8
|
+
meta name="viewport" content="width=1000, initial-scale=1"
|
9
|
+
|
10
|
+
= favicon_link_tag
|
11
|
+
= favicon_link_tag 'apple-touch-icon.png', rel: 'apple-touch-icon', sizes: '180x180'
|
12
|
+
= favicon_link_tag 'favicon-32x32.png', rel: 'icon', sizes: '32x32'
|
13
|
+
= favicon_link_tag 'favicon-16x16.png', rel: 'icon', sizes: '16x16'
|
14
|
+
= favicon_link_tag 'safari-pinned-tab.svg', rel: 'mask-icon', color: '#000000'
|
15
|
+
|
16
|
+
meta[name='apple-mobile-web-app-title' content='Adminos']
|
17
|
+
meta[name='application-name' content='Adminos']
|
18
|
+
meta[name='msapplication-TileColor' content='#000000']
|
19
|
+
meta[name='theme-color' content='#ffffff']
|
20
|
+
|
21
|
+
= stylesheet_pack_tag 'admin'
|
22
|
+
|
23
|
+
= yield :styles
|
24
|
+
|
25
|
+
javascript:
|
26
|
+
document.getElementById('no-js').id = 'js';
|
27
|
+
|
28
|
+
= csrf_meta_tag
|
29
|
+
|
30
|
+
= javascript_pack_tag 'vendor', rel: "prefetch"
|
31
|
+
= javascript_pack_tag 'admin'
|
32
|
+
|
33
|
+
= yield :javascript
|
34
|
+
|
35
|
+
body.page class="#{@body_class}"
|
36
|
+
= content_for?(:admin_layout) ? yield(:admin_layout) : yield
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Admin::PagesController < Admin::BaseController
|
2
|
+
authorize_resource param_method: :strong_params
|
3
|
+
|
4
|
+
resource(Page,
|
5
|
+
location: proc { params[:stay_in_place] ?
|
6
|
+
edit_polymorphic_path([:admin, resource]) :
|
7
|
+
polymorphic_path([:admin, resource.class]) },
|
8
|
+
collection_scope: [:sorted])
|
9
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.f__fieldset
|
2
|
+
.hidden
|
3
|
+
= f.input :behavior, as: :select, wrapper: :select,
|
4
|
+
collection: resource.class::BEHAVIORS.map { |b| [resource.class.human_behavior_name(b), b]},
|
5
|
+
include_blank: false
|
6
|
+
= f.input :name
|
7
|
+
= f.input :nav_name
|
8
|
+
= f.input :slug
|
9
|
+
= f.input :published, wrapper: :check
|
10
|
+
= f.input :nav_published, wrapper: :check
|
11
|
+
|
12
|
+
- if !resource.new_record? && !resource.editable_behavior?
|
13
|
+
.alert.alert-info
|
14
|
+
= render partial: 'shared/helpers/alert_close'
|
15
|
+
.text= I18n.t 'admin.pages.alerts.behavior_not_default', behavior: resource.human_behavior_name
|
16
|
+
- elsif resource.children.present? && resource.children.published.present?
|
17
|
+
.alert.alert-info
|
18
|
+
= render partial: 'shared/helpers/alert_close'
|
19
|
+
.text= I18n.t 'admin.pages.alerts.category'
|
20
|
+
- else
|
21
|
+
= f.rich_text_area :content
|
22
|
+
|
23
|
+
.f__fieldset
|
24
|
+
.f__legend= t 'labels.admin.legend.seo'
|
25
|
+
= f.input :meta_title
|
26
|
+
= f.input :meta_description, as: :string
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/.nested-set-item
|
2
|
+
.list-item rel=object.id id="#{object.class.name.underscore}_#{object.id}" class=(optional_cls('list-item--unpublished' => !object.published?))
|
3
|
+
.list-item__move
|
4
|
+
.icon.icon--move class="-move"
|
5
|
+
.list-item__name
|
6
|
+
= link_to object.name, polymorphic_path([:admin, object], action: :edit)
|
7
|
+
.list-item__url
|
8
|
+
= object.absolute_path
|
9
|
+
|
10
|
+
.list-item__controls
|
11
|
+
.list-item__group
|
12
|
+
- if object.nav_published?
|
13
|
+
= admin_nav_published_sign(class: '-nav')
|
14
|
+
- if object.published?
|
15
|
+
= admin_published_sign(class: '-state')
|
16
|
+
- else
|
17
|
+
= admin_unpublished_sign(class: '-state')
|
18
|
+
.list-item__group
|
19
|
+
= object_link_duplication(object)
|
20
|
+
.list-item__group
|
21
|
+
= object_link_edit(object)
|
22
|
+
.list-item__group
|
23
|
+
= object_link_new(object)
|
24
|
+
.list-item__check
|
25
|
+
= admin_cb(object)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- if objects.present?
|
2
|
+
ul.list__list max-levels="#{objects.first.first.class.const_get('MAX_DEPTH')}"
|
3
|
+
- objects.each do |object, children|
|
4
|
+
li.list__item href=polymorphic_path([:admin, object], action: :drop) rel=object.id
|
5
|
+
= render partial: 'object', object: object
|
6
|
+
= render partial: 'objects', object: children
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Admin::UsersController < Admin::BaseController
|
2
|
+
authorize_resource param_method: :strong_params
|
3
|
+
|
4
|
+
before_action :remove_password_if_blank, only: [:update]
|
5
|
+
|
6
|
+
resource User,
|
7
|
+
location: proc { params[:stay_in_place] ?
|
8
|
+
edit_polymorphic_path([:admin, resource]) :
|
9
|
+
polymorphic_path([:admin, resource.class]) }
|
10
|
+
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def remove_password_if_blank
|
15
|
+
return unless strong_params[:password].blank?
|
16
|
+
params.require(:user).delete(:password)
|
17
|
+
end
|
18
|
+
|
19
|
+
def strong_params
|
20
|
+
params.require(:user).permit(:email, :password, roles: [])
|
21
|
+
end
|
22
|
+
|
23
|
+
alias_method :collection_orig, :collection
|
24
|
+
def collection
|
25
|
+
@collection ||= collection_orig.search_for(params[:query])
|
26
|
+
.page(params[:page]).per(settings.per_page)
|
27
|
+
.order("#{params[:order_by]} #{params[:direction]}")
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
- collection_title
|
2
|
+
= collection_header
|
3
|
+
|
4
|
+
= render 'shared/admin/search_form'
|
5
|
+
|
6
|
+
- if collection.present?
|
7
|
+
- pagination = capture do
|
8
|
+
= paginate collection, theme: :admin
|
9
|
+
|
10
|
+
- list = capture do
|
11
|
+
= pagination
|
12
|
+
.table-list
|
13
|
+
table.table.table-hover.table-sm
|
14
|
+
thead
|
15
|
+
tr
|
16
|
+
th= admin_sortable_column :email, resource_class.human_attribute_name(:email)
|
17
|
+
th= resource_class.human_attribute_name(:roles)
|
18
|
+
th
|
19
|
+
th
|
20
|
+
tbody
|
21
|
+
- collection.each do |object|
|
22
|
+
tr
|
23
|
+
td= link_to object.email, polymorphic_path([:admin, object], action: :edit)
|
24
|
+
td= object.translated_roles
|
25
|
+
td.table-list__controls= object_link_edit(object)
|
26
|
+
td.table-list__check= admin_cb(object)
|
27
|
+
= pagination
|
28
|
+
|
29
|
+
- if controller.respond_to?(:batch_action)
|
30
|
+
= batch_actions_tag do
|
31
|
+
= list
|
32
|
+
- else
|
33
|
+
= list
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class Admin::VersionsController < Admin::BaseController
|
2
|
+
load_and_authorize_resource param_method: :strong_params, class: 'PaperTrail::Version'
|
3
|
+
|
4
|
+
respond_to :xlsx
|
5
|
+
|
6
|
+
resource PaperTrail::Version,
|
7
|
+
location: proc { params[:stay_in_place] ?
|
8
|
+
edit_polymorphic_path([:admin, resource]) :
|
9
|
+
polymorphic_path([:admin, resource.class]) }
|
10
|
+
|
11
|
+
def index
|
12
|
+
@versions = PaperTrail::Version.all
|
13
|
+
|
14
|
+
respond_with do |respond|
|
15
|
+
respond.xlsx do
|
16
|
+
xlsx_file = ExportXlsx.new.call
|
17
|
+
send_data xlsx_file
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
alias_method :collection_orig, :collection
|
25
|
+
def collection
|
26
|
+
@collection ||= collection_orig.order('created_at desc')
|
27
|
+
.page(params[:page]).per(settings.per_page)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
- collection_title
|
2
|
+
= collection_header button_new: false
|
3
|
+
|
4
|
+
- if collection.present?
|
5
|
+
- pagination = capture do
|
6
|
+
- if collection.respond_to?(:current_page)
|
7
|
+
= paginate collection, theme: :admin
|
8
|
+
|
9
|
+
- list = capture do
|
10
|
+
= pagination
|
11
|
+
.table-list
|
12
|
+
table.table.table-hover.table-sm
|
13
|
+
thead
|
14
|
+
tr
|
15
|
+
th= resource_class.human_attribute_name(:item)
|
16
|
+
th= resource_class.human_attribute_name(:item_type)
|
17
|
+
th= resource_class.human_attribute_name(:event)
|
18
|
+
th= resource_class.human_attribute_name(:whodunnit)
|
19
|
+
th= resource_class.human_attribute_name(:created_at)
|
20
|
+
th
|
21
|
+
th
|
22
|
+
tbody
|
23
|
+
- collection.each do |object|
|
24
|
+
tr
|
25
|
+
td= version_item object if object.item
|
26
|
+
td= object.item_type.constantize.model_name.human if object.item_type
|
27
|
+
td= version_event object
|
28
|
+
td= object.whodunnit unless version_login?(object)
|
29
|
+
td= l object.created_at, format: :admin
|
30
|
+
td.table-list__controls
|
31
|
+
= link_to t('labels.admin.show'), admin_version_path(object), class: 'icon icon--diff -edit', title: t('labels.admin.show')
|
32
|
+
td.table-list__check
|
33
|
+
= admin_cb(object)
|
34
|
+
= pagination
|
35
|
+
|
36
|
+
- if controller.respond_to?(:batch_action)
|
37
|
+
= batch_actions_tag publication: (collection.respond_to?(:set_each_published_on)),
|
38
|
+
nav_publication: (collection.respond_to?(:set_nav_published_on)) do
|
39
|
+
= list
|
40
|
+
- else
|
41
|
+
= list
|
42
|
+
|
43
|
+
p
|
44
|
+
= link_to 'Сохранить таблицу',
|
45
|
+
admin_versions_path(format: :xlsx),
|
46
|
+
target: '_blank',
|
47
|
+
class: 'btn btn-primary btn-small'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
- resource_title
|
2
|
+
- breadcrumbs resource_name
|
3
|
+
|
4
|
+
= resource_header
|
5
|
+
|
6
|
+
.table-list
|
7
|
+
table.table.table-hover.table-sm
|
8
|
+
thead
|
9
|
+
tr
|
10
|
+
th Поле
|
11
|
+
th Старое значение
|
12
|
+
th Новое значение
|
13
|
+
tbody
|
14
|
+
- resource.changeset.each do |field, change|
|
15
|
+
tr
|
16
|
+
td= field
|
17
|
+
td= change[0]
|
18
|
+
td= change[1]
|