ecm_galleries 0.1.0 → 0.2.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/ecm/galleries/picture_detail.rb +10 -0
- data/app/view_helpers/ecm/galleries/galleries_helper.rb +1 -7
- data/app/view_helpers/ecm/galleries/pictures_helper.rb +37 -0
- data/app/views/ecm/galleries/galleries_helper/_render.html.haml +14 -0
- data/app/views/ecm/galleries/pictures_helper/_render.html.haml +15 -0
- data/config/locales/de.yml +7 -5
- data/config/locales/en.yml +7 -5
- data/lib/ecm/galleries/configuration.rb +1 -0
- data/lib/ecm/galleries/version.rb +1 -1
- data/lib/generators/ecm/galleries/install/templates/initializer.rb +8 -1
- metadata +4 -2
- data/app/views/ecm/galleries/view_helper/_render.html.haml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 814fd3760f2d7a87052c49a9de9a2894d30b6073be4e25d35b5237f74ebaece9
|
4
|
+
data.tar.gz: b100d376e2b2db919b9a51a753b8a7a749c4d638ddf28ef153f3e39da3467113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220fb93955e3c1bdf2b5ffbf265edf027cc8e7fe74521bafd48cf81111af26d3dd4a82f26fbe851ce966f4bfc1687b18b27715ad947773bc5469a1d9e8d06051
|
7
|
+
data.tar.gz: f792a1c985e39f9f677568f5945f022676177ac017a57cb0addab3f015944321510193ff7c820e4bed38201c0c0d925999a51d5c024635626767ebd8aaabd12e
|
@@ -6,5 +6,15 @@ module Ecm::Galleries
|
|
6
6
|
belongs_to :asset, class_name: 'ActiveStorage::Attachment', dependent: :destroy
|
7
7
|
|
8
8
|
acts_as_list scope: :picture_gallery
|
9
|
+
|
10
|
+
module DisplayCodesConcern
|
11
|
+
extend ActiveSupport::Concern
|
12
|
+
|
13
|
+
def display_code_for_erb
|
14
|
+
"<%= pictures_helper(self).render(id: #{id}) %>"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
include DisplayCodesConcern
|
9
19
|
end
|
10
20
|
end
|
@@ -27,13 +27,7 @@ module Ecm
|
|
27
27
|
show_details = options.delete(:show_details)
|
28
28
|
|
29
29
|
resource = Ecm::Galleries::PictureGallery.where(name: name).first
|
30
|
-
c.render partial: 'ecm/galleries/
|
31
|
-
end
|
32
|
-
|
33
|
-
private
|
34
|
-
|
35
|
-
def c
|
36
|
-
@context
|
30
|
+
c.render partial: 'ecm/galleries/galleries_helper/render', locals: { resource: resource, variant_options: variant_options, show_details: show_details }
|
37
31
|
end
|
38
32
|
end
|
39
33
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ecm
|
2
|
+
module Galleries
|
3
|
+
# Usage:
|
4
|
+
#
|
5
|
+
# # app/controllers/application_vontroller.rb
|
6
|
+
# class ApplicationController < ActionController::Base
|
7
|
+
# view_helper Ecm::Galleries::PicturesHelper, as: :pictures_helper
|
8
|
+
# # ...
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# # app/views/home/index.html.haml
|
12
|
+
# = pictures_helper(self).render(name: 'main', variant_options: { combine_options: { resize: "255x255^", extent: "255x255", gravity: "center"} }, show_details: true)
|
13
|
+
#
|
14
|
+
# Default options are taken from Ecm::Galleries::Configuration.pictures_helper_render_default_options.
|
15
|
+
# You can set this option in the initializer.
|
16
|
+
#
|
17
|
+
# You can pass the image_tag_only option to render just the <img>-tag without a bootstrap card.
|
18
|
+
#
|
19
|
+
class PicturesHelper < ViewHelper::Base
|
20
|
+
def initialize(context)
|
21
|
+
@context = context
|
22
|
+
end
|
23
|
+
|
24
|
+
def render(options = {})
|
25
|
+
options.reverse_merge!(Ecm::Galleries::Configuration.pictures_helper_render_default_options)
|
26
|
+
|
27
|
+
id = options.delete(:id)
|
28
|
+
variant_options = options.delete(:variant_options) || {}
|
29
|
+
show_details = options.delete(:show_details)
|
30
|
+
image_tag_only = options.delete(:image_tag_only)
|
31
|
+
|
32
|
+
resource = Ecm::Galleries::PictureDetail.where(id: id).first
|
33
|
+
c.render partial: 'ecm/galleries/pictures_helper/render', locals: { resource: resource, variant_options: variant_options, show_details: show_details, image_tag_only: image_tag_only }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- if resource.nil?
|
2
|
+
- else
|
3
|
+
%notextile
|
4
|
+
.row{ id: dom_id(resource), class: dom_class(resource) }
|
5
|
+
- resource.picture_details.published.each do |picture_detail|
|
6
|
+
.col-md-6.col-lg-3.d-flex.align-items-stretch.mb-4
|
7
|
+
= bootstrap_card(image_options: { src: main_app.url_for(picture_detail.asset.variant(variant_options))}, additional_css_classes: 'text-center border-0 w-100' ) do
|
8
|
+
- if show_details
|
9
|
+
.card-body
|
10
|
+
%h5.card-title
|
11
|
+
= picture_detail.title
|
12
|
+
%p.card-text
|
13
|
+
= picture_detail.description
|
14
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- if resource.nil?
|
2
|
+
- else
|
3
|
+
%notextile
|
4
|
+
- if image_tag_only
|
5
|
+
%img.img-responsive{ src: main_app.url_for(resource.asset.variant(variant_options)) }
|
6
|
+
- else
|
7
|
+
.row{ id: dom_id(resource), class: dom_class(resource) }
|
8
|
+
.col-md-6.col-lg-3.d-flex.align-items-stretch.mb-4
|
9
|
+
= bootstrap_card(image_options: { src: main_app.url_for(resource.asset.variant(variant_options)) }, additional_css_classes: 'text-center border-0 w-100' ) do
|
10
|
+
- if show_details
|
11
|
+
.card-body
|
12
|
+
%h5.card-title
|
13
|
+
= resource.title
|
14
|
+
%p.card-text
|
15
|
+
= resource.description
|
data/config/locales/de.yml
CHANGED
@@ -15,6 +15,7 @@ de:
|
|
15
15
|
id: ID
|
16
16
|
name: Name
|
17
17
|
description: Beschreibung
|
18
|
+
display_code_for_erb: Anzeigecode (erb)
|
18
19
|
picture_details_count: Bilder
|
19
20
|
preview: Vorschau
|
20
21
|
published: Veröffentlicht
|
@@ -23,15 +24,16 @@ de:
|
|
23
24
|
updated_at: Aktualisiert am
|
24
25
|
ecm/galleries/picture_detail:
|
25
26
|
id: ID
|
26
|
-
picture_gallery: Galerie
|
27
|
-
picture_gallery_id: Galerie
|
28
|
-
asset: Datei
|
29
27
|
asset_id: Datei
|
30
|
-
|
28
|
+
asset: Datei
|
31
29
|
description: Beschreibung
|
30
|
+
display_code_for_erb: Anzeigecode (erb)
|
31
|
+
picture_gallery_id: Galerie
|
32
|
+
picture_gallery: Galerie
|
32
33
|
position: Position
|
33
|
-
published: Veröffentlicht
|
34
34
|
published_at: Veröffentlicht am
|
35
|
+
published: Veröffentlicht
|
36
|
+
title: Titel
|
35
37
|
created_at: Erstellt am
|
36
38
|
updated_at: Aktualisiert am
|
37
39
|
ecm:
|
data/config/locales/en.yml
CHANGED
@@ -15,6 +15,7 @@ en:
|
|
15
15
|
id: ID
|
16
16
|
name: Name
|
17
17
|
description: Description
|
18
|
+
display_code_for_erb: Display code (erb)
|
18
19
|
picture_details_count: Pictures
|
19
20
|
preview: Preview
|
20
21
|
published: Published
|
@@ -23,15 +24,16 @@ en:
|
|
23
24
|
updated_at: Updated at
|
24
25
|
ecm/galleries/picture_detail:
|
25
26
|
id: ID
|
26
|
-
picture_gallery: Gallery
|
27
|
-
picture_gallery_id: Gallery
|
28
|
-
asset: File
|
29
27
|
asset_id: File
|
30
|
-
|
28
|
+
asset: File
|
31
29
|
description: Description
|
30
|
+
display_code_for_erb: Display code (erb)
|
31
|
+
picture_gallery_id: Gallery
|
32
|
+
picture_gallery: Gallery
|
32
33
|
position: Position
|
33
|
-
published: Published
|
34
34
|
published_at: Published at
|
35
|
+
published: Published
|
36
|
+
title: Title
|
35
37
|
created_at: Created at
|
36
38
|
updated_at: Updated at
|
37
39
|
ecm:
|
@@ -6,5 +6,6 @@ module Ecm::Galleries
|
|
6
6
|
|
7
7
|
mattr_accessor(:base_controller) { '::FrontendController' }
|
8
8
|
mattr_accessor(:galleries_helper_render_default_options) { { variant_options: {}, show_details: false } }
|
9
|
+
mattr_accessor(:pictures_helper_render_default_options) { { variant_options: {}, show_details: false } }
|
9
10
|
end
|
10
11
|
end
|
@@ -10,5 +10,12 @@ Ecm::Galleries.configure do |config|
|
|
10
10
|
#
|
11
11
|
# Default: config.galleries_helper_render_default_options = { variant_options: {}, show_details: false }
|
12
12
|
#
|
13
|
-
config.
|
13
|
+
config.base_controller = '<%= base_controller_class_name %>'
|
14
|
+
|
15
|
+
# These options are the defaults that will be applied to when rendering
|
16
|
+
# pictures through the pictures helper.
|
17
|
+
#
|
18
|
+
# Default: config.pictures_helper_render_default_options = { variant_options: {}, show_details: false }
|
19
|
+
#
|
20
|
+
config.pictures_helper_render_default_options = { variant_options: {}, show_details: false }
|
14
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_galleries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
@@ -284,9 +284,11 @@ files:
|
|
284
284
|
- app/models/ecm/galleries/picture_detail.rb
|
285
285
|
- app/models/ecm/galleries/picture_gallery.rb
|
286
286
|
- app/view_helpers/ecm/galleries/galleries_helper.rb
|
287
|
+
- app/view_helpers/ecm/galleries/pictures_helper.rb
|
288
|
+
- app/views/ecm/galleries/galleries_helper/_render.html.haml
|
287
289
|
- app/views/ecm/galleries/picture_galleries/index.haml
|
288
290
|
- app/views/ecm/galleries/picture_galleries/show.haml
|
289
|
-
- app/views/ecm/galleries/
|
291
|
+
- app/views/ecm/galleries/pictures_helper/_render.html.haml
|
290
292
|
- app/views/layouts/ecm/galleries/application.html.erb
|
291
293
|
- config/initializers/assets.rb
|
292
294
|
- config/locales/de.yml
|
@@ -1,13 +0,0 @@
|
|
1
|
-
- if resource.nil?
|
2
|
-
- else
|
3
|
-
.row{ id: dom_id(resource), class: dom_class(resource) }
|
4
|
-
- resource.picture_details.published.each do |picture_detail|
|
5
|
-
.col-md-6.col-lg-3.d-flex.align-items-stretch.mb-4
|
6
|
-
= bootstrap_card(image_options: { src: main_app.url_for(picture_detail.asset.variant(variant_options))}, additional_css_classes: 'text-center border-0 w-100' ) do
|
7
|
-
- if show_details
|
8
|
-
.card-body
|
9
|
-
%h5.card-title
|
10
|
-
= picture_detail.title
|
11
|
-
%p.card-text
|
12
|
-
= picture_detail.description
|
13
|
-
|