udongo 6.6.3 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/concerns/seo.rb +12 -0
- data/changelog.md +10 -1
- data/db/migrate/20170728094909_add_seo_locales_to_models_with_seo.rb +6 -0
- data/db/migrate/20170728125838_remove_content_images.rb +5 -0
- data/lib/tasks/udongo_tasks.rake +0 -12
- data/lib/udongo/configs/flexible_content.rb +1 -1
- data/lib/udongo/version.rb +1 -1
- data/readme.md +16 -0
- data/spec/support/concerns/seo.rb +48 -1
- metadata +4 -9
- data/app/controllers/backend/content/rows/images_controller.rb +0 -6
- data/app/decorators/content_image_decorator.rb +0 -3
- data/app/models/content_image.rb +0 -9
- data/app/uploaders/content_image_uploader.rb +0 -52
- data/app/views/backend/content/_image.html.erb +0 -10
- data/app/views/backend/content/rows/images/edit.html.erb +0 -16
- data/spec/factories/content_images.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abcf2f3a3fea0a5ff7a89fa8364f083c948fe8d0
|
4
|
+
data.tar.gz: a9cea4a94f6790316fae6a9843bf8e088a01f762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7349c0efcab0845f8358291a103043059a46ca7314fecb33fc3ed5f092b27a209187f041f2fcb4648c9bf0745fa6ae6cea27227c6f1c71d10bcb96c73b69ed55
|
7
|
+
data.tar.gz: 3c4df6d375c5cac2ca2f9b2f8e48c8ba73d8756e6145b58f6f4044685d79e00b130842f801bf215a362ba8367b9ee772be6969bfb64aa4b5e460c9356d74874b
|
data/app/models/concerns/seo.rb
CHANGED
@@ -3,7 +3,19 @@ module Concerns
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
+
serialize :seo_locales, Array
|
6
7
|
has_many :meta, as: :sluggable, dependent: :destroy
|
8
|
+
|
9
|
+
after_save do
|
10
|
+
locales = Meta.where(
|
11
|
+
sluggable_type: self.class.to_s,
|
12
|
+
sluggable_id: self.id
|
13
|
+
).where('slug IS NOT NULL OR slug != ""').pluck(:locale).uniq
|
14
|
+
|
15
|
+
update_column :seo_locales, locales
|
16
|
+
end
|
17
|
+
|
18
|
+
scope :with_seo, ->(locale) { where('seo_locales LIKE ?', "%#{locale}%")}
|
7
19
|
end
|
8
20
|
|
9
21
|
module ClassMethods
|
data/changelog.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
7.0.0 - 2017-07-28
|
2
|
+
--
|
3
|
+
* It's now possible to use the scope .with_seo(:nl) to fetch models that actually
|
4
|
+
have a slug in that locale. You used to have to do some nasty manual things to
|
5
|
+
work around this issue, but no more!
|
6
|
+
* After being deprecated for some time, ```ContentImage``` has finally been
|
7
|
+
removed from the system.
|
8
|
+
|
9
|
+
|
1
10
|
6.6.3 - 2017-07-27
|
2
11
|
--
|
3
12
|
* Bugfix: the cacheable concern #find_in_cache method has been tweaked to make
|
@@ -140,7 +149,7 @@
|
|
140
149
|
without flexible content without getting an unknown method error.
|
141
150
|
* The column widths for flexible content are displayed in percentages.
|
142
151
|
* An extra widget ```ContentPicture``` has been added. This is the replacement
|
143
|
-
for the
|
152
|
+
for the ```ContentImage``` which has now been deprecated.
|
144
153
|
|
145
154
|
|
146
155
|
5.7.0 - 2017-03-22
|
data/lib/tasks/udongo_tasks.rake
CHANGED
@@ -13,18 +13,6 @@ namespace :udongo do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
namespace :content_images do
|
17
|
-
desc 'Regenerate all the image versions.'
|
18
|
-
task regenerate: :environment do
|
19
|
-
ContentImage.find_each do |i|
|
20
|
-
if i.file?
|
21
|
-
i.file.recreate_versions!
|
22
|
-
i.save!
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
16
|
namespace :queue do
|
29
17
|
desc 'Checks the queue for tasks and executes at most 3 of them'
|
30
18
|
task process: :environment do
|
@@ -6,7 +6,7 @@ module Udongo
|
|
6
6
|
BREAKPOINTS = %w(xs sm md lg xl)
|
7
7
|
DEFAULT_BREAKPOINT = 'md'
|
8
8
|
|
9
|
-
attribute :types, Array, default: %w(text picture video slideshow form
|
9
|
+
attribute :types, Array, default: %w(text picture video slideshow form)
|
10
10
|
attribute :picture_caption_editor, Axiom::Types::Boolean, default: false
|
11
11
|
attribute :video_caption_editor, Axiom::Types::Boolean, default: false
|
12
12
|
|
data/lib/udongo/version.rb
CHANGED
data/readme.md
CHANGED
@@ -173,6 +173,22 @@ class Document < ApplicationRecord
|
|
173
173
|
end
|
174
174
|
```
|
175
175
|
|
176
|
+
It also allows you to do something like this ```Page.with_locale(:nl)``` which
|
177
|
+
will then fetch all pages that have the translatable fields in :nl avaialble.
|
178
|
+
|
179
|
+
## Seo concern
|
180
|
+
This concern is used if you want to attach (seo) meta details to your model. In
|
181
|
+
order to use this, you need to add a text colun 'seo_locales' to your model.
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
class Document < ApplicationRecord
|
185
|
+
include Concerns::Seo
|
186
|
+
end
|
187
|
+
```
|
188
|
+
|
189
|
+
This will then allow you to fetch all documents that have seo (with slug!) in
|
190
|
+
a certain locale. ```Document.with_seo(:nl)```
|
191
|
+
|
176
192
|
## Searchable concern
|
177
193
|
Include this in your model if you want its records to appear in search autocompletes.
|
178
194
|
|
@@ -5,6 +5,28 @@ shared_examples_for :seo do
|
|
5
5
|
let(:klass) { model.to_s.underscore.to_sym }
|
6
6
|
let(:instance) { create(klass) }
|
7
7
|
|
8
|
+
describe '#seo_locales' do
|
9
|
+
it 'defaults to an empty array' do
|
10
|
+
expect(build(klass).seo_locales.class).to eq Array
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'updates when a slug is present' do
|
14
|
+
object = create(klass)
|
15
|
+
object.seo(:nl).slug = 'foo'
|
16
|
+
object.save
|
17
|
+
|
18
|
+
expect(object.seo_locales).to include 'nl'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'does not update unless a slug is present' do
|
22
|
+
object = create(klass)
|
23
|
+
object.seo(:nl).slug = nil
|
24
|
+
object.save
|
25
|
+
|
26
|
+
expect(object.seo_locales).to eq []
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
8
30
|
describe '#seo' do
|
9
31
|
it 'always returns a meta object' do
|
10
32
|
expect(instance.seo(:nl).class).to eq Meta
|
@@ -22,6 +44,31 @@ shared_examples_for :seo do
|
|
22
44
|
end
|
23
45
|
end
|
24
46
|
|
47
|
+
describe 'scopes' do
|
48
|
+
describe '.with_seo' do
|
49
|
+
it 'no results' do
|
50
|
+
expect(model.with_seo(:nl)).to eq []
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'dutch only' do
|
54
|
+
object = create(klass)
|
55
|
+
object.seo(:nl).slug = 'foo'
|
56
|
+
object.save
|
57
|
+
|
58
|
+
expect(model.with_seo(:nl)).to eq [object]
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'dutch and english' do
|
62
|
+
object = create(klass)
|
63
|
+
object.seo(:nl).slug = 'foo'
|
64
|
+
object.seo(:en).slug = 'foo'
|
65
|
+
object.save
|
66
|
+
|
67
|
+
expect(model.with_seo(:nl)).to eq [object]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
25
72
|
describe '.find_by_slug' do
|
26
73
|
it :result do
|
27
74
|
instance.meta.create!(locale: 'nl', slug: 'test')
|
@@ -49,6 +96,6 @@ shared_examples_for :seo do
|
|
49
96
|
end
|
50
97
|
|
51
98
|
it '.respond_to?' do
|
52
|
-
expect(model).to respond_to(:find_by_slug, :find_by_slug
|
99
|
+
expect(model).to respond_to(:find_by_slug, :find_by_slug!, :with_seo)
|
53
100
|
end
|
54
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: udongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Davy Hellemans
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-07-
|
12
|
+
date: 2017-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -464,7 +464,6 @@ files:
|
|
464
464
|
- app/controllers/backend/base_controller.rb
|
465
465
|
- app/controllers/backend/content/rows/columns_controller.rb
|
466
466
|
- app/controllers/backend/content/rows/forms_controller.rb
|
467
|
-
- app/controllers/backend/content/rows/images_controller.rb
|
468
467
|
- app/controllers/backend/content/rows/pictures_controller.rb
|
469
468
|
- app/controllers/backend/content/rows/slideshows_controller.rb
|
470
469
|
- app/controllers/backend/content/rows/texts_controller.rb
|
@@ -504,7 +503,6 @@ files:
|
|
504
503
|
- app/controllers/redirects_controller.rb
|
505
504
|
- app/decorators/application_decorator.rb
|
506
505
|
- app/decorators/content_form_decorator.rb
|
507
|
-
- app/decorators/content_image_decorator.rb
|
508
506
|
- app/decorators/content_picture_decorator.rb
|
509
507
|
- app/decorators/content_row_decorator.rb
|
510
508
|
- app/decorators/content_slideshow_decorator.rb
|
@@ -576,7 +574,6 @@ files:
|
|
576
574
|
- app/models/concerns/visible.rb
|
577
575
|
- app/models/content_column.rb
|
578
576
|
- app/models/content_form.rb
|
579
|
-
- app/models/content_image.rb
|
580
577
|
- app/models/content_picture.rb
|
581
578
|
- app/models/content_row.rb
|
582
579
|
- app/models/content_slideshow.rb
|
@@ -611,7 +608,6 @@ files:
|
|
611
608
|
- app/uploaders/asset_uploader.rb
|
612
609
|
- app/uploaders/ckeditor_attachment_file_uploader.rb
|
613
610
|
- app/uploaders/ckeditor_picture_uploader.rb
|
614
|
-
- app/uploaders/content_image_uploader.rb
|
615
611
|
- app/validators/email_validator.rb
|
616
612
|
- app/validators/url_validator.rb
|
617
613
|
- app/views/backend/_breadcrumbs.html.erb
|
@@ -639,7 +635,6 @@ files:
|
|
639
635
|
- app/views/backend/assets/index.html.erb
|
640
636
|
- app/views/backend/assets/new.html.erb
|
641
637
|
- app/views/backend/content/_form.html.erb
|
642
|
-
- app/views/backend/content/_image.html.erb
|
643
638
|
- app/views/backend/content/_picture.html.erb
|
644
639
|
- app/views/backend/content/_rows.html.erb
|
645
640
|
- app/views/backend/content/_slideshow.html.erb
|
@@ -651,7 +646,6 @@ files:
|
|
651
646
|
- app/views/backend/content/rows/columns/new.html.erb
|
652
647
|
- app/views/backend/content/rows/edit.html.erb
|
653
648
|
- app/views/backend/content/rows/forms/edit.html.erb
|
654
|
-
- app/views/backend/content/rows/images/edit.html.erb
|
655
649
|
- app/views/backend/content/rows/pictures/_filter.html.erb
|
656
650
|
- app/views/backend/content/rows/pictures/edit.html.erb
|
657
651
|
- app/views/backend/content/rows/pictures/link_or_upload.html.erb
|
@@ -858,6 +852,8 @@ files:
|
|
858
852
|
- db/migrate/20170616114757_add_external_ref_to_form_field.rb
|
859
853
|
- db/migrate/20170623121241_add_no_gutters_to_content_row.rb
|
860
854
|
- db/migrate/20170623124218_add_caption_to_content_video.rb
|
855
|
+
- db/migrate/20170728094909_add_seo_locales_to_models_with_seo.rb
|
856
|
+
- db/migrate/20170728125838_remove_content_images.rb
|
861
857
|
- lib/tasks/task_extras.rb
|
862
858
|
- lib/tasks/udongo_tasks.rake
|
863
859
|
- lib/udongo.rb
|
@@ -912,7 +908,6 @@ files:
|
|
912
908
|
- spec/factories/comments.rb
|
913
909
|
- spec/factories/content_columns.rb
|
914
910
|
- spec/factories/content_forms.rb
|
915
|
-
- spec/factories/content_images.rb
|
916
911
|
- spec/factories/content_pictures.rb
|
917
912
|
- spec/factories/content_rows.rb
|
918
913
|
- spec/factories/content_slideshows.rb
|
data/app/models/content_image.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
class ContentImageUploader < CarrierWave::Uploader::Base
|
2
|
-
include CarrierWave::RMagick
|
3
|
-
|
4
|
-
storage :file
|
5
|
-
|
6
|
-
def filename
|
7
|
-
@name ||= "#{secure_token}-#{model.id}.#{file.extension.downcase}" if original_filename
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def secure_token
|
13
|
-
ivar = "@#{mounted_as}_secure_token"
|
14
|
-
token = model.instance_variable_get(ivar)
|
15
|
-
token ||= model.instance_variable_set(ivar, SecureRandom.hex(4))
|
16
|
-
end
|
17
|
-
|
18
|
-
def store_dir
|
19
|
-
main_dir = Digest::MD5.hexdigest(model.id.to_s)[0,2]
|
20
|
-
"uploads/flexible_content/images/#{main_dir}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def extension_white_list
|
24
|
-
%w(jpg jpeg gif png)
|
25
|
-
end
|
26
|
-
|
27
|
-
process resize_to_limit: [2560, 1440]
|
28
|
-
|
29
|
-
version :size_800x600 do
|
30
|
-
process resize_to_limit: [800, 600]
|
31
|
-
end
|
32
|
-
|
33
|
-
version :size_1024x640 do
|
34
|
-
process resize_to_limit: [1024, 640]
|
35
|
-
end
|
36
|
-
|
37
|
-
version :size_1280x800 do
|
38
|
-
process resize_to_limit: [1280, 800]
|
39
|
-
end
|
40
|
-
|
41
|
-
version :size_1440x900 do
|
42
|
-
process resize_to_limit: [1440, 900]
|
43
|
-
end
|
44
|
-
|
45
|
-
version :size_1680x1050 do
|
46
|
-
process resize_to_limit: [1680, 1050]
|
47
|
-
end
|
48
|
-
|
49
|
-
version :size_1920x1200 do
|
50
|
-
process resize_to_limit: [1920, 1200]
|
51
|
-
end
|
52
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<% if object.present? && object.file.present? %>
|
2
|
-
|
3
|
-
<%= image_tag object.file.size_1024x640.url, alt: '', class: 'img-fluid' %>
|
4
|
-
|
5
|
-
<% if object.caption.present? %>
|
6
|
-
<div class="text-xs-center">
|
7
|
-
<%= object.caption.html_safe %>
|
8
|
-
</div>
|
9
|
-
<% end %>
|
10
|
-
<% end %>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<%= render 'backend/general_form_error', object: @model %>
|
2
|
-
|
3
|
-
<% if @model.file.present? %>
|
4
|
-
<div class="row">
|
5
|
-
<div class="col-lg-8 col-lg-offset-2">
|
6
|
-
<%= image_tag(@model.file.url, alt: '', class: 'img-fluid') %>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= simple_form_for [:backend, @model] do |f| %>
|
12
|
-
<%= f.input :file, as: :file %>
|
13
|
-
<%= f.input :url, as: :string %>
|
14
|
-
<%= f.input :caption, as: :text %>
|
15
|
-
<%= render 'backend/form_actions', cancel_url: '#lity-close' %>
|
16
|
-
<% end %>
|