adminos 1.0.0.pre.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,31 @@
|
|
|
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
|
+
meta name="description" content=settings&.index_meta_description
|
|
8
|
+
|
|
9
|
+
meta name="viewport" content="width=device-width, initial-scale=1"
|
|
10
|
+
<% if ENV['CMSMG'] %>
|
|
11
|
+
meta name="cmsmagazine" content="<%= ENV['CMSMG'] %>"
|
|
12
|
+
<% end %>
|
|
13
|
+
# link rel="icon" type="image/png" sizes="16x16" href="/favicon.png"
|
|
14
|
+
# link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"
|
|
15
|
+
|
|
16
|
+
= stylesheet_link_tag :application, media: 'all'
|
|
17
|
+
|
|
18
|
+
javascript:
|
|
19
|
+
document.getElementById('no-js').id = 'js';
|
|
20
|
+
|
|
21
|
+
= csrf_meta_tags
|
|
22
|
+
|
|
23
|
+
body
|
|
24
|
+
= yield
|
|
25
|
+
<% if @settings[:add_pages] %>
|
|
26
|
+
// Вывод меню Page
|
|
27
|
+
/ = nested_li @pages do |page|
|
|
28
|
+
= link_to page.name, page.absolute_path
|
|
29
|
+
<% end %>
|
|
30
|
+
= javascript_include_tag :application
|
|
31
|
+
= yield :javascript
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Load DSL and set up stages
|
|
2
|
+
require 'capistrano/setup'
|
|
3
|
+
|
|
4
|
+
# Include default deployment tasks
|
|
5
|
+
require 'capistrano/deploy'
|
|
6
|
+
require 'capistrano/rvm'
|
|
7
|
+
require 'capistrano/bundler'
|
|
8
|
+
require 'capistrano/rails'
|
|
9
|
+
require 'capistrano3/unicorn'
|
|
10
|
+
require 'capistrano-db-tasks'
|
|
11
|
+
|
|
12
|
+
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
|
|
13
|
+
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
|
|
14
|
+
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# More info at https://github.com/guard/guard#readme
|
|
2
|
+
|
|
3
|
+
## Uncomment and set this to only include directories you want to watch
|
|
4
|
+
# directories %w(app lib config test spec features)
|
|
5
|
+
|
|
6
|
+
## Uncomment to clear the screen before every task
|
|
7
|
+
clearing :on
|
|
8
|
+
|
|
9
|
+
guard 'livereload' do
|
|
10
|
+
watch(%r{app/views/.+\.(erb|haml|slim)$})
|
|
11
|
+
watch(%r{app/helpers/.+\.rb})
|
|
12
|
+
watch(%r{public/.+\.(css|js|html)})
|
|
13
|
+
watch(%r{config/locales/.+\.yml})
|
|
14
|
+
# Rails Assets Pipeline
|
|
15
|
+
watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
|
|
16
|
+
watch(%r{(app|vendor)(/assets/\w+/(.+)\.(scss))}) { |m| "/assets/#{m[3]}.css" }
|
|
17
|
+
watch(%r{(app|vendor)(/assets/\w+/(.+)\.(coffee))}) { |m| "/assets/#{m[3]}.js" }
|
|
18
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
web: bin/rails server -p $PORT -e $RAILS_ENV
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Отображение полей в завиисимости от выбранной опции в селекте при использование Cocoon
|
|
2
|
+
$(function() {
|
|
3
|
+
function toggleFields() {
|
|
4
|
+
$('.toggle-fields').each(function() {
|
|
5
|
+
var selected = $(this).val(),
|
|
6
|
+
root = $(this).closest('.toggle-fields-container').first();
|
|
7
|
+
|
|
8
|
+
if (selected) {
|
|
9
|
+
root.find('.options__item').hide();
|
|
10
|
+
root.find('.options__item').each(function() {
|
|
11
|
+
var types = $(this).data('type').split(' ');
|
|
12
|
+
if ($.inArray(selected, types) != -1) {
|
|
13
|
+
$(this).show();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function initToggleFields() {
|
|
21
|
+
$(document).on('change', '.toggle-fields', function(e) {
|
|
22
|
+
toggleFields();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
$(document).on('cocoon:after-insert', function() {
|
|
26
|
+
toggleFields();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
$(window).on('turbolinks:load', function() {
|
|
31
|
+
toggleFields();
|
|
32
|
+
initToggleFields();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
$(document).on('click', '.nav-tabs .nav-link, .nav-pills .nav-link', function(e) {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
$(this).closest('.pills_container').find(".nav-link.active").removeClass("active");
|
|
39
|
+
$(this).addClass("active");
|
|
40
|
+
$(this).closest('.pills_container').find(".tab-pane.active").removeClass("in active");
|
|
41
|
+
var target = $(e.target).attr("href");
|
|
42
|
+
$(this).closest('.pills_container').find(target).addClass("in active");
|
|
43
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class Admin::BaseController < ApplicationController
|
|
2
|
+
include Adminos::Controllers::AdminExtension
|
|
3
|
+
|
|
4
|
+
before_action :authenticate_user!
|
|
5
|
+
check_authorization
|
|
6
|
+
|
|
7
|
+
layout 'admin/base'
|
|
8
|
+
|
|
9
|
+
before_action :define_breadcrumb_struct
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def define_breadcrumb_struct
|
|
14
|
+
Struct.new('Breadcrumb', :label, :url) unless defined?(Struct::Breadcrumb)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class Admin::SettingsController < Admin::BaseController
|
|
2
|
+
load_and_authorize_resource param_method: :strong_params, class: 'Settings'
|
|
3
|
+
|
|
4
|
+
def update
|
|
5
|
+
if resource.update_attributes strong_params
|
|
6
|
+
flash[:notice] = t 'flash.actions.update.notice'
|
|
7
|
+
redirect_to action: :edit
|
|
8
|
+
else
|
|
9
|
+
flash[:error] = t 'flash.actions.update.alert'
|
|
10
|
+
render action: :edit
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def resource
|
|
17
|
+
@resource ||= Settings.get
|
|
18
|
+
end
|
|
19
|
+
helper_method :resource
|
|
20
|
+
|
|
21
|
+
def strong_params
|
|
22
|
+
params.require(:settings).permit :email, :email_header_from, :per_page,
|
|
23
|
+
:copyright, :index_meta_title, :index_meta_description, :company_name,
|
|
24
|
+
:contact_email, :seo_google_analytics, :seo_yandex_metrika
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
class ApplicationController < ActionController::Base
|
|
2
|
+
protect_from_forgery
|
|
3
|
+
|
|
4
|
+
respond_to :html
|
|
5
|
+
|
|
6
|
+
before_action :reload_routes, :set_paper_trail_whodunnit, :set_pages
|
|
7
|
+
|
|
8
|
+
@@routes_version = 0
|
|
9
|
+
@@lock = Mutex.new
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
def user_for_paper_trail
|
|
14
|
+
current_user&.email || 'Public user'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Not foget enable cache in development
|
|
18
|
+
def self.update_routes
|
|
19
|
+
@@lock.synchronize do
|
|
20
|
+
version = Rails.cache.fetch(:routes_version) { @@routes_version }
|
|
21
|
+
return if @@routes_version == version
|
|
22
|
+
|
|
23
|
+
Rails.logger.warn "NEW ROUTES VERSION: #{version}"
|
|
24
|
+
Rails.application.reload_routes!
|
|
25
|
+
@@routes_version = version
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def reload_routes
|
|
30
|
+
ApplicationController.update_routes
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
rescue_from CanCan::AccessDenied do |exception|
|
|
34
|
+
path = current_user ? root_path : new_user_session_path
|
|
35
|
+
session[:previous_url] = request.fullpath
|
|
36
|
+
redirect_to path, alert: exception.message
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def after_sign_in_path_for(resource)
|
|
40
|
+
session[:previous_url] || super
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def paper_trail_enabled_for_controller
|
|
44
|
+
ApplicationController.descendants.include? Admin::BaseController
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def set_pages
|
|
48
|
+
@pages ||= Page.navigation.sorted
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
module NestedHelper
|
|
2
|
+
def nested_li(objects, &block)
|
|
3
|
+
objects = objects.order(:lft) if objects.is_a? Class
|
|
4
|
+
|
|
5
|
+
return '' if objects.size == 0
|
|
6
|
+
|
|
7
|
+
output = "<ul><li #{'class=active' if is_active_page?(objects.first)}>"
|
|
8
|
+
path = [nil]
|
|
9
|
+
|
|
10
|
+
objects.each_with_index do |o, i|
|
|
11
|
+
if o.parent_id != path.last
|
|
12
|
+
# We are on a new level, did we descend or ascend?
|
|
13
|
+
if path.include?(o.parent_id)
|
|
14
|
+
# Remove the wrong trailing path elements
|
|
15
|
+
while path.last != o.parent_id
|
|
16
|
+
path.pop
|
|
17
|
+
output << '</li></ul>'
|
|
18
|
+
end
|
|
19
|
+
output << "</li><li #{'class=active' if is_active_page?(o)}>"
|
|
20
|
+
else
|
|
21
|
+
path << o.parent_id
|
|
22
|
+
output << "<ul><li #{'class=active' if is_active_page?(o)}>"
|
|
23
|
+
end
|
|
24
|
+
elsif i != 0
|
|
25
|
+
output << "</li><li #{'class=active' if is_active_page?(o)}>"
|
|
26
|
+
end
|
|
27
|
+
output << capture(o, path.size - 1, &block)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
output << '</li></ul>' * path.length
|
|
31
|
+
output.html_safe
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def sorted_nested_li(objects, order, &block)
|
|
35
|
+
nested_li sort_list(objects, order), &block
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def is_active_page?(page)
|
|
41
|
+
return unless current_page
|
|
42
|
+
current_page.is_or_is_descendant_of?(page)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def sort_list(objects, order)
|
|
46
|
+
objects = objects.order(:lft) if objects.is_a? Class
|
|
47
|
+
|
|
48
|
+
# Partition the results
|
|
49
|
+
children_of = {}
|
|
50
|
+
objects.each do |o|
|
|
51
|
+
children_of[ o.parent_id ] ||= []
|
|
52
|
+
children_of[ o.parent_id ] << o
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Sort each sub-list individually
|
|
56
|
+
children_of.each_value do |children|
|
|
57
|
+
children.sort_by! &order
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Re-join them into a single list
|
|
61
|
+
results = []
|
|
62
|
+
recombine_lists(results, children_of, nil)
|
|
63
|
+
|
|
64
|
+
results
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def recombine_lists(results, children_of, parent_id)
|
|
68
|
+
if children_of[parent_id]
|
|
69
|
+
children_of[parent_id].each do |o|
|
|
70
|
+
results << o
|
|
71
|
+
recombine_lists(results, children_of, o.id)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module VersionsHelper
|
|
2
|
+
def version_item(object)
|
|
3
|
+
case object.item_type
|
|
4
|
+
when 'Settings'
|
|
5
|
+
name = 'Настройки'
|
|
6
|
+
link = :settings
|
|
7
|
+
when 'User'
|
|
8
|
+
name = object.item.email
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
link_to name || object.item.name,
|
|
12
|
+
polymorphic_path([:admin, link || object.item], action: :edit) rescue ''
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def version_event(object)
|
|
16
|
+
if version_login? object
|
|
17
|
+
'Логин'
|
|
18
|
+
elsif version_registration? object
|
|
19
|
+
'Регистрация'
|
|
20
|
+
else
|
|
21
|
+
t "admin.actions.#{object.event}"
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def version_login?(object)
|
|
26
|
+
object.item_type == ('User') && object.changeset.include?('sign_in_count')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def version_registration?(object)
|
|
30
|
+
object.item_type == ('User') && object.changeset.include?('id') &&
|
|
31
|
+
object.whodunnit.blank?
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
class CarrierwaveInput < SimpleForm::Inputs::Base
|
|
2
|
+
def input(wrapper_options = nil)
|
|
3
|
+
version = input_html_options.delete(:preview_version) || :preview
|
|
4
|
+
is_image = input_html_options.delete(:image) || false
|
|
5
|
+
|
|
6
|
+
out = []
|
|
7
|
+
out << %{<div class="f-file">}
|
|
8
|
+
out << @builder.hidden_field("#{attribute_name}_cache")
|
|
9
|
+
out << %{ <label class="f-file__selection js-file">}
|
|
10
|
+
out << %{ <span class="f-file__button">Выбрать</span>}
|
|
11
|
+
out << @builder.file_field(attribute_name, input_html_options)
|
|
12
|
+
out << %{ <span class="f-file__selected"></span>}
|
|
13
|
+
out << %{ </label>}
|
|
14
|
+
out << preview(is_image, version) if object.send("#{attribute_name}?")
|
|
15
|
+
out << remove_field if object.send("#{attribute_name}?")
|
|
16
|
+
out << %{</div>}
|
|
17
|
+
out.join.html_safe
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def remove_field
|
|
23
|
+
out = []
|
|
24
|
+
out << %{<div class="f-file__remove">}
|
|
25
|
+
out << @builder.input_field("remove_#{attribute_name}", as: :boolean)
|
|
26
|
+
out << %{ <label class="f-check">}
|
|
27
|
+
out << %{ <span class="f-check__box"></span>}
|
|
28
|
+
out << %{ <span class="f-check__label">Удалить</span>}
|
|
29
|
+
out << %{ </label>}
|
|
30
|
+
out << %{</div>}
|
|
31
|
+
out.join
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def preview(is_image, version)
|
|
35
|
+
out = []
|
|
36
|
+
out << %{<div class="f-file__preview">}
|
|
37
|
+
out << %( <a target="_blank" href="#{object.send(attribute_name).url}">)
|
|
38
|
+
if is_image
|
|
39
|
+
return nil if object.send(attribute_name).nil?
|
|
40
|
+
out << template.image_tag(object.send(attribute_name).tap { |o| break o.send(version) if version }.send('url'))
|
|
41
|
+
else
|
|
42
|
+
out << template.link_to(basename, object.send(attribute_name).url, target: '_blank')
|
|
43
|
+
end
|
|
44
|
+
out << %( </a>)
|
|
45
|
+
out << %{</div>}
|
|
46
|
+
out.join
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def basename
|
|
50
|
+
File.basename(object.send(attribute_name).file.path)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class CheckboxInput < SimpleForm::Inputs::BooleanInput
|
|
2
|
+
def input(wrapper_options = nil)
|
|
3
|
+
out = []
|
|
4
|
+
out << %{<div>}
|
|
5
|
+
out << %{ <label class="f-check" for="#{object_name}_#{attribute_name}">}
|
|
6
|
+
out << @builder.input_field("#{attribute_name}", as: :boolean)
|
|
7
|
+
out << %{ <span class="f-check__box"></span>}
|
|
8
|
+
out << %{ <span class="f-check__label">Опубликовано</span>}
|
|
9
|
+
out << %{ </label>}
|
|
10
|
+
out << %{</div>}
|
|
11
|
+
out.join.html_safe
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class RichTextInput < SimpleForm::Inputs::Base
|
|
4
|
+
def input(wrapper_options = nil)
|
|
5
|
+
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
|
6
|
+
|
|
7
|
+
@builder.rich_text_area(attribute_name, merged_input_options)
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
class Settings < ApplicationRecord
|
|
2
|
+
before_validation :sanitize
|
|
3
|
+
|
|
4
|
+
validates :company_name, :email, :email_header_from, :per_page, presence: true
|
|
5
|
+
validate :check_email_header_from
|
|
6
|
+
|
|
7
|
+
def self.get
|
|
8
|
+
first || new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def sanitize
|
|
14
|
+
fields = [ :copyright, :email, :index_meta_description, :index_meta_title ]
|
|
15
|
+
|
|
16
|
+
fields.each do |attribute|
|
|
17
|
+
self[attribute] = Sanitize.clean self[attribute], elements: ['br']
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def check_email_header_from
|
|
22
|
+
host = ActionMailer::Base.default_url_options[:host].split(':')[0]
|
|
23
|
+
unless self.email_header_from.include?(host)
|
|
24
|
+
errors.add(:email_header_from, :wrong_host, host: host)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
class ExportXlsx
|
|
2
|
+
include SpreadsheetArchitect
|
|
3
|
+
|
|
4
|
+
def initialize
|
|
5
|
+
@versions = PaperTrail::Version.all
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def call
|
|
9
|
+
generate_xlsx
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def generate_xlsx
|
|
15
|
+
headers = [
|
|
16
|
+
'Объект',
|
|
17
|
+
'Тип',
|
|
18
|
+
'Событие',
|
|
19
|
+
'Пользователь',
|
|
20
|
+
'Дата',
|
|
21
|
+
'Изменения'
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
data = @versions.map do |x|
|
|
25
|
+
next if x.item_type.safe_constantize.blank? || x.item.blank?
|
|
26
|
+
[
|
|
27
|
+
x.item.name,
|
|
28
|
+
x.item_type,
|
|
29
|
+
x.event,
|
|
30
|
+
x.whodunnit,
|
|
31
|
+
x.created_at.strftime('%Y-%m-%d'),
|
|
32
|
+
YAML.load(x.object_changes)
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
data = data.compact
|
|
36
|
+
|
|
37
|
+
header_style = {
|
|
38
|
+
background_color: '000000',
|
|
39
|
+
color: 'FFFFFF',
|
|
40
|
+
font_name: 'Arial',
|
|
41
|
+
font_size: 12,
|
|
42
|
+
align: {
|
|
43
|
+
horizontal: :center,
|
|
44
|
+
vertical: :center,
|
|
45
|
+
wrap_text: true
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
borders = [
|
|
50
|
+
{
|
|
51
|
+
range: { rows: :all, columns: :all },
|
|
52
|
+
border_styles: {
|
|
53
|
+
edges: [:top, :bottom, :left, :right],
|
|
54
|
+
style: :medium,
|
|
55
|
+
color: '000000'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
column_styles = [
|
|
61
|
+
{
|
|
62
|
+
columns: (1..4),
|
|
63
|
+
styles:
|
|
64
|
+
{ align: { horizontal: :center, vertical: :center, wrap_text: true } }
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
SpreadsheetArchitect.to_xlsx(
|
|
69
|
+
headers: headers,
|
|
70
|
+
data: data,
|
|
71
|
+
header_style: header_style,
|
|
72
|
+
borders: borders,
|
|
73
|
+
column_styles: column_styles
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<% transformations = { resize: local_assigns[:in_gallery] ? "800x600>" : "1024x768>" } %>
|
|
2
|
+
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
|
|
3
|
+
<% if blob.variable? %>
|
|
4
|
+
<%= image_tag blob.variant(transformations) %>
|
|
5
|
+
<% elsif blob.previewable? %>
|
|
6
|
+
<%= image_tag blob.preview(transformations) %>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<figcaption class="attachment__caption">
|
|
10
|
+
<% if caption = blob.try(:caption) %>
|
|
11
|
+
<%= caption %>
|
|
12
|
+
<% else %>
|
|
13
|
+
<span class="attachment__name"><%= blob.filename %></span>
|
|
14
|
+
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
|
15
|
+
<% end %>
|
|
16
|
+
</figcaption>
|
|
17
|
+
</figure>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
- resource_title
|
|
2
|
+
- if resource.try(:parent).present?
|
|
3
|
+
- breadcrumbs label: resource.parent.name,
|
|
4
|
+
url: polymorphic_path([:edit, :admin, resource.parent])
|
|
5
|
+
- breadcrumbs resource_name
|
|
6
|
+
- breadcrumbs label: collection_name, url: admin_index_path(resource.class)
|
|
7
|
+
|
|
8
|
+
= resource_header
|
|
9
|
+
|
|
10
|
+
= simple_form_for resource_form_object, wrapper: :admin do |f|
|
|
11
|
+
.f
|
|
12
|
+
.f__wrapper
|
|
13
|
+
/ Родительский элемент
|
|
14
|
+
/ Это лажа, но пока пусть будет так...
|
|
15
|
+
- max_depth = f.object.class.const_get('MAX_DEPTH') rescue 0
|
|
16
|
+
- if f.object.respond_to?(:parent) && max_depth > 1
|
|
17
|
+
- f.object.parent_id = params[:parent_id] if action_name == 'new'
|
|
18
|
+
= f.association :parent, wrapper: :select, input_html: { class: 'select2it' }
|
|
19
|
+
|
|
20
|
+
= render 'fields', f: f
|
|
21
|
+
|
|
22
|
+
.f-submit.f-submit--fixed
|
|
23
|
+
.wrapper
|
|
24
|
+
= f.button :submit, 'Сохранить', class: 'btn btn-primary btn--done'
|
|
25
|
+
/resource_button_value_main
|
|
26
|
+
/= f.button :submit, 'Применить', type: 'button', name: 'stay_in_place', class: 'btn btn-secondary js-save-form'
|
|
27
|
+
= f.button :submit, 'Применить', name: 'stay_in_place', class: 'btn btn-secondary'
|
|
28
|
+
/resource_button_value_stay
|
|
29
|
+
/= link_to resource_button_value_cancel,
|
|
30
|
+
polymorphic_path([:admin, resource.class.name.underscore.pluralize]),
|
|
31
|
+
class: 'btn btn-secondary'
|
|
32
|
+
|
|
33
|
+
= render "shared/admin/back_button"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
- parent_object = begin parent_resource rescue nil end
|
|
2
|
+
- object_array = parent_object ? [:admin, parent_object, object] : [:admin, object]
|
|
3
|
+
- is_publishable = object.respond_to?(:published)
|
|
4
|
+
- is_published = is_publishable && object.published?
|
|
5
|
+
|
|
6
|
+
- if controller.respond_to?(:sort)
|
|
7
|
+
- if object.respond_to?(:move_to)
|
|
8
|
+
- sort = {data: {id: object.id, href: polymorphic_path(object_array, action: :sort)}}
|
|
9
|
+
- if object.class.respond_to?(:apply_sortable_order)
|
|
10
|
+
- sort = {rel: object.id, data: {id: object.id, placeholder: object.reasonable_name}}
|
|
11
|
+
|
|
12
|
+
- attrs = sort || {}
|
|
13
|
+
|
|
14
|
+
tr id="#{object.class.name.underscore}_#{object.id}" class=optional_cls(unpublished: is_publishable && !is_published) *attrs
|
|
15
|
+
- if controller.respond_to?(:sort)
|
|
16
|
+
td.table-list__move
|
|
17
|
+
.icon.icon--move class="-move"
|
|
18
|
+
td= link_to object.reasonable_name, polymorphic_path(object_array, action: :edit)
|
|
19
|
+
td.table-list__controls
|
|
20
|
+
- if is_publishable
|
|
21
|
+
- if is_published
|
|
22
|
+
= admin_published_sign(class: '-state')
|
|
23
|
+
- else
|
|
24
|
+
= admin_unpublished_sign(class: '-state')
|
|
25
|
+
= object_link_edit(object)
|
|
26
|
+
- if controller.respond_to?(:batch_action)
|
|
27
|
+
td.table-list__check= admin_cb(object)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
- if objects.present?
|
|
2
|
+
- if controller.respond_to?(:sort)
|
|
3
|
+
- if objects.respond_to?(:apply_sortable_order)
|
|
4
|
+
- sort = {class: 'with-apply-sortable-order', data: {sortable: url_for(action: :sort)}}
|
|
5
|
+
- if objects.first.respond_to?(:move_to)
|
|
6
|
+
- sort = {class: 'with-move-to'}
|
|
7
|
+
- pagination = capture do
|
|
8
|
+
- if collection.respond_to?(:current_page)
|
|
9
|
+
= paginate collection, theme: :admin
|
|
10
|
+
|
|
11
|
+
- attrs = sort || {}
|
|
12
|
+
|
|
13
|
+
= pagination
|
|
14
|
+
.table-list
|
|
15
|
+
table.table.table-hover.table-sm
|
|
16
|
+
tbody *attrs
|
|
17
|
+
- objects.each do |object|
|
|
18
|
+
= render partial: 'object', object: object
|
|
19
|
+
= pagination
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$('div[rel=<%= resource.id %>]').replaceWith('<%= escape_javascript(render(partial: "object", object: resource)) %>');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
= render 'form'
|