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.
Files changed (288) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +14 -0
  3. data/.gitignore +25 -0
  4. data/.gitlab-ci.yml +18 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +120 -0
  7. data/.rubocop_todo.yml +58 -0
  8. data/Gemfile +25 -0
  9. data/Guardfile +70 -0
  10. data/LICENSE.txt +22 -0
  11. data/README.md +88 -0
  12. data/Rakefile +20 -0
  13. data/adminos.gemspec +37 -0
  14. data/adminos.png +0 -0
  15. data/app/assets/images/.keep +0 -0
  16. data/app/assets/images/apple-touch-icon.png +0 -0
  17. data/app/assets/images/favicon-16x16.png +0 -0
  18. data/app/assets/images/favicon-32x32.png +0 -0
  19. data/app/assets/images/favicon.ico +0 -0
  20. data/app/assets/images/safari-pinned-tab.svg +23 -0
  21. data/app/inputs/cropp_input.rb +45 -0
  22. data/bin/bundle +105 -0
  23. data/bin/gem +39 -0
  24. data/bin/rspec +29 -0
  25. data/exe/adminos +5 -0
  26. data/lib/adminos/cli.rb +71 -0
  27. data/lib/adminos/controllers/admin_extension.rb +34 -0
  28. data/lib/adminos/controllers/helpers.rb +24 -0
  29. data/lib/adminos/controllers/resource.rb +169 -0
  30. data/lib/adminos/extensions/globalize_actiontext.rb +28 -0
  31. data/lib/adminos/extensions/globalize_fields.rb +19 -0
  32. data/lib/adminos/extensions/nested_set.rb +27 -0
  33. data/lib/adminos/extensions/string.rb +5 -0
  34. data/lib/adminos/generators/gemfile_merge.rb +85 -0
  35. data/lib/adminos/generators/utilities.rb +87 -0
  36. data/lib/adminos/helpers/admin.rb +190 -0
  37. data/lib/adminos/helpers/bootstrap.rb +64 -0
  38. data/lib/adminos/helpers/models/apply_sortable_order.rb +10 -0
  39. data/lib/adminos/helpers/models/array_attrs.rb +17 -0
  40. data/lib/adminos/helpers/models/cropped.rb +20 -0
  41. data/lib/adminos/helpers/models/dom_id.rb +16 -0
  42. data/lib/adminos/helpers/models/flag_attrs.rb +43 -0
  43. data/lib/adminos/helpers/models/if_blank_set_to_nil_params.rb +19 -0
  44. data/lib/adminos/helpers/models/move_to.rb +17 -0
  45. data/lib/adminos/helpers/models/nested_set/duplication.rb +31 -0
  46. data/lib/adminos/helpers/models/nested_set/materialize_path.rb +50 -0
  47. data/lib/adminos/helpers/models/nested_set/place_to.rb +35 -0
  48. data/lib/adminos/helpers/models/nested_set/safe_destroy.rb +34 -0
  49. data/lib/adminos/helpers/models/recognizable.rb +28 -0
  50. data/lib/adminos/helpers/models/slugged.rb +20 -0
  51. data/lib/adminos/helpers/models/soft_destroy.rb +61 -0
  52. data/lib/adminos/helpers/models/wysiwyg.rb +105 -0
  53. data/lib/adminos/helpers/view.rb +137 -0
  54. data/lib/adminos/operations/check_environment.rb +18 -0
  55. data/lib/adminos/operations/extract_environment.rb +42 -0
  56. data/lib/adminos/operations/load_environment.rb +30 -0
  57. data/lib/adminos/stateful_link/action_any_of.rb +76 -0
  58. data/lib/adminos/stateful_link/helper.rb +31 -0
  59. data/lib/adminos.rb +42 -0
  60. data/lib/adminos_template.rb +15 -0
  61. data/lib/generators/adminos/adminos_generator.rb +164 -0
  62. data/lib/generators/adminos/ci_generator.rb +124 -0
  63. data/lib/generators/adminos/field_generator.rb +105 -0
  64. data/lib/generators/adminos/i18n_generator.rb +76 -0
  65. data/lib/generators/adminos/install_generator.rb +238 -0
  66. data/lib/generators/templates/adminos/adminos.ru.yml +15 -0
  67. data/lib/generators/templates/adminos/fields.slim +21 -0
  68. data/lib/generators/templates/adminos/locales/general_fields.slim +7 -0
  69. data/lib/generators/templates/adminos/locales/locale_fields.slim +10 -0
  70. data/lib/generators/templates/adminos/locales/migration.rb.erb +18 -0
  71. data/lib/generators/templates/adminos/locales/model.rb.erb +6 -0
  72. data/lib/generators/templates/adminos/sidebar.slim +2 -0
  73. data/lib/generators/templates/adminos/sorts/body.slim +3 -0
  74. data/lib/generators/templates/adminos/sorts/headers.slim +3 -0
  75. data/lib/generators/templates/adminos/types/default/controller.rb.erb +18 -0
  76. data/lib/generators/templates/adminos/types/default/migration.rb +5 -0
  77. data/lib/generators/templates/adminos/types/default/model.rb +20 -0
  78. data/lib/generators/templates/adminos/types/default/model_includes.rb +4 -0
  79. data/lib/generators/templates/adminos/types/default/views/index.slim +14 -0
  80. data/lib/generators/templates/adminos/types/section/controller.rb.erb +10 -0
  81. data/lib/generators/templates/adminos/types/section/migration.rb +12 -0
  82. data/lib/generators/templates/adminos/types/section/model.rb +62 -0
  83. data/lib/generators/templates/adminos/types/section/model_includes.rb +7 -0
  84. data/lib/generators/templates/adminos/types/section/views/_object.slim +24 -0
  85. data/lib/generators/templates/adminos/types/section/views/_objects.slim +6 -0
  86. data/lib/generators/templates/adminos/types/section/views/index.slim +7 -0
  87. data/lib/generators/templates/adminos/types/sortable/controller.rb.erb +10 -0
  88. data/lib/generators/templates/adminos/types/sortable/migration.rb +9 -0
  89. data/lib/generators/templates/adminos/types/sortable/model.rb +35 -0
  90. data/lib/generators/templates/adminos/types/sortable/model_includes.rb +6 -0
  91. data/lib/generators/templates/adminos/types/sortable/views/_object.slim +17 -0
  92. data/lib/generators/templates/adminos/types/sortable/views/_objects.slim +6 -0
  93. data/lib/generators/templates/adminos/types/sortable/views/index.slim +7 -0
  94. data/lib/generators/templates/adminos/types/table/controller.rb.erb +19 -0
  95. data/lib/generators/templates/adminos/types/table/views/index.slim +31 -0
  96. data/lib/generators/templates/ci/.gitlab-ci.yml +40 -0
  97. data/lib/generators/templates/ci/audit/Gemfile +3 -0
  98. data/lib/generators/templates/ci/lint/Gemfile +3 -0
  99. data/lib/generators/templates/ci/lint/rubocop.yml +116 -0
  100. data/lib/generators/templates/ci/rakelib/audit.rake +13 -0
  101. data/lib/generators/templates/ci/rakelib/lint.rake +13 -0
  102. data/lib/generators/templates/ci/spec/Gemfile +9 -0
  103. data/lib/generators/templates/field/locales/locale_fields.slim +4 -0
  104. data/lib/generators/templates/field/locales/migration.rb.erb +13 -0
  105. data/lib/generators/templates/field/locales/model.rb.erb +6 -0
  106. data/lib/generators/templates/i18n/Gemfile +1 -0
  107. data/lib/generators/templates/i18n/add_translation_table_to_page.rb +15 -0
  108. data/lib/generators/templates/i18n/auto/app/validators/locale_validator.rb +23 -0
  109. data/lib/generators/templates/i18n/auto/app/views/admin/base/_fields.slim +1 -0
  110. data/lib/generators/templates/i18n/auto/app/views/admin/base/_pills.slim +19 -0
  111. data/lib/generators/templates/i18n/auto/app/views/admin/pages/_general_fields.slim +8 -0
  112. data/lib/generators/templates/i18n/auto/app/views/admin/pages/_locale_fields.slim +13 -0
  113. data/lib/generators/templates/i18n/auto/config/initializers/globalize_fields.rb +1 -0
  114. data/lib/generators/templates/i18n/controller.rb +12 -0
  115. data/lib/generators/templates/i18n/devise/devise.ru.yml +60 -0
  116. data/lib/generators/templates/i18n/devise/views/_links.erb +25 -0
  117. data/lib/generators/templates/i18n/devise/views/confirmations/new.slim +8 -0
  118. data/lib/generators/templates/i18n/devise/views/mailer/confirmation_instructions.slim +4 -0
  119. data/lib/generators/templates/i18n/devise/views/mailer/reset_password_instructions.slim +5 -0
  120. data/lib/generators/templates/i18n/devise/views/mailer/unlock_instructions.slim +4 -0
  121. data/lib/generators/templates/i18n/devise/views/passwords/edit.slim +7 -0
  122. data/lib/generators/templates/i18n/devise/views/passwords/new.slim +5 -0
  123. data/lib/generators/templates/i18n/devise/views/registrations/edit.slim +25 -0
  124. data/lib/generators/templates/i18n/devise/views/registrations/new.slim +7 -0
  125. data/lib/generators/templates/i18n/devise/views/sessions/new.slim +22 -0
  126. data/lib/generators/templates/i18n/devise/views/unlocks/new.slim +11 -0
  127. data/lib/generators/templates/i18n/locales.slim +3 -0
  128. data/lib/generators/templates/i18n/page.rb +5 -0
  129. data/lib/generators/templates/install/.gitignore +11 -0
  130. data/lib/generators/templates/install/Gemfile +57 -0
  131. data/lib/generators/templates/install/Procfile +1 -0
  132. data/lib/generators/templates/install/_sidebar.slim.erb +44 -0
  133. data/lib/generators/templates/install/add_authentications/authentication.rb +7 -0
  134. data/lib/generators/templates/install/add_authentications/authentications_controller.rb +95 -0
  135. data/lib/generators/templates/install/add_authentications/authentications_migration.rb +12 -0
  136. data/lib/generators/templates/install/add_authentications/views/authentications/_form.slim +5 -0
  137. data/lib/generators/templates/install/add_authentications/views/authentications/_modal.slim +7 -0
  138. data/lib/generators/templates/install/add_pages/page.rb +116 -0
  139. data/lib/generators/templates/install/add_pages/pages_controller.rb +6 -0
  140. data/lib/generators/templates/install/add_pages/pages_migration.rb +25 -0
  141. data/lib/generators/templates/install/add_pages/views/pages/show.slim +4 -0
  142. data/lib/generators/templates/install/admin.slim +36 -0
  143. data/lib/generators/templates/install/admin_panel/pages/admin_pages_controller.rb +9 -0
  144. data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_fields.slim +26 -0
  145. data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_object.slim +25 -0
  146. data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/_objects.slim +6 -0
  147. data/lib/generators/templates/install/admin_panel/pages/views/admin_pages/index.slim +7 -0
  148. data/lib/generators/templates/install/admin_panel/users/admin_users_controller.rb +29 -0
  149. data/lib/generators/templates/install/admin_panel/users/views/admin_users/_fields.slim +4 -0
  150. data/lib/generators/templates/install/admin_panel/users/views/admin_users/index.slim +33 -0
  151. data/lib/generators/templates/install/admin_panel/versions/admin_versions_controller.rb +29 -0
  152. data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/index.slim +47 -0
  153. data/lib/generators/templates/install/admin_panel/versions/views/admin_versions/show.slim +18 -0
  154. data/lib/generators/templates/install/application.slim.erb +31 -0
  155. data/lib/generators/templates/install/auto/.editorconfig +14 -0
  156. data/lib/generators/templates/install/auto/.env.staging +2 -0
  157. data/lib/generators/templates/install/auto/Capfile +14 -0
  158. data/lib/generators/templates/install/auto/Guardfile +18 -0
  159. data/lib/generators/templates/install/auto/Procfile +1 -0
  160. data/lib/generators/templates/install/auto/Procfile.local +2 -0
  161. data/lib/generators/templates/install/auto/app/assets/javascripts/admin/application.js +3 -0
  162. data/lib/generators/templates/install/auto/app/assets/javascripts/admin/cocoon_fields.js +43 -0
  163. data/lib/generators/templates/install/auto/app/assets/javascripts/application.js +1 -0
  164. data/lib/generators/templates/install/auto/app/assets/stylesheets/admin/application.scss +1 -0
  165. data/lib/generators/templates/install/auto/app/controllers/admin/base_controller.rb +16 -0
  166. data/lib/generators/templates/install/auto/app/controllers/admin/helps_controller.rb +4 -0
  167. data/lib/generators/templates/install/auto/app/controllers/admin/settings_controller.rb +26 -0
  168. data/lib/generators/templates/install/auto/app/controllers/application_controller.rb +50 -0
  169. data/lib/generators/templates/install/auto/app/controllers/index_controller.rb +2 -0
  170. data/lib/generators/templates/install/auto/app/helpers/nested_helper.rb +75 -0
  171. data/lib/generators/templates/install/auto/app/helpers/versions_helper.rb +33 -0
  172. data/lib/generators/templates/install/auto/app/inputs/carrierwave_input.rb +52 -0
  173. data/lib/generators/templates/install/auto/app/inputs/checkbox_input.rb +13 -0
  174. data/lib/generators/templates/install/auto/app/inputs/rich_text_input.rb +9 -0
  175. data/lib/generators/templates/install/auto/app/mailers/notifier.rb +9 -0
  176. data/lib/generators/templates/install/auto/app/models/settings.rb +27 -0
  177. data/lib/generators/templates/install/auto/app/services/export_xlsx.rb +76 -0
  178. data/lib/generators/templates/install/auto/app/views/active_storage/blobs/_blob.html.erb +17 -0
  179. data/lib/generators/templates/install/auto/app/views/admin/base/_form.slim +33 -0
  180. data/lib/generators/templates/install/auto/app/views/admin/base/_object.slim +27 -0
  181. data/lib/generators/templates/install/auto/app/views/admin/base/_objects.slim +19 -0
  182. data/lib/generators/templates/install/auto/app/views/admin/base/drop.js.erb +1 -0
  183. data/lib/generators/templates/install/auto/app/views/admin/base/edit.slim +1 -0
  184. data/lib/generators/templates/install/auto/app/views/admin/base/index.slim +14 -0
  185. data/lib/generators/templates/install/auto/app/views/admin/base/new.slim +1 -0
  186. data/lib/generators/templates/install/auto/app/views/admin/helps/index.slim +29 -0
  187. data/lib/generators/templates/install/auto/app/views/admin/settings/edit.slim +27 -0
  188. data/lib/generators/templates/install/auto/app/views/kaminari/_first_page.slim +10 -0
  189. data/lib/generators/templates/install/auto/app/views/kaminari/_gap.slim +7 -0
  190. data/lib/generators/templates/install/auto/app/views/kaminari/_last_page.slim +10 -0
  191. data/lib/generators/templates/install/auto/app/views/kaminari/_next_page.slim +9 -0
  192. data/lib/generators/templates/install/auto/app/views/kaminari/_page.slim +10 -0
  193. data/lib/generators/templates/install/auto/app/views/kaminari/_paginator.slim +16 -0
  194. data/lib/generators/templates/install/auto/app/views/kaminari/_prev_page.slim +9 -0
  195. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_first_page.slim +10 -0
  196. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_gap.slim +8 -0
  197. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_last_page.slim +10 -0
  198. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_next_page.slim +10 -0
  199. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_page.slim +10 -0
  200. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_paginator.slim +16 -0
  201. data/lib/generators/templates/install/auto/app/views/kaminari/admin/_prev_page.slim +10 -0
  202. data/lib/generators/templates/install/auto/app/views/layouts/admin/base.slim +17 -0
  203. data/lib/generators/templates/install/auto/app/views/shared/admin/_back_button.slim +3 -0
  204. data/lib/generators/templates/install/auto/app/views/shared/admin/_footer.slim +3 -0
  205. data/lib/generators/templates/install/auto/app/views/shared/admin/_search_form.slim +6 -0
  206. data/lib/generators/templates/install/auto/app/views/shared/admin/_topbar.slim +11 -0
  207. data/lib/generators/templates/install/auto/app/views/shared/helpers/_alert_close.slim +1 -0
  208. data/lib/generators/templates/install/auto/app/views/shared/helpers/_contacts_page_link_tag.slim +1 -0
  209. data/lib/generators/templates/install/auto/app/views/shared/helpers/_link_button_to.slim +2 -0
  210. data/lib/generators/templates/install/auto/app/views/shared/helpers/_method_ajax_request_link_to.slim +2 -0
  211. data/lib/generators/templates/install/auto/app/views/shared/helpers/_method_link_to.slim +12 -0
  212. data/lib/generators/templates/install/auto/app/views/shared/helpers/_navigation_menu.html.slim +3 -0
  213. data/lib/generators/templates/install/auto/app/views/shared/helpers/_print_tag.slim +2 -0
  214. data/lib/generators/templates/install/auto/app/views/shared/helpers/_search_tag_for.slim +16 -0
  215. data/lib/generators/templates/install/auto/app/views/shared/helpers/_show_breadcrumbs.slim +7 -0
  216. data/lib/generators/templates/install/auto/app/views/shared/helpers/_show_flash_alert.slim +9 -0
  217. data/lib/generators/templates/install/auto/app/views/shared/helpers/_sortable_column.slim +3 -0
  218. data/lib/generators/templates/install/auto/app/views/shared/helpers/_span_link_to.slim +3 -0
  219. data/lib/generators/templates/install/auto/app/views/shared/helpers/_sub_navigation.slim +14 -0
  220. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_batch_actions_tag.slim +16 -0
  221. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_button_new.slim +5 -0
  222. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_collection_header.slim +4 -0
  223. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_locked_sign.slim +3 -0
  224. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_nav_published_sign.slim +1 -0
  225. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_children.slim +2 -0
  226. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_duplication.slim +1 -0
  227. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_edit.slim +1 -0
  228. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_object_link_new.slim +1 -0
  229. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_page_header.slim +5 -0
  230. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_published_sign.slim +1 -0
  231. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_show_breadcrumbs.slim +6 -0
  232. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_top_menu_item.slim +5 -0
  233. data/lib/generators/templates/install/auto/app/views/shared/helpers/admin/_unpublished_sign.slim +1 -0
  234. data/lib/generators/templates/install/auto/browserslist +3 -0
  235. data/lib/generators/templates/install/auto/config/deploy/shared/database.yml.erb +10 -0
  236. data/lib/generators/templates/install/auto/config/deploy/shared/nginx.conf.erb +28 -0
  237. data/lib/generators/templates/install/auto/config/deploy/shared/unicorn.rb.erb +35 -0
  238. data/lib/generators/templates/install/auto/config/deploy/staging.rb +12 -0
  239. data/lib/generators/templates/install/auto/config/environments/staging.rb +84 -0
  240. data/lib/generators/templates/install/auto/config/initializers/awesome_nested_set.rb +1 -0
  241. data/lib/generators/templates/install/auto/config/initializers/content_security_policy.rb +26 -0
  242. data/lib/generators/templates/install/auto/config/initializers/friendly_id.rb +1 -0
  243. data/lib/generators/templates/install/auto/config/initializers/kaminari_config.rb +15 -0
  244. data/lib/generators/templates/install/auto/config/initializers/simple_form.rb +238 -0
  245. data/lib/generators/templates/install/auto/config/initializers/slim.rb +2 -0
  246. data/lib/generators/templates/install/auto/config/locales/adminos.en.yml +164 -0
  247. data/lib/generators/templates/install/auto/config/locales/adminos.ru.yml +292 -0
  248. data/lib/generators/templates/install/auto/lib/capistrano/substitute_strings.rb +12 -0
  249. data/lib/generators/templates/install/auto/lib/capistrano/tasks/setup_config.cap +39 -0
  250. data/lib/generators/templates/install/auto/lib/capistrano/template.rb +33 -0
  251. data/lib/generators/templates/install/auto/public/404.html +26 -0
  252. data/lib/generators/templates/install/auto/public/500.html +25 -0
  253. data/lib/generators/templates/install/database.yml +19 -0
  254. data/lib/generators/templates/install/deploy.rb.erb +21 -0
  255. data/lib/generators/templates/install/install_devise/ability.rb +49 -0
  256. data/lib/generators/templates/install/install_devise/application.rb +7 -0
  257. data/lib/generators/templates/install/install_devise/prepare_users.rb +1 -0
  258. data/lib/generators/templates/install/install_devise/user.rb +21 -0
  259. data/lib/generators/templates/install/prepare_settings.rb +4 -0
  260. data/lib/generators/templates/install/routes/pages.rb +18 -0
  261. data/lib/generators/templates/install/routes.rb.erb +53 -0
  262. data/lib/generators/templates/install/settings_migration.rb +16 -0
  263. data/lib/generators/templates/install/webpack/custom.js +36 -0
  264. data/lib/generators/templates/install/webpack/environment.js +4 -0
  265. data/lib/generators/templates/install/webpack/javascript/admin/js/index.js +2 -0
  266. data/lib/generators/templates/install/webpack/javascript/admin/styles/admin.scss +2 -0
  267. data/lib/generators/templates/install/webpack/javascript/packs/admin.js +2 -0
  268. data/package-lock.json +3 -0
  269. data/spec/config/database.yml +2 -0
  270. data/spec/db/schema.rb +0 -0
  271. data/spec/lib/adminos/helpers/models/apply_sortable_order.rb +26 -0
  272. data/spec/lib/adminos/helpers/models/array_attrs_spec.rb +38 -0
  273. data/spec/lib/adminos/helpers/models/dom_id_spec.rb +41 -0
  274. data/spec/lib/adminos/helpers/models/flag_attrs_spec.rb +115 -0
  275. data/spec/lib/adminos/helpers/models/if_blank_set_to_nil_params_spec.rb +36 -0
  276. data/spec/lib/adminos/helpers/models/recognizable_spec.rb +40 -0
  277. data/spec/lib/adminos/helpers/models/slugged.rb +40 -0
  278. data/spec/lib/generators/adminos/adminos_generator_spec.rb +106 -0
  279. data/spec/lib/generators/adminos/ci_generator_spec.rb +88 -0
  280. data/spec/lib/generators/adminos/i18n_generator_spec.rb +31 -0
  281. data/spec/lib/generators/adminos/install_generator_rspec.rb +322 -0
  282. data/spec/spec_helper.rb +122 -0
  283. data/spec/support/ammeter.rb +14 -0
  284. data/spec/support/database.rb +29 -0
  285. data/spec/support/generators.rb +99 -0
  286. data/spec/support/post.rb +8 -0
  287. data/spec/support/shared/generator.rb +35 -0
  288. metadata +632 -0
@@ -0,0 +1,238 @@
1
+ require 'adminos/generators/utilities'
2
+ require 'rails/generators/active_record'
3
+
4
+ module Adminos::Generators
5
+ class InstallGenerator < ActiveRecord::Generators::Base
6
+ include Utilities
7
+
8
+ desc 'Creates initial adminos file and data structure'
9
+
10
+ source_root File.expand_path '../../templates/install', __FILE__
11
+
12
+ # ActiveRecord::Generators::Base requires a NAME parameter.
13
+ argument :name, type: :string, default: 'random_name'
14
+
15
+ class_option :i18n, type: :boolean, default: true, desc: 'Set up I18n'
16
+ class_option :locales, type: :string
17
+ class_option :is_test, type: :boolean, default: false
18
+ class_option :ci, type: :boolean, default: true, desc: 'Set up Gitlab CI'
19
+
20
+ def questions
21
+ @settings = {}
22
+ @settings[:install_devise] = ask_user('Install Devise?')
23
+ @settings[:add_devise_views_locales] = @settings[:install_devise] || ask_user('Add Devise views (login page, etc..) and locales?')
24
+ @settings[:add_users_to_admin_panel] = @settings[:install_devise] || ask_user('Add Devise Users to admin panel?')
25
+ @settings[:add_authentications] = !@settings[:install_devise] || ask_user('Add Authentications for Users?')
26
+ @settings[:install_paper_trail] = ask_user('Install PaperTrail?')
27
+ @settings[:add_versions_to_admin_panel] = @settings[:install_paper_trail] || ask_user('Add PaperTrail versions to admin panel?')
28
+ @settings[:add_pages] = ask_user('Create Pages model?')
29
+ @settings[:set_default_locale_time_zone] = ask_user('Set default_locale = :ru and time_zone = "Moscow" ? in application.rb')
30
+ end
31
+
32
+ def bundle_dependencies
33
+ merge_gemfile_with('Gemfile')
34
+ install_dependencies
35
+ end
36
+
37
+ def auto
38
+ directory 'auto', '.', mode: :preserve
39
+ comment_lines 'Gemfile', /spring-watcher-listen/
40
+ end
41
+
42
+ def setup_ci
43
+ return unless options.ci?
44
+
45
+ generate 'adminos:ci'
46
+ end
47
+
48
+ def migrations
49
+ migration_template 'settings_migration.rb', 'db/migrate/create_settings.rb', migration_version: migration_version
50
+ end
51
+
52
+ def seeds
53
+ append_file 'db/seeds.rb', file_content('prepare_settings.rb')
54
+ end
55
+
56
+ def templates
57
+ template 'deploy.rb.erb', 'config/deploy.rb'
58
+ template 'database.yml', 'config/database.yml'
59
+ template 'database.yml', 'config/database.yml.example'
60
+ template 'admin.slim', 'app/views/layouts/admin.slim'
61
+ template 'application.slim.erb', 'app/views/layouts/application.slim'
62
+ template '_sidebar.slim.erb', 'app/views/shared/admin/_sidebar.slim'
63
+ end
64
+
65
+ def update_gitignore
66
+ append_file '.gitignore', file_content('.gitignore')
67
+ end
68
+
69
+ def update_procfile
70
+ if file_exists?('Procfile')
71
+ append_file('Procfile', file_content('Procfile'))
72
+ else
73
+ copy_file 'Procfile', 'Procfile'
74
+ end
75
+ end
76
+
77
+ def install_webpacker
78
+ run 'bundle exec rails webpacker:install'
79
+ run "yarn add resolve-url-loader adminos"
80
+
81
+ copy_file 'webpack/custom.js', 'config/webpack/custom.js'
82
+ copy_file 'webpack/javascript/packs/admin.js', 'app/javascript/packs/admin.js'
83
+ directory 'webpack/javascript/admin', 'app/javascript/admin'
84
+ inject_into_file 'config/webpack/environment.js', file_content('webpack/environment.js'), before: /\nmodule.exports/
85
+ end
86
+
87
+ def install_active_storage
88
+ run 'bundle exec rails active_storage:install'
89
+ end
90
+
91
+ def install_actiontext
92
+ run 'bundle exec rails action_text:install'
93
+ end
94
+
95
+ def install_devise
96
+ return unless @settings[:install_devise]
97
+ generate 'devise:install'
98
+ # create user
99
+ generate 'devise', 'User roles_mask:integer --routes=false'
100
+ remove_file 'app/models/user.rb'
101
+ copy_file 'install_devise/user.rb', 'app/models/user.rb'
102
+ # add ability
103
+ copy_file 'install_devise/ability.rb', 'app/models/ability.rb'
104
+ # some settings
105
+ gsub_file 'config/initializers/devise.rb', /.*please-change-me-at-config-initializers-devise@example.com\'/, " config.mailer_sender = Settings.get.email_header_from || 'admin@changeme.please' rescue nil"
106
+ gsub_file 'config/initializers/devise.rb', /.*# config.omniauth .*/, " config.omniauth :facebook, 'test', 'test'\n config.omniauth :twitter, 'test', 'test'\n config.omniauth :vkontakte, 'test', 'test'"
107
+ inject_into_file 'config/application.rb', file_content('install_devise/application.rb'), after: /Rails::Application\n/
108
+ # create adminos_user
109
+ append_file 'db/seeds.rb', file_content('install_devise/prepare_users.rb')
110
+ end
111
+
112
+ def install_paper_trail
113
+ return unless @settings[:install_paper_trail]
114
+ generate 'paper_trail:install', '--with-changes'
115
+ end
116
+
117
+ def add_pages
118
+ return unless @settings[:add_pages]
119
+ migration_template 'add_pages/pages_migration.rb', 'db/migrate/create_pages.rb'
120
+ copy_file 'add_pages/page.rb', 'app/models/page.rb'
121
+ copy_file 'add_pages/pages_controller.rb', 'app/controllers/pages_controller.rb'
122
+ directory 'add_pages/views/pages', 'app/views/pages', mode: :preserve
123
+ end
124
+
125
+ def add_authentications
126
+ return unless @settings[:add_authentications]
127
+ migration_template 'add_authentications/authentications_migration.rb', 'db/migrate/create_authentications.rb'
128
+ copy_file 'add_authentications/authentication.rb', 'app/models/authentication.rb'
129
+ copy_file 'add_authentications/authentications_controller.rb', 'app/controllers/authentications_controller.rb'
130
+ directory 'add_authentications/views/authentications', 'app/views/authentications', mode: :preserve
131
+ end
132
+
133
+ def add_adminos_users
134
+ return unless @settings[:add_users_to_admin_panel]
135
+ # admin controller
136
+ copy_file 'admin_panel/users/admin_users_controller.rb', 'app/controllers/admin/users_controller.rb'
137
+ # admin views
138
+ directory 'admin_panel/users/views/admin_users', 'app/views/admin/users', mode: :preserve
139
+ end
140
+
141
+ def add_adminos_versions
142
+ return unless @settings[:add_versions_to_admin_panel]
143
+ # admin controller
144
+ copy_file 'admin_panel/versions/admin_versions_controller.rb', 'app/controllers/admin/versions_controller.rb'
145
+ # admin views
146
+ directory 'admin_panel/versions/views/admin_versions', 'app/views/admin/versions', mode: :preserve
147
+ end
148
+
149
+ def add_adminos_pages
150
+ return unless @settings[:add_pages]
151
+ # admin controller
152
+ copy_file 'admin_panel/pages/admin_pages_controller.rb', 'app/controllers/admin/pages_controller.rb'
153
+ # admin views
154
+ directory 'admin_panel/pages/views/admin_pages', 'app/views/admin/pages', mode: :preserve
155
+ end
156
+
157
+ def copy_route_config
158
+ routes = []
159
+ routes << " # ADMINOS ROUTES START"
160
+ # devise
161
+ if @settings[:install_devise]
162
+ routes << "\n devise_for :users, skip: :omniauth_callbacks"
163
+ end
164
+ if @settings[:add_authentications]
165
+ routes << "\n devise_for :users, skip: [:session, :password, :registration, :confirmation],"
166
+ routes << " controllers: { omniauth_callbacks: 'authentications' }"
167
+ routes << "\n devise_scope :user do"
168
+ routes << " get 'authentications/new', to: 'authentications#new'"
169
+ routes << " post 'authentications/link', to: 'authentications#link'"
170
+ routes << " end"
171
+ end
172
+ # adminos
173
+ routes << "\n namespace :admin do"
174
+ routes << " resources :helps, only: :index"
175
+ routes << " resource :settings, only: [:edit, :update]"
176
+ if @settings[:add_users_to_admin_panel]
177
+ routes << "\n resources :users, except: :show do"
178
+ routes << " collection { post :batch_action }"
179
+ routes << " end"
180
+ end
181
+ if @settings[:add_versions_to_admin_panel]
182
+ routes << "\n resources :versions, only: [:index, :show] do"
183
+ routes << " collection { post :batch_action }"
184
+ routes << " end"
185
+ end
186
+ if @settings[:add_pages]
187
+ routes << "\n resources :pages, except: :show do"
188
+ routes << " collection { post :batch_action }"
189
+ routes << " member { put :drop }"
190
+ routes << " member { post :duplication }"
191
+ routes << " end"
192
+ routes << "\n root to: 'pages#index', as: :root"
193
+ end
194
+ routes << " end"
195
+ routes << "\n root to: 'index#index'"
196
+ # pages
197
+ if @settings[:add_pages]
198
+ routes << file_content('routes/pages.rb')
199
+ end
200
+ routes << " # ADMINOS ROUTES END\n"
201
+ inject_into_file 'config/routes.rb', routes.join("\n"), after: /routes.draw do\n/
202
+ end
203
+
204
+ def modify_application_config
205
+ inject_into_file 'config/application.rb', " config.assets.paths << Rails.root.join('app', 'assets', 'fonts')\n", after: /Rails::Application\n/
206
+ inject_into_file 'config/application.rb', " config.action_mailer.default_url_options = { host: 'molinos.ru' }\n", after: /Rails::Application\n/
207
+ inject_into_file 'config/application.rb', " config.generators { |g| g.test_framework :rspec }\n", after: /Rails::Application\n/
208
+ end
209
+
210
+ def setup_i18n
211
+ unless i18n?
212
+ create_file 'config/locales/ru.yml', "ru:\n"
213
+ return
214
+ end
215
+
216
+ generate 'adminos:i18n', options_for_cli(
217
+ locales: locales,
218
+ devise: !!@settings[:add_devise_views_locales],
219
+ russian: !!@settings[:set_default_locale_time_zone],
220
+ pages: !!@settings[:add_pages]
221
+ )
222
+ end
223
+
224
+ private
225
+
226
+ def i18n?
227
+ options.i18n? || locales.any?
228
+ end
229
+
230
+ def locales
231
+ @locales ||= options[:locales].to_s.split(',').uniq
232
+ end
233
+
234
+ def ask_user(text)
235
+ options.is_test? || yes?("#{text} (yN)")
236
+ end
237
+ end
238
+ end
@@ -0,0 +1,15 @@
1
+ <%= table_name %>:
2
+ actions:
3
+ index:
4
+ header: <%= table_name.capitalize %>
5
+ title: <%= table_name.capitalize %>
6
+ labels:
7
+ actions:
8
+ create: Добавить <%= file_name %>
9
+ create_stay_in_place: Применить
10
+ edit: Сохранить <%= file_name %>
11
+ edit_stay_in_place: Применить
12
+ new: Добавить <%= file_name %>
13
+ new_stay_in_place: Применить
14
+ update: Сохранить <%= file_name %>
15
+ update_stay_in_place: Применить
@@ -0,0 +1,21 @@
1
+ .f__fieldset
2
+ = f.input :name
3
+ <% if options.type == 'section' -%>
4
+ = f.input :nav_name
5
+ <% end -%>
6
+ = f.input :slug
7
+ = f.input :published, wrapper: :check
8
+ <% if options.type == 'section' -%>
9
+ = f.input :nav_published
10
+ <% end -%>
11
+
12
+ <% attributes.each do |attribute| -%>
13
+ = f.input :<%= attribute.name %>
14
+ <% end -%>
15
+
16
+ <% unless options.seo? -%>
17
+ .f__fieldset
18
+ .f__legend= t 'labels.admin.legend.seo'
19
+ = f.input :meta_title
20
+ = f.input :meta_description, as: :string
21
+ <% end -%>
@@ -0,0 +1,7 @@
1
+ .f__fieldset
2
+ = f.input :slug
3
+ = f.input :published, wrapper: :check
4
+ <%= " = f.input :nav_published, wrapper: :check\n" if options.type == 'section' -%>
5
+ <% attributes.each do |attribute| -%>
6
+ <%= " = f.input :#{attribute.name}\n" unless attribute.locale -%>
7
+ <% end -%>
@@ -0,0 +1,10 @@
1
+ .f__fieldset
2
+ = f.input :name<%= "\n = f.input :nav_name" if options.type == 'section' %>
3
+ <% attributes.each do |attribute| -%>
4
+ <%= " = f.input :#{attribute.name}\n" if attribute.locale -%>
5
+ <% end -%>
6
+
7
+ .f__fieldset
8
+ .f__legend= t 'labels.admin.legend.seo'
9
+ = f.input :meta_title
10
+ = f.input :meta_description, as: :string
@@ -0,0 +1,18 @@
1
+ class AddTranslationTableTo<%= file_name.camelize %> < ActiveRecord::Migration[5.2]
2
+ def up
3
+ <%= file_name.camelize %>.create_translation_table!({
4
+ name: :string,<%= "\n nav_name: :string," if options.type == 'section' %>
5
+ <% attributes.each do |attribute| -%>
6
+ <%= "#{attribute.name}: :#{attribute.type},\n" if attribute.locale -%>
7
+ <% end -%>
8
+ meta_description: :text,
9
+ meta_title: :string
10
+ }, {
11
+ migrate_data: true
12
+ })
13
+ end
14
+
15
+ def down
16
+ <%= file_name.camelize %>.drop_translation_table! migrate_data: true
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+
2
+ translates :name, <%= attributes.map{|a| ":#{a.name}, " if a.locale }.compact.join %><%= ':nav_name, ' if options.type == 'section' %>:meta_description, :meta_title
3
+
4
+ accepts_nested_attributes_for :translations
5
+
6
+ validates_with LocaleValidator
@@ -0,0 +1,2 @@
1
+ = top_menu_item active: 'admin/<%= table_name%>#' do
2
+ = link_to t('admin.<%= table_name%>.actions.index.header'), admin_<%= table_name%>_path, class: 'nav__link'
@@ -0,0 +1,3 @@
1
+ <% attributes.each do |attribute| -%>
2
+ <%= " td= object.#{attribute.name}\n" if attribute.sort -%>
3
+ <% end -%>
@@ -0,0 +1,3 @@
1
+ <% attributes.each do |attribute| -%>
2
+ <%= " th= admin_sortable_column :#{attribute.name}, resource_class.human_attribute_name(:#{attribute.name})\n" if attribute.sort -%>
3
+ <% end -%>
@@ -0,0 +1,18 @@
1
+ class Admin::<%= table_name.camelize %>Controller < Admin::BaseController
2
+ authorize_resource param_method: :strong_params
3
+
4
+ resource(<%= file_name.camelize %>,
5
+ collection_scope: [:sorted],
6
+ location: proc { params[:stay_in_place] ?
7
+ edit_polymorphic_path([:admin, resource]) :
8
+ polymorphic_path([:admin, resource.class]) },
9
+ finder: :find_by_slug!)
10
+
11
+ private
12
+
13
+ alias_method :collection_orig, :collection
14
+ def collection
15
+ @collection ||= collection_orig
16
+ .page(params[:page]).per(settings.per_page)
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ t.string :name
2
+ t.boolean :published, default: true, null: false
3
+ t.string :slug
4
+ t.text :meta_description
5
+ t.string :meta_title
@@ -0,0 +1,20 @@
1
+ has_paper_trail
2
+ slugged :recognizable_name
3
+ flag_attrs :published
4
+ acts_as_recognizable :recognizable_name
5
+
6
+ validates :name, presence: true
7
+
8
+ scope :sorted, -> { order('<%= "#{table_name}." if options.locales? %>created_at DESC') }
9
+
10
+ def reasonable_name
11
+ if self.respond_to?(:translations)
12
+ name.presence || translations.detect { |t| t.name.present? }.try(:name)
13
+ else
14
+ name
15
+ end
16
+ end
17
+
18
+ def recognizable_name
19
+ slug.present? ? slug : reasonable_name
20
+ end
@@ -0,0 +1,4 @@
1
+ include Adminos::Slugged
2
+ include Adminos::FlagAttrs
3
+ include Adminos::Recognizable
4
+ include Adminos::NestedSet::Duplication
@@ -0,0 +1,14 @@
1
+ - collection_title
2
+ = collection_header
3
+
4
+ - if collection.present?
5
+
6
+ - list = capture do
7
+ = render partial: 'objects', object: collection
8
+
9
+ - if controller.respond_to?(:batch_action)
10
+ = batch_actions_tag publication: (collection.respond_to?(:set_each_published_on)),
11
+ nav_publication: (collection.respond_to?(:set_nav_published_on)) do
12
+ = list
13
+ - else
14
+ = list
@@ -0,0 +1,10 @@
1
+ class Admin::<%= table_name.camelize %>Controller < Admin::BaseController
2
+ authorize_resource param_method: :strong_params
3
+
4
+ resource(<%= file_name.camelize %>,
5
+ collection_scope: [:sorted],
6
+ location: proc { params[:stay_in_place] ?
7
+ edit_polymorphic_path([:admin, resource]) :
8
+ polymorphic_path([:admin, resource.class]) },
9
+ finder: :find_by_slug!)
10
+ end
@@ -0,0 +1,12 @@
1
+ t.string :name
2
+ t.boolean :published, default: true, null: false
3
+ t.string :slug
4
+ t.text :meta_description
5
+ t.string :meta_title
6
+ t.integer :parent_id
7
+ t.integer :depth, default: 0
8
+ t.integer :lft
9
+ t.integer :rgt
10
+ t.string :path
11
+ t.string :nav_name
12
+ t.boolean :nav_published, default: true
@@ -0,0 +1,62 @@
1
+ MAX_DEPTH = 3
2
+
3
+ has_paper_trail
4
+ materialize_path
5
+ acts_as_nested_set
6
+ acts_as_recognizable :recognizable_name
7
+ slugged :recognizable_name
8
+ flag_attrs :published, :nav_published
9
+
10
+ after_save :update_descendants_states
11
+
12
+ validates :name, :nav_name, presence: true
13
+ validate :depth_validator
14
+
15
+ scope :sorted, -> { order('lft ASC') }
16
+ scope :navigation, -> { where(published: true, nav_published: true) }
17
+ scope :navigation_top, -> { navigation.where(depth: 0) }
18
+
19
+ def reasonable_name
20
+ if self.respond_to?(:translations)
21
+ name.presence || translations.detect { |t| t.name.present? }.try(:name)
22
+ else
23
+ name
24
+ end
25
+ end
26
+
27
+ def recognizable_name
28
+ slug.present? ? slug : reasonable_name
29
+ end
30
+
31
+ def breadcrumbs
32
+ ancestors.navigation
33
+ end
34
+
35
+ def absolute_path
36
+ "/#{path}"
37
+ end
38
+
39
+ def update_descendants_states
40
+ if saved_change_to_published? && !published?
41
+ self.class.unscoped.where(parent_id: id).set_each_published_off
42
+ end
43
+ end
44
+
45
+ alias_method :destroy_orig, :destroy
46
+ def destroy
47
+ safe_destroy(children_to: :parent, without_destroy: true)
48
+ destroy_orig
49
+ end
50
+
51
+ def depth_validator
52
+ return true unless self.saved_change_to_parent_id?
53
+ # Итоговый уровень вложенности считается так:
54
+ # Уровeнь вложенносить родителя + максимальный уровень вложености
55
+ # детей относителньо самого объекта + 1
56
+ parent = self.parent.try(:depth) || 0
57
+ child = self.descendants.map(&:depth).max
58
+ child = child ? child - self.depth : 0
59
+ if (parent + child + 1) > (MAX_DEPTH - 1)
60
+ self.errors.add(:parent, :too_much_nesting, count: MAX_DEPTH)
61
+ end
62
+ end
@@ -0,0 +1,7 @@
1
+ include Adminos::Slugged
2
+ include Adminos::FlagAttrs
3
+ include Adminos::Recognizable
4
+ include Adminos::NestedSet::PlaceTo
5
+ include Adminos::NestedSet::SafeDestroy
6
+ include Adminos::NestedSet::MaterializePath
7
+ include Adminos::NestedSet::Duplication
@@ -0,0 +1,24 @@
1
+ .list-item rel=object.id id="#{object.class.name.underscore}_#{object.id}" class=(optional_cls('list-item--unpublished' => !object.published?))
2
+ .list-item__move
3
+ .icon.icon--move class="-move"
4
+ .list-item__name
5
+ = link_to object.reasonable_name, polymorphic_path([:admin, object], action: :edit)
6
+ .list-item__url
7
+ = object.absolute_path
8
+
9
+ .list-item__controls
10
+ .list-item__group
11
+ - if object.nav_published?
12
+ = admin_nav_published_sign(class: '-nav')
13
+ - if object.published?
14
+ = admin_published_sign(class: '-state')
15
+ - else
16
+ = admin_unpublished_sign(class: '-state')
17
+ .list-item__group
18
+ = object_link_duplication(object)
19
+ .list-item__group
20
+ = object_link_edit(object)
21
+ .list-item__group
22
+ = object_link_new(object)
23
+ .list-item__check
24
+ = 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,7 @@
1
+ - collection_title
2
+ = collection_header
3
+
4
+ - if collection.present?
5
+ = batch_actions_tag publication: true, nav_publication: true do
6
+ .list.with-nested-sortable
7
+ = render partial: 'objects', object: collection.arrange
@@ -0,0 +1,10 @@
1
+ class Admin::<%= table_name.camelize %>Controller < Admin::BaseController
2
+ authorize_resource param_method: :strong_params
3
+
4
+ resource(<%= file_name.camelize %>,
5
+ collection_scope: [:sorted],
6
+ location: proc { params[:stay_in_place] ?
7
+ edit_polymorphic_path([:admin, resource]) :
8
+ polymorphic_path([:admin, resource.class]) },
9
+ finder: :find_by_slug!)
10
+ end
@@ -0,0 +1,9 @@
1
+ t.string :name
2
+ t.boolean :published, default: true, null: false
3
+ t.string :slug
4
+ t.text :meta_description
5
+ t.string :meta_title
6
+ t.integer :parent_id
7
+ t.integer :depth, default: 0
8
+ t.integer :lft
9
+ t.integer :rgt
@@ -0,0 +1,35 @@
1
+ has_paper_trail
2
+ slugged :recognizable_name
3
+ flag_attrs :published
4
+ acts_as_nested_set
5
+ acts_as_recognizable :recognizable_name
6
+
7
+ after_save :update_descendants_states
8
+
9
+ validates :name, presence: true
10
+
11
+ scope :sorted, -> { order('lft ASC') }
12
+
13
+ def reasonable_name
14
+ if self.respond_to?(:translations)
15
+ name.presence || translations.detect { |t| t.name.present? }.try(:name)
16
+ else
17
+ name
18
+ end
19
+ end
20
+
21
+ def recognizable_name
22
+ slug.present? ? slug : reasonable_name
23
+ end
24
+
25
+ def update_descendants_states
26
+ if saved_change_to_published? && !published?
27
+ self.class.unscoped.where(parent_id: id).set_each_published_off
28
+ end
29
+ end
30
+
31
+ alias_method :destroy_orig, :destroy
32
+ def destroy
33
+ safe_destroy(children_to: :parent, without_destroy: true)
34
+ destroy_orig
35
+ end
@@ -0,0 +1,6 @@
1
+ include Adminos::Slugged
2
+ include Adminos::FlagAttrs
3
+ include Adminos::Recognizable
4
+ include Adminos::NestedSet::PlaceTo
5
+ include Adminos::NestedSet::SafeDestroy
6
+ include Adminos::NestedSet::Duplication
@@ -0,0 +1,17 @@
1
+ .list-item rel=object.id id="#{object.class.name.underscore}_#{object.id}" class=(optional_cls('list-item--unpublished' => !object.published?))
2
+ .list-item__move
3
+ .icon.icon--move class="-move"
4
+ .list-item__name
5
+ = link_to object.reasonable_name, polymorphic_path([:admin, object], action: :edit)
6
+ .list-item__controls
7
+ .list-item__group
8
+ - if object.published?
9
+ = admin_published_sign(class: '-state')
10
+ - else
11
+ = admin_unpublished_sign(class: '-state')
12
+ .list-item__group
13
+ = object_link_duplication(object)
14
+ .list-item__group
15
+ = object_link_edit(object)
16
+ .list-item__check
17
+ = admin_cb(object)
@@ -0,0 +1,6 @@
1
+ - if objects.present?
2
+ ul.list__list max-levels="1"
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,7 @@
1
+ - collection_title
2
+ = collection_header
3
+
4
+ - if collection.present?
5
+ = batch_actions_tag publication: true do
6
+ .list.with-nested-sortable
7
+ = render partial: 'objects', object: collection.arrange