spina 2.12.0 → 2.13.1

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +17 -17
  3. data/app/assets/builds/spina/tailwind.css +79 -47
  4. data/app/components/spina/application_component.rb +1 -1
  5. data/app/components/spina/forms/group_component.rb +2 -3
  6. data/app/components/spina/forms/label_component.rb +2 -3
  7. data/app/components/spina/forms/password_field_component.rb +1 -1
  8. data/app/components/spina/forms/switch_component.rb +2 -3
  9. data/app/components/spina/forms/text_field_component.rb +8 -9
  10. data/app/components/spina/forms/trix_toolbar_component.rb +1 -3
  11. data/app/components/spina/hooks/hook_component.rb +3 -5
  12. data/app/components/spina/hooks/partial_component.rb +4 -5
  13. data/app/components/spina/main_navigation/link_component.rb +1 -3
  14. data/app/components/spina/main_navigation/sub_nav_component.rb +6 -7
  15. data/app/components/spina/media_picker/image_component.rb +1 -3
  16. data/app/components/spina/media_picker/modal_component.rb +4 -6
  17. data/app/components/spina/pages/actions_component.rb +1 -3
  18. data/app/components/spina/pages/list_component.rb +3 -4
  19. data/app/components/spina/pages/location_component.rb +10 -11
  20. data/app/components/spina/pages/new_page_button_component.rb +4 -5
  21. data/app/components/spina/pages/page_component.rb +8 -9
  22. data/app/components/spina/pages/page_select_component.rb +3 -4
  23. data/app/components/spina/pages/tab_button_component.rb +1 -3
  24. data/app/components/spina/pages/translations_component.rb +9 -11
  25. data/app/components/spina/user_interface/dropdown_button_component.rb +4 -4
  26. data/app/components/spina/user_interface/dropdown_component.rb +8 -9
  27. data/app/components/spina/user_interface/flash_message_component.rb +3 -5
  28. data/app/components/spina/user_interface/header_component.rb +2 -2
  29. data/app/components/spina/user_interface/modal_component.rb +1 -3
  30. data/app/components/spina/user_interface/tab_link_component.rb +1 -3
  31. data/app/components/spina/user_interface/translations_component.rb +8 -10
  32. data/app/controllers/concerns/spina/api/paginable.rb +36 -37
  33. data/app/controllers/concerns/spina/current_spina_account.rb +1 -1
  34. data/app/controllers/concerns/spina/current_theme.rb +6 -7
  35. data/app/controllers/concerns/spina/frontend.rb +58 -44
  36. data/app/controllers/spina/admin/accounts_controller.rb +9 -10
  37. data/app/controllers/spina/admin/admin_controller.rb +18 -18
  38. data/app/controllers/spina/admin/attachments_controller.rb +15 -10
  39. data/app/controllers/spina/admin/embeds_controller.rb +17 -19
  40. data/app/controllers/spina/admin/images_controller.rb +24 -25
  41. data/app/controllers/spina/admin/layout_controller.rb +19 -20
  42. data/app/controllers/spina/admin/media_folders_controller.rb +4 -5
  43. data/app/controllers/spina/admin/media_picker_controller.rb +2 -4
  44. data/app/controllers/spina/admin/move_pages_controller.rb +8 -10
  45. data/app/controllers/spina/admin/navigation_items_controller.rb +13 -14
  46. data/app/controllers/spina/admin/navigations_controller.rb +26 -26
  47. data/app/controllers/spina/admin/page_translations_controller.rb +1 -3
  48. data/app/controllers/spina/admin/pages_controller.rb +34 -34
  49. data/app/controllers/spina/admin/parent_pages_controller.rb +1 -3
  50. data/app/controllers/spina/admin/password_resets_controller.rb +8 -9
  51. data/app/controllers/spina/admin/resources_controller.rb +14 -15
  52. data/app/controllers/spina/admin/sessions_controller.rb +2 -2
  53. data/app/controllers/spina/admin/settings_controller.rb +28 -29
  54. data/app/controllers/spina/admin/theme_controller.rb +10 -11
  55. data/app/controllers/spina/admin/users_controller.rb +28 -29
  56. data/app/controllers/spina/api/api_controller.rb +17 -17
  57. data/app/controllers/spina/api/images_controller.rb +1 -3
  58. data/app/controllers/spina/api/navigations_controller.rb +2 -4
  59. data/app/controllers/spina/api/pages_controller.rb +8 -9
  60. data/app/controllers/spina/api/resources_controller.rb +2 -4
  61. data/app/controllers/spina/application_controller.rb +4 -3
  62. data/app/controllers/spina/pages_controller.rb +4 -5
  63. data/app/controllers/spina/sitemaps_controller.rb +0 -2
  64. data/app/helpers/spina/admin/icons_helper.rb +151 -153
  65. data/app/helpers/spina/admin/images_helper.rb +0 -2
  66. data/app/helpers/spina/admin/pages_helper.rb +3 -5
  67. data/app/helpers/spina/attachments_helper.rb +1 -3
  68. data/app/helpers/spina/images_helper.rb +5 -7
  69. data/app/helpers/spina/pages_helper.rb +0 -2
  70. data/app/helpers/spina/spina_helper.rb +1 -3
  71. data/app/jobs/spina/replace_signed_id_job.rb +10 -11
  72. data/app/jobs/spina/resource_pages_update_job.rb +1 -1
  73. data/app/mailers/spina/application_mailer.rb +2 -2
  74. data/app/mailers/spina/user_mailer.rb +4 -6
  75. data/app/models/concerns/spina/gravatar.rb +11 -12
  76. data/app/models/concerns/spina/partable.rb +4 -6
  77. data/app/models/concerns/spina/translated_content.rb +5 -5
  78. data/app/models/spina/account.rb +9 -10
  79. data/app/models/spina/application_record.rb +2 -3
  80. data/app/models/spina/attachment.rb +3 -4
  81. data/app/models/spina/current.rb +1 -1
  82. data/app/models/spina/embeds/base.rb +2 -2
  83. data/app/models/spina/embeds/button.rb +4 -4
  84. data/app/models/spina/embeds/vimeo.rb +17 -18
  85. data/app/models/spina/embeds/youtube.rb +18 -19
  86. data/app/models/spina/image.rb +4 -4
  87. data/app/models/spina/media_folder.rb +1 -1
  88. data/app/models/spina/navigation.rb +1 -2
  89. data/app/models/spina/navigation_item.rb +2 -2
  90. data/app/models/spina/page.rb +32 -38
  91. data/app/models/spina/parts/attachment.rb +1 -2
  92. data/app/models/spina/parts/base.rb +5 -4
  93. data/app/models/spina/parts/image.rb +3 -4
  94. data/app/models/spina/parts/image_collection.rb +2 -3
  95. data/app/models/spina/parts/image_variant.rb +3 -4
  96. data/app/models/spina/parts/repeater_content.rb +2 -2
  97. data/app/models/spina/resource.rb +3 -4
  98. data/app/models/spina/rewrite_rule.rb +1 -1
  99. data/app/models/spina/setting.rb +0 -2
  100. data/app/models/spina/user.rb +3 -4
  101. data/app/presenters/spina/content_presenter.rb +11 -12
  102. data/app/presenters/spina/menu_presenter.rb +55 -55
  103. data/app/presenters/spina/rich_text_presenter.rb +28 -29
  104. data/app/serializers/spina/api/base_serializer.rb +1 -1
  105. data/app/serializers/spina/api/image_serializer.rb +6 -6
  106. data/app/serializers/spina/api/navigation_serializer.rb +4 -7
  107. data/app/serializers/spina/api/page_serializer.rb +9 -12
  108. data/app/serializers/spina/api/resource_serializer.rb +5 -5
  109. data/app/views/layouts/spina/admin/application.html.erb +1 -0
  110. data/app/views/spina/admin/parts/attachments/_attachment.html.erb +3 -0
  111. data/app/views/spina/admin/parts/attachments/_form.html.erb +22 -1
  112. data/app/views/spina/admin/parts/repeaters/_fields.html.erb +2 -2
  113. data/app/views/spina/admin/parts/repeaters/_form.html.erb +4 -4
  114. data/app/views/spina/admin/shared/_navigation.html.erb +3 -1
  115. data/app/views/spina/admin/shared/_version.html.erb +18 -0
  116. data/app/views/spina/sitemaps/show.xml.builder +1 -1
  117. data/config/initializers/importmap.rb +3 -3
  118. data/config/initializers/yaml_column_permitted_classes.rb +3 -3
  119. data/config/locales/de.yml +1 -0
  120. data/config/locales/en.yml +3 -0
  121. data/config/locales/nl.yml +4 -1
  122. data/config/routes.rb +10 -17
  123. data/db/migrate/1_create_spina_tables.rb +57 -57
  124. data/db/migrate/3_create_spina_navigations.rb +1 -1
  125. data/db/seeds.rb +0 -1
  126. data/lib/generators/spina/embed_generator.rb +5 -6
  127. data/lib/generators/spina/install_generator.rb +48 -41
  128. data/lib/generators/spina/tailwind_config_generator.rb +3 -4
  129. data/lib/generators/spina/templates/app/models/spina/embeds/embed.rb.tt +20 -18
  130. data/lib/generators/spina/templates/config/initializers/spina.rb +11 -11
  131. data/lib/generators/spina/templates/config/initializers/themes/default.rb +17 -17
  132. data/lib/generators/spina/templates/config/initializers/themes/demo.rb +22 -22
  133. data/lib/spina/admin_sectionable.rb +5 -8
  134. data/lib/spina/attr_json_monkeypatch.rb +4 -7
  135. data/lib/spina/attr_json_spina_parts_model.rb +1 -3
  136. data/lib/spina/authentication/basic.rb +9 -10
  137. data/lib/spina/authentication/sessions.rb +10 -11
  138. data/lib/spina/embeddable.rb +14 -17
  139. data/lib/spina/embeds/trix_conversion.rb +25 -26
  140. data/lib/spina/embeds.rb +1 -3
  141. data/lib/spina/engine.rb +18 -19
  142. data/lib/spina/part.rb +1 -6
  143. data/lib/spina/plugin.rb +9 -13
  144. data/lib/spina/railtie.rb +5 -7
  145. data/lib/spina/theme.rb +13 -17
  146. data/lib/spina/theme_reloader.rb +12 -13
  147. data/lib/spina/version.rb +1 -1
  148. data/lib/spina.rb +40 -40
  149. data/lib/tasks/install.rake +8 -14
  150. data/lib/tasks/tailwind.rake +10 -8
  151. metadata +18 -2
@@ -1,16 +1,16 @@
1
1
  class CreateSpinaTables < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table "spina_accounts", force: :cascade do |t|
4
- t.string "name"
5
- t.string "address"
6
- t.string "postal_code"
7
- t.string "city"
8
- t.string "phone"
9
- t.string "email"
10
- t.text "preferences"
11
- t.datetime "created_at", null: false
12
- t.datetime "updated_at", null: false
13
- t.boolean "robots_allowed", default: false
4
+ t.string "name"
5
+ t.string "address"
6
+ t.string "postal_code"
7
+ t.string "city"
8
+ t.string "phone"
9
+ t.string "email"
10
+ t.text "preferences"
11
+ t.datetime "created_at", null: false
12
+ t.datetime "updated_at", null: false
13
+ t.boolean "robots_allowed", default: false
14
14
  end
15
15
 
16
16
  create_table "spina_attachment_collections", force: :cascade do |t|
@@ -24,62 +24,62 @@ class CreateSpinaTables < ActiveRecord::Migration[4.2]
24
24
  end
25
25
 
26
26
  create_table "spina_attachments", force: :cascade do |t|
27
- t.string "file"
27
+ t.string "file"
28
28
  t.datetime "created_at", null: false
29
29
  t.datetime "updated_at", null: false
30
30
  end
31
31
 
32
32
  create_table "spina_layout_parts", force: :cascade do |t|
33
- t.string "title"
34
- t.string "name"
35
- t.integer "layout_partable_id"
36
- t.string "layout_partable_type"
33
+ t.string "title"
34
+ t.string "name"
35
+ t.integer "layout_partable_id"
36
+ t.string "layout_partable_type"
37
37
  t.datetime "created_at"
38
38
  t.datetime "updated_at"
39
- t.integer "account_id"
39
+ t.integer "account_id"
40
40
  end
41
41
 
42
42
  create_table "spina_lines", force: :cascade do |t|
43
- t.string "content"
43
+ t.string "content"
44
44
  t.datetime "created_at"
45
45
  t.datetime "updated_at"
46
46
  end
47
47
 
48
48
  create_table "spina_page_parts", force: :cascade do |t|
49
- t.string "title"
50
- t.string "name"
51
- t.datetime "created_at", null: false
52
- t.datetime "updated_at", null: false
53
- t.integer "page_id"
54
- t.integer "page_partable_id"
55
- t.string "page_partable_type"
49
+ t.string "title"
50
+ t.string "name"
51
+ t.datetime "created_at", null: false
52
+ t.datetime "updated_at", null: false
53
+ t.integer "page_id"
54
+ t.integer "page_partable_id"
55
+ t.string "page_partable_type"
56
56
  end
57
57
 
58
58
  create_table "spina_pages", force: :cascade do |t|
59
- t.string "title"
60
- t.string "menu_title"
61
- t.string "description"
62
- t.boolean "show_in_menu", default: true
63
- t.string "slug"
64
- t.boolean "deletable", default: true
65
- t.datetime "created_at", null: false
66
- t.datetime "updated_at", null: false
67
- t.string "name"
68
- t.string "seo_title"
69
- t.boolean "skip_to_first_child", default: false
70
- t.string "view_template"
71
- t.string "layout_template"
72
- t.boolean "draft", default: false
73
- t.string "link_url"
74
- t.string "ancestry"
75
- t.integer "position"
76
- t.string "materialized_path"
77
- t.boolean "active", default: true
59
+ t.string "title"
60
+ t.string "menu_title"
61
+ t.string "description"
62
+ t.boolean "show_in_menu", default: true
63
+ t.string "slug"
64
+ t.boolean "deletable", default: true
65
+ t.datetime "created_at", null: false
66
+ t.datetime "updated_at", null: false
67
+ t.string "name"
68
+ t.string "seo_title"
69
+ t.boolean "skip_to_first_child", default: false
70
+ t.string "view_template"
71
+ t.string "layout_template"
72
+ t.boolean "draft", default: false
73
+ t.string "link_url"
74
+ t.string "ancestry"
75
+ t.integer "position"
76
+ t.string "materialized_path"
77
+ t.boolean "active", default: true
78
78
  end
79
79
 
80
80
  create_table "spina_structure_items", force: :cascade do |t|
81
- t.integer "structure_id"
82
- t.integer "position"
81
+ t.integer "structure_id"
82
+ t.integer "position"
83
83
  t.datetime "created_at"
84
84
  t.datetime "updated_at"
85
85
  end
@@ -87,11 +87,11 @@ class CreateSpinaTables < ActiveRecord::Migration[4.2]
87
87
  add_index "spina_structure_items", ["structure_id"], name: "index_spina_structure_items_on_structure_id", using: :btree
88
88
 
89
89
  create_table "spina_structure_parts", force: :cascade do |t|
90
- t.integer "structure_item_id"
91
- t.integer "structure_partable_id"
92
- t.string "structure_partable_type"
93
- t.string "name"
94
- t.string "title"
90
+ t.integer "structure_item_id"
91
+ t.integer "structure_partable_id"
92
+ t.string "structure_partable_type"
93
+ t.string "name"
94
+ t.string "title"
95
95
  t.datetime "created_at"
96
96
  t.datetime "updated_at"
97
97
  end
@@ -105,18 +105,18 @@ class CreateSpinaTables < ActiveRecord::Migration[4.2]
105
105
  end
106
106
 
107
107
  create_table "spina_texts", force: :cascade do |t|
108
- t.text "content"
108
+ t.text "content"
109
109
  t.datetime "created_at"
110
110
  t.datetime "updated_at"
111
111
  end
112
112
 
113
113
  create_table "spina_users", force: :cascade do |t|
114
- t.string "name"
115
- t.string "email"
116
- t.string "password_digest"
117
- t.boolean "admin", default: false
118
- t.datetime "created_at", null: false
119
- t.datetime "updated_at", null: false
114
+ t.string "name"
115
+ t.string "email"
116
+ t.string "password_digest"
117
+ t.boolean "admin", default: false
118
+ t.datetime "created_at", null: false
119
+ t.datetime "updated_at", null: false
120
120
  t.datetime "last_logged_in"
121
121
  end
122
122
 
@@ -18,4 +18,4 @@ class CreateSpinaNavigations < ActiveRecord::Migration[4.2]
18
18
  t.index ["page_id", "navigation_id"], name: "index_spina_navigation_items_on_page_id_and_navigation_id", unique: true, using: :btree
19
19
  end
20
20
  end
21
- end
21
+ end
data/db/seeds.rb CHANGED
@@ -1,2 +1 @@
1
1
  puts "Seeding #{__FILE__} from Spina::Engine"
2
-
@@ -1,18 +1,17 @@
1
1
  module Spina
2
2
  class EmbedGenerator < Rails::Generators::NamedBase
3
3
  source_root File.expand_path("../templates", __FILE__)
4
-
4
+
5
5
  argument :attributes, type: :array, default: [], banner: "field field"
6
-
6
+
7
7
  def create_embed_object
8
8
  template "app/models/spina/embeds/embed.rb.tt", "app/models/spina/embeds/#{file_name}.rb"
9
9
  end
10
-
10
+
11
11
  def create_views
12
12
  template "app/views/spina/embeds/_fields.html.erb", "app/views/spina/embeds/#{plural_file_name}/_#{file_name}_fields.html.erb"
13
-
13
+
14
14
  template "app/views/spina/embeds/_partial.html.erb", "app/views/spina/embeds/#{plural_file_name}/_#{file_name}.html.erb"
15
15
  end
16
-
17
16
  end
18
- end
17
+ end
@@ -1,18 +1,18 @@
1
1
  module Spina
2
2
  class InstallGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path("../templates", __FILE__)
4
-
4
+
5
5
  class_option :first_deploy, type: :boolean, default: false
6
6
  class_option :silent, type: :boolean, default: false
7
7
 
8
8
  def create_initializer_file
9
9
  return if first_deploy?
10
- template 'config/initializers/spina.rb'
10
+ template "config/initializers/spina.rb"
11
11
  end
12
12
 
13
13
  def create_mobility_initializer_file
14
14
  return if first_deploy?
15
- template 'config/initializers/mobility.rb'
15
+ template "config/initializers/mobility.rb"
16
16
  end
17
17
 
18
18
  def add_route
@@ -23,78 +23,82 @@ module Spina
23
23
 
24
24
  def copy_migrations
25
25
  return if first_deploy?
26
- rake 'spina:install:migrations'
26
+ rake "spina:install:migrations"
27
27
  end
28
28
 
29
29
  def run_migrations
30
30
  return if first_deploy?
31
- rake 'db:migrate'
31
+ rake "db:migrate"
32
32
  end
33
33
 
34
34
  def create_account
35
- return if ::Spina::Account.exists? && ( !talkative_install? || !no?('An account already exists. Skip? [Yn]') )
36
- name = ::Spina::Account.first.try(:name) || 'MySite'
35
+ return if ::Spina::Account.exists? && (silent_install? || !no?("An account already exists. Skip? [Yn]"))
36
+
37
+ name = ::Spina::Account.first&.name || "MySite"
37
38
  if talkative_install?
38
- name = ask("What would you like to name your website? [#{name}]").presence || name
39
+ name = ask("What would you like to name your website?", default: name)
39
40
  end
40
- account = ::Spina::Account.first_or_create.update(name: name)
41
+
42
+ ::Spina::Account.first_or_create.update(name: name)
41
43
  end
42
44
 
43
45
  def set_theme
44
46
  account = ::Spina::Account.first
45
- return if account.theme.present? && ( !talkative_install? || !no?("Theme '#{account.theme}' is set. Skip? [Yn]") )
47
+ return if account.theme.present? && (silent_install? || !no?("Theme '#{account.theme}' is set. Skip? [Yn]"))
46
48
 
47
- theme = account.theme || themes.first
48
- if talkative_install?
49
- theme = begin
50
- theme = ask("What theme do you want to use? (#{themes.join('/')}) [#{theme}]").presence || theme
51
- end until theme.in? themes
49
+ theme = if talkative_install?
50
+ ask("What theme do you want to use?", limited_to: themes)
51
+ else
52
+ account.theme || themes.first
52
53
  end
53
54
 
54
55
  account.update(theme: theme)
55
56
  end
56
57
 
57
58
  def copy_template_files
58
- return if options['first_deploy']
59
+ return if options["first_deploy"]
60
+
59
61
  theme = ::Spina::Account.first.theme
60
- if theme.in? ['default', 'demo']
62
+ if theme.in?(["default", "demo"])
61
63
  template "config/initializers/themes/#{theme}.rb"
62
64
  directory "app/views/#{theme}"
63
65
  directory "app/views/layouts/#{theme}"
64
66
  end
65
67
  Spina::THEMES.clear
66
- Dir[Rails.root.join('config', 'initializers', 'themes', '*.rb')].each { |file| load file }
68
+ Dir[Rails.root.join("config", "initializers", "themes", "*.rb")].each { |file| load file }
67
69
  end
68
70
 
69
71
  def create_user
70
- return if ::Spina::User.exists? && ( !talkative_install? || !no?('A user already exists. Skip? [Yn]') )
72
+ return if ::Spina::User.exists? && (silent_install? || !no?("A user already exists. Skip? [Yn]"))
71
73
 
72
- email = 'admin@domain.com'
74
+ email = "admin@domain.com"
73
75
  if talkative_install?
74
- email = ask("Please enter an email address for your first user: [#{email}]").presence || email
76
+ email = ask("Please enter an email address for your first user:", default: email)
75
77
  end
76
- password = 'password'
78
+
79
+ password = "password"
77
80
  if talkative_install?
78
- password = ask("Create a temporary password: [#{password}]").presence || password
81
+ password = ask("Create a temporary password:", default: password)
79
82
  end
83
+
80
84
  @temporary_password = password
81
- ::Spina::User.create name: 'admin', email: email, password: password, admin: true
85
+ ::Spina::User.create name: "admin", email: email, password: password, admin: true
82
86
  end
83
87
 
84
88
  def bootstrap_spina
85
- rake 'spina:bootstrap'
89
+ rake "spina:bootstrap"
86
90
  end
87
-
91
+
88
92
  def build_tailwind
89
- rake 'spina:tailwind:build'
93
+ rake "spina:tailwind:build"
90
94
  end
91
95
 
92
96
  def feedback
93
- return if !talkative_install?
97
+ return if silent_install?
94
98
  puts
95
- puts ' Your Spina site has been succesfully installed! '
99
+ puts " Your Spina site has been succesfully installed! "
96
100
  puts
97
- puts ' Restart your server and visit http://localhost:3000 in your browser!'
101
+ puts " Restart your server and visit http://localhost:3000 in your browser!"
98
102
  puts " The admin backend is located at http://localhost:3000/#{Spina.config.backend_path}."
99
103
  puts
100
104
  puts " Site name : #{::Spina::Account.first.name}"
@@ -106,18 +110,21 @@ module Spina
106
110
 
107
111
  private
108
112
 
109
- def themes
110
- themes = Spina::Theme.all.map(&:name)
111
- themes | ['default', 'demo']
112
- end
113
-
114
- def first_deploy?
115
- options['first_deploy']
116
- end
113
+ def themes
114
+ themes = Spina::Theme.all.map(&:name)
115
+ themes | ["default", "demo"]
116
+ end
117
117
 
118
- def talkative_install?
119
- !options['silent']
120
- end
118
+ def first_deploy?
119
+ options["first_deploy"]
120
+ end
121
+
122
+ def talkative_install?
123
+ !silent_install?
124
+ end
121
125
 
126
+ def silent_install?
127
+ options["silent"]
128
+ end
122
129
  end
123
130
  end
@@ -1,10 +1,9 @@
1
1
  module Spina
2
2
  class TailwindConfigGenerator < Rails::Generators::Base
3
3
  source_root File.expand_path("../templates", __FILE__)
4
-
4
+
5
5
  def create_tailwind_config_file
6
- template 'app/assets/config/spina/tailwind.config.js'
6
+ template "app/assets/config/spina/tailwind.config.js"
7
7
  end
8
-
9
8
  end
10
- end
9
+ end
@@ -1,18 +1,20 @@
1
- class <%= class_name %> < Spina::Embeds::Base
2
- attributes <%= attributes.map{|attr| ":#{attr.name}"}.join(", ") %>
3
-
4
- # You can use Rails validations on your attributes
5
- validates <%= attributes.map{|attr| ":#{attr.name}"}.join(", ") %>, presence: true
6
-
7
- # Pick an icon at https://heroicons.com
8
- # and it'll show up in the list of embeddable components
9
- heroicon "chip"
10
-
11
- # If you want to render your embeddable component differently in Trix,
12
- # you can choose to render a different partial
13
- # Default: _<%= file_name %>.html.erb
14
- #
15
- # def to_trix_partial_path
16
- # "spina/embeds/<%= plural_file_name %>/trix_<%= file_name %>"
17
- # end
18
- end
1
+ module Spina::Embeds
2
+ class <%= class_name %> < Spina::Embeds::Base
3
+ attributes <%= attributes.map{|attr| ":#{attr.name}"}.join(", ") %>
4
+
5
+ # You can use Rails validations on your attributes
6
+ validates <%= attributes.map{|attr| ":#{attr.name}"}.join(", ") %>, presence: true
7
+
8
+ # Pick an icon at https://heroicons.com
9
+ # and it'll show up in the list of embeddable components
10
+ heroicon "chip"
11
+
12
+ # If you want to render your embeddable component differently in Trix,
13
+ # you can choose to render a different partial
14
+ # Default: _<%= file_name %>.html.erb
15
+ #
16
+ # def to_trix_partial_path
17
+ # "spina/embeds/<%= plural_file_name %>/trix_<%= file_name %>"
18
+ # end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- Spina.configure do |config|
1
+ Spina.configure do |config|
2
2
  # Locales
3
3
  # ===============
4
4
  # All locales your content should be available in.
@@ -15,51 +15,51 @@ Spina.configure do |config|
15
15
  # Uncomment the config below to disable 'current_account'.
16
16
  # Use this if you are having a namespace conflict with the deprecated 'current_account' method.
17
17
  # config.disable_current_account = true
18
-
18
+
19
19
  # Frontend routes
20
20
  # ===============
21
21
  # Uncomment the config below to disable all frontend routes.
22
22
  # You'll have to write your own.
23
23
  # config.disable_frontend_routes = true
24
-
24
+
25
25
  # Embedded image size
26
26
  # ===============
27
27
  # Images that are inserted in rich text fields are resized automatically.
28
28
  # You can define your desired dimensions here.
29
29
  # config.embedded_image_size = [2000, 2000]
30
-
30
+
31
31
  # Thumbnail image size
32
32
  # ===============
33
33
  # Thumbnail images for the API are generated using `resize_to_fill`.
34
34
  # config.thumbnail_image_size = [400, 400]
35
-
35
+
36
36
  # Parent controller
37
37
  # ===============
38
38
  # The parent controller all frontend Spina controllers inherit from
39
39
  # Defaults to ApplicationController
40
40
  # config.frontend_parent_controller = "ApplicationController"
41
-
41
+
42
42
  # Authentication
43
43
  # ===============
44
44
  # Specify the module that handles authentication
45
45
  # You can swap this out for something like Devise, or you can use your own authentication.
46
46
  # The default is Spina::Authentication::Sessions and includes basic user management
47
47
  # config.authentication = "Spina::Authentication::Sessions"
48
-
48
+
49
49
  # Mailers
50
50
  # ===============
51
51
  # In order to send emails, you need to set a default from address.
52
52
  # You can set an optional reply_to address as well.
53
53
  # config.mailer_defaults.from = "no-reply@example.com"
54
54
  # config.mailer_defaults.reply_to = "support@example.com"
55
-
55
+
56
56
  # API
57
57
  # ===============
58
- # Set an API key to activate Spina's API.
58
+ # Set an API key to activate Spina's API.
59
59
  # It's highly recommended to use Rails credentials to store this API key.
60
60
  # config.api_key = Rails.application.credentials.spina_api_key
61
61
  # config.api_path = 'api'
62
-
62
+
63
63
  # Background jobs
64
64
  # ===============
65
65
  # By default, all background jobs are queued as :default
@@ -79,7 +79,7 @@ Spina.configure do |config|
79
79
  # Transliterations
80
80
  # ===============
81
81
  # Set provided transliterations for normalizing url slugs
82
- # %i( bulgarian cyrillic danish german greek latin macedonian norwegian
82
+ # %i( bulgarian cyrillic danish german greek latin macedonian norwegian
83
83
  # romanian russian serbian spanish swedish ukrainian vietnamese)
84
84
  # config.transliterations = %i(latin)
85
85
  end
@@ -5,12 +5,12 @@
5
5
 
6
6
  Spina::Theme.register do |theme|
7
7
  # All views are namespaced based on the theme's name
8
- theme.name = 'default'
9
- theme.title = 'Default theme'
10
-
11
- # Parts
8
+ theme.name = "default"
9
+ theme.title = "Default theme"
10
+
11
+ # Parts
12
12
  # Define all editable parts you want to use in your view templates
13
- #
13
+ #
14
14
  # Built-in part types:
15
15
  # - Line
16
16
  # - MultiLine
@@ -21,45 +21,45 @@ Spina::Theme.register do |theme|
21
21
  # - Option
22
22
  # - Repeater
23
23
  theme.parts = [
24
- {name: 'text', title: "Body", hint: "Your main content", part_type: "Spina::Parts::Text"}
24
+ {name: "text", title: "Body", hint: "Your main content", part_type: "Spina::Parts::Text"}
25
25
  ]
26
-
26
+
27
27
  # View templates
28
28
  # Every page has a view template stored in app/views/my_theme/pages/*
29
29
  # You define which parts you want to enable for every view template
30
30
  # by referencing them from the theme.parts configuration above.
31
31
  theme.view_templates = [
32
- {name: 'homepage', title: 'Homepage', parts: %w(text)},
33
- {name: 'show', title: 'Page', parts: %w(text)}
32
+ {name: "homepage", title: "Homepage", parts: %w[text]},
33
+ {name: "show", title: "Page", parts: %w[text]}
34
34
  ]
35
-
35
+
36
36
  # Custom pages
37
37
  # Some pages should not be created by the user, but generated automatically.
38
38
  # By naming them you can reference them in your code.
39
39
  theme.custom_pages = [
40
- {name: 'homepage', title: "Homepage", deletable: false, view_template: "homepage"},
40
+ {name: "homepage", title: "Homepage", deletable: false, view_template: "homepage"}
41
41
  ]
42
-
42
+
43
43
  # Navigations (optional)
44
44
  # If your project has multiple navigations, it can be useful to configure multiple
45
45
  # navigations.
46
46
  theme.navigations = [
47
- {name: 'main', label: 'Main navigation'}
47
+ {name: "main", label: "Main navigation"}
48
48
  ]
49
-
49
+
50
50
  # Layout parts (optional)
51
51
  # You can create global content that doesn't belong to one specific page. We call these layout parts.
52
52
  # You only have to reference the name of the parts you want to have here.
53
53
  theme.layout_parts = []
54
-
54
+
55
55
  # Resources (optional)
56
56
  # Think of resources as a collection of pages. They are managed separately in Spina
57
57
  # allowing you to separate these pages from the 'main' collection of pages.
58
58
  theme.resources = []
59
-
59
+
60
60
  # Plugins (optional)
61
61
  theme.plugins = []
62
-
62
+
63
63
  # Embeds (optional)
64
64
  theme.embeds = []
65
65
  end