spina 0.12.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spina might be problematic. Click here for more details.

Files changed (210) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +65 -7
  3. data/app/assets/fonts/spina/ics_spina.eot +0 -0
  4. data/app/assets/fonts/spina/ics_spina.svg +65 -61
  5. data/app/assets/fonts/spina/ics_spina.ttf +0 -0
  6. data/app/assets/fonts/spina/ics_spina.woff +0 -0
  7. data/app/assets/fonts/spina/ics_spina.woff2 +0 -0
  8. data/app/assets/icons/spina/export.svg +10 -0
  9. data/app/assets/icons/spina/preview/ics_spina-preview.html +17 -1
  10. data/app/assets/images/spina/media_folder_placeholder.png +0 -0
  11. data/app/assets/images/spina/{admin/spina.png → spina-large.png} +0 -0
  12. data/app/assets/javascripts/spina/admin/application.js +50 -0
  13. data/app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js +40 -0
  14. data/app/assets/javascripts/spina/admin/media_gallery.coffee +65 -0
  15. data/app/assets/javascripts/spina/admin/modal.coffee +0 -1
  16. data/app/assets/javascripts/spina/admin/pages.coffee.erb +2 -2
  17. data/app/assets/javascripts/spina/admin/{application.coffee.erb → scaffold.coffee} +20 -61
  18. data/app/assets/javascripts/spina/admin/trix.coffee.erb +5 -8
  19. data/app/assets/javascripts/spina/admin/uploads.coffee +2 -2
  20. data/app/assets/stylesheets/spina.sass +3 -3
  21. data/app/assets/stylesheets/spina/_buttons.sass +0 -1
  22. data/app/assets/stylesheets/spina/{_configuration.sass → _configuration.sass.erb} +5 -1
  23. data/app/assets/stylesheets/spina/_forms.sass +79 -20
  24. data/app/assets/stylesheets/spina/_gallery.sass +91 -3
  25. data/app/assets/stylesheets/spina/_ics_spina.scss +1 -0
  26. data/app/assets/stylesheets/spina/_tables.sass +4 -0
  27. data/app/assets/stylesheets/spina/_trix.sass +7 -4
  28. data/app/assets/stylesheets/spina_front_end.sass +19 -0
  29. data/app/controllers/concerns/spina/frontend.rb +29 -12
  30. data/app/controllers/spina/admin/admin_controller.rb +1 -1
  31. data/app/controllers/spina/admin/attachments_controller.rb +10 -5
  32. data/app/controllers/spina/admin/images_controller.rb +51 -0
  33. data/app/controllers/spina/admin/media_folders_controller.rb +37 -0
  34. data/app/controllers/spina/admin/media_picker_controller.rb +28 -0
  35. data/app/controllers/spina/admin/pages_controller.rb +16 -6
  36. data/app/controllers/spina/admin/resources_controller.rb +33 -0
  37. data/app/controllers/spina/admin/settings_controller.rb +56 -0
  38. data/app/controllers/spina/pages_controller.rb +0 -6
  39. data/app/helpers/spina/admin/pages_helper.rb +2 -2
  40. data/app/helpers/spina/admin_nav_helper.rb +7 -0
  41. data/app/helpers/spina/files_helper.rb +9 -0
  42. data/app/helpers/spina/images_helper.rb +17 -0
  43. data/app/helpers/spina/pages_helper.rb +17 -0
  44. data/app/models/concerns/spina/image_collectable.rb +23 -0
  45. data/app/models/concerns/spina/part.rb +7 -4
  46. data/app/models/spina/account.rb +10 -14
  47. data/app/models/spina/attachment.rb +8 -10
  48. data/app/models/spina/attachment_collection.rb +6 -1
  49. data/app/models/spina/current.rb +5 -0
  50. data/app/models/spina/image.rb +26 -0
  51. data/app/models/spina/{photo_collection.rb → image_collection.rb} +6 -6
  52. data/app/models/spina/image_collections_image.rb +6 -0
  53. data/app/models/spina/line.rb +1 -0
  54. data/app/models/spina/media_folder.rb +7 -0
  55. data/app/models/spina/navigation.rb +4 -0
  56. data/app/models/spina/navigation_item.rb +1 -1
  57. data/app/models/spina/page.rb +18 -13
  58. data/app/models/spina/page_part.rb +1 -0
  59. data/app/models/spina/resource.rb +16 -0
  60. data/app/models/spina/setting.rb +7 -0
  61. data/app/models/spina/structure.rb +2 -0
  62. data/app/models/spina/structure_item.rb +2 -0
  63. data/app/models/spina/structure_part.rb +2 -1
  64. data/app/models/spina/text.rb +1 -0
  65. data/app/views/dummy/show.html.haml +1 -0
  66. data/app/views/layouts/spina/admin/media_library.html.haml +6 -3
  67. data/app/views/layouts/spina/admin/pages.html.haml +4 -1
  68. data/app/views/layouts/spina/admin/resources.html.haml +10 -0
  69. data/app/views/spina/admin/accounts/style.html.haml +3 -2
  70. data/app/views/spina/admin/attachments/_attachment.html.haml +3 -3
  71. data/app/views/spina/admin/attachments/_select.html.haml +7 -15
  72. data/app/views/spina/admin/attachments/_select_collection.html.haml +7 -14
  73. data/app/views/spina/admin/attachments/create.js.erb +1 -3
  74. data/app/views/spina/admin/attachments/index.html.haml +4 -3
  75. data/app/views/spina/admin/attachments/insert.js.erb +5 -0
  76. data/app/views/spina/admin/image_collections/_image_collection.html.haml +5 -0
  77. data/app/views/spina/admin/images/_form.html.haml +5 -0
  78. data/app/views/spina/admin/images/_image.html.haml +10 -0
  79. data/app/views/spina/admin/images/create.js.erb +8 -0
  80. data/app/views/spina/admin/images/index.html.haml +22 -0
  81. data/app/views/spina/admin/images/index.js.erb +7 -0
  82. data/app/views/spina/admin/media_folders/_form.html.haml +14 -0
  83. data/app/views/spina/admin/media_folders/_media_folder.html.haml +8 -0
  84. data/app/views/spina/admin/media_folders/new.js.erb +1 -0
  85. data/app/views/spina/admin/media_folders/show.html.haml +17 -0
  86. data/app/views/spina/admin/media_picker/_modal.html.haml +26 -0
  87. data/app/views/spina/admin/media_picker/infinite_scroll.js.erb +5 -0
  88. data/app/views/spina/admin/media_picker/select.js.erb +28 -0
  89. data/app/views/spina/admin/media_picker/show.js.erb +1 -0
  90. data/app/views/spina/admin/navigations/_page.html.haml +2 -2
  91. data/app/views/spina/admin/navigations/edit.html.haml +1 -1
  92. data/app/views/spina/admin/pages/_form.html.haml +21 -15
  93. data/app/views/spina/admin/pages/_form_advanced.html.haml +53 -43
  94. data/app/views/spina/admin/pages/_form_page_content.html.haml +1 -1
  95. data/app/views/spina/admin/pages/_form_page_seo.html.haml +1 -1
  96. data/app/views/spina/admin/pages/_page_nested_list.html.haml +3 -3
  97. data/app/views/spina/admin/pages/index.html.haml +1 -1
  98. data/app/views/spina/admin/{page_partables → partables}/attachment_collections/_form.html.haml +1 -1
  99. data/app/views/spina/admin/{page_partables → partables}/attachments/_form.html.haml +4 -4
  100. data/app/views/spina/admin/partables/image_collections/_form.html.haml +16 -0
  101. data/app/views/spina/admin/partables/images/_form.html.haml +14 -0
  102. data/app/views/spina/admin/{page_partables → partables}/lines/_form.html.haml +1 -1
  103. data/app/views/spina/admin/{structure_partables → partables}/options/_form.html.haml +1 -1
  104. data/app/views/spina/admin/partables/photo_collections/_form.html.haml +4 -0
  105. data/app/views/spina/admin/partables/photos/_form.html.haml +4 -0
  106. data/app/views/spina/admin/{page_partables → partables}/structures/_form.html.haml +3 -3
  107. data/app/views/spina/admin/{page_partables → partables}/texts/_form.html.haml +1 -1
  108. data/app/views/spina/admin/password_resets/edit.html.haml +1 -1
  109. data/app/views/spina/admin/password_resets/new.html.haml +1 -1
  110. data/app/views/spina/admin/resources/edit.html.haml +49 -0
  111. data/app/views/spina/admin/resources/show.html.haml +14 -0
  112. data/app/views/spina/admin/sessions/new.html.haml +1 -1
  113. data/app/views/spina/admin/settings/_string_field.html.haml +4 -0
  114. data/app/views/spina/admin/settings/_wysiwyg_field.html.haml +4 -0
  115. data/app/views/spina/admin/settings/edit.html.haml +13 -0
  116. data/app/views/spina/admin/shared/_primary_navigation.html.haml +13 -5
  117. data/app/views/spina/admin/shared/_rich_text_field.html.haml +10 -10
  118. data/app/views/spina/admin/structure_items/_fields.html.haml +1 -1
  119. data/app/views/spina/admin/structure_partables/attachment_collections/_form.html.haml +14 -0
  120. data/app/views/spina/admin/structure_partables/attachments/_form.html.haml +13 -0
  121. data/app/views/spina/shared/_analytics.html.erb +8 -8
  122. data/app/views/spina/shared/_navigation.html.haml +3 -3
  123. data/app/views/spina/shared/_spina_link.html.haml +2 -0
  124. data/app/views/spina/sitemaps/show.xml.builder +2 -2
  125. data/config/initializers/assets.rb +6 -1
  126. data/config/locales/TH.yml +243 -0
  127. data/config/locales/bg.yml +250 -0
  128. data/config/locales/de.yml +67 -22
  129. data/config/locales/en.yml +29 -2
  130. data/config/locales/es.yml +58 -1
  131. data/config/locales/fr.yml +80 -32
  132. data/config/locales/id.yml +228 -0
  133. data/config/locales/nl.yml +32 -0
  134. data/config/locales/pl.yml +225 -0
  135. data/config/locales/pt-BR.yml +34 -3
  136. data/config/locales/ro.yml +225 -0
  137. data/config/locales/ru.yml +10 -0
  138. data/config/locales/sv.yml +223 -0
  139. data/config/routes.rb +13 -13
  140. data/db/migrate/10_create_spina_image_collections.rb +16 -0
  141. data/db/migrate/11_create_spina_resources.rb +15 -0
  142. data/db/migrate/1_create_spina_tables.rb +0 -19
  143. data/db/migrate/2_create_spina_translation_tables.rb +36 -6
  144. data/db/migrate/7_create_spina_settings.rb +11 -0
  145. data/db/migrate/8_create_spina_media_folders.rb +8 -0
  146. data/db/migrate/9_create_spina_images.rb +10 -0
  147. data/lib/generators/spina/install_generator.rb +2 -2
  148. data/lib/generators/spina/templates/app/views/default/pages/homepage.html.haml +3 -2
  149. data/lib/generators/spina/templates/app/views/default/pages/show.html.haml +2 -2
  150. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +3 -5
  151. data/lib/generators/spina/templates/app/views/demo/pages/demo.html.haml +20 -23
  152. data/lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml +2 -2
  153. data/lib/generators/spina/templates/app/views/demo/pages/show.html.haml +2 -2
  154. data/lib/generators/spina/templates/app/views/demo/shared/_navigation.html.haml +3 -5
  155. data/lib/generators/spina/templates/config/initializers/mobility.rb +6 -0
  156. data/lib/generators/spina/templates/config/initializers/spina.rb +3 -0
  157. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +7 -7
  158. data/lib/spina.rb +0 -1
  159. data/lib/spina/engine.rb +6 -7
  160. data/lib/spina/plugin.rb +48 -3
  161. data/lib/spina/version.rb +1 -1
  162. data/vendor/assets/javascripts/spina/stimulus.umd.js +5 -0
  163. data/vendor/assets/javascripts/spina/trix.js +10 -9
  164. metadata +106 -103
  165. data/app/assets/images/spina/danger-zone-ribbon.png +0 -0
  166. data/app/assets/images/spina/spina_small.png +0 -0
  167. data/app/assets/javascripts/spina/admin/infinite_scroll.coffee +0 -25
  168. data/app/controllers/spina/admin/photos_controller.rb +0 -100
  169. data/app/models/concerns/spina/photo_collectable.rb +0 -24
  170. data/app/models/spina/photo.rb +0 -29
  171. data/app/models/spina/photo_collections_photo.rb +0 -6
  172. data/app/presenters/spina/pages/menu_presenter.rb +0 -63
  173. data/app/uploaders/spina/default_store_uploader.rb +0 -15
  174. data/app/uploaders/spina/file_uploader.rb +0 -6
  175. data/app/uploaders/spina/logo_uploader.rb +0 -13
  176. data/app/uploaders/spina/photo_uploader.rb +0 -23
  177. data/app/views/spina/admin/attachments/_fields.html.haml +0 -8
  178. data/app/views/spina/admin/attachments/insert.js.coffee +0 -5
  179. data/app/views/spina/admin/page_partables/options/_form.html.haml +0 -6
  180. data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +0 -17
  181. data/app/views/spina/admin/page_partables/photos/_form.html.haml +0 -14
  182. data/app/views/spina/admin/photos/_photo.html.haml +0 -8
  183. data/app/views/spina/admin/photos/_photo_collection.html.haml +0 -5
  184. data/app/views/spina/admin/photos/_photo_collection_select.html.haml +0 -23
  185. data/app/views/spina/admin/photos/_photo_link.html.haml +0 -11
  186. data/app/views/spina/admin/photos/_photo_multi_picker.html.haml +0 -3
  187. data/app/views/spina/admin/photos/_photo_select.html.haml +0 -16
  188. data/app/views/spina/admin/photos/_photo_single_picker.html.haml +0 -3
  189. data/app/views/spina/admin/photos/_photo_uploaded.html.haml +0 -4
  190. data/app/views/spina/admin/photos/_trix_select.html.haml +0 -11
  191. data/app/views/spina/admin/photos/create.js.erb +0 -4
  192. data/app/views/spina/admin/photos/index.html.haml +0 -13
  193. data/app/views/spina/admin/photos/index.js.erb +0 -5
  194. data/app/views/spina/admin/photos/insert_photo.js.erb +0 -10
  195. data/app/views/spina/admin/photos/insert_photo_collection.js.erb +0 -25
  196. data/app/views/spina/admin/photos/link.js.erb +0 -2
  197. data/app/views/spina/admin/photos/multi_picker_infinite_scroll.js.erb +0 -6
  198. data/app/views/spina/admin/photos/photo_collection_select.js.erb +0 -3
  199. data/app/views/spina/admin/photos/photo_select.js.erb +0 -3
  200. data/app/views/spina/admin/photos/single_picker_infinite_scroll.js.erb +0 -6
  201. data/app/views/spina/admin/photos/trix_infinite_scroll.js.erb +0 -4
  202. data/app/views/spina/admin/photos/trix_insert.js.erb +0 -2
  203. data/app/views/spina/admin/photos/trix_select.js.erb +0 -3
  204. data/app/views/spina/admin/structure_partables/lines/_form.html.haml +0 -5
  205. data/app/views/spina/admin/structure_partables/photo_collections/_form.html.haml +0 -17
  206. data/app/views/spina/admin/structure_partables/photos/_form.html.haml +0 -11
  207. data/app/views/spina/admin/structure_partables/texts/_form.html.haml +0 -5
  208. data/config/initializers/spina.rb +0 -0
  209. data/lib/generators/spina/templates/config/initializers/carrierwave.rb +0 -17
  210. data/lib/spina/railtie.rb +0 -9
@@ -4,22 +4,14 @@
4
4
  %h3= t('spina.attachments.insert')
5
5
 
6
6
  %section
7
- -# = form_for [spina, :admin, @attachment], html: {multipart: true} do |f|
8
- -# = f.file_field :file, data: {customfileinput: true}
9
-
10
- = form_tag spina.insert_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment', style: 'margin-bottom: 0' do
11
- .table-container
12
- %table.table.table-clickable
13
- %thead
14
- %tr
15
- %th
16
- %th= Spina::Attachment.human_attribute_name(:name)
17
- %tbody
18
- - @attachments.each do |attachment|
19
- %tr
20
- %td= radio_button_tag :attachment_id, attachment.id, attachment.id == @selected_attachment_id
21
- %td= attachment.name
7
+ = form_tag spina.insert_admin_attachments_path(params[:page_part_id]), remote: true, class: 'document-select' do
8
+ = hidden_field_tag :hidden_field_id, @hidden_field_id
22
9
 
10
+ %ul
11
+ - @attachments.each do |attachment|
12
+ %li.item
13
+ = radio_button_tag :attachment_id, attachment.id, attachment.id == @selected_attachment_id
14
+ = label_tag "attachment_id_#{attachment.id}", attachment.name
23
15
  %footer
24
16
  = link_to t('spina.cancel'), "#", data: {dismiss: 'modal'}
25
17
  = button_tag t('spina.attachments.insert'), type: 'submit', class: 'primary', data: {icon: 't '}
@@ -4,22 +4,15 @@
4
4
  %h3= t('spina.attachments.insert_multiple')
5
5
 
6
6
  %section
7
- -# = form_for [spina, :admin, @attachment], html: {multipart: true} do |f|
8
- -# = f.file_field :file, data: {customfileinput: true}
9
-
10
- = form_tag spina.insert_collection_admin_attachments_path(params[:page_part_id]), remote: true, class: 'gallery-prepend-attachment', style: 'margin-bottom: 0' do
7
+ = form_tag spina.insert_collection_admin_attachments_path(params[:page_part_id]), remote: true, class: 'document-select' do
11
8
  .table-container
12
- %table.table.table-clickable
13
- %thead
9
+ %table.table.table-clickable-tr{style: 'margin-top: 0'}
10
+ - @attachments.each do |attachment|
14
11
  %tr
15
- %th
16
- %th= Spina::Attachment.human_attribute_name(:name)
17
- %tbody
18
- - @attachments.each do |attachment|
19
- %tr
20
- %td= check_box_tag 'attachment_ids[]', attachment.id, attachment.id.in?(@selected_attachment_ids)
21
- %td= attachment.name
22
-
12
+ %td
13
+ .form-checkbox
14
+ = check_box_tag 'attachment_ids[]', attachment.id, attachment.id.in?(@selected_attachment_ids), id: "attachment_id_#{attachment.id}"
15
+ = label_tag "attachment_id_#{attachment.id}", attachment.name
23
16
  %footer
24
17
  = link_to t('spina.cancel'), "#", data: {dismiss: 'modal'}
25
18
  = button_tag t('spina.attachments.insert_multiple'), type: 'submit', class: 'primary', data: {icon: 't '}
@@ -1,3 +1 @@
1
- <% unless @attachment.new_record? %>
2
- $(".table-prepend-document").prepend("<%= j render partial: 'spina/admin/attachments/attachment', object: @attachment %>");
3
- <% end %>
1
+ $(".table-prepend-document").prepend("<%= j render partial: 'spina/admin/attachments/attachment', collection: @attachments %>");
@@ -7,9 +7,10 @@
7
7
  %th= Spina::Attachment.human_attribute_name(:created_at)
8
8
  %th
9
9
  %tr
10
- %td{colspan: 5}
11
- = form_for [spina, :admin, @attachment], html: {multipart: true, class: "new_document", style: 'margin-bottom: 0'} do |f|
12
- = f.file_field :file, data: {customfileinput: true}
10
+ %td{colspan: 4}
11
+ = form_with model: [:admin, Spina::Attachment.new], class: 'new_document', style: 'margin-bottom: 0' do |f|
12
+ = f.submit style: 'display: none'
13
+ = f.file_field :files, multiple: true, data: {direct_upload_url: main_app.rails_direct_uploads_url, customfileinput: true}
13
14
 
14
15
  %tbody.table-prepend-document
15
16
  = render partial: 'spina/admin/attachments/attachment', collection: @attachments
@@ -0,0 +1,5 @@
1
+ var hidden_input = $("input[name='<%= j params[:page_part_id] %>[partable_id]'], input[name='<%= j params[:page_part_id] %>[structure_partable_id]'], input[data-hidden-field-id='<%= j params[:hidden_field_id] %>']");
2
+ hidden_input.parents('.media_picker').find('.attachment').remove();
3
+ hidden_input.parents('.media_picker').append("<div class='attachment'><%= @attachment.name %></div>");
4
+ hidden_input.val("<%= @attachment.id %>");
5
+ $.hideModal();
@@ -0,0 +1,5 @@
1
+ - if images.present?
2
+ %ul.sortable-grid
3
+ - images.each do |image|
4
+ %li.image{data: {image_id: image.id}}
5
+ = image_tag variant(image.file, resize: '300x300^', crop: "300x300+0+0")
@@ -0,0 +1,5 @@
1
+ = form_for [:admin, Spina::Image.new], id: 'new_image', class: 'new_image', data: {remote: true} do |f|
2
+ = f.submit style: 'display: none'
3
+ = hidden_field_tag :media_library, value: true
4
+ = f.label :file, t('spina.images.upload')
5
+ = f.file_field :files, multiple: true, accept: "image/*", data: {direct_upload_url: main_app.rails_direct_uploads_url, customfileinput: true}
@@ -0,0 +1,10 @@
1
+ .item.image{class: ('selected' if image.id.to_s.try(:in?, params[:selected_ids].to_a))}
2
+ - unless defined?(simple) && simple
3
+ .overlay
4
+ = link_to admin_image_path(image), method: :delete, class: 'icon-only delete-photo-link', data: {confirm: t('spina.images.delete_confirmation')} do
5
+ = t('spina.images.delete')
6
+ %span.photo-name= truncate(image.name, length: 125)
7
+ = radio_button_tag :image_id, image.id
8
+ = check_box_tag 'image_ids[]', image.id, image.id.to_s.try(:in?, params[:selected_ids].to_a)
9
+
10
+ = image_tag main_app.url_for(image.variant(resize: '300x300^', crop: "300x300+0+0"))
@@ -0,0 +1,8 @@
1
+ <% @images.each do |image| %>
2
+ $item = $("<%=j render partial: 'spina/admin/images/image', object: image %>");
3
+ $(".gallery-prepend-image .infinite-scroll").prepend($item);
4
+ <% end %>
5
+
6
+ $('.gallery .new-image-form').html("<%=j render 'form' %>").find('input[type="file"]').each(function() {
7
+ $(this).customFileInput();
8
+ });
@@ -0,0 +1,22 @@
1
+ - content_for(:header_actions) do
2
+ - if @media_folders.any?
3
+ = link_to '#', class: 'button organize-switch', data: {organize_images: t('spina.photos.organize'), done_organizing: t('spina.photos.done_organizing')} do
4
+ = icon('random')
5
+ = t('spina.photos.organize')
6
+
7
+ = link_to new_admin_media_folder_path, class: 'button button-primary', style: 'margin-right: 0; margin-left: 4px', data: {remote: true} do
8
+ = icon('plus')
9
+ =t 'spina.photos.new_folder'
10
+
11
+ .gallery-container
12
+ .gallery
13
+ .item.new-image-form
14
+ = render 'form'
15
+
16
+ = render partial: 'spina/admin/media_folders/media_folder', collection: @media_folders
17
+
18
+ .gallery-prepend-image
19
+ .infinite-scroll
20
+ = render partial: 'spina/admin/images/image', collection: @images
21
+
22
+ .infinite-pagination{data: {controller: 'infinite-scroll'}}= link_to_next_page @images, 'Next', remote: true, data: {target: "infinite-scroll.link"}
@@ -0,0 +1,7 @@
1
+ // Append new data
2
+ $("<%=j render partial: 'spina/admin/images/image', collection: @images %>").appendTo($(".infinite-scroll"));
3
+
4
+ // Update pagination link
5
+ $('.infinite-pagination').html("<%= j link_to_next_page @images, 'Next', remote: true, data: {target: 'infinite-scroll.link'} %>");
6
+
7
+ $('.infinite-scroll .item:not(.ui-draggable)').draggable({revert: 'invalid', disabled: true});
@@ -0,0 +1,14 @@
1
+ .modal
2
+ %header
3
+ = link_to '#', data: {dismiss: "modal"} do
4
+ = icon('cross')
5
+ %h3=t 'spina.photos.new_folder'
6
+
7
+ = form_for [spina, :admin, @media_folder] do |f|
8
+ %section
9
+ = f.text_field :name, placeholder: Spina::MediaFolder.human_attribute_name(:name)
10
+ %footer
11
+ = link_to t('spina.cancel'), '#', data: {dismiss: 'modal'}
12
+ = button_tag type: :submit, class: 'primary' do
13
+ %i.icon.icon-plus{style: 'margin-right: 4px'}
14
+ =t 'spina.photos.new_folder'
@@ -0,0 +1,8 @@
1
+ = link_to [:admin, media_folder], class: 'item media-folder', data: {add_to_media_folder_url: add_to_media_folder_admin_images_url(media_folder)} do
2
+ .media-folder-thumbnail{data: {badge: media_folder.images.count}}
3
+ - if media_folder.images.any?
4
+ = image_tag variant(media_folder.images.last.file, resize: '144x144^', crop: "144x144+0+0")
5
+ - else
6
+ = image_tag 'spina/media_folder_placeholder.png'
7
+ .media-folder-shadow
8
+ .media-folder-name= media_folder.name
@@ -0,0 +1 @@
1
+ $("<%=j render 'form' %>").modal()
@@ -0,0 +1,17 @@
1
+ - content_for(:header_actions) do
2
+ = link_to t('spina.photos.delete_folder'), spina.admin_media_folder_path(@media_folder), class: 'button button-danger button-link', style: "margin-right: 0", data: {method: :delete, confirm: t('spina.delete_confirmation', subject: @media_folder.name)}
3
+
4
+ .gallery-container
5
+ .gallery
6
+ .item
7
+ = form_with model: [:admin, Spina::Image.new], id: 'new_image', class: 'new_image' do |f|
8
+ = f.submit style: 'display: none'
9
+ = hidden_field_tag :media_library, value: @media_folder.id
10
+ = f.label :file, t('spina.images.upload')
11
+ = f.file_field :files, multiple: true, data: {direct_upload_url: main_app.rails_direct_uploads_url, customfileinput: true}
12
+
13
+ .gallery-prepend-image
14
+ .infinite-scroll
15
+ = render partial: 'spina/admin/images/image', collection: @images
16
+
17
+ .infinite-pagination{data: {controller: 'infinite-scroll'}}= link_to_next_page @images, 'Next', remote: true, data: {target: "infinite-scroll.link"}
@@ -0,0 +1,26 @@
1
+ .modal.modal-large
2
+ %section
3
+ .gallery-select.gallery{data: {multiselect: defined?(multiple) && multiple}}
4
+ .item.item-small.item-uploader.new-image-form
5
+ = render partial: 'spina/admin/images/form'
6
+
7
+ = form_with url: admin_media_picker_path, class: 'gallery-prepend-image' do
8
+ = hidden_field_tag :hidden_field_id, params[:hidden_field_id]
9
+ = hidden_field_tag :trix_editor_id, params[:trix_editor_id]
10
+ = check_box_tag :multiple, true, defined?(multiple) && multiple, style: 'display: none'
11
+
12
+ .infinite-scroll
13
+ = render partial: 'spina/admin/images/image', collection: @images
14
+
15
+ .infinite-pagination{data: {controller: 'infinite-scroll'}}= link_to_next_page @images, 'Next', params: params, remote: true, data: {target: "infinite-scroll.link"}
16
+
17
+ - if defined?(multiple) && multiple
18
+ .gallery-select-action-bar
19
+ .pull-right
20
+ = link_to t('spina.cancel'), "#", class: 'button button-link', data: {dismiss: 'modal'}
21
+ = button_tag type: 'submit', class: 'button button-primary button-large', style: 'margin-bottom: 0px' do
22
+ = icon('plus')
23
+ = t('spina.images.choose_images')
24
+ %span.gallery-select-counter
25
+ - if params[:selected_ids].try(:any?)
26
+ (#{ params[:selected_ids].count })
@@ -0,0 +1,5 @@
1
+ // Append new data
2
+ $("<%=j render partial: 'spina/admin/images/image', collection: @images %>").appendTo($(".infinite-scroll"));
3
+
4
+ // Update pagination link
5
+ $('.infinite-pagination').html("<%= j link_to_next_page @images, 'Next', params: params.slice(:selected_photo_id).permit(:selected_photo_id), remote: true, data: {target: 'infinite-scroll.link'} %>")
@@ -0,0 +1,28 @@
1
+ let hidden_input = $("input[data-hidden-field-id='<%= j params[:hidden_field_id] %>']");
2
+ hidden_input.parents('.media_picker').find('.image').remove();
3
+
4
+ <% if @image.present? %>
5
+ hidden_input.parents('.media_picker').append("<%=j render partial: 'spina/admin/images/image', object: @image, locals: {simple: true} %>");
6
+ hidden_input.val("<%= @image.id %>");
7
+
8
+ // Trix editor
9
+ $('#<%= params[:trix_editor_id] %>').trigger('image-insert', '<%= main_app.url_for(@image.variant(resize: "800x800")) %>');
10
+ $.hideModal();
11
+ <% end %>
12
+
13
+ <% if @images.present? %>
14
+ let image_collection = $("<%= j render partial: 'spina/admin/image_collections/image_collection', locals: {images: @images} %>");
15
+ hidden_input.parents('.horizontal-form-content').find('.image-collection').html(image_collection);
16
+ hidden_input.val("<%= @images.map(&:id).join(',') %>");
17
+ <% end %>
18
+
19
+ $('.sortable-grid').sortable().bind('sortupdate', function(e) {
20
+ position_array = [];
21
+ $(e.target).find('li.image').each(function(index) {
22
+ position_array.push($(this).data('image-id'));
23
+ });
24
+ $(e.target).parents('.horizontal-form-content').find('.images-positions').val(position_array.join(","));
25
+ });
26
+ $('.sortable-grid').trigger('sortupdate');
27
+
28
+ $.hideModal();
@@ -0,0 +1 @@
1
+ $("<%=j render partial: 'modal', locals: {multiple: params[:multiple]} %>").modal();
@@ -4,5 +4,5 @@
4
4
  = check_box_tag 'navigation[page_ids][]', page.id, @navigation.page_ids.include?(page.id)
5
5
  = label_tag page.title
6
6
 
7
- - if page.children.any?
8
- = render partial: 'page', collection: page.children.sorted
7
+ - if page.children.regular_pages.any?
8
+ = render partial: 'page', collection: page.children.sorted.regular_pages
@@ -10,7 +10,7 @@
10
10
  .well
11
11
  .table-container
12
12
  %table.table.table-clickable
13
- %tbody= render partial: 'page', collection: Spina::Page.sorted.roots
13
+ %tbody= render partial: 'page', collection: Spina::Page.sorted.roots.regular_pages
14
14
 
15
15
  .well
16
16
  .horizontal-form
@@ -10,18 +10,24 @@
10
10
 
11
11
  = form_for [spina, :admin, @page], html: {id: 'page_form', autocomplete: "off"} do |f|
12
12
  %header#header
13
- .breadcrumbs= render_breadcrumbs separator: '<div class="divider"></div>'
14
- - unless @page.new_record?
15
- - if Spina.config.locales.size > 1
16
- %div{style: 'display: inline-block; margin-left: 12px; position: absolute', data: {dropdown: true}}
17
- = link_to '#', class: 'button button-link button-round button-small', data: {trigger: 'dropdown', target: '#locales'} do
18
- = icon('comment')
19
- = @locale.upcase
20
-
21
- %ul#locales
22
- - Spina.config.locales.each do |locale|
23
- %li
24
- = link_to t("languages.#{locale}"), "?locale=#{locale}", style: ('font-weight: 600' if @locale.to_s == locale.to_s)
13
+ .breadcrumbs
14
+ = render_breadcrumbs separator: '<div class="divider"></div>'
15
+ %span{style: 'margin-left: 10px'}
16
+ - unless @page.new_record?
17
+ - if Spina.config.locales.size > 1
18
+ %div{style: "display: inline-block", data: {dropdown: true}}
19
+ = link_to '#', class: 'button button-hollow button-small', style: 'margin-left: 0; margin-right: 0', data: {trigger: 'dropdown', target: '#locales'} do
20
+ = icon('comment')
21
+ =t "languages.#{@locale}"
22
+ %i.icon.icon-chevron-down{style: 'font-size: 9px; margin-right: 0'}
23
+
24
+ %ul#locales
25
+ - Spina.config.locales.each do |locale|
26
+ %li
27
+ = link_to t("languages.#{locale}"), "?locale=#{locale}", style: ('font-weight: 600' if @locale.to_s == locale.to_s)
28
+
29
+ = link_to @page.materialized_path, target: :blank, class: 'button button-hollow button-small', style: 'margin-left: 0' do
30
+ %i.icon.icon-export{style: 'margin: 0'}
25
31
 
26
32
  #header_actions
27
33
  %button.button.button-primary{type: 'submit', style: 'margin-right: 0', data: {disable_with: t('spina.pages.saving')}}
@@ -36,9 +42,9 @@
36
42
 
37
43
  = hidden_field_tag :locale, @locale
38
44
 
39
- - Globalize.with_locale(@locale) do
45
+ - Mobility.with_locale(@locale) do
40
46
  - @tabs.each do |tab|
41
47
  = render "spina/admin/pages/form_#{tab}", f: f
42
48
 
43
- - unless @page.new_record? || !@page.deletable
44
- .pull-right= link_to t('spina.permanently_delete'), spina.admin_page_path(@page), method: :delete, data: {confirm: t('spina.pages.delete_confirmation', subject: @page.menu_title)}, class: 'button button-link button-danger'
49
+ - unless @page.new_record? || !@page.deletable
50
+ .pull-right= link_to t('spina.permanently_delete'), spina.admin_page_path(@page), method: :delete, data: {confirm: t('spina.pages.delete_confirmation', subject: @page.menu_title)}, class: 'button button-link button-danger'
@@ -1,47 +1,57 @@
1
- #advanced.tab-content.well
1
+ #advanced.tab-content
2
2
  .horizontal-form
3
- .horizontal-form-group
4
- .horizontal-form-label
5
- = Spina::Page.human_attribute_name :draft
6
- %small= Spina::Page.human_attribute_name :draft_description
7
- .horizontal-form-content
8
- = f.check_box :draft, data: {switch: true}
3
+ .well
4
+ .horizontal-form-group
5
+ .horizontal-form-label
6
+ = Spina::Page.human_attribute_name :draft
7
+ %small= Spina::Page.human_attribute_name :draft_description
8
+ .horizontal-form-content
9
+ = f.check_box :draft, data: {switch: true}
10
+ .horizontal-form-group
11
+ .horizontal-form-label
12
+ = Spina::Page.human_attribute_name :show_in_menu
13
+ %small= Spina::Page.human_attribute_name :show_in_menu_description
14
+ .horizontal-form-content
15
+ = f.check_box :show_in_menu, data: {switch: true}
16
+ .horizontal-form-group
17
+ .horizontal-form-label
18
+ = Spina::Page.human_attribute_name :menu_title
19
+ .horizontal-form-content
20
+ = f.text_field :menu_title, placeholder: Spina::Page.human_attribute_name(:show_in_menu_placeholder), value: f.object.menu_title(fallback: false, default: nil)
21
+ .horizontal-form-group
22
+ .horizontal-form-label
23
+ = Spina::Page.human_attribute_name :skip_to_first_child
24
+ %small= Spina::Page.human_attribute_name :skip_to_first_child_description
25
+ .horizontal-form-content
26
+ = f.check_box :skip_to_first_child, data: {switch: true}
9
27
 
10
- .horizontal-form-group
11
- .horizontal-form-label
12
- = Spina::Page.human_attribute_name :skip_to_first_child
13
- %small= Spina::Page.human_attribute_name :skip_to_first_child_description
14
- .horizontal-form-content
15
- = f.check_box :skip_to_first_child, data: {switch: true}
16
- .horizontal-form-group
17
- .horizontal-form-label
18
- = Spina::Page.human_attribute_name :link_url
19
- %small= Spina::Page.human_attribute_name :link_url_description
20
- .horizontal-form-content
21
- = f.text_field :link_url, placeholder: Spina::Page.human_attribute_name(:link_url_placeholder)
22
- .horizontal-form-group
23
- .horizontal-form-label
24
- = Spina::Page.human_attribute_name :show_in_menu
25
- %small= Spina::Page.human_attribute_name :show_in_menu_description
26
- .horizontal-form-content
27
- = f.check_box :show_in_menu, data: {switch: true}
28
- .horizontal-form-group
29
- .horizontal-form-label
30
- = Spina::Page.human_attribute_name :menu_title
31
- .horizontal-form-content
32
- = f.text_field :menu_title, placeholder: Spina::Page.human_attribute_name(:show_in_menu_placeholder), value: f.object.read_attribute(:menu_title)
28
+ .well
29
+ .horizontal-form-group
30
+ .horizontal-form-label
31
+ = Spina::Page.human_attribute_name :link_url
32
+ %small= Spina::Page.human_attribute_name :link_url_description
33
+ .horizontal-form-content
34
+ = f.text_field :link_url, placeholder: Spina::Page.human_attribute_name(:link_url_placeholder)
33
35
 
34
- .horizontal-form-group{style: ('display: none' if @page.custom_page?)}
35
- .horizontal-form-label
36
- = Spina::Page.human_attribute_name :view_template
37
- .horizontal-form-content
38
- .select-dropdown.page-template{data: {page_parts: @page.view_template_config(current_theme)[:page_parts]}}
39
- - options = options_for_select(current_theme.view_templates.map { |template| [template[:title], template[:name], {'data-page-parts' => template[:page_parts]}] }, @page.view_template)
40
- = f.select :view_template, options
36
+ .well
37
+ .horizontal-form-group
38
+ .horizontal-form-label
39
+ = Spina::Page.human_attribute_name :ancestry
40
+ .horizontal-form-content
41
+ .select-dropdown.ancestry
42
+ = f.select :parent_id, page_ancestry_options(f.object), include_blank: Spina::Page.human_attribute_name(:no_parent)
41
43
 
42
- .horizontal-form-group
43
- .horizontal-form-label
44
- = Spina::Page.human_attribute_name :ancestry
45
- .horizontal-form-content
46
- .select-dropdown.ancestry
47
- = f.select :parent_id, page_ancestry_options(f.object), include_blank: Spina::Page.human_attribute_name(:no_parent)
44
+ .horizontal-form-group{style: ('display: none' if @page.custom_page?)}
45
+ .horizontal-form-label
46
+ = Spina::Page.human_attribute_name :view_template
47
+ .horizontal-form-content
48
+ .select-dropdown.page-template{data: {page_parts: @page.view_template_config(current_theme)[:page_parts]}}
49
+ - options = options_for_select(current_theme.view_templates.map { |template| [template[:title], template[:name], {'data-page-parts' => template[:page_parts]}] }, @page.view_template)
50
+ = f.select :view_template, options
51
+
52
+ .horizontal-form-group
53
+ .horizontal-form-label
54
+ = Spina::Page.human_attribute_name :resource
55
+ .horizontal-form-content
56
+ .select-dropdown
57
+ = f.select :resource_id, Spina::Resource.order(:label).pluck(:label, :id), include_blank: t('spina.website.pages')
@@ -13,4 +13,4 @@
13
13
  = ff.hidden_field :name
14
14
 
15
15
  .horizontal-form-group.page-part{data: {name: ff.object.name}}
16
- = render "spina/admin/page_partables/#{ partable_type_partial_namespace(ff.object.page_partable_type) }/form", f: ff
16
+ = render "spina/admin/partables/#{ partable_type_partial_namespace(ff.object.page_partable_type) }/form", f: ff