spina 1.2.0 → 2.0.0.alpha

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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/spina/favicon.png +0 -0
  3. data/app/assets/javascripts/spina/admin/application.js +1 -2
  4. data/app/assets/javascripts/spina/admin/controllers/attachment_picker_controller.js +15 -0
  5. data/app/assets/javascripts/spina/admin/controllers/image_form_controller.js +5 -4
  6. data/app/assets/javascripts/spina/admin/controllers/infinite_scroll_controller.js +20 -22
  7. data/app/assets/javascripts/spina/admin/controllers/media_picker_controller.js +171 -0
  8. data/app/assets/javascripts/spina/admin/controllers/modal_controller.js +18 -0
  9. data/app/assets/javascripts/spina/admin/controllers/repeater_form_controller.js +38 -0
  10. data/app/assets/javascripts/spina/admin/media_gallery.coffee +0 -3
  11. data/app/assets/javascripts/spina/admin/notifications.coffee +1 -1
  12. data/app/assets/javascripts/spina/admin/pages.coffee.erb +3 -20
  13. data/app/assets/javascripts/spina/admin/scaffold.coffee +0 -3
  14. data/app/assets/javascripts/spina/admin/trix.coffee.erb +14 -18
  15. data/app/assets/stylesheets/spina.sass +10 -8
  16. data/app/assets/stylesheets/spina/_buttons.sass +57 -31
  17. data/app/assets/stylesheets/spina/_forms.sass +59 -73
  18. data/app/assets/stylesheets/spina/_gallery.sass +18 -2
  19. data/app/assets/stylesheets/spina/_media_picker.sass +133 -0
  20. data/app/assets/stylesheets/spina/_modal.sass +35 -2
  21. data/app/assets/stylesheets/spina/_notifications.sass +20 -14
  22. data/app/assets/stylesheets/spina/_pages.sass +131 -0
  23. data/app/assets/stylesheets/spina/_sortable_lists.sass +14 -8
  24. data/app/assets/stylesheets/spina/_trix_custom.sass +1 -1
  25. data/app/controllers/concerns/spina/frontend.rb +9 -0
  26. data/app/controllers/spina/admin/accounts_controller.rb +9 -13
  27. data/app/controllers/spina/admin/attachments_controller.rb +0 -22
  28. data/app/controllers/spina/admin/images_controller.rb +1 -1
  29. data/app/controllers/spina/admin/media_picker_controller.rb +18 -19
  30. data/app/controllers/spina/admin/pages_controller.rb +1 -5
  31. data/app/controllers/spina/admin/resources_controller.rb +9 -4
  32. data/app/controllers/spina/application_controller.rb +1 -1
  33. data/app/helpers/spina/admin/pages_helper.rb +22 -20
  34. data/app/helpers/spina/{files_helper.rb → attachments_helper.rb} +1 -1
  35. data/app/helpers/spina/images_helper.rb +6 -0
  36. data/app/helpers/spina/pages_helper.rb +23 -4
  37. data/app/models/concerns/spina/partable.rb +19 -7
  38. data/app/models/concerns/spina/translated_content.rb +19 -0
  39. data/app/models/spina/account.rb +3 -10
  40. data/app/models/spina/attachment.rb +0 -4
  41. data/app/models/spina/current.rb +1 -0
  42. data/app/models/spina/image.rb +0 -4
  43. data/app/models/spina/page.rb +7 -15
  44. data/app/models/spina/parts/attachment.rb +17 -0
  45. data/app/models/spina/parts/base.rb +12 -0
  46. data/app/models/spina/parts/image.rb +30 -0
  47. data/app/models/spina/parts/image_collection.rb +23 -0
  48. data/app/models/spina/parts/line.rb +7 -0
  49. data/app/models/spina/parts/option.rb +13 -0
  50. data/app/models/spina/parts/repeater.rb +10 -0
  51. data/app/models/spina/parts/repeater_content.rb +15 -0
  52. data/app/models/spina/parts/text.rb +7 -0
  53. data/app/models/spina/resource.rb +4 -0
  54. data/app/presenters/spina/content_presenter.rb +58 -0
  55. data/app/presenters/spina/menu_presenter.rb +2 -1
  56. data/app/views/layouts/spina/admin/admin.html.haml +3 -4
  57. data/app/views/layouts/spina/admin/pages.html.haml +5 -4
  58. data/app/views/spina/admin/accounts/_form.html.haml +13 -7
  59. data/app/views/spina/admin/accounts/analytics.html.haml +5 -3
  60. data/app/views/spina/admin/accounts/style.html.haml +26 -21
  61. data/app/views/spina/admin/images/index.html.haml +7 -5
  62. data/app/views/spina/admin/media_folders/show.html.haml +2 -2
  63. data/app/views/spina/admin/media_picker/_image.html.haml +3 -0
  64. data/app/views/spina/admin/media_picker/_media_picker.html.haml +32 -0
  65. data/app/views/spina/admin/media_picker/_media_picker_grid.html.haml +25 -0
  66. data/app/views/spina/admin/media_picker/infinite_scroll.js.erb +4 -4
  67. data/app/views/spina/admin/media_picker/select.js.erb +2 -0
  68. data/app/views/spina/admin/media_picker/show.html.haml +1 -0
  69. data/app/views/spina/admin/media_picker/show.js.erb +1 -1
  70. data/app/views/spina/admin/pages/_form.html.haml +9 -7
  71. data/app/views/spina/admin/pages/_form_advanced.html.haml +5 -5
  72. data/app/views/spina/admin/pages/_form_page_content.html.haml +14 -13
  73. data/app/views/spina/admin/pages/_form_page_seo.html.haml +9 -5
  74. data/app/views/spina/admin/pages/_page.html.haml +5 -3
  75. data/app/views/spina/admin/pages/_page_nested_list.html.haml +2 -3
  76. data/app/views/spina/admin/pages/index.html.haml +5 -4
  77. data/app/views/spina/admin/parts/attachments/_form.html.haml +6 -0
  78. data/app/views/spina/admin/parts/image_collections/_fields.html.haml +7 -0
  79. data/app/views/spina/admin/parts/image_collections/_form.html.haml +12 -0
  80. data/app/views/spina/admin/parts/images/_form.html.haml +18 -0
  81. data/app/views/spina/admin/parts/lines/_form.html.haml +2 -0
  82. data/app/views/spina/admin/parts/options/_form.html.haml +3 -0
  83. data/app/views/spina/admin/parts/repeaters/_fields.html.haml +15 -0
  84. data/app/views/spina/admin/parts/repeaters/_form.html.haml +18 -0
  85. data/app/views/spina/admin/parts/texts/_form.html.haml +6 -0
  86. data/app/views/spina/admin/resources/edit.html.haml +28 -5
  87. data/app/views/spina/admin/resources/show.html.haml +5 -2
  88. data/app/views/spina/admin/shared/_notifications.html.haml +4 -4
  89. data/db/migrate/12_add_url_title_to_spina_page_translations.rb +1 -1
  90. data/db/migrate/13_add_json_attributes_to_spina_accounts.rb +5 -0
  91. data/db/migrate/14_add_json_attributes_to_spina_pages.rb +5 -0
  92. data/db/migrate/15_add_slug_to_spina_resources.rb +5 -0
  93. data/lib/generators/spina/templates/app/views/demo/pages/demo.html.haml +13 -21
  94. data/lib/generators/spina/templates/app/views/demo/pages/homepage.html.haml +1 -1
  95. data/lib/generators/spina/templates/config/initializers/themes/default.rb +4 -4
  96. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +32 -44
  97. data/lib/spina.rb +2 -0
  98. data/lib/spina/attr_json_spina_parts_model.rb +29 -0
  99. data/lib/spina/engine.rb +13 -2
  100. data/lib/spina/part.rb +19 -0
  101. data/lib/spina/theme.rb +1 -1
  102. data/lib/spina/version.rb +1 -1
  103. data/vendor/assets/javascripts/spina/sortable.js +2 -2
  104. metadata +54 -42
  105. data/app/assets/javascripts/spina/admin/account.coffee +0 -16
  106. data/app/models/concerns/spina/image_collectable.rb +0 -23
  107. data/app/models/concerns/spina/optionable.rb +0 -12
  108. data/app/models/concerns/spina/part.rb +0 -38
  109. data/app/models/spina/attachment_collection.rb +0 -20
  110. data/app/models/spina/image_collection.rb +0 -23
  111. data/app/models/spina/image_collections_image.rb +0 -6
  112. data/app/models/spina/layout_part.rb +0 -22
  113. data/app/models/spina/line.rb +0 -10
  114. data/app/models/spina/option.rb +0 -17
  115. data/app/models/spina/page_part.rb +0 -22
  116. data/app/models/spina/structure.rb +0 -14
  117. data/app/models/spina/structure_item.rb +0 -22
  118. data/app/models/spina/structure_part.rb +0 -20
  119. data/app/models/spina/text.rb +0 -10
  120. data/app/views/dummy/show.html.haml +0 -1
  121. data/app/views/spina/admin/attachments/_attachment_collection.html.haml +0 -2
  122. data/app/views/spina/admin/attachments/_select.html.haml +0 -17
  123. data/app/views/spina/admin/attachments/_select_collection.html.haml +0 -18
  124. data/app/views/spina/admin/attachments/insert.js.erb +0 -5
  125. data/app/views/spina/admin/attachments/insert_collection.js.coffee +0 -7
  126. data/app/views/spina/admin/attachments/select.js.erb +0 -2
  127. data/app/views/spina/admin/attachments/select_collection.js.erb +0 -2
  128. data/app/views/spina/admin/image_collections/_image_collection.html.haml +0 -5
  129. data/app/views/spina/admin/layout_partables/lines/_form.html.haml +0 -2
  130. data/app/views/spina/admin/partables/attachment_collections/_form.html.haml +0 -14
  131. data/app/views/spina/admin/partables/attachments/_form.html.haml +0 -13
  132. data/app/views/spina/admin/partables/image_collections/_form.html.haml +0 -16
  133. data/app/views/spina/admin/partables/images/_form.html.haml +0 -21
  134. data/app/views/spina/admin/partables/lines/_form.html.haml +0 -5
  135. data/app/views/spina/admin/partables/options/_form.html.haml +0 -7
  136. data/app/views/spina/admin/partables/photo_collections/_form.html.haml +0 -4
  137. data/app/views/spina/admin/partables/photos/_form.html.haml +0 -4
  138. data/app/views/spina/admin/partables/structures/_form.html.haml +0 -21
  139. data/app/views/spina/admin/partables/texts/_form.html.haml +0 -8
  140. data/app/views/spina/admin/structure_items/_fields.html.haml +0 -15
  141. data/app/views/spina/admin/structure_partables/attachment_collections/_form.html.haml +0 -14
  142. data/app/views/spina/admin/structure_partables/attachments/_form.html.haml +0 -13
@@ -7,42 +7,48 @@
7
7
  = icon('check')
8
8
  = t('spina.preferences.account_save')
9
9
 
10
- .well
10
+ %div{style: "margin-top: 40px"}
11
11
  .horizontal-form
12
12
  .horizontal-form-group
13
13
  .horizontal-form-label
14
14
  = Spina::Account.human_attribute_name(:name)
15
15
  .horizontal-form-content
16
- = f.text_field :name, placeholder: Spina::Account.human_attribute_name(:name)
16
+ .page-form-control
17
+ = f.text_field :name, placeholder: Spina::Account.human_attribute_name(:name)
17
18
 
18
19
  .horizontal-form-group
19
20
  .horizontal-form-label
20
21
  = Spina::Account.human_attribute_name(:address)
21
22
  .horizontal-form-content
22
- = f.text_field :address, placeholder: Spina::Account.human_attribute_name(:address)
23
+ .page-form-control
24
+ = f.text_field :address, placeholder: Spina::Account.human_attribute_name(:address)
23
25
 
24
26
  .horizontal-form-group
25
27
  .horizontal-form-label
26
28
  = Spina::Account.human_attribute_name(:postal_code)
27
29
  .horizontal-form-content
28
- = f.text_field :postal_code, placeholder: Spina::Account.human_attribute_name(:postal_code)
30
+ .page-form-control
31
+ = f.text_field :postal_code, placeholder: Spina::Account.human_attribute_name(:postal_code)
29
32
 
30
33
  .horizontal-form-group
31
34
  .horizontal-form-label
32
35
  = Spina::Account.human_attribute_name(:city)
33
36
  .horizontal-form-content
34
- = f.text_field :city, placeholder: Spina::Account.human_attribute_name(:city)
37
+ .page-form-control
38
+ = f.text_field :city, placeholder: Spina::Account.human_attribute_name(:city)
35
39
 
36
40
  .horizontal-form-group
37
41
  .horizontal-form-label
38
42
  = Spina::Account.human_attribute_name(:phone)
39
43
  .horizontal-form-content
40
- = f.text_field :phone, placeholder: Spina::Account.human_attribute_name(:phone)
44
+ .page-form-control
45
+ = f.text_field :phone, placeholder: Spina::Account.human_attribute_name(:phone)
41
46
 
42
47
  .horizontal-form-group
43
48
  .horizontal-form-label
44
49
  = Spina::Account.human_attribute_name(:email)
45
50
  .horizontal-form-content
46
- = f.text_field :email, placeholder: Spina::Account.human_attribute_name(:email)
51
+ .page-form-control
52
+ = f.text_field :email, placeholder: Spina::Account.human_attribute_name(:email)
47
53
 
48
54
 
@@ -7,7 +7,7 @@
7
7
  = icon('check')
8
8
  = t('spina.preferences.analytics_save')
9
9
 
10
- .well
10
+ %div{style: "margin-top: 40px"}
11
11
  .horizontal-form
12
12
  .horizontal-form-group
13
13
  .horizontal-form-label
@@ -18,9 +18,11 @@
18
18
  .horizontal-form-label
19
19
  = Spina::Account.human_attribute_name(:google_analytics)
20
20
  .horizontal-form-content
21
- = f.text_field :google_analytics, placeholder: Spina::Account.human_attribute_name(:google_analytics)
21
+ .page-form-control
22
+ = f.text_field :google_analytics, placeholder: Spina::Account.human_attribute_name(:google_analytics)
22
23
  .horizontal-form-group
23
24
  .horizontal-form-label
24
25
  = Spina::Account.human_attribute_name(:google_site_verification)
25
26
  .horizontal-form-content
26
- = f.text_field :google_site_verification, placeholder: Spina::Account.human_attribute_name(:google_site_verification)
27
+ .page-form-control
28
+ = f.text_field :google_site_verification, placeholder: Spina::Account.human_attribute_name(:google_site_verification)
@@ -1,30 +1,35 @@
1
1
  = form_for [spina, :admin, current_account], url: spina.admin_account_path do |f|
2
2
  %header#header
3
- = render partial: 'spina/admin/shared/breadcrumbs'
3
+ .breadcrumbs
4
+ = render_breadcrumbs separator: '<div class="divider"></div>'
5
+ %span{style: 'margin-left: 10px'}
6
+ - if Spina.config.locales.size > 1
7
+ %div{style: "display: inline-block", data: {dropdown: true}}
8
+ = link_to '#', class: 'button button-default button-small', style: 'margin-left: 0; margin-right: 0', data: {trigger: 'dropdown', target: '#locales'} do
9
+ = icon('comment')
10
+ =t "spina.languages.#{@locale}"
11
+ %i.icon.icon-chevron-down{style: 'font-size: 9px; margin-right: 0'}
12
+
13
+ %ul#locales
14
+ - Spina.config.locales.each do |locale|
15
+ %li
16
+ = link_to t("spina.languages.#{locale}"), "?locale=#{locale}", style: ('font-weight: 600' if @locale.to_s == locale.to_s).to_s
4
17
 
5
18
  #header_actions
6
19
  %button.button.button-primary{type: 'submit', data: {icon: 'o'}}
7
20
  = icon('check')
8
21
  = t('spina.preferences.style_save')
9
22
 
10
- .well
11
- .horizontal-form
12
- .horizontal-form-group
13
- .horizontal-form-label
14
- = Spina::Account.human_attribute_name(:theme)
15
- .horizontal-form-content
16
- .select-dropdown.account-theme{data: {layout_parts: current_theme.layout_parts.map{|layout_part| layout_part[:name]}}}
17
- - options = options_for_select(::Spina::Theme.all.map { |theme| [theme.name, theme.name, {'data-layout-parts' => theme.layout_parts.map{|layout_part| layout_part[:name] }}] }, current_account.theme)
18
- = f.select :theme, options
19
-
20
- = f.fields_for :layout_parts do |ff|
21
- .horizontal-form-group.layout-part{data: {name: ff.object.name}}
22
- .horizontal-form-label
23
- = ff.object.title
24
- .horizontal-form-content
25
- = ff.hidden_field :id
26
- = ff.hidden_field :title
27
- = ff.hidden_field :layout_partable_type
28
- = ff.hidden_field :name
23
+ .page-form
24
+ .page-form-group
25
+ .page-form-label= Spina::Account.human_attribute_name(:theme)
26
+ .page-form-control
27
+ .select-dropdown= f.select :theme, Spina::Theme.all.map(&:name)
29
28
 
30
- = render "spina/admin/layout_partables/#{ partable_type_partial_namespace(ff.object.layout_partable_type) }/form", f: ff
29
+ = f.fields_for "#{@locale}_content".to_sym, build_parts(f.object, current_theme.layout_parts) do |ff|
30
+ = ff.hidden_field :type, value: ff.object.class
31
+ = ff.hidden_field :name
32
+ = ff.hidden_field :title
33
+
34
+ .page-form-group.page-part{data: {name: ff.object.name}}
35
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -1,12 +1,14 @@
1
1
  - content_for(:header_actions) do
2
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')
3
+ = link_to '#', class: 'button button-default organize-switch', data: {organize_images: t('spina.photos.organize'), done_organizing: t('spina.photos.done_organizing')} do
4
+ .button-content
5
+ = icon('random')
6
+ = t('spina.photos.organize')
6
7
 
7
8
  = 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'
9
+ .button-content
10
+ = icon('plus')
11
+ =t 'spina.photos.new_folder'
10
12
 
11
13
  .gallery-container
12
14
  .gallery
@@ -1,6 +1,6 @@
1
1
  - content_for(:header_actions) do
2
- = link_to t('spina.photos.rename_folder'), spina.edit_admin_media_folder_path(@media_folder), class: 'button', data: {remote: true}
3
- = link_to t('spina.photos.delete_folder'), spina.admin_media_folder_path(@media_folder), class: 'button button-danger', style: "margin-right: 0", data: {method: :delete, confirm: t('spina.delete_confirmation', subject: @media_folder.name)}
2
+ = link_to t('spina.photos.rename_folder'), spina.edit_admin_media_folder_path(@media_folder), class: 'button button-default', data: {remote: true}
3
+ = link_to t('spina.photos.delete_folder'), spina.admin_media_folder_path(@media_folder), class: 'button button-default button-danger', style: "margin-right: 0", data: {method: :delete, confirm: t('spina.delete_confirmation', subject: @media_folder.name)}
4
4
 
5
5
  .gallery-container
6
6
  .gallery
@@ -0,0 +1,3 @@
1
+ %label.media-picker-image{data: {target: "media-picker.image"}}
2
+ = check_box_tag :image_id, image.id, image.id.in?(selected_ids), data: {action: "media-picker#choose", image_id: image.id, signed_blob_id: image.file.blob.signed_id, thumbnail_url: thumbnail_url(image), full_image_url: main_app.url_for(image.file), filename: image.file.filename}
3
+ %span= image_tag thumbnail_url(image)
@@ -0,0 +1,32 @@
1
+ .modal-container{data: {controller: "modal media-picker infinite-scroll", mode: @mode}}
2
+ .modal.modal-large{data: {target: "infinite-scroll.scrollContainer"}}
3
+ %header
4
+ = button_tag type: :default, class: 'modal-close-cross', data: {action: "modal#close"} do
5
+ = icon('cross')
6
+ - if @mode == "multiple"
7
+ %h3=t "spina.images.choose_images"
8
+ - else
9
+ %h3=t "spina.images.choose_image"
10
+ %section.media-picker
11
+ = hidden_field_tag :input, params[:input], data: {target: "media-picker.input"}
12
+
13
+ %div{data: {target: "media-picker.grid"}}
14
+ = render 'media_picker_grid'
15
+
16
+ - if @mode == "trix"
17
+ %section.media-picker-footer
18
+ = text_field_tag :alt, nil, placeholder: "✍️ Alt", data: {target: "media-picker.alt"}
19
+ = text_field_tag :link_to_url, nil, placeholder: "🔗 Link to URL", data: {target: "media-picker.linkToUrl"}
20
+
21
+ = button_tag type: :button, class: 'pull-right button button-primary', data: {action: "media-picker#insert_trix"} do
22
+ =t "spina.images.insert_image"
23
+
24
+ - if @mode == "multiple"
25
+ %section.media-picker-footer
26
+ .media-picker-selected-images{data: {target: "media-picker.selectedImages"}}
27
+ - @selected_images.each do |image|
28
+ = image_tag thumbnail_url(image), data: {target: "media-picker.selectedImage", image_id: image.id, signed_blob_id: image.file.blob.signed_id}
29
+
30
+ = button_tag type: :button, class: 'pull-right button button-primary', data: {action: "media-picker#choose_multiple"} do
31
+ =t "spina.images.confirm_selection"
32
+ %span{data: {target: "media-picker.selectedCount"}} (#{@selected_images.size})
@@ -0,0 +1,25 @@
1
+ .media-picker-grid#media_picker_grid
2
+ - if @media_folder.present?
3
+ = link_to spina.admin_media_picker_path, class: 'media-folder', data: {action: "media-picker#openFolder"} do
4
+ .media-folder-thumbnail
5
+ .media-folder-placeholder
6
+ %i.icon.icon-picture-o
7
+ .media-folder-shadow
8
+ .media-folder-name=t "spina.images.all_images"
9
+ - else
10
+ = form_with model: Spina::Image.new, url: admin_images_path, data: {action: "ajax:success->media-picker#refresh ajax:before->media-picker#startUpload", media_picker_url: spina.admin_media_picker_path} do |f|
11
+ .media-picker-uploader
12
+ = f.file_field :files, multiple: true, accept: "image/*", data: {direct_upload_url: main_app.rails_direct_uploads_url}
13
+ = f.submit
14
+
15
+ - @media_folders.each do |media_folder|
16
+ = link_to spina.admin_media_picker_path(media_folder_id: media_folder.id), class: 'media-folder', data: {action: "media-picker#openFolder"} do
17
+ .media-folder-thumbnail{data: {badge: media_folder.images.size}}
18
+ = image_tag variant(media_folder.images.last.file, resize: '144x144^', crop: "144x144+0+0")
19
+ .media-folder-shadow
20
+ .media-folder-name= media_folder.name
21
+
22
+ = render partial: 'image', collection: @images
23
+
24
+ .media-picker-pagination
25
+ = link_to_next_page @images, "Next", data: {remote: true, target: "infinite-scroll.link"}
@@ -1,5 +1,5 @@
1
- // Append new data
2
- $("<%=j render partial: 'spina/admin/images/image', collection: @images %>").appendTo($(".infinite-scroll"));
1
+ document.querySelector(".media-picker-grid").insertAdjacentHTML("beforeend", "<%=j render partial: 'image', collection: @images %>")
3
2
 
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'} %>")
3
+ document.querySelector(".media-picker-pagination").innerHTML = "<%=j link_to_next_page @images, 'Next', data: {remote: true, target: 'infinite-scroll.link'} %>"
4
+
5
+ document.querySelector(".modal-container").infiniteScroll.loadNextPage()
@@ -4,6 +4,8 @@ hidden_input.val("");
4
4
 
5
5
  <% if @image.present? %>
6
6
  hidden_input.parents('.media_picker').append("<%=j render partial: 'spina/admin/images/image', object: @image, locals: {simple: true} %>");
7
+ hidden_input.parents('[data-controller="image-form"]').find(".image img").remove();
8
+ hidden_input.parents('[data-controller="image-form"]').find(".image")[0].insertAdjacentHTML("beforeend", `<%=j image_tag variant(@image.file, resize: "400x300^", crop: "400x300+0+0"), width: 200, height: 150 %>`)
7
9
  hidden_input.val("<%= @image.id %>");
8
10
 
9
11
  // Trix editor
@@ -0,0 +1 @@
1
+ = render partial: 'media_picker_grid'
@@ -1 +1 @@
1
- $("<%=j render partial: 'modal', locals: {multiple: params[:multiple]} %>").modal();
1
+ document.querySelector('body').insertAdjacentHTML("beforeend", "<%=j render partial: 'media_picker' %>")
@@ -1,6 +1,6 @@
1
1
  - if @page.errors.any?
2
2
  - content_for :notifications do
3
- .notification.notification-danger.animated.fadeInRight
3
+ .notification.notification-danger.animated.fadeInLeft
4
4
  = icon('exclamation')
5
5
  .notification-message
6
6
  =t 'spina.notifications.alert'
@@ -16,17 +16,18 @@
16
16
  - unless @page.new_record?
17
17
  - if Spina.config.locales.size > 1
18
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 "spina.languages.#{@locale}"
22
- %i.icon.icon-chevron-down{style: 'font-size: 9px; margin-right: 0'}
19
+ = link_to '#', class: 'button button-default button-small', style: 'margin-left: 0; margin-right: 0', data: {trigger: 'dropdown', target: '#locales'} do
20
+ .button-content
21
+ = icon('comment')
22
+ =t "spina.languages.#{@locale}"
23
+ %i.icon.icon-chevron-down{style: 'font-size: 9px; margin-right: 0; margin-left: 5px'}
23
24
 
24
25
  %ul#locales
25
26
  - Spina.config.locales.each do |locale|
26
27
  %li
27
28
  = link_to t("spina.languages.#{locale}"), "?locale=#{locale}", style: ('font-weight: 600' if @locale.to_s == locale.to_s).to_s
28
29
 
29
- = link_to @page.materialized_path, target: :blank, class: 'button button-hollow button-small', style: 'margin-left: 0' do
30
+ = link_to @page.materialized_path, target: :blank, class: 'button button-default button-small', style: 'margin-left: 0' do
30
31
  %i.icon.icon-export{style: 'margin: 0'}
31
32
 
32
33
  #header_actions
@@ -47,4 +48,5 @@
47
48
  = render "spina/admin/pages/form_#{tab}", f: f
48
49
 
49
50
  - 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'
51
+ .text-right{style: "margin-top: 60px"}
52
+ = 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-default button-small button-danger', style: 'margin: 0'
@@ -1,6 +1,6 @@
1
1
  #advanced.tab-content
2
2
  .horizontal-form
3
- .well
3
+ %div{style: "margin: 40px 0"}
4
4
  .horizontal-form-group
5
5
  .horizontal-form-label
6
6
  = Spina::Page.human_attribute_name :draft
@@ -17,7 +17,8 @@
17
17
  .horizontal-form-label
18
18
  = Spina::Page.human_attribute_name :menu_title
19
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)
20
+ .page-form-control
21
+ = 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
22
  .horizontal-form-group
22
23
  .horizontal-form-label
23
24
  = Spina::Page.human_attribute_name :skip_to_first_child
@@ -25,15 +26,14 @@
25
26
  .horizontal-form-content
26
27
  = f.check_box :skip_to_first_child, data: {switch: true}
27
28
 
28
- .well
29
29
  .horizontal-form-group
30
30
  .horizontal-form-label
31
31
  = Spina::Page.human_attribute_name :link_url
32
32
  %small= Spina::Page.human_attribute_name :link_url_description
33
33
  .horizontal-form-content
34
- = f.text_field :link_url, placeholder: Spina::Page.human_attribute_name(:link_url_placeholder)
34
+ .page-form-control
35
+ = f.text_field :link_url, placeholder: Spina::Page.human_attribute_name(:link_url_placeholder)
35
36
 
36
- .well
37
37
  - unless @page.resource.present?
38
38
  .horizontal-form-group
39
39
  .horizontal-form-label
@@ -1,16 +1,17 @@
1
- #page_content.tab-content.active.well
2
- .horizontal-form
3
- .horizontal-form-group
4
- .horizontal-form-label
5
- = Spina::Page.human_attribute_name :title
6
- .horizontal-form-content
7
- = f.text_field :title, placeholder: Spina::Page.human_attribute_name(:title_placeholder)
1
+ #page_content.tab-content.active
8
2
 
9
- = f.fields_for :page_parts, @page_parts.sort { |a,b| a.position(current_theme) <=> b.position(current_theme) } do |ff|
10
- = ff.hidden_field :id
11
- = ff.hidden_field :title
12
- = ff.hidden_field :page_partable_type
3
+ .page-form
4
+ .page-form-group
5
+ .page-form-label= Spina::Page.human_attribute_name :title
6
+ .page-form-control
7
+ = f.text_field :title, placeholder: Spina::Page.human_attribute_name(:title_placeholder), class: 'input-large'
8
+
9
+ - parts = (current_theme.view_templates.find{|v|v[:name].to_s == f.object.view_template.to_s}&.dig(:parts) || [])
10
+
11
+ = f.fields_for "#{@locale}_content".to_sym, build_parts(f.object, parts) do |ff|
12
+ = ff.hidden_field :type, value: ff.object.class
13
13
  = ff.hidden_field :name
14
+ = ff.hidden_field :title
14
15
 
15
- .horizontal-form-group.page-part{data: {name: ff.object.name}}
16
- = render "spina/admin/partables/#{ partable_type_partial_namespace(ff.object.page_partable_type) }/form", f: ff
16
+ .page-form-group.page-part{data: {name: ff.object.name}}
17
+ = render "spina/admin/parts/#{parts_partial_namespace(ff.object.class.to_s)}/form", f: ff
@@ -1,28 +1,32 @@
1
- #page_seo.tab-content.well
1
+ #page_seo.tab-content{style: "margin-top: 40px"}
2
2
  .horizontal-form
3
3
  .horizontal-form-group
4
4
  .horizontal-form-label
5
5
  = Spina::Page.human_attribute_name :seo_title
6
6
  .horizontal-form-content
7
- = f.text_field :seo_title, placeholder: Spina::Page.human_attribute_name(:seo_title_placeholder), value: f.object.seo_title(fallback: false, default: nil)
7
+ .page-form-control
8
+ = f.text_field :seo_title, placeholder: Spina::Page.human_attribute_name(:seo_title_placeholder), value: f.object.seo_title(fallback: false, default: nil)
8
9
 
9
10
  .horizontal-form-group
10
11
  .horizontal-form-label
11
12
  = Spina::Page.human_attribute_name :description
12
13
  %small= Spina::Page.human_attribute_name :description_description
13
14
  .horizontal-form-content
14
- = f.text_field :description, placeholder: Spina::Page.human_attribute_name(:description_placeholder)
15
+ .page-form-control
16
+ = f.text_field :description, placeholder: Spina::Page.human_attribute_name(:description_placeholder)
15
17
 
16
18
  .horizontal-form-group
17
19
  .horizontal-form-label
18
20
  = Spina::Page.human_attribute_name :url_title
19
21
  %small= Spina::Page.human_attribute_name :url_title_description
20
22
  .horizontal-form-content
21
- = f.text_field :url_title, placeholder: Spina::Page.human_attribute_name(:url_title_placeholder), value: f.object.url_title(fallback: false, default: nil)&.parameterize
23
+ .page-form-control
24
+ = f.text_field :url_title, placeholder: Spina::Page.human_attribute_name(:url_title_placeholder), value: f.object.url_title(fallback: false, default: nil)&.parameterize
22
25
 
23
26
  - unless @page.new_record?
24
27
  .horizontal-form-group
25
28
  .horizontal-form-label
26
29
  = Spina::Page.human_attribute_name :materialized_path
27
30
  .horizontal-form-content
28
- = f.text_field :materialized_path, disabled: true
31
+ .page-form-control
32
+ = f.text_field :materialized_path, disabled: true
@@ -1,5 +1,6 @@
1
1
  = link_to spina.edit_admin_page_path(page), class: 'button button-link button-small sortable-link' do
2
2
  = page.menu_title
3
+
3
4
  - if page.draft?
4
5
  %small (#{t('spina.pages.concept')})
5
6
  - elsif !page.show_in_menu?
@@ -9,6 +10,7 @@
9
10
  %small (#{raw t('spina.pages.skip_to_first_child')})
10
11
 
11
12
  %span.pull-right
12
- = link_to spina.edit_admin_page_path(page), class: 'button button-small button-link dd-nodrag' do
13
- = icon('pencil-outline')
14
- = t('spina.edit')
13
+ = link_to spina.edit_admin_page_path(page), class: 'button button-small button-default dd-nodrag' do
14
+ .button-content
15
+ = icon('pencil-outline')
16
+ = t('spina.edit')
@@ -2,6 +2,5 @@
2
2
  .dd-item-inner
3
3
  = render partial: 'page', object: page_nested_list
4
4
 
5
- - if page_nested_list.children.active.regular_pages.any?
6
- %ol.dd-list
7
- = render partial: 'page_nested_list', collection: page_nested_list.children.active.sorted.regular_pages
5
+ %ol.dd-list
6
+ = render partial: 'page_nested_list', collection: page_nested_list.children.active.sorted.regular_pages
@@ -1,8 +1,9 @@
1
1
  - content_for(:header_actions) do
2
2
  %span{data: {dropdown: true}}
3
3
  = link_to spina.new_admin_page_path(params: {view_template: 'show'}), class: 'button button-primary', style: 'margin-right: 0', data: {trigger: ('dropdown' if current_theme.new_page_templates.size > 1), target: '#create_page_dropdown'} do
4
- = icon('plus')
5
- = t('spina.pages.new')
4
+ .button-content
5
+ = icon('plus')
6
+ = t('spina.pages.new')
6
7
 
7
8
  .sliding-dropdown#create_page_dropdown.align-right
8
9
  .slide-controls
@@ -25,9 +26,9 @@
25
26
  - current_theme.new_page_templates.each_with_index do |template2, index2|
26
27
  .slide-dot{class: ('active' if index2 == index)}
27
28
 
28
- = link_to spina.new_admin_page_path(params: {view_template: template[0]}), class: 'button button-primary' do
29
+ = link_to spina.new_admin_page_path(params: {view_template: template[0]}), class: 'button button-default' do
29
30
  = icon('pencil-outline')
30
- = t('spina.pages.create_page', template: template[1])
31
+ = t('spina.pages.new')
31
32
 
32
33
  .well
33
34
  .dd#pages_list{data: {:"sort-url" => spina.sort_admin_pages_url }}