spina 0.11.1 → 0.12.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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -12
  3. data/Rakefile +1 -0
  4. data/app/assets/fonts/spina/ics_spina.eot +0 -0
  5. data/app/assets/fonts/spina/ics_spina.svg +5 -3
  6. data/app/assets/fonts/spina/ics_spina.ttf +0 -0
  7. data/app/assets/fonts/spina/ics_spina.woff +0 -0
  8. data/app/assets/icons/spina/lock.svg +3 -0
  9. data/app/assets/icons/spina/preview/ics_spina-preview.html +16 -1
  10. data/app/assets/javascripts/spina/admin/application.coffee.erb +3 -25
  11. data/app/assets/javascripts/spina/admin/navigation.coffee +7 -0
  12. data/app/assets/javascripts/spina/admin/pages.coffee.erb +1 -13
  13. data/app/assets/javascripts/spina/admin/trix.coffee.erb +2 -1
  14. data/app/assets/stylesheets/spina/_admin_editing.sass +0 -4
  15. data/app/assets/stylesheets/spina/_buttons.sass +8 -8
  16. data/app/assets/stylesheets/spina/_configuration.sass +5 -1
  17. data/app/assets/stylesheets/spina/_custom_animations.sass +26 -26
  18. data/app/assets/stylesheets/spina/_fonts.sass +5 -1
  19. data/app/assets/stylesheets/spina/_forms.sass +66 -33
  20. data/app/assets/stylesheets/spina/_gallery.sass +32 -15
  21. data/app/assets/stylesheets/spina/_ics_spina.scss +1 -0
  22. data/app/assets/stylesheets/spina/_login.sass +10 -4
  23. data/app/assets/stylesheets/spina/_mixins.sass +5 -0
  24. data/app/assets/stylesheets/spina/_modal.sass +4 -4
  25. data/app/assets/stylesheets/spina/_notifications.sass +5 -5
  26. data/app/assets/stylesheets/spina/_sortable_lists.sass +9 -9
  27. data/app/assets/stylesheets/spina/_tables.sass +9 -9
  28. data/app/assets/stylesheets/spina/_wizard.sass +5 -5
  29. data/app/assets/stylesheets/spina/admin/application.sass +4 -1
  30. data/app/assets/stylesheets/spina/application.sass +0 -1
  31. data/app/assets/stylesheets/spina.sass +23 -27
  32. data/app/controllers/spina/admin/accounts_controller.rb +2 -7
  33. data/app/controllers/spina/admin/admin_controller.rb +8 -3
  34. data/app/controllers/spina/admin/attachments_controller.rb +0 -2
  35. data/app/controllers/spina/admin/navigations_controller.rb +3 -2
  36. data/app/controllers/spina/admin/pages_controller.rb +7 -8
  37. data/app/controllers/spina/admin/password_resets_controller.rb +49 -0
  38. data/app/controllers/spina/admin/photos_controller.rb +15 -34
  39. data/app/controllers/spina/admin/sessions_controller.rb +1 -1
  40. data/app/controllers/spina/admin/users_controller.rb +8 -9
  41. data/app/controllers/spina/application_controller.rb +3 -9
  42. data/app/controllers/spina/pages_controller.rb +3 -3
  43. data/app/helpers/spina/admin/pages_helper.rb +16 -23
  44. data/app/mailers/spina/user_mailer.rb +21 -0
  45. data/app/models/concerns/spina/optionable.rb +12 -0
  46. data/app/models/concerns/spina/part.rb +5 -1
  47. data/app/models/concerns/spina/partable.rb +20 -5
  48. data/app/models/concerns/spina/photo_collectable.rb +24 -0
  49. data/app/models/spina/account.rb +16 -6
  50. data/app/models/spina/layout_part.rb +1 -0
  51. data/app/models/spina/option.rb +17 -0
  52. data/app/models/spina/page.rb +36 -63
  53. data/app/models/spina/page_part.rb +1 -0
  54. data/app/models/spina/photo_collection.rb +1 -13
  55. data/app/models/spina/structure_item.rb +4 -8
  56. data/app/models/spina/structure_part.rb +2 -13
  57. data/app/models/spina/user.rb +1 -0
  58. data/app/presenters/spina/pages/menu_presenter.rb +18 -49
  59. data/app/views/layouts/spina/mail.html.erb +1 -0
  60. data/app/views/spina/admin/page_partables/{colors → options}/_form.html.haml +2 -3
  61. data/app/views/spina/admin/page_partables/photo_collections/_form.html.haml +7 -7
  62. data/app/views/spina/admin/page_partables/structures/_form.html.haml +7 -8
  63. data/app/views/spina/admin/pages/_form.html.haml +2 -2
  64. data/app/views/spina/admin/pages/_form_advanced.html.haml +2 -2
  65. data/app/views/spina/admin/password_resets/edit.html.haml +13 -0
  66. data/app/views/spina/admin/password_resets/new.html.haml +13 -0
  67. data/app/views/spina/admin/photos/_photo.html.haml +2 -1
  68. data/app/views/spina/admin/photos/{_wysihtml5_select.html.haml → _trix_select.html.haml} +2 -4
  69. data/app/views/spina/admin/photos/create.js.erb +3 -5
  70. data/app/views/spina/admin/photos/{wysihtml5_infinite_scroll.js.erb → trix_infinite_scroll.js.erb} +0 -2
  71. data/app/views/spina/admin/photos/{wysihtml5_insert.js.coffee → trix_insert.js.erb} +2 -2
  72. data/app/views/spina/admin/photos/trix_select.js.erb +3 -0
  73. data/app/views/spina/admin/sessions/new.html.haml +3 -1
  74. data/app/views/spina/admin/shared/_primary_navigation.html.haml +1 -1
  75. data/app/views/spina/admin/shared/_rich_text_field.html.haml +2 -1
  76. data/app/views/spina/admin/structure_items/_fields.html.haml +3 -3
  77. data/app/views/spina/admin/structure_partables/lines/_form.html.haml +5 -2
  78. data/app/views/spina/admin/structure_partables/options/_form.html.haml +7 -0
  79. data/app/views/spina/admin/structure_partables/photo_collections/_form.html.haml +12 -9
  80. data/app/views/spina/admin/structure_partables/photos/_form.html.haml +10 -7
  81. data/app/views/spina/admin/structure_partables/texts/_form.html.haml +5 -2
  82. data/app/views/spina/admin/users/_form.html.haml +1 -1
  83. data/app/views/spina/shared/_admin_bar.html.haml +1 -1
  84. data/app/views/spina/shared/_navigation.html.haml +1 -1
  85. data/app/views/spina/user_mailer/forgot_password.html.erb +1 -0
  86. data/app/views/spina/user_mailer/forgot_password.txt.erb +1 -0
  87. data/config/locales/en.yml +10 -0
  88. data/config/locales/nl.yml +2 -0
  89. data/config/routes.rb +5 -9
  90. data/db/migrate/1_create_spina_tables.rb +8 -7
  91. data/db/migrate/2_create_spina_translation_tables.rb +7 -26
  92. data/db/migrate/3_create_spina_navigations.rb +1 -1
  93. data/db/migrate/4_add_password_reset_token_to_spina_users.rb +6 -0
  94. data/db/migrate/5_remove_translated_columns.rb +11 -0
  95. data/db/migrate/6_create_spina_options.rb +8 -0
  96. data/lib/generators/spina/install_generator.rb +0 -22
  97. data/lib/generators/spina/templates/app/views/default/shared/_navigation.html.haml +1 -1
  98. data/lib/generators/spina/templates/app/views/demo/shared/_navigation.html.haml +1 -1
  99. data/lib/generators/spina/templates/config/initializers/themes/default.rb +9 -0
  100. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +1 -9
  101. data/lib/spina/engine.rb +4 -3
  102. data/lib/spina/theme.rb +2 -1
  103. data/lib/spina/version.rb +1 -1
  104. data/lib/spina.rb +0 -23
  105. metadata +32 -69
  106. data/app/assets/images/spina/marker.png +0 -0
  107. data/app/assets/images/spina/mask.png +0 -0
  108. data/app/assets/images/spina/wheel.png +0 -0
  109. data/app/assets/stylesheets/spina/_cards.sass +0 -54
  110. data/app/assets/stylesheets/spina/_farbtastic.sass +0 -37
  111. data/app/assets/stylesheets/spina/_wysihtml5.sass +0 -79
  112. data/app/assets/stylesheets/spina/wysihtml5_textarea.sass +0 -14
  113. data/app/controllers/spina/admin/page_parts_controller.rb +0 -11
  114. data/app/helpers/spina/application_helper.rb +0 -30
  115. data/app/models/spina/ability.rb +0 -20
  116. data/app/models/spina/color.rb +0 -7
  117. data/app/presenters/spina/pages/breadcrumb.rb +0 -102
  118. data/app/views/layouts/spina/email.html.erb +0 -124
  119. data/app/views/spina/admin/layout_partables/colors/_form.html.haml +0 -4
  120. data/app/views/spina/admin/page_parts/_wysihtml5_link.html.haml +0 -12
  121. data/app/views/spina/admin/page_parts/insert_wysihtml5_link.js +0 -5
  122. data/app/views/spina/admin/page_parts/wysihtml5_link.js +0 -2
  123. data/app/views/spina/admin/photos/create_and_select.js.erb +0 -7
  124. data/app/views/spina/admin/photos/create_multiple.js.erb +0 -4
  125. data/app/views/spina/admin/photos/wysihtml5_select.js.erb +0 -3
  126. data/vendor/assets/javascripts/spina/jquery.farbtastic.js +0 -345
  127. data/vendor/assets/javascripts/spina/morris.js +0 -1767
  128. data/vendor/assets/javascripts/spina/raphael.js +0 -8111
  129. data/vendor/assets/javascripts/spina/wysihtml5.js +0 -269
  130. data/vendor/assets/javascripts/spina/wysihtml5_parser_rules.js +0 -551
  131. data/vendor/assets/stylesheets/spina/_morris.scss +0 -2
@@ -0,0 +1,3 @@
1
+ var modal = $("<%= j render 'trix_select' %>");
2
+ modal.modal();
3
+ $(document).trigger('page:change');
@@ -9,4 +9,6 @@
9
9
  = text_field_tag :email, params[:email], placeholder: Spina::User.human_attribute_name(:email), autofocus: true, class: "animated fadeInDown"
10
10
  = password_field_tag :password, nil, placeholder: Spina::User.human_attribute_name(:password), class: "animated fadeInDown"
11
11
 
12
- = button_tag t('spina.login'), class: 'button button-primary animated fadeInDown', data: {icon: '3'}
12
+ = button_tag t('spina.login'), class: 'button button-primary animated fadeInDown'
13
+
14
+ .login-extra-links.animated.fadeInDown= link_to t('spina.forgot_password.new'), spina.new_admin_password_reset_path, class: 'button button-hollow button-block'
@@ -36,7 +36,7 @@
36
36
  = link_to t('spina.preferences.account'), spina.edit_admin_account_path
37
37
  %li{class: ('active' if params[:action] == 'style')}
38
38
  = link_to t('spina.preferences.style'), spina.style_admin_account_path
39
- - if can? :manage, Spina::User
39
+ - if current_spina_user.admin?
40
40
  %li{class: ('active' if %w[users].include? controller_name)}
41
41
  = link_to t('spina.preferences.users'), spina.admin_users_path
42
42
  %li{class: ('active' if params[:action] == 'social')}
@@ -1,4 +1,5 @@
1
- - object_id = f.object.persisted? ? f.object.object_id : "new_association_#{f.object.object_id}"
1
+
2
+ - object_id = (f.object.persisted? ? f.object.object_id : "new_association_#{f.object.object_id}").to_s + "_#{field}"
2
3
  = f.hidden_field field, id: "#{object_id}_input"
3
4
 
4
5
  %trix-toolbar.clearfix{ id: "#{object_id}_toolbar", data: { trix_editor_id: "#{object_id}_editor" }}
@@ -1,8 +1,8 @@
1
- .structure-form-pane{class: ('active' if f.options[:child_index] == 0), id: "structure_form_pane_#{f.object.id}"}
1
+ .structure-form-pane{class: ('active' if f.options[:child_index] == 0), id: "structure_form_pane_#{f.object.object_id}"}
2
2
  / Structure parts
3
3
  = f.fields_for :structure_parts, build_structure_parts(f.object.structure.try(:page_part).try(:name), f.object) do |ff|
4
4
  .structure-form-part
5
- = render "spina/admin/structure_partables/#{ partable_type_partial_namespace(ff.object.structure_partable_type) }/form", f: ff
5
+ = render "spina/admin/structure_partables/#{partable_type_partial_namespace(ff.object.structure_partable_type)}/form", f: ff
6
6
 
7
7
  = ff.hidden_field :id
8
8
  = ff.hidden_field :title
@@ -10,6 +10,6 @@
10
10
  = ff.hidden_field :name
11
11
 
12
12
  / Hidden field
13
- = f.hidden_field :position, placeholder: "Position", class: "structure_form_pane_#{f.object.id}_position"
13
+ = f.hidden_field :position, placeholder: "Position", class: "structure_form_pane_#{f.object.object_id}_position"
14
14
  = f.hidden_field :_destroy
15
15
  = link_to t('spina.delete'), '#', class: 'remove_structure_item_fields button button-mini button-link pull-right'
@@ -1,2 +1,5 @@
1
- = f.fields_for :structure_partable do |ff|
2
- = ff.text_field :content, placeholder: f.object.title
1
+ .horizontal-form-label
2
+ = f.object.title
3
+ .horizontal-form-content
4
+ = f.fields_for :structure_partable do |ff|
5
+ = ff.text_field :content, placeholder: f.object.title
@@ -0,0 +1,7 @@
1
+ .horizontal-form-label
2
+ = f.object.title
3
+ .horizontal-form-content
4
+ = f.fields_for :structure_partable, f.object.structure_partable do |ff|
5
+ .select-dropdown
6
+ = ff.label :value, f.object.title
7
+ = ff.select :value, f.object.options[:values].map{|o| [option_label(f.object, o), o]}, prompt: true
@@ -3,12 +3,15 @@
3
3
  .horizontal-form-content
4
4
  = f.fields_for :structure_partable, f.object.structure_partable do |ff|
5
5
  = link_to spina.photo_collection_select_admin_photos_path(ff.object_name, selected_photo_ids: ff.object.photo_ids), remote: true, class: 'media_picker clearfix' do
6
- .placeholder.pull-right
7
- %span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photos_picker'
8
- .photo-collection
9
- - if ff.object.photos.sorted_by_photo_collection.any?
10
- = render 'spina/admin/photos/photo_collection', photos: ff.object.photos.sorted_by_photo_collection
11
- - elsif ff.object.photos.any?
12
- = render 'spina/admin/photos/photo_collection', photos: ff.object.photos
13
- = ff.hidden_field :photo_tokens, value: ff.object.photo_ids.join(",")
14
- = ff.hidden_field :photo_positions, value: ff.object.photos.sorted_by_photo_collection.pluck(:photo_id).join(","), class: 'photo-positions'
6
+ .placeholder
7
+ %span.button.button-small.button-round
8
+ %i.icon.icon-dots
9
+ =t 'spina.pages.photos_picker'
10
+
11
+ .photo-collection
12
+ - if ff.object.photos.sorted_by_photo_collection.any?
13
+ = render 'spina/admin/photos/photo_collection', photos: ff.object.photos.sorted_by_photo_collection
14
+ - elsif ff.object.photos.any?
15
+ = render 'spina/admin/photos/photo_collection', photos: ff.object.photos
16
+ = ff.hidden_field :photo_tokens, value: ff.object.photo_ids.join(",")
17
+ = ff.hidden_field :photo_positions, value: ff.object.photos.sorted_by_photo_collection.pluck(:photo_id).join(","), class: 'photo-positions'
@@ -1,8 +1,11 @@
1
- = link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: f.object.structure_partable.try(:id)), remote: true, class: "media_picker" do
2
- .placeholder
3
- %span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photo_picker'
4
- - if f.object.structure_partable && f.object.structure_partable.file.present?
5
- .image
6
- = image_tag f.object.structure_partable.file.thumb
1
+ .horizontal-form-label
2
+ = f.object.title
3
+ .horizontal-form-content
4
+ = link_to spina.photo_select_admin_photos_path(f.object_name, selected_photo_id: f.object.structure_partable.try(:id)), remote: true, class: "media_picker" do
5
+ .placeholder
6
+ %span.button.button-small.button-round{data: {icon: 'U'}}=t 'spina.pages.photo_picker'
7
+ - if f.object.structure_partable && f.object.structure_partable.file.present?
8
+ .image
9
+ = image_tag f.object.structure_partable.file.thumb
7
10
 
8
- = f.hidden_field :structure_partable_id
11
+ = f.hidden_field :structure_partable_id
@@ -1,2 +1,5 @@
1
- = f.fields_for :structure_partable, f.object.structure_partable do |ff|
2
- = render 'spina/admin/shared/rich_text_field', f: ff, field: :content
1
+ .horizontal-form-label
2
+ = f.object.title
3
+ .horizontal-form-content
4
+ = f.fields_for :structure_partable, f.object.structure_partable do |ff|
5
+ = render 'spina/admin/shared/rich_text_field', f: ff, field: :content
@@ -54,5 +54,5 @@
54
54
  .horizontal-form-content
55
55
  = f.check_box :admin, data: {switch: 'true'}
56
56
 
57
- - unless @user.new_record? || @user == current_user
57
+ - unless @user.new_record? || @user == current_spina_user
58
58
  .pull-right= link_to t('spina.permanently_delete'), spina.admin_user_path(@user), method: :delete, data: {confirm: t('spina.users.delete_confirmation', user: @user)}, class: 'button button-link button-danger'
@@ -1,4 +1,4 @@
1
- - if current_user.present?
1
+ - if current_spina_user.present?
2
2
  #admin_bar
3
3
  = link_to t('spina.edit_website'), spina.admin_root_url, data: {icon: 'q', :"no-turbolink" => true}, class: 'button button-hollow button-round button-small'
4
4
  = link_to t('spina.logout'), spina.admin_logout_path, data: {icon: 'h'}, class: 'button button-hollow button-round button-small'
@@ -1,3 +1,3 @@
1
- - pages = current_user.present? ? Spina::Page.active : Spina::Page.live
1
+ - pages = current_spina_user.present? ? Spina::Page.active : Spina::Page.live
2
2
  - menu = Spina::Pages::MenuPresenter.new(pages.in_menu.arrange(order: :position), self, @page)
3
3
  = menu.to_html
@@ -0,0 +1 @@
1
+ You forgot your password dummy. Here's a link to setup a new one: <%= link_to 'Reset password', spina.edit_admin_password_reset_url(@user.password_reset_token) %>. It expires in 2 hours.
@@ -0,0 +1 @@
1
+ You forgot your password dummy. Here's a link to setup a new one: <%= spina.edit_admin_password_reset_url(@user.password_reset_token) %>. It expires in 2 hours.
@@ -16,6 +16,15 @@ en:
16
16
  logout: Logout
17
17
  main_menu: Main menu
18
18
 
19
+ forgot_password:
20
+ new: Forgot password
21
+ request: Request new password
22
+ unknown_user: This user does not exist
23
+ save: Save new password
24
+ success: You can use your new password
25
+ mail_subject: Reset your password
26
+ expired: Your password reset token has expired
27
+
19
28
  modal:
20
29
  agree: "Yes, I'm sure"
21
30
  cancel: "No, cancel"
@@ -57,6 +66,7 @@ en:
57
66
  rebuild_materialized_path: Rebuild materialized path
58
67
  materialize_path_confirmation: "Are you sure you want to rebuild the path for this page?"
59
68
  saving: Saving...
69
+ saved: Page saved
60
70
 
61
71
  users:
62
72
  new: New user
@@ -2,6 +2,8 @@ nl:
2
2
  languages:
3
3
  nl: Nederlands
4
4
  en: Engels
5
+ de: Duits
6
+ fr: Frans
5
7
  spina:
6
8
  cancel: Annuleren
7
9
  close: Sluiten
data/config/routes.rb CHANGED
@@ -19,6 +19,9 @@ Spina::Engine.routes.draw do
19
19
  get "login" => "sessions#new"
20
20
  get "logout" => "sessions#destroy"
21
21
 
22
+ # Passwords
23
+ resources :password_resets
24
+
22
25
  # Media library
23
26
  get 'media_library' => 'photos#media_library', as: "media_library"
24
27
 
@@ -30,13 +33,6 @@ Spina::Engine.routes.draw do
30
33
  post :sort, on: :member
31
34
  end
32
35
 
33
- resources :page_parts do
34
- collection do
35
- get 'wysihtml5_link/:object_id' => 'page_parts#wysihtml5_link', as: :wysihtml5_link
36
- post 'wysihtml5_link/:object_id' => 'page_parts#insert_wysihtml5_link'
37
- end
38
- end
39
-
40
36
  resources :attachments do
41
37
  collection do
42
38
  get 'select/:page_part_id' => 'attachments#select', as: :select
@@ -48,8 +44,8 @@ Spina::Engine.routes.draw do
48
44
 
49
45
  resources :photos do
50
46
  collection do
51
- get 'wysihtml5_select/:object_id' => 'photos#wysihtml5_select', as: :wysihtml5_select
52
- post 'wysihtml5_insert/:object_id' => 'photos#wysihtml5_insert', as: :wysihtml5_insert
47
+ get 'trix_select/:object_id' => 'photos#trix_select', as: :trix_select
48
+ post 'trix_insert/:object_id' => 'photos#trix_insert', as: :trix_insert
53
49
  get 'photo_select/:page_part_id' => 'photos#photo_select', as: :photo_select
54
50
  get 'photo_collection_select/:page_part_id' => 'photos#photo_collection_select', as: :photo_collection_select
55
51
  post 'insert_photo/:page_part_id' => 'photos#insert_photo', as: :insert_photo
@@ -1,4 +1,4 @@
1
- class CreateSpinaTables < ActiveRecord::Migration
1
+ class CreateSpinaTables < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table "spina_accounts", force: :cascade do |t|
4
4
  t.string "name"
@@ -32,12 +32,6 @@ class CreateSpinaTables < ActiveRecord::Migration
32
32
  t.datetime "updated_at", null: false
33
33
  end
34
34
 
35
- create_table "spina_colors", force: :cascade do |t|
36
- t.text "content"
37
- t.datetime "created_at"
38
- t.datetime "updated_at"
39
- end
40
-
41
35
  create_table "spina_layout_parts", force: :cascade do |t|
42
36
  t.string "title"
43
37
  t.string "name"
@@ -49,6 +43,7 @@ class CreateSpinaTables < ActiveRecord::Migration
49
43
  end
50
44
 
51
45
  create_table "spina_lines", force: :cascade do |t|
46
+ t.string "content"
52
47
  t.datetime "created_at"
53
48
  t.datetime "updated_at"
54
49
  end
@@ -64,12 +59,16 @@ class CreateSpinaTables < ActiveRecord::Migration
64
59
  end
65
60
 
66
61
  create_table "spina_pages", force: :cascade do |t|
62
+ t.string "title"
63
+ t.string "menu_title"
64
+ t.string "description"
67
65
  t.boolean "show_in_menu", default: true
68
66
  t.string "slug"
69
67
  t.boolean "deletable", default: true
70
68
  t.datetime "created_at", null: false
71
69
  t.datetime "updated_at", null: false
72
70
  t.string "name"
71
+ t.string "seo_title"
73
72
  t.boolean "skip_to_first_child", default: false
74
73
  t.string "view_template"
75
74
  t.string "layout_template"
@@ -77,6 +76,7 @@ class CreateSpinaTables < ActiveRecord::Migration
77
76
  t.string "link_url"
78
77
  t.string "ancestry"
79
78
  t.integer "position"
79
+ t.string "materialized_path"
80
80
  t.boolean "active", default: true
81
81
  end
82
82
 
@@ -125,6 +125,7 @@ class CreateSpinaTables < ActiveRecord::Migration
125
125
  end
126
126
 
127
127
  create_table "spina_texts", force: :cascade do |t|
128
+ t.text "content"
128
129
  t.datetime "created_at"
129
130
  t.datetime "updated_at"
130
131
  end
@@ -1,32 +1,13 @@
1
- class CreateSpinaTranslationTables < ActiveRecord::Migration
1
+ class CreateSpinaTranslationTables < ActiveRecord::Migration[4.2]
2
2
  def up
3
- Spina::Page.create_translation_table!({
4
- title: :string,
5
- menu_title: :string,
6
- description: :string,
7
- seo_title: :string,
8
- materialized_path: :string
9
- }, {
10
- migrate_data: true,
11
- remove_source_columns: true
12
- })
13
- Spina::Text.create_translation_table!({
14
- content: :text
15
- }, {
16
- migrate_data: true,
17
- remove_source_columns: true
18
- })
19
- Spina::Line.create_translation_table!({
20
- content: :string
21
- }, {
22
- migrate_data: true,
23
- remove_source_columns: true
24
- })
3
+ Spina::Page.create_translation_table! title: :string, menu_title: :string, description: :string, seo_title: :string, materialized_path: :string
4
+ Spina::Text.create_translation_table! content: :text
5
+ Spina::Line.create_translation_table! content: :string
25
6
  end
26
7
 
27
8
  def down
28
- Spina::Page.drop_translation_table! migrate_data: true
29
- Spina::Text.drop_translation_table! migrate_data: true
30
- Spina::Line.drop_translation_table! migrate_data: true
9
+ Spina::Page.drop_translation_table!
10
+ Spina::Text.drop_translation_table!
11
+ Spina::Line.drop_translation_table!
31
12
  end
32
13
  end
@@ -1,4 +1,4 @@
1
- class CreateSpinaNavigations < ActiveRecord::Migration
1
+ class CreateSpinaNavigations < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table "spina_navigations", force: :cascade do |t|
4
4
  t.string "name", null: false
@@ -0,0 +1,6 @@
1
+ class AddPasswordResetTokenToSpinaUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :spina_users, :password_reset_token, :string
4
+ add_column :spina_users, :password_reset_sent_at, :datetime
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ class RemoveTranslatedColumns < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :spina_lines, :content
4
+ remove_column :spina_texts, :content
5
+ remove_column :spina_pages, :title
6
+ remove_column :spina_pages, :menu_title
7
+ remove_column :spina_pages, :description
8
+ remove_column :spina_pages, :seo_title
9
+ remove_column :spina_pages, :materialized_path
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ class CreateSpinaOptions < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :spina_options do |t|
4
+ t.string :value
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -72,28 +72,6 @@ module Spina
72
72
  rake 'spina:bootstrap'
73
73
  end
74
74
 
75
- def seed_demo_content
76
- theme_name = Account.first.theme
77
- if theme_name == 'demo' && !no?('Seed example content? [Yn]')
78
- current_theme = ::Spina::Theme.find_by_name(theme_name)
79
- if (page = Spina::Page.find_by(name: 'demo'))
80
- page.page_parts.clear
81
- parts = current_theme.page_parts.map { |page_part| page.page_part(page_part) }
82
- parts.each do |part|
83
- case part.partable_type
84
- when 'Spina::Line' then part.partable.content = 'This is a single line'
85
- when 'Spina::Text' then part.partable.content = '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>'
86
- when 'Spina::Photo' then part.partable.remote_file_url = 'https://unsplash.it/300/200?random'
87
- when 'Spina::PhotoCollection'
88
- 5.times { part.partable.photos.build(remote_file_url: 'https://unsplash.it/300/200?random') }
89
- when 'Spina::Color' then part.partable.content = '#6865b4'
90
- end
91
- end
92
- page.save
93
- end
94
- end
95
- end
96
-
97
75
  def feedback
98
76
  puts
99
77
  puts ' Your Spina site has been succesfully installed! '
@@ -1,4 +1,4 @@
1
- - pages = current_user.present? ? Spina::Page.active : Spina::Page.live
1
+ - pages = current_spina_user.present? ? Spina::Page.active : Spina::Page.live
2
2
  - menu = Spina::Pages::MenuPresenter.new(pages.in_menu.arrange(order: :position), self, @page)
3
3
  - menu.list_class = 'nav'
4
4
  - menu.list_item_css = 'nav-item'
@@ -1,4 +1,4 @@
1
- - pages = current_user.present? ? Spina::Page.active : Spina::Page.live
1
+ - pages = current_spina_user.present? ? Spina::Page.active : Spina::Page.live
2
2
  - menu = Spina::Pages::MenuPresenter.new(pages.in_menu.arrange(order: :position), self, @page)
3
3
  - menu.list_class = 'nav'
4
4
  - menu.list_item_css = 'nav-item'
@@ -28,4 +28,13 @@
28
28
  view_template: 'homepage'
29
29
  }]
30
30
 
31
+ theme.navigations = [{
32
+ name: 'mobile',
33
+ label: 'Mobile'
34
+ }, {
35
+ name: 'main',
36
+ label: 'Main navigation',
37
+ auto_add_pages: true
38
+ }]
39
+
31
40
  end
@@ -31,10 +31,6 @@
31
31
  name: 'structure',
32
32
  title: 'Structure',
33
33
  partable_type: 'Spina::Structure'
34
- }, {
35
- name: 'color',
36
- title: 'Color',
37
- partable_type: 'Spina::Color'
38
34
  }]
39
35
 
40
36
  theme.structures = [{
@@ -54,10 +50,6 @@
54
50
  name: 'line',
55
51
  title: 'Line',
56
52
  partable_type: 'Spina::Line'
57
- }, {
58
- name: 'color',
59
- title: 'Color',
60
- partable_type: 'Spina::Color'
61
53
  }]
62
54
 
63
55
  theme.view_templates = [{
@@ -73,7 +65,7 @@
73
65
  name: 'demo',
74
66
  title: 'Demo',
75
67
  description: 'Contains examples of every page part',
76
- page_parts: ['line', 'text', 'photo', 'photo_collection', 'attachment', 'attachment_collection', 'structure', 'color']
68
+ page_parts: ['line', 'text', 'photo', 'photo_collection', 'attachment', 'attachment_collection', 'structure']
77
69
  }]
78
70
 
79
71
  theme.custom_pages = [{
data/lib/spina/engine.rb CHANGED
@@ -1,14 +1,11 @@
1
1
  require 'haml-rails'
2
2
  require 'sass-rails'
3
- require 'bourbon'
4
- require 'neat'
5
3
  require 'coffee-rails'
6
4
  require 'jquery-rails'
7
5
  require 'jquery-fileupload-rails'
8
6
  require 'turbolinks'
9
7
  require 'carrierwave'
10
8
  require 'mini_magick'
11
- require 'cancancan'
12
9
  require 'ancestry'
13
10
  require 'breadcrumbs_on_rails'
14
11
  require 'kaminari'
@@ -24,9 +21,13 @@ module Spina
24
21
  config.assets.paths << config.root.join('vendor', 'assets')
25
22
 
26
23
  config.to_prepare do
24
+ # Require decorators from main application
27
25
  [Rails.root].flatten.map { |p| Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]}.flatten.uniq.each do |decorator|
28
26
  Rails.configuration.cache_classes ? require(decorator) : load(decorator)
29
27
  end
28
+
29
+ # Load helpers from main application
30
+ Spina::ApplicationController.helper Rails.application.helpers
30
31
  end
31
32
 
32
33
  end
data/lib/spina/theme.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Spina
2
2
  class Theme
3
3
 
4
- attr_accessor :name, :title, :page_parts, :structures, :view_templates, :layout_parts, :custom_pages, :plugins, :public_theme, :config
4
+ attr_accessor :name, :title, :page_parts, :structures, :view_templates, :layout_parts, :custom_pages, :plugins, :public_theme, :config, :navigations
5
5
 
6
6
  class << self
7
7
 
@@ -31,6 +31,7 @@ module Spina
31
31
  @layout_parts = []
32
32
  @view_templates = []
33
33
  @custom_pages = []
34
+ @navigations = []
34
35
  @public_theme = false
35
36
  end
36
37
 
data/lib/spina/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spina
2
- VERSION = "0.11.1"
2
+ VERSION = "0.12.0"
3
3
  end
data/lib/spina.rb CHANGED
@@ -22,27 +22,4 @@ module Spina
22
22
 
23
23
  self.locales = [I18n.default_locale]
24
24
 
25
- class << self
26
-
27
- def register_theme(deprecated_theme)
28
- warn "[DEPRECATION] `register_theme` is deprecated. Please use `::Spina::Theme.register` instead."
29
- Spina::Theme.register do |theme|
30
- theme.name = deprecated_theme.name
31
- theme.title = deprecated_theme.config.title
32
- theme.page_parts = deprecated_theme.config.page_parts
33
- theme.view_templates = deprecated_theme.config.view_templates.inject([]) do |a, (k, v)|
34
- v[:name] = k
35
- a << v
36
- end
37
- theme.layout_parts = deprecated_theme.config.layout_parts
38
- theme.custom_pages = deprecated_theme.config.custom_pages
39
- theme.plugins = deprecated_theme.config.plugins
40
- theme.structures = deprecated_theme.config.structures.inject([]) do |a, (k, v)|
41
- a << { name: k, structure_parts: v }
42
- end
43
- theme.public_theme = deprecated_theme.config.public_theme
44
- end
45
- end
46
-
47
- end
48
25
  end