spina 2.12.0 → 2.13.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 (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 +39 -40
  149. data/lib/tasks/install.rake +8 -14
  150. data/lib/tasks/tailwind.rake +10 -8
  151. metadata +18 -2
@@ -4,7 +4,7 @@ module Spina
4
4
 
5
5
  attr_accessor :_destroy
6
6
 
7
- scope :sorted, -> { order('created_at DESC') }
7
+ scope :sorted, -> { order("created_at DESC") }
8
8
 
9
9
  def name
10
10
  file.filename.to_s
@@ -13,7 +13,7 @@ module Spina
13
13
  def content
14
14
  file if file.attached?
15
15
  end
16
-
16
+
17
17
  def present?
18
18
  signed_blob_id.present?
19
19
  end
@@ -21,11 +21,10 @@ module Spina
21
21
  alias_method :old_update, :update
22
22
  def update(attributes)
23
23
  if attributes["_destroy"] == "1" && attributes["file"].blank?
24
- self.page_part.destroy
24
+ page_part.destroy
25
25
  else
26
26
  old_update(attributes)
27
27
  end
28
28
  end
29
-
30
29
  end
31
30
  end
@@ -5,4 +5,4 @@ module Spina
5
5
  attribute :user
6
6
  attribute :theme
7
7
  end
8
- end
8
+ end
@@ -1,7 +1,7 @@
1
1
  module Spina::Embeds
2
- class Base
2
+ class Base
3
3
  include ActiveModel::Model
4
4
  include Spina::Embeddable
5
5
  include Spina::Embeds::TrixConversion
6
6
  end
7
- end
7
+ end
@@ -1,13 +1,13 @@
1
1
  module Spina::Embeds
2
2
  class Button < Base
3
3
  attributes :url, :label
4
-
4
+
5
5
  heroicon "cursor-click"
6
-
6
+
7
7
  validates :url, :label, presence: true
8
-
8
+
9
9
  def to_trix_partial_path
10
10
  "spina/embeds/buttons/trix_button"
11
11
  end
12
12
  end
13
- end
13
+ end
@@ -1,39 +1,38 @@
1
- require 'net/http'
1
+ require "net/http"
2
2
 
3
3
  module Spina::Embeds
4
4
  class Vimeo < Base
5
5
  attributes :url
6
-
6
+
7
7
  heroicon "video-camera"
8
-
8
+
9
9
  REGEX = /(https?:\/\/)?(www.)?(player.)?vimeo.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/
10
-
10
+
11
11
  validates :url, presence: true, format: {with: REGEX}
12
-
12
+
13
13
  def id
14
14
  REGEX.match(url).try(:[], 5)
15
15
  end
16
-
16
+
17
17
  # Get title from Vimeo API (remote call)
18
18
  def remote_title
19
19
  get_vimeo_json&.dig(0, "title")
20
20
  end
21
-
21
+
22
22
  def to_trix_partial_path
23
23
  "spina/embeds/vimeos/thumbnail"
24
24
  end
25
-
25
+
26
26
  private
27
-
28
- def get_vimeo_json
29
- uri = URI("https://vimeo.com/api/v2/video/#{id}.json")
30
- response = Net::HTTP.get(uri)
31
- begin
32
- JSON.parse(response)
33
- rescue
34
- nil
35
- end
27
+
28
+ def get_vimeo_json
29
+ uri = URI("https://vimeo.com/api/v2/video/#{id}.json")
30
+ response = Net::HTTP.get(uri)
31
+ begin
32
+ JSON.parse(response)
33
+ rescue
34
+ nil
36
35
  end
37
-
36
+ end
38
37
  end
39
38
  end
@@ -1,39 +1,38 @@
1
- require 'net/http'
1
+ require "net/http"
2
2
 
3
3
  module Spina::Embeds
4
4
  class Youtube < Base
5
5
  attributes :url
6
-
6
+
7
7
  heroicon "video-camera"
8
-
8
+
9
9
  REGEX = /(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/
10
-
10
+
11
11
  validates :url, presence: true, format: {with: REGEX}
12
-
12
+
13
13
  def id
14
14
  REGEX.match(url).try(:[], 1)
15
15
  end
16
-
16
+
17
17
  # Get title from Youtube API (remote call)
18
18
  def remote_title
19
19
  get_youtube_json&.dig("title")
20
20
  end
21
-
21
+
22
22
  def to_trix_partial_path
23
23
  "spina/embeds/youtubes/thumbnail"
24
24
  end
25
-
25
+
26
26
  private
27
-
28
- def get_youtube_json
29
- uri = URI("https://www.youtube.com/oembed?url=http://youtube.com/watch?v=#{id}&format=json")
30
- response = Net::HTTP.get(uri)
31
- begin
32
- JSON.parse(response)
33
- rescue
34
- nil
35
- end
27
+
28
+ def get_youtube_json
29
+ uri = URI("https://www.youtube.com/oembed?url=http://youtube.com/watch?v=#{id}&format=json")
30
+ response = Net::HTTP.get(uri)
31
+ begin
32
+ JSON.parse(response)
33
+ rescue
34
+ nil
36
35
  end
37
-
36
+ end
38
37
  end
39
- end
38
+ end
@@ -4,7 +4,7 @@ module Spina
4
4
 
5
5
  has_one_attached :file
6
6
 
7
- scope :sorted, -> { order('created_at DESC') }
7
+ scope :sorted, -> { order("created_at DESC") }
8
8
 
9
9
  def name
10
10
  file.try(:filename).to_s
@@ -12,7 +12,7 @@ module Spina
12
12
 
13
13
  def variant(options)
14
14
  return "" unless file.attached?
15
- return file if file.content_type.include?('svg')
15
+ return file if file.content_type.include?("svg")
16
16
  return file unless file.variable?
17
17
 
18
18
  file.variant(options)
@@ -22,10 +22,10 @@ module Spina
22
22
  self
23
23
  end
24
24
 
25
- def thumbnail(size = '100x100', modifier = '^')
25
+ def thumbnail(size = "100x100", modifier = "^")
26
26
  variant(
27
27
  combine_options: {
28
- gravity: 'center',
28
+ gravity: "center",
29
29
  thumbnail: "#{size}#{modifier}",
30
30
  extent: size
31
31
  }
@@ -4,4 +4,4 @@ module Spina
4
4
 
5
5
  validates :name, presence: true, uniqueness: true
6
6
  end
7
- end
7
+ end
@@ -11,6 +11,5 @@ module Spina
11
11
  def cache_key
12
12
  super + "_" + Mobility.locale.to_s
13
13
  end
14
-
15
14
  end
16
- end
15
+ end
@@ -6,7 +6,7 @@ module Spina
6
6
  has_ancestry
7
7
 
8
8
  scope :regular_pages, -> { joins(:page).where(spina_pages: {resource_id: nil}) }
9
- scope :sorted, -> { order('spina_navigation_items.position') }
9
+ scope :sorted, -> { order("spina_navigation_items.position") }
10
10
  scope :live, -> { joins(:page).where(spina_pages: {draft: false, active: true}) }
11
11
  scope :in_menu, -> { joins(:page).where(spina_pages: {show_in_menu: true}) }
12
12
  scope :active, -> { joins(:page).where(spina_pages: {active: true}) }
@@ -15,4 +15,4 @@ module Spina
15
15
 
16
16
  delegate :menu_title, :materialized_path, :draft?, to: :page
17
17
  end
18
- end
18
+ end
@@ -20,7 +20,7 @@ module Spina
20
20
  belongs_to :resource, optional: true, touch: true
21
21
 
22
22
  scope :main, -> { where(resource_id: nil) }
23
- scope :regular_pages, -> { main }
23
+ scope :regular_pages, -> { main }
24
24
  scope :resource_pages, -> { where.not(resource: nil) }
25
25
  scope :active, -> { where(active: true) }
26
26
  scope :sorted, -> { order(:position) }
@@ -59,7 +59,7 @@ module Spina
59
59
  end
60
60
 
61
61
  def homepage?
62
- name == 'homepage'
62
+ name == "homepage"
63
63
  end
64
64
 
65
65
  def custom_page?
@@ -75,11 +75,11 @@ module Spina
75
75
  end
76
76
 
77
77
  def previous_sibling
78
- siblings.where('position < ?', position).sorted.last
78
+ siblings.where("position < ?", position).sorted.last
79
79
  end
80
80
 
81
81
  def next_sibling
82
- siblings.where('position > ?', position).sorted.first
82
+ siblings.where("position > ?", position).sorted.first
83
83
  end
84
84
 
85
85
  def set_materialized_path
@@ -98,48 +98,42 @@ module Spina
98
98
  super + "_" + Mobility.locale.to_s
99
99
  end
100
100
 
101
- def view_template_config(theme)
102
- view_template_name = view_template.presence || 'show'
103
- theme.view_templates.find { |template| template[:name] == view_template_name }
104
- end
105
-
106
101
  private
107
102
 
108
- def set_default_position
109
- self.position ||= self.class.maximum(:position).to_i.next
110
- end
111
-
112
- def set_resource_from_parent
113
- self.resource_id = parent.resource_id
114
- end
103
+ def set_default_position
104
+ self.position ||= self.class.maximum(:position).to_i.next
105
+ end
115
106
 
116
- def touch_navigations
117
- navigations.update_all(updated_at: Time.zone.now)
118
- end
107
+ def set_resource_from_parent
108
+ self.resource_id = parent.resource_id
109
+ end
119
110
 
120
- def rewrite_rule
121
- RewriteRule.where(old_path: old_path).first_or_create.update(new_path: materialized_path) if old_path != materialized_path
122
- end
111
+ def touch_navigations
112
+ navigations.update_all(updated_at: Time.zone.now)
113
+ end
123
114
 
124
- def localized_materialized_path
125
- segments = if Mobility.locale == I18n.default_locale
126
- [Spina.mounted_at, generate_materialized_path]
127
- else
128
- [Spina.mounted_at, Mobility.locale, generate_materialized_path]
129
- end
130
- File.join(*segments.map(&:to_s).compact)
131
- end
115
+ def rewrite_rule
116
+ RewriteRule.where(old_path: old_path).first_or_create.update(new_path: materialized_path) if old_path != materialized_path
117
+ end
132
118
 
133
- def generate_materialized_path
134
- path_fragments = [resource&.slug]
135
- path_fragments.append *ancestors.collect(&:slug)
136
- path_fragments.append(slug) unless homepage?
137
- path_fragments.compact.map(&:parameterize).join('/')
119
+ def localized_materialized_path
120
+ segments = if Mobility.locale == I18n.default_locale
121
+ [Spina.mounted_at, generate_materialized_path]
122
+ else
123
+ [Spina.mounted_at, Mobility.locale, generate_materialized_path]
138
124
  end
125
+ File.join(*segments.map(&:to_s).compact)
126
+ end
139
127
 
140
- def duplicate_materialized_path?
141
- self.class.where.not(id: id).i18n.where(materialized_path: materialized_path).exists?
142
- end
128
+ def generate_materialized_path
129
+ path_fragments = [resource&.slug]
130
+ path_fragments.append(*ancestors.collect(&:slug))
131
+ path_fragments.append(slug) unless homepage?
132
+ path_fragments.compact.map(&:parameterize).join("/")
133
+ end
143
134
 
135
+ def duplicate_materialized_path?
136
+ self.class.where.not(id: id).i18n.where(materialized_path: materialized_path).exists?
137
+ end
144
138
  end
145
139
  end
@@ -12,11 +12,10 @@ module Spina
12
12
  def present?
13
13
  signed_blob_id.present?
14
14
  end
15
-
15
+
16
16
  def signed_id(expires_in: nil)
17
17
  signed_blob_id
18
18
  end
19
-
20
19
  end
21
20
  end
22
21
  end
@@ -6,14 +6,15 @@ module Spina
6
6
  attr_json_config(unknown_key: :strip)
7
7
 
8
8
  attr_json :name, :string
9
-
10
- attr_accessor :title, :hint
9
+
10
+ attr_accessor :title, :hint, :item_name
11
11
 
12
12
  def label
13
13
  content&.to_s
14
14
  end
15
15
 
16
- def content; end
16
+ def content
17
+ end
17
18
  end
18
19
  end
19
- end
20
+ end
@@ -17,7 +17,7 @@ module Spina
17
17
  end
18
18
 
19
19
  def svg?
20
- filename =~ /\.svg\z/
20
+ filename.end_with?(".svg")
21
21
  end
22
22
 
23
23
  def spina_image
@@ -27,15 +27,14 @@ module Spina
27
27
  def present?
28
28
  signed_blob_id.present?
29
29
  end
30
-
30
+
31
31
  def signed_id(expires_in: nil)
32
32
  signed_blob_id
33
33
  end
34
-
34
+
35
35
  def variant(options)
36
36
  Spina::Parts::ImageVariant.new(self, options)
37
37
  end
38
-
39
38
  end
40
39
  end
41
40
  end
@@ -2,7 +2,7 @@ module Spina
2
2
  module Parts
3
3
  class ImageCollection < Base
4
4
  include AttrJson::NestedAttributes
5
-
5
+
6
6
  attr_json :images, Image.to_type, array: true
7
7
  attr_json_accepts_nested_attributes_for :images
8
8
 
@@ -17,7 +17,6 @@ module Spina
17
17
  def image_ids
18
18
  content.map(&:image_id)
19
19
  end
20
-
21
20
  end
22
21
  end
23
- end
22
+ end
@@ -2,18 +2,17 @@ module Spina
2
2
  module Parts
3
3
  class ImageVariant
4
4
  attr_reader :blob
5
-
5
+
6
6
  def initialize(image, options)
7
7
  @blob = image
8
8
  @options = options
9
9
  end
10
-
10
+
11
11
  def variation
12
12
  OpenStruct.new({
13
13
  key: ActiveStorage::Variation.encode(@options)
14
14
  })
15
- end
16
-
15
+ end
17
16
  end
18
17
  end
19
18
  end
@@ -8,8 +8,8 @@ module Spina
8
8
  attr_json_accepts_nested_attributes_for :parts
9
9
 
10
10
  def find_part(name)
11
- (parts || []).find{|part| part.name.to_s == name.to_s}
11
+ (parts || []).find { |part| part.name.to_s == name.to_s }
12
12
  end
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -24,13 +24,12 @@ module Spina
24
24
  ResourcePagesUpdateJob.perform_later(id)
25
25
  end
26
26
  end
27
-
27
+
28
28
  def order_by_options
29
29
  [
30
- [Spina::Page.human_attribute_name(:title), "title"],
30
+ [Spina::Page.human_attribute_name(:title), "title"],
31
31
  [Spina::Page.human_attribute_name(:created_at), "created_at"]
32
32
  ]
33
33
  end
34
-
35
34
  end
36
- end
35
+ end
@@ -2,4 +2,4 @@ module Spina
2
2
  class RewriteRule < ApplicationRecord
3
3
  validates :old_path, uniqueness: true
4
4
  end
5
- end
5
+ end
@@ -1,7 +1,5 @@
1
1
  module Spina
2
2
  class Setting < ApplicationRecord
3
-
4
3
  validates :plugin, presence: true
5
-
6
4
  end
7
5
  end
@@ -1,12 +1,12 @@
1
1
  module Spina
2
2
  class User < ApplicationRecord
3
3
  include Gravatar
4
-
4
+
5
5
  has_secure_password
6
6
  has_secure_token :password_reset_token
7
7
 
8
8
  validates :name, presence: true
9
- validates :email, uniqueness: true, presence: true, format: { with:/\A[^@]+@[^@]+\z/ }
9
+ validates :email, uniqueness: true, presence: true, format: {with: /\A[^@]+@[^@]+\z/}
10
10
 
11
11
  def admin?
12
12
  admin
@@ -15,12 +15,11 @@ module Spina
15
15
  def to_s
16
16
  name
17
17
  end
18
-
18
+
19
19
  def reset_passord!
20
20
  regenerate_password_reset_token
21
21
  self.password_reset_sent_at = Time.current
22
22
  save!
23
23
  end
24
-
25
24
  end
26
25
  end
@@ -35,17 +35,16 @@ module Spina
35
35
 
36
36
  private
37
37
 
38
- def main_app_image_url(image, variant_options = {})
39
- # SVG's can't have variants,
40
- # Render rails_service_blob_url directly instead
41
- return view_context.main_app.url_for(image) if image.svg?
42
-
43
- view_context.main_app.url_for(image.variant(variant_options))
44
- end
45
-
46
- def find_part(name)
47
- container.find_part(name)
48
- end
38
+ def main_app_image_url(image, variant_options = {})
39
+ # SVG's can't have variants,
40
+ # Render rails_service_blob_url directly instead
41
+ return view_context.main_app.url_for(image) if image.svg?
49
42
 
43
+ view_context.main_app.url_for(image.variant(variant_options))
44
+ end
45
+
46
+ def find_part(name)
47
+ container.find_part(name)
48
+ end
50
49
  end
51
- end
50
+ end