ecm_pictures2 5.1.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ecm/pictures/galleries_controller.rb +2 -2
- data/app/controllers/ecm/pictures/pictures_controller.rb +2 -2
- data/app/helpers/ecm/pictures_helper.rb +2 -2
- data/app/models/ecm/pictures/attached_picture.rb +2 -2
- data/app/models/ecm/pictures/gallery.rb +9 -2
- data/app/models/ecm/pictures/picture.rb +3 -0
- data/app/views/ecm/pictures/galleries/index.haml +1 -1
- data/app/views/ecm/pictures/galleries/show.haml +2 -2
- data/config/locales/ecm.pictures.attached_picture.de.yml +4 -0
- data/config/locales/ecm.pictures.attached_picture.en.yml +4 -0
- data/config/locales/ecm.pictures.gallery.de.yml +4 -1
- data/config/locales/ecm.pictures.gallery.en.yml +4 -1
- data/config/locales/ecm.pictures.picture.de.yml +7 -1
- data/config/locales/ecm.pictures.picture.en.yml +8 -1
- data/db/migrate/20171002221137_add_published_at_to_ecm_pictures_galleries.rb +5 -0
- data/db/migrate/20171002232958_add_published_at_to_ecm_pictures_pictures.rb +5 -0
- data/db/migrate/20180325205124_rename_ecm_pictures_picture_id_on_ecm_pictures_attached_pictures.rb +5 -0
- data/lib/ecm/pictures/version.rb +1 -1
- data/lib/ecm_pictures2.rb +1 -0
- data/lib/generators/ecm/pictures/install/templates/initializer.rb +6 -0
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29f38d24ca296c73767ef8e1fb1f3a3ad59460bc
|
4
|
+
data.tar.gz: c0a86295ed72ed2b2e2b1f4b1321654ea2c67e6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6348e2824683d32724e4ef3151dc69f0d7136662088ea759a1543407a4852490da9a13dd7346ceb0346a8a617883665e71c812f03db99e5721da8cb62cc6a2f
|
7
|
+
data.tar.gz: 56392d7231dc84fab7e9390decfd8a7b5384884063c94f9a78f518d7a8e2bebdf71b4a0c43dfb95bc152b2547c4a63f178e9d2618e9ef363fbe28b636c1468f9
|
@@ -15,11 +15,11 @@ module Ecm
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def load_collection
|
18
|
-
@collection = resource_class.all
|
18
|
+
@collection = resource_class.published.all
|
19
19
|
end
|
20
20
|
|
21
21
|
def load_resource
|
22
|
-
@resource = resource_class.find(params[:id])
|
22
|
+
@resource = resource_class.published.find(params[:id])
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -15,11 +15,11 @@ module Ecm
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def load_collection
|
18
|
-
@collection = resource_class.all
|
18
|
+
@collection = resource_class.published.all
|
19
19
|
end
|
20
20
|
|
21
21
|
def load_resource
|
22
|
-
@resource = resource_class.find(params[:id])
|
22
|
+
@resource = resource_class.published.find(params[:id])
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -10,7 +10,7 @@ module Ecm::PicturesHelper
|
|
10
10
|
def render_picture_gallery(name, options = {})
|
11
11
|
options = { preview_style: :thumb }.merge(options)
|
12
12
|
|
13
|
-
gallery = Ecm::Pictures::Gallery.where(name: name.to_s).first
|
13
|
+
gallery = Ecm::Pictures::Gallery.published.where(name: name.to_s).first
|
14
14
|
|
15
15
|
if gallery.nil?
|
16
16
|
content_tag(:div, class: 'warning missing gallery') do
|
@@ -53,7 +53,7 @@ module Ecm::PicturesHelper
|
|
53
53
|
img_css_class = options.delete(:img_css_class)
|
54
54
|
plain = options.delete(:plain)
|
55
55
|
|
56
|
-
picture = Ecm::Pictures::Picture.where(name: name.to_s).first
|
56
|
+
picture = Ecm::Pictures::Picture.published.where(name: name.to_s).first
|
57
57
|
|
58
58
|
if picture.nil?
|
59
59
|
return content_tag(:div, class: 'warning missing picture') do
|
@@ -2,11 +2,11 @@ module Ecm
|
|
2
2
|
module Pictures
|
3
3
|
class AttachedPicture < ActiveRecord::Base
|
4
4
|
# associations
|
5
|
-
belongs_to :picture
|
5
|
+
belongs_to :picture
|
6
6
|
belongs_to :pictureable, polymorphic: true
|
7
7
|
|
8
8
|
# validations
|
9
|
-
validates :picture, :pictureable, presence: true
|
9
|
+
validates :picture, :pictureable, presence: true if Rails.version < '5.0.0'
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -3,7 +3,11 @@ module Ecm
|
|
3
3
|
class Gallery < ActiveRecord::Base
|
4
4
|
# associations
|
5
5
|
has_many :pictures, -> { order :position },
|
6
|
-
dependent: :destroy
|
6
|
+
dependent: :destroy do
|
7
|
+
def published
|
8
|
+
where(proxy_association.reflection.klass.arel_table[:published_at].not_eq(nil))
|
9
|
+
end
|
10
|
+
end
|
7
11
|
|
8
12
|
# attributes
|
9
13
|
accepts_nested_attributes_for :pictures, allow_destroy: true
|
@@ -12,6 +16,9 @@ module Ecm
|
|
12
16
|
acts_as_list
|
13
17
|
default_scope { order(:position) }
|
14
18
|
|
19
|
+
include ActsAsPublished::ActiveRecord
|
20
|
+
acts_as_published
|
21
|
+
|
15
22
|
# acts as markup
|
16
23
|
acts_as_markup language: :variable, columns: [:description]
|
17
24
|
|
@@ -51,7 +58,7 @@ module Ecm
|
|
51
58
|
end
|
52
59
|
|
53
60
|
def preview_picture
|
54
|
-
pictures.first
|
61
|
+
pictures.published.first
|
55
62
|
end
|
56
63
|
|
57
64
|
private
|
@@ -11,6 +11,9 @@ module Ecm
|
|
11
11
|
# acts as markup
|
12
12
|
acts_as_markup language: :variable, columns: [:description, :description]
|
13
13
|
|
14
|
+
include ActsAsPublished::ActiveRecord
|
15
|
+
acts_as_published
|
16
|
+
|
14
17
|
# callbacks
|
15
18
|
after_initialize :set_defaults
|
16
19
|
before_validation :set_name_from_image_file_name, if: proc { |p| (p.name.nil? || p.name.empty?) }
|
@@ -16,7 +16,7 @@
|
|
16
16
|
= t('.more')
|
17
17
|
- when :media_object
|
18
18
|
- @collection.each do |resource|
|
19
|
-
= bootstrap_media_object(image_options: { src: resource.preview_picture&.image&.url(Ecm::Pictures.thumbnail_paperclip_style) }) do
|
19
|
+
= bootstrap_media_object(container_id: dom_id(resource), image_options: { src: resource.preview_picture&.image&.url(Ecm::Pictures.thumbnail_paperclip_style) }) do
|
20
20
|
%h4= resource.name
|
21
21
|
- if Ecm::Pictures::Configuration.prevent_textile_rendering_in_html
|
22
22
|
%notextile
|
@@ -1,8 +1,8 @@
|
|
1
1
|
%h1= @resource.name
|
2
2
|
|
3
3
|
.row
|
4
|
-
- @resource.pictures.each do |picture|
|
5
|
-
= bootstrap_thumbnail(container_classes: Ecm::Pictures.thumbnail_container_css_classes, image_options: { src: picture.image.url(Ecm::Pictures.thumbnail_paperclip_style) }, link_options: { href: "#{picture.image.url}#{File.extname(picture.image_file_name).downcase}", :'data-gallery' => "gallery" }) do
|
4
|
+
- @resource.pictures.published.each do |picture|
|
5
|
+
= bootstrap_thumbnail(container_id: dom_id(picture), container_classes: Ecm::Pictures.thumbnail_container_css_classes, image_options: { src: picture.image.url(Ecm::Pictures.thumbnail_paperclip_style) }, link_options: { href: "#{picture.image.url}#{File.extname(picture.image_file_name).downcase}", :'data-gallery' => "gallery" }) do
|
6
6
|
%h3= picture.name
|
7
7
|
- if Ecm::Pictures::Configuration.prevent_textile_rendering_in_html
|
8
8
|
%notextile
|
@@ -6,8 +6,12 @@ de:
|
|
6
6
|
other: Verknüpfte Bilder
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/attached_picture:
|
9
|
+
id: ID
|
9
10
|
picture: Bild
|
11
|
+
picture_id: Bild
|
10
12
|
pictureable: Verknüpft mit
|
13
|
+
pictureable_id: Verknüpft mit
|
14
|
+
pictureable_type: Verknüofungstyp
|
11
15
|
created_at: Erstellt am
|
12
16
|
updated_at: Aktualisiert am
|
13
17
|
routes:
|
@@ -6,8 +6,12 @@ en:
|
|
6
6
|
other: attached pictures
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/attached_picture:
|
9
|
+
id: ID
|
9
10
|
picture: picture
|
11
|
+
picture_id: picture
|
10
12
|
pictureable: attached to
|
13
|
+
pictureable_id: attached to
|
14
|
+
pictureable_type: attached to type
|
11
15
|
created_at: created at
|
12
16
|
updated_at: updated at
|
13
17
|
routes:
|
@@ -6,7 +6,7 @@ de:
|
|
6
6
|
other: Bildgalerien
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/gallery:
|
9
|
-
|
9
|
+
id: ID
|
10
10
|
description: Beschreibung
|
11
11
|
display_code_for_erb: Anzeigecode (erb)
|
12
12
|
link_images: Bilder verlinken
|
@@ -15,4 +15,7 @@ de:
|
|
15
15
|
pictures: Bilder
|
16
16
|
pictures_count: Bilder
|
17
17
|
position: Position
|
18
|
+
published_at: Veröffentlicht am
|
19
|
+
slug: Freundliche ID
|
20
|
+
created_at: Erstellt am
|
18
21
|
updated_at: Aktualisiert am
|
@@ -6,7 +6,7 @@ en:
|
|
6
6
|
other: picture galleries
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/gallery:
|
9
|
-
|
9
|
+
id: ID
|
10
10
|
description: description
|
11
11
|
display_code_for_erb: display code (erb)
|
12
12
|
link_images: link images
|
@@ -15,4 +15,7 @@ en:
|
|
15
15
|
pictures: pictures
|
16
16
|
pictures_count: pictures
|
17
17
|
position: position
|
18
|
+
published_at: published at
|
19
|
+
slug: slug
|
20
|
+
created_at: created at
|
18
21
|
updated_at: updated at
|
@@ -6,20 +6,26 @@ de:
|
|
6
6
|
other: Bilder
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/picture:
|
9
|
-
|
9
|
+
id: ID
|
10
10
|
description: Beschreibung
|
11
11
|
display_code: Anzeigecode
|
12
12
|
display_code_for_erb: Anzeigecode (erb)
|
13
13
|
display_code_for_textile: Anzeigecode (textile)
|
14
14
|
image: Datei
|
15
|
+
image_content_type: Dateityp
|
15
16
|
image_file: Datei
|
16
17
|
image_file_name: Dateiname
|
17
18
|
image_file_size: Größe
|
18
19
|
image_fingerprint: Fingerabdruck
|
20
|
+
image_updated_at: Datei aktualisiert am
|
19
21
|
markup_language: Markup Sprache
|
20
22
|
name: Name
|
21
23
|
gallery: Galerie
|
24
|
+
gallery_id: Galerie
|
22
25
|
position: Position
|
23
26
|
preview_picture: Vorschau
|
27
|
+
published_at: Veröffentlicht am
|
28
|
+
slug: Freundliche ID
|
24
29
|
thumbnail: Vorschau
|
30
|
+
created_at: Erstellt am
|
25
31
|
updated_at: Aktualisiert am
|
@@ -6,19 +6,26 @@ en:
|
|
6
6
|
other: pictures
|
7
7
|
attributes:
|
8
8
|
ecm/pictures/picture:
|
9
|
-
|
9
|
+
id: ID
|
10
10
|
description: description
|
11
11
|
display_code: display code
|
12
12
|
display_code_for_erb: display code (erb)
|
13
13
|
display_code_for_textile: display code (textile)
|
14
|
+
image: image
|
15
|
+
image_content_type: image type
|
14
16
|
image_file: image
|
15
17
|
image_file_name: image filename
|
16
18
|
image_file_size: image size
|
17
19
|
image_fingerprint: image fingerprint
|
20
|
+
image_updated_at: image updated at
|
18
21
|
markup_language: markup language
|
19
22
|
name: name
|
20
23
|
gallery: picture gallery
|
24
|
+
gallery_id: picture gallery
|
21
25
|
position: position
|
22
26
|
preview_picture: preview
|
27
|
+
published_at: published at
|
28
|
+
slug: slug
|
23
29
|
thumbnail: thumbnail
|
30
|
+
created_at: created at
|
24
31
|
updated_at: updated at
|
data/lib/ecm/pictures/version.rb
CHANGED
data/lib/ecm_pictures2.rb
CHANGED
@@ -44,4 +44,10 @@ Ecm::Pictures.configure do |config|
|
|
44
44
|
# Default: config.render_gallery_index_as = :media_object
|
45
45
|
#
|
46
46
|
config.render_gallery_index_as = :media_object
|
47
|
+
|
48
|
+
# Name of the factory to use to attach attached pictures to.
|
49
|
+
#
|
50
|
+
# default: config.pictureable_factory_name = :post
|
51
|
+
#
|
52
|
+
config.pictureable_factory_name = :post
|
47
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_pictures2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: acts_as_published
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: friendly_id
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -386,6 +400,9 @@ files:
|
|
386
400
|
- db/migrate/003_create_ecm_pictures_attached_pictures.rb
|
387
401
|
- db/migrate/20160626141629_rename_ecm_pictures_picture_galleries_to_ecm_pictures_galleries.rb
|
388
402
|
- db/migrate/20160626143414_rename_ecm_pictures_pictures_picture_gallery_id_to_gallery_id.rb
|
403
|
+
- db/migrate/20171002221137_add_published_at_to_ecm_pictures_galleries.rb
|
404
|
+
- db/migrate/20171002232958_add_published_at_to_ecm_pictures_pictures.rb
|
405
|
+
- db/migrate/20180325205124_rename_ecm_pictures_picture_id_on_ecm_pictures_attached_pictures.rb
|
389
406
|
- lib/ecm/pictures/configuration.rb
|
390
407
|
- lib/ecm/pictures/engine.rb
|
391
408
|
- lib/ecm/pictures/version.rb
|