spina 2.0.0.alpha → 2.0.0.beta
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.
- checksums.yaml +4 -4
- data/app/assets/icons/spina/preview/icons_spina-preview.html +0 -2
- data/app/assets/icons/spina/preview/ics_spina-preview.html +0 -2
- data/app/assets/javascripts/spina/admin/controllers/media_picker_controller.js +1 -1
- data/app/assets/javascripts/spina/admin/scaffold.coffee +1 -0
- data/app/assets/stylesheets/spina/_forms.sass +7 -1
- data/app/assets/stylesheets/spina/_trix_custom.sass +14 -4
- data/app/controllers/concerns/spina/current_methods.rb +26 -0
- data/app/controllers/spina/admin/admin_controller.rb +5 -1
- data/app/controllers/spina/application_controller.rb +6 -23
- data/app/controllers/spina/pages_controller.rb +11 -13
- data/app/controllers/spina/sitemaps_controller.rb +6 -6
- data/app/helpers/spina/images_helper.rb +5 -20
- data/app/models/spina/page.rb +12 -3
- data/app/models/spina/parts/attachment.rb +5 -0
- data/app/models/spina/parts/image.rb +9 -0
- data/app/models/spina/parts/image_variant.rb +19 -0
- data/app/models/spina/parts/multi_line.rb +7 -0
- data/app/presenters/spina/content_presenter.rb +4 -11
- data/app/views/layouts/spina/admin/admin.html.haml +0 -3
- data/app/views/layouts/spina/login.html.haml +0 -3
- data/app/views/spina/admin/accounts/social.html.haml +13 -7
- data/app/views/spina/admin/attachments/index.html.haml +1 -1
- data/app/views/spina/admin/images/_image.html.haml +1 -1
- data/app/views/spina/admin/media_folders/_media_folder.html.haml +1 -1
- data/app/views/spina/admin/media_picker/_image.html.haml +1 -1
- data/app/views/spina/admin/media_picker/_media_picker_grid.html.haml +2 -2
- data/app/views/spina/admin/media_picker/_modal.html.haml +1 -1
- data/app/views/spina/admin/media_picker/select.js.erb +1 -1
- data/app/views/spina/admin/parts/multi_lines/_form.html.haml +2 -0
- data/app/views/spina/admin/parts/repeaters/_form.html.haml +2 -3
- data/config/routes.rb +13 -0
- data/lib/generators/spina/templates/config/initializers/mobility.rb +13 -4
- data/lib/generators/spina/templates/config/initializers/spina.rb +4 -0
- data/lib/generators/spina/templates/config/initializers/themes/default.rb +3 -3
- data/lib/spina.rb +17 -4
- data/lib/spina/engine.rb +8 -11
- data/lib/spina/version.rb +1 -1
- data/lib/tasks/spina_tasks.rake +1 -1
- metadata +21 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ffac212f63076f1f1f2618fd99a9aea48b98522a17744693effa84c3a0b728f
|
4
|
+
data.tar.gz: 4fc74453a0f0a9bee380e48f6b5fff9af7b5b3c9b1291baf857e3ff6d0d90980
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60571a66d7df102b996d258960bb820f5a29186cb42153a20970a98606af9515b12da196debc41d11ba352b1af7febb6b90a71b3e71d76aaeaa43c2ad6ddad30
|
7
|
+
data.tar.gz: 4b9724c07226f0ce27df11bfce67062da229a5ed4d1e6af6595345f78513fa84a1943afc86aaa6c5a091e012a93e218a6bce6f5240cb4259583daaa4432391ed
|
@@ -288,8 +288,6 @@
|
|
288
288
|
.icon-users-outline:before { content: "\f107"; }
|
289
289
|
</style>
|
290
290
|
|
291
|
-
<!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
292
|
-
|
293
291
|
<script>
|
294
292
|
function toggleCharacters() {
|
295
293
|
var body = document.getElementsByTagName('body')[0];
|
@@ -309,8 +309,6 @@
|
|
309
309
|
.icon-users-outline:before { content: "\f137"; }
|
310
310
|
</style>
|
311
311
|
|
312
|
-
<!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
|
313
|
-
|
314
312
|
<script>
|
315
313
|
function toggleCharacters() {
|
316
314
|
var body = document.getElementsByTagName('body')[0];
|
@@ -76,7 +76,7 @@
|
|
76
76
|
|
77
77
|
insert_trix(event) {
|
78
78
|
let customEvent = new CustomEvent("image-insert", {bubbles: true, cancelable: true, detail: {
|
79
|
-
url: this.trixImage.dataset.
|
79
|
+
url: this.trixImage.dataset.imageUrl,
|
80
80
|
alt: this.altTarget.value,
|
81
81
|
link_to_url: this.linkToUrlTarget.value
|
82
82
|
}})
|
@@ -65,6 +65,7 @@ ready = ->
|
|
65
65
|
if header = document.getElementById('header')
|
66
66
|
headerHeight = header.getBoundingClientRect().height
|
67
67
|
$('section#main').css({paddingTop: headerHeight})
|
68
|
+
$('section#main trix-toolbar').css({top: headerHeight + 15})
|
68
69
|
|
69
70
|
# Login wrapper
|
70
71
|
$('#login_wrapper').css('margin-top', $(document).innerHeight() / 8)
|
@@ -677,13 +677,14 @@ input.datepicker
|
|
677
677
|
ul li a, ul li.sortable-placeholder
|
678
678
|
color: #444
|
679
679
|
cursor: pointer
|
680
|
-
display:
|
680
|
+
display: flex
|
681
681
|
font-weight: 600
|
682
682
|
font-size: 13px
|
683
683
|
height: 44px
|
684
684
|
line-height: 44px
|
685
685
|
outline: none
|
686
686
|
padding-left: 20px
|
687
|
+
padding-right: 6px
|
687
688
|
|
688
689
|
&:hover
|
689
690
|
background: #f9f9f9
|
@@ -694,6 +695,11 @@ input.datepicker
|
|
694
695
|
margin-right: 8px
|
695
696
|
vertical-align: middle
|
696
697
|
|
698
|
+
span
|
699
|
+
white-space: nowrap
|
700
|
+
overflow: hidden
|
701
|
+
text-overflow: ellipsis
|
702
|
+
|
697
703
|
ul li.sortable-placeholder
|
698
704
|
background: #f9f9f9
|
699
705
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
trix-toolbar
|
2
|
+
position: sticky
|
3
|
+
z-index: 2
|
4
|
+
|
2
5
|
.trix-button-group
|
3
6
|
border: 0
|
7
|
+
margin-bottom: 0
|
4
8
|
|
5
9
|
&:not(:first-child)
|
6
10
|
margin-left: 10px
|
@@ -91,10 +95,12 @@ trix-toolbar
|
|
91
95
|
trix-editor
|
92
96
|
line-height: 18px
|
93
97
|
min-height: 100px
|
98
|
+
margin-top: 15px
|
94
99
|
|
95
100
|
h1, h2, h3, h4, h5, h6
|
96
101
|
padding-left: 24px
|
97
102
|
position: relative
|
103
|
+
z-index: 1
|
98
104
|
|
99
105
|
&:after
|
100
106
|
color: #ccc
|
@@ -167,10 +173,14 @@ trix-editor
|
|
167
173
|
font-size: 16px
|
168
174
|
|
169
175
|
.trix-attachment-spina-image
|
176
|
+
background: #f5f5f5
|
177
|
+
border-radius: 6px
|
170
178
|
cursor: default
|
171
179
|
display: block
|
180
|
+
height: 150px
|
172
181
|
margin-bottom: 40px
|
173
182
|
position: relative
|
183
|
+
width: 200px
|
174
184
|
|
175
185
|
&[data-label=""]
|
176
186
|
margin-bottom: 0px
|
@@ -181,8 +191,8 @@ trix-editor
|
|
181
191
|
img
|
182
192
|
border-radius: 6px
|
183
193
|
display: block
|
184
|
-
|
185
|
-
|
194
|
+
height: 150px
|
195
|
+
width: 200px
|
186
196
|
|
187
197
|
&:before
|
188
198
|
background: #eee
|
@@ -201,7 +211,7 @@ trix-editor
|
|
201
211
|
white-space: nowrap
|
202
212
|
width: auto
|
203
213
|
|
204
|
-
figure[data-trix-mutable]
|
214
|
+
figure[data-trix-mutable]
|
205
215
|
.trix-attachment-spina-image:before
|
206
216
|
background: $primary-color
|
207
217
|
color: white
|
@@ -211,4 +221,4 @@ trix-editor
|
|
211
221
|
|
212
222
|
.trix-button--remove
|
213
223
|
border: none
|
214
|
-
box-shadow: 0 0 5px rgba(0, 0, 0, .15)
|
224
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, .15)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Spina
|
2
|
+
module CurrentMethods
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
helper_method :current_theme
|
7
|
+
helper_method :current_spina_user
|
8
|
+
helper_method :current_account
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def current_theme
|
14
|
+
@current_theme ||= Spina::Theme.find_by_name(current_account.theme)
|
15
|
+
end
|
16
|
+
|
17
|
+
def current_spina_user
|
18
|
+
@current_spina_user ||= Spina::User.where(id: session[:user_id]).first if session[:user_id]
|
19
|
+
end
|
20
|
+
|
21
|
+
def current_account
|
22
|
+
@current_account ||= Spina::Account.first
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Spina
|
2
2
|
module Admin
|
3
|
-
class AdminController < ::
|
3
|
+
class AdminController < ActionController::Base
|
4
|
+
include Spina::CurrentMethods
|
5
|
+
|
6
|
+
helper Spina::Engine.helpers
|
7
|
+
|
4
8
|
before_action :set_admin_locale
|
5
9
|
before_action :authorize_spina_user
|
6
10
|
|
@@ -1,24 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def current_theme
|
9
|
-
@current_theme ||= ::Spina::Theme.find_by_name(current_account.theme)
|
10
|
-
end
|
11
|
-
helper_method :current_theme
|
12
|
-
|
13
|
-
def current_spina_user
|
14
|
-
@current_spina_user ||= ::Spina::User.where(id: session[:user_id]).first if session[:user_id]
|
15
|
-
end
|
16
|
-
helper_method :current_spina_user
|
17
|
-
|
18
|
-
def current_account
|
19
|
-
@current_account ||= ::Spina::Account.first
|
20
|
-
end
|
21
|
-
helper_method :current_account
|
22
|
-
|
23
|
-
end
|
1
|
+
class Spina::ApplicationController < Spina.frontend_parent_controller.constantize
|
2
|
+
include Spina::CurrentMethods
|
3
|
+
|
4
|
+
helper Spina::Engine.helpers
|
5
|
+
|
6
|
+
protect_from_forgery with: :exception
|
24
7
|
end
|
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
include Spina::Frontend
|
1
|
+
class Spina::PagesController < Spina::ApplicationController
|
2
|
+
include Spina::Frontend
|
4
3
|
|
5
|
-
|
4
|
+
before_action :current_spina_user_can_view_page?, except: [:robots]
|
6
5
|
|
7
|
-
|
6
|
+
helper_method :page
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def homepage
|
9
|
+
render_with_template(page)
|
10
|
+
end
|
12
11
|
|
13
|
-
|
12
|
+
private
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
def current_spina_user_can_view_page?
|
15
|
+
raise ActiveRecord::RecordNotFound unless current_spina_user.present? || page.live?
|
16
|
+
end
|
18
17
|
|
19
|
-
end
|
20
18
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
class Spina::SitemapsController < Spina::ApplicationController
|
2
|
+
|
3
|
+
def show
|
4
|
+
I18n.locale = I18n.default_locale
|
5
|
+
@pages = Spina::Page.live.sorted
|
7
6
|
end
|
7
|
+
|
8
8
|
end
|
@@ -1,29 +1,14 @@
|
|
1
1
|
module Spina
|
2
2
|
module ImagesHelper
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def variant(image, options)
|
8
|
-
if image.attached? && image.variable?
|
9
|
-
variant = image.variant(options)
|
10
|
-
main_app.rails_blob_representation_path(variant.blob.signed_id, variant.variation.key, variant.blob.filename)
|
11
|
-
elsif image.image?
|
12
|
-
# Allows SVGs to be displayed as they are not variable. Requires:
|
13
|
-
# - https://github.com/Dreamersoul/administrate-field-active_storage/issues/36#issuecomment-608446819 to be applied
|
14
|
-
#
|
15
|
-
# Additionally, https://github.com/hopsoft/active_storage_svg_sanitizer/
|
16
|
-
# should be added if users are able to upload their own SVG content due to:
|
17
|
-
# https://github.com/rails/rails/issues/34665#issuecomment-445888009
|
18
|
-
main_app.url_for(image)
|
19
|
-
else
|
20
|
-
"https://placehold.it/100x100.png"
|
21
|
-
end
|
4
|
+
def thumbnail_url(image)
|
5
|
+
return "" if image.nil?
|
6
|
+
main_app.url_for(image.variant(resize: "400x300^", crop: "400x300+0+0"))
|
22
7
|
end
|
23
8
|
|
24
|
-
def
|
9
|
+
def embedded_image_url(image)
|
25
10
|
return "" if image.nil?
|
26
|
-
|
11
|
+
main_app.url_for(image.variant(resize: Spina.config.embedded_image_size))
|
27
12
|
end
|
28
13
|
|
29
14
|
end
|
data/app/models/spina/page.rb
CHANGED
@@ -74,12 +74,17 @@ module Spina
|
|
74
74
|
def next_sibling
|
75
75
|
siblings.where('position > ?', position).sorted.first
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
def set_materialized_path
|
79
79
|
self.old_path = materialized_path
|
80
80
|
self.materialized_path = localized_materialized_path
|
81
|
-
|
82
|
-
materialized_path
|
81
|
+
|
82
|
+
# Append counter to duplicate materialized_path
|
83
|
+
i = 0
|
84
|
+
while duplicate_materialized_path?
|
85
|
+
i += 1
|
86
|
+
self.materialized_path = localized_materialized_path.concat("-#{i}")
|
87
|
+
end
|
83
88
|
end
|
84
89
|
|
85
90
|
def cache_key
|
@@ -119,6 +124,10 @@ module Spina
|
|
119
124
|
path_fragments.append(slug) unless name == 'homepage'
|
120
125
|
path_fragments.compact.map(&:parameterize).join('/')
|
121
126
|
end
|
127
|
+
|
128
|
+
def duplicate_materialized_path?
|
129
|
+
self.class.where.not(id: id).i18n.where(materialized_path: materialized_path).exists?
|
130
|
+
end
|
122
131
|
|
123
132
|
end
|
124
133
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spina
|
2
|
+
module Parts
|
3
|
+
class ImageVariant
|
4
|
+
attr_reader :blob
|
5
|
+
|
6
|
+
def initialize(image, options)
|
7
|
+
@blob = image
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def variation
|
12
|
+
OpenStruct.new({
|
13
|
+
key: ActiveStorage::Variation.encode(@options)
|
14
|
+
})
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -30,7 +30,7 @@ module Spina
|
|
30
30
|
|
31
31
|
def attachment_url(attachment)
|
32
32
|
attachment = find_part(attachment) unless attachment.is_a? Spina::Parts::Attachment
|
33
|
-
|
33
|
+
view_context.main_app.url_for(attachment) if attachment.present?
|
34
34
|
end
|
35
35
|
|
36
36
|
private
|
@@ -38,16 +38,9 @@ module Spina
|
|
38
38
|
def main_app_image_url(image, variant_options = {})
|
39
39
|
# SVG's can't have variants,
|
40
40
|
# Render rails_service_blob_url directly instead
|
41
|
-
return
|
42
|
-
|
43
|
-
|
44
|
-
variant_key = ActiveStorage::Variation.encode(variant_options)
|
45
|
-
view_context.main_app.rails_blob_representation_url(image.signed_blob_id, variant_key, image.filename.presence || "image")
|
46
|
-
end
|
47
|
-
|
48
|
-
def rails_service_blob_url(file)
|
49
|
-
return if file.blank?
|
50
|
-
view_context.main_app.rails_service_blob_url(file.signed_blob_id, filename: file.filename.presence || "file")
|
41
|
+
return view_context.main_app.url_for(image) if image.svg?
|
42
|
+
|
43
|
+
view_context.main_app.url_for(image.variant(variant_options))
|
51
44
|
end
|
52
45
|
|
53
46
|
def find_part(name)
|
@@ -13,9 +13,6 @@
|
|
13
13
|
/ Stylesheet
|
14
14
|
= stylesheet_link_tag 'spina/admin/application', data: {turbolinks_track: true}
|
15
15
|
|
16
|
-
/[if lt IE 9]
|
17
|
-
= javascript_include_tag '//html5shiv.googlecode.com/svn/trunk/html5.js', data: {turbolinks_track: true}
|
18
|
-
|
19
16
|
/ JavaScript
|
20
17
|
= javascript_include_tag 'spina/admin/application', data: {turbolinks_track: true}
|
21
18
|
= yield(:plugin_stylesheets)
|
@@ -7,40 +7,46 @@
|
|
7
7
|
= icon('check')
|
8
8
|
= t('spina.preferences.social_media_save')
|
9
9
|
|
10
|
-
|
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(:facebook)
|
15
15
|
.horizontal-form-content
|
16
|
-
|
16
|
+
.page-form-control
|
17
|
+
= f.text_field :facebook, placeholder: Spina::Account.human_attribute_name(:facebook)
|
17
18
|
|
18
19
|
.horizontal-form-group
|
19
20
|
.horizontal-form-label
|
20
21
|
= Spina::Account.human_attribute_name(:twitter)
|
21
22
|
.horizontal-form-content
|
22
|
-
|
23
|
+
.page-form-control
|
24
|
+
= f.text_field :twitter, placeholder: Spina::Account.human_attribute_name(:twitter)
|
23
25
|
|
24
26
|
.horizontal-form-group
|
25
27
|
.horizontal-form-label
|
26
28
|
= Spina::Account.human_attribute_name(:instagram)
|
27
29
|
.horizontal-form-content
|
28
|
-
|
30
|
+
.page-form-control
|
31
|
+
= f.text_field :instagram, placeholder: Spina::Account.human_attribute_name(:instagram)
|
29
32
|
|
30
33
|
.horizontal-form-group
|
31
34
|
.horizontal-form-label
|
32
35
|
= Spina::Account.human_attribute_name(:youtube)
|
33
36
|
.horizontal-form-content
|
34
|
-
|
37
|
+
.page-form-control
|
38
|
+
= f.text_field :youtube, placeholder: Spina::Account.human_attribute_name(:youtube)
|
35
39
|
|
36
40
|
.horizontal-form-group
|
37
41
|
.horizontal-form-label
|
38
42
|
= Spina::Account.human_attribute_name(:linkedin)
|
39
43
|
.horizontal-form-content
|
40
|
-
|
44
|
+
.page-form-control
|
45
|
+
= f.text_field :linkedin, placeholder: Spina::Account.human_attribute_name(:linkedin)
|
41
46
|
|
42
47
|
.horizontal-form-group
|
43
48
|
.horizontal-form-label
|
44
49
|
= Spina::Account.human_attribute_name(:google_plus)
|
45
50
|
.horizontal-form-content
|
46
|
-
|
51
|
+
.page-form-control
|
52
|
+
= f.text_field :google_plus, placeholder: Spina::Account.human_attribute_name(:google_plus)
|
@@ -8,7 +8,7 @@
|
|
8
8
|
%th
|
9
9
|
%tr
|
10
10
|
%td{colspan: 4}
|
11
|
-
= form_with model: [:admin, Spina::Attachment.new], class: 'new_document', style: 'margin-bottom: 0' do |f|
|
11
|
+
= form_with model: [:admin, Spina::Attachment.new], local: false, class: 'new_document', style: 'margin-bottom: 0' do |f|
|
12
12
|
= f.submit style: 'display: none'
|
13
13
|
= f.file_field :files, multiple: true, data: {direct_upload_url: main_app.rails_direct_uploads_url, customfileinput: true}
|
14
14
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
= link_to [:admin, media_folder], class: 'item media-folder', data: {add_to_media_folder_url: add_to_media_folder_admin_images_url(media_folder)} do
|
2
2
|
.media-folder-thumbnail{data: {badge: media_folder.images.count}}
|
3
3
|
- if media_folder.images.any?
|
4
|
-
= image_tag
|
4
|
+
= image_tag main_app.url_for(media_folder.images.last.variant(resize: '144x144^', crop: "144x144+0+0"))
|
5
5
|
- else
|
6
6
|
= image_tag 'spina/media_folder_placeholder.svg'
|
7
7
|
.media-folder-shadow
|
@@ -1,3 +1,3 @@
|
|
1
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),
|
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), image_url: embedded_image_url(image), filename: image.file.filename}
|
3
3
|
%span= image_tag thumbnail_url(image)
|
@@ -7,7 +7,7 @@
|
|
7
7
|
.media-folder-shadow
|
8
8
|
.media-folder-name=t "spina.images.all_images"
|
9
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|
|
10
|
+
= form_with model: Spina::Image.new, url: admin_images_path, local: false, data: {action: "ajax:success->media-picker#refresh ajax:before->media-picker#startUpload", media_picker_url: spina.admin_media_picker_path} do |f|
|
11
11
|
.media-picker-uploader
|
12
12
|
= f.file_field :files, multiple: true, accept: "image/*", data: {direct_upload_url: main_app.rails_direct_uploads_url}
|
13
13
|
= f.submit
|
@@ -15,7 +15,7 @@
|
|
15
15
|
- @media_folders.each do |media_folder|
|
16
16
|
= link_to spina.admin_media_picker_path(media_folder_id: media_folder.id), class: 'media-folder', data: {action: "media-picker#openFolder"} do
|
17
17
|
.media-folder-thumbnail{data: {badge: media_folder.images.size}}
|
18
|
-
= image_tag
|
18
|
+
= image_tag main_app.url_for(media_folder.images.last.variant(resize: '144x144^', crop: "144x144+0+0"))
|
19
19
|
.media-folder-shadow
|
20
20
|
.media-folder-name= media_folder.name
|
21
21
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
= link_to spina.admin_media_picker_path({media_folder_id: media_folder.id}.merge(request.query_parameters)), class: 'item media-folder', data: {remote: true} do
|
17
17
|
.media-folder-thumbnail{data: {badge: media_folder.images.count}}
|
18
18
|
- if media_folder.images.any?
|
19
|
-
= image_tag
|
19
|
+
= image_tag main_app.url_for(media_folder.images.last.variant(resize: '144x144^', crop: "144x144+0+0"))
|
20
20
|
- else
|
21
21
|
= image_tag 'spina/media_folder_placeholder.svg'
|
22
22
|
.media-folder-shadow
|
@@ -5,7 +5,7 @@ hidden_input.val("");
|
|
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
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
|
8
|
+
hidden_input.parents('[data-controller="image-form"]').find(".image")[0].insertAdjacentHTML("beforeend", `<%=j image_tag main_app.url_for(@image.variant(resize: "400x300^", crop: "400x300+0+0")), width: 200, height: 150 %>`)
|
9
9
|
hidden_input.val("<%= @image.id %>");
|
10
10
|
|
11
11
|
// Trix editor
|
@@ -7,12 +7,11 @@
|
|
7
7
|
%li{class: ('active' if index.zero?), data: {part_id: repeater_content.object_id, target: "repeater-form.listItem"}}
|
8
8
|
= link_to "#structure_form_pane_#{repeater_content.object_id}" do
|
9
9
|
%i.icon.icon-bars.sortable-handle
|
10
|
-
= repeater_content.parts&.first&.content
|
10
|
+
%span= strip_tags(repeater_content.parts&.first&.content.to_s)
|
11
11
|
|
12
12
|
%div{style: "margin-top: 6px; margin-left: 6px"}
|
13
13
|
= link_to_add_repeater_fields f do
|
14
14
|
= icon('plus')
|
15
|
-
|
16
15
|
.structure-form-content{data: {target: "repeater-form.content"}}
|
17
16
|
= f.fields_for :content do |ff|
|
18
|
-
= render 'spina/admin/parts/repeaters/fields', f: ff
|
17
|
+
= render 'spina/admin/parts/repeaters/fields', f: ff
|
data/config/routes.rb
CHANGED
@@ -1,4 +1,17 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
if ActiveStorage.respond_to?(:resolve_model_to_route)
|
3
|
+
resolve("Spina::Parts::Image") { |image, options| route_for(ActiveStorage.resolve_model_to_route, image, options) }
|
4
|
+
resolve("Spina::Parts::ImageVariant") { |image, options| route_for(ActiveStorage.resolve_model_to_route, image, options) }
|
5
|
+
resolve("Spina::Parts::Attachment") { |attachment, options| route_for(ActiveStorage.resolve_model_to_route, attachment, options) }
|
6
|
+
else
|
7
|
+
resolve("Spina::Parts::Image") { |image, options| route_for(:rails_blob, image, options) }
|
8
|
+
resolve("Spina::Parts::ImageVariant") { |image, options| route_for(:rails_representation, image, options) }
|
9
|
+
resolve("Spina::Parts::Attachment") { |attachment, options| route_for(:rails_blob, attachment, options) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
1
13
|
Spina::Engine.routes.draw do
|
14
|
+
|
2
15
|
# Backend
|
3
16
|
namespace :admin, path: Spina.config.backend_path do
|
4
17
|
root to: "pages#index"
|
@@ -1,5 +1,14 @@
|
|
1
|
-
Mobility.configure do
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
Mobility.configure do
|
2
|
+
plugins do
|
3
|
+
backend :table
|
4
|
+
active_record
|
5
|
+
reader
|
6
|
+
writer
|
7
|
+
backend_reader
|
8
|
+
query
|
9
|
+
cache
|
10
|
+
presence
|
11
|
+
fallbacks false # default to false, enable if passed fallbacks: true
|
12
|
+
default
|
13
|
+
end
|
5
14
|
end
|
@@ -11,6 +11,10 @@ Spina.configure do |config|
|
|
11
11
|
|
12
12
|
# Specify a backend path. Defaults to /admin.
|
13
13
|
# config.backend_path = 'admin'
|
14
|
+
|
15
|
+
# The parent controller all frontend Spina controllers inherit from
|
16
|
+
# Defaults to ApplicationController
|
17
|
+
# config.frontend_parent_controller = "ApplicationController"
|
14
18
|
|
15
19
|
# Pages Options
|
16
20
|
# ===============
|
@@ -12,13 +12,13 @@
|
|
12
12
|
theme.view_templates = [{
|
13
13
|
name: 'homepage',
|
14
14
|
title: 'Homepage',
|
15
|
-
|
15
|
+
parts: ['text']
|
16
16
|
}, {
|
17
17
|
name: 'show',
|
18
18
|
title: 'Default',
|
19
19
|
description: 'A simple page',
|
20
20
|
usage: 'Use for your content',
|
21
|
-
|
21
|
+
parts: ['text']
|
22
22
|
}]
|
23
23
|
|
24
24
|
theme.custom_pages = [{
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
theme.navigations = [{
|
32
32
|
name: 'mobile',
|
33
|
-
label: 'Mobile'
|
33
|
+
label: 'Mobile'
|
34
34
|
}, {
|
35
35
|
name: 'main',
|
36
36
|
label: 'Main navigation',
|
data/lib/spina.rb
CHANGED
@@ -12,16 +12,29 @@ module Spina
|
|
12
12
|
PLUGINS = []
|
13
13
|
THEMES = []
|
14
14
|
|
15
|
-
config_accessor :backend_path,
|
16
|
-
|
15
|
+
config_accessor :backend_path,
|
16
|
+
:frontend_parent_controller,
|
17
|
+
:disable_frontend_routes,
|
18
|
+
:max_page_depth,
|
19
|
+
:locales,
|
20
|
+
:embedded_image_size
|
21
|
+
|
22
|
+
# Specify a backend path. Defaults to /admin.
|
17
23
|
self.backend_path = 'admin'
|
24
|
+
|
25
|
+
# The parent controller all frontend Spina controllers inherit from
|
26
|
+
# Default is ApplicationController
|
27
|
+
self.frontend_parent_controller = "ApplicationController"
|
18
28
|
|
19
29
|
self.disable_frontend_routes = false
|
20
30
|
|
21
|
-
self.storage = :file
|
22
|
-
|
23
31
|
self.max_page_depth = 5
|
24
32
|
|
25
33
|
self.locales = [I18n.default_locale]
|
26
34
|
|
35
|
+
# Images that are embedded in the Trix editor are resized to fit
|
36
|
+
# You can optimize this for your website and go for a smaller (or larger) size
|
37
|
+
# Default: 2000x2000px
|
38
|
+
self.embedded_image_size = "2000x2000>"
|
39
|
+
|
27
40
|
end
|
data/lib/spina/engine.rb
CHANGED
@@ -3,7 +3,6 @@ require 'sass-rails'
|
|
3
3
|
require 'coffee-rails'
|
4
4
|
require 'jquery-rails'
|
5
5
|
require 'turbolinks'
|
6
|
-
require 'mini_magick'
|
7
6
|
require 'ancestry'
|
8
7
|
require 'breadcrumbs_on_rails'
|
9
8
|
require 'kaminari'
|
@@ -19,10 +18,7 @@ module Spina
|
|
19
18
|
|
20
19
|
config.autoload_paths += %W( #{config.root}/lib )
|
21
20
|
|
22
|
-
config.to_prepare do
|
23
|
-
# Load helpers from main application
|
24
|
-
Spina::ApplicationController.helper Rails.application.helpers
|
25
|
-
|
21
|
+
config.to_prepare do
|
26
22
|
# Require decorators from main application
|
27
23
|
[Rails.root].flatten.map { |p| Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]}.flatten.uniq.each do |decorator|
|
28
24
|
Rails.configuration.cache_classes ? require(decorator) : load(decorator)
|
@@ -30,12 +26,13 @@ module Spina
|
|
30
26
|
|
31
27
|
# Register JSON part types for editing content
|
32
28
|
Spina::Part.register(
|
33
|
-
Spina::Parts::Line,
|
34
|
-
Spina::Parts::
|
35
|
-
Spina::Parts::
|
36
|
-
Spina::Parts::
|
37
|
-
Spina::Parts::
|
38
|
-
Spina::Parts::
|
29
|
+
Spina::Parts::Line,
|
30
|
+
Spina::Parts::MultiLine,
|
31
|
+
Spina::Parts::Text,
|
32
|
+
Spina::Parts::Image,
|
33
|
+
Spina::Parts::ImageCollection,
|
34
|
+
Spina::Parts::Repeater,
|
35
|
+
Spina::Parts::Option,
|
39
36
|
Spina::Parts::Attachment
|
40
37
|
)
|
41
38
|
end
|
data/lib/spina/version.rb
CHANGED
data/lib/tasks/spina_tasks.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spina
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Jetten
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pg
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: image_processing
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -182,16 +182,16 @@ dependencies:
|
|
182
182
|
name: mobility
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - '='
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 1.1.1
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - '='
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 1.1.1
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: rack-rewrite
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -390,6 +390,7 @@ files:
|
|
390
390
|
- app/assets/stylesheets/spina/admin/application.css.sass
|
391
391
|
- app/assets/stylesheets/spina/application.sass
|
392
392
|
- app/assets/stylesheets/spina_front_end.sass
|
393
|
+
- app/controllers/concerns/spina/current_methods.rb
|
393
394
|
- app/controllers/concerns/spina/frontend.rb
|
394
395
|
- app/controllers/spina/admin/accounts_controller.rb
|
395
396
|
- app/controllers/spina/admin/admin_controller.rb
|
@@ -429,7 +430,9 @@ files:
|
|
429
430
|
- app/models/spina/parts/base.rb
|
430
431
|
- app/models/spina/parts/image.rb
|
431
432
|
- app/models/spina/parts/image_collection.rb
|
433
|
+
- app/models/spina/parts/image_variant.rb
|
432
434
|
- app/models/spina/parts/line.rb
|
435
|
+
- app/models/spina/parts/multi_line.rb
|
433
436
|
- app/models/spina/parts/option.rb
|
434
437
|
- app/models/spina/parts/repeater.rb
|
435
438
|
- app/models/spina/parts/repeater_content.rb
|
@@ -493,6 +496,7 @@ files:
|
|
493
496
|
- app/views/spina/admin/parts/image_collections/_form.html.haml
|
494
497
|
- app/views/spina/admin/parts/images/_form.html.haml
|
495
498
|
- app/views/spina/admin/parts/lines/_form.html.haml
|
499
|
+
- app/views/spina/admin/parts/multi_lines/_form.html.haml
|
496
500
|
- app/views/spina/admin/parts/options/_form.html.haml
|
497
501
|
- app/views/spina/admin/parts/repeaters/_fields.html.haml
|
498
502
|
- app/views/spina/admin/parts/repeaters/_form.html.haml
|
@@ -593,10 +597,15 @@ files:
|
|
593
597
|
- vendor/assets/stylesheets/spina/_animate.scss
|
594
598
|
- vendor/assets/stylesheets/spina/_normalize.scss
|
595
599
|
- vendor/assets/stylesheets/spina/_trix.css
|
596
|
-
homepage:
|
600
|
+
homepage: https://www.spinacms.com
|
597
601
|
licenses:
|
598
602
|
- MIT
|
599
|
-
metadata:
|
603
|
+
metadata:
|
604
|
+
homepage_uri: https://www.spinacms.com
|
605
|
+
bug_tracker_uri: https://github.com/SpinaCMS/Spina/issues
|
606
|
+
documentation_uri: https://www.spinacms.com/guide
|
607
|
+
changelog_uri: https://github.com/SpinaCMS/Spina/blob/master/CHANGELOG.md
|
608
|
+
source_code_uri: https://github.com/SpinaCMS/Spina
|
600
609
|
post_install_message:
|
601
610
|
rdoc_options: []
|
602
611
|
require_paths:
|
@@ -612,7 +621,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
612
621
|
- !ruby/object:Gem::Version
|
613
622
|
version: 1.3.1
|
614
623
|
requirements: []
|
615
|
-
rubygems_version: 3.
|
624
|
+
rubygems_version: 3.1.4
|
616
625
|
signing_key:
|
617
626
|
specification_version: 4
|
618
627
|
summary: Spina
|