ecm_galleries 0.2.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 814fd3760f2d7a87052c49a9de9a2894d30b6073be4e25d35b5237f74ebaece9
4
- data.tar.gz: b100d376e2b2db919b9a51a753b8a7a749c4d638ddf28ef153f3e39da3467113
3
+ metadata.gz: 63e8eb6fd06cf5bd76c95f17e295ebeec9d832b8575e7e329a70aaf4e42f36b3
4
+ data.tar.gz: 6b9218d794876d898b1f909983193b0dc85b2afe1fe756bb0e8770f0b8e6c467
5
5
  SHA512:
6
- metadata.gz: 220fb93955e3c1bdf2b5ffbf265edf027cc8e7fe74521bafd48cf81111af26d3dd4a82f26fbe851ce966f4bfc1687b18b27715ad947773bc5469a1d9e8d06051
7
- data.tar.gz: f792a1c985e39f9f677568f5945f022676177ac017a57cb0addab3f015944321510193ff7c820e4bed38201c0c0d925999a51d5c024635626767ebd8aaabd12e
6
+ metadata.gz: c552ffe145650312b7c53b0017d9e244005280f30931011c47bfd4dada7147041df4fd976d11b3a66863b4691dd5b6a8285837bf12ce7d6b2f799b4ccc362435
7
+ data.tar.gz: 4122125395d355aca9a370d0fc2bb1bb84c3efc6895596c0ec2d0b249b8ead4f671e8b60a037a4655ff6e264e26662e8806f11fb2d934571dbcc55b7acb52b5a
@@ -7,6 +7,10 @@ module Ecm::Galleries
7
7
 
8
8
  acts_as_list scope: :picture_gallery
9
9
 
10
+ def human
11
+ title || id
12
+ end
13
+
10
14
  module DisplayCodesConcern
11
15
  extend ActiveSupport::Concern
12
16
 
@@ -12,11 +12,29 @@ module Ecm::Galleries
12
12
  extend ActiveSupport::Concern
13
13
 
14
14
  included do
15
- has_many :picture_details, -> { order(position: :asc) }, inverse_of: :picture_gallery, dependent: :destroy
15
+ has_many :picture_details, -> { order(position: :asc) }, inverse_of: :picture_gallery, dependent: :destroy, autosave: true
16
16
  before_validation :cleanup_orphaned_picture_details
17
17
  before_validation :ensure_picture_details
18
18
  end
19
19
 
20
+ def append_assets
21
+ assets
22
+ end
23
+
24
+ def append_assets=(assets)
25
+ self.assets = assets
26
+ end
27
+
28
+ def overwrite_assets
29
+ assets
30
+ end
31
+
32
+ def overwrite_assets=(assets)
33
+ return if assets.nil? || assets.empty?
34
+ self.picture_details.map { |pd| pd.mark_for_destruction }
35
+ self.assets = assets
36
+ end
37
+
20
38
  def picture_details_count
21
39
  picture_details.count
22
40
  end
@@ -36,12 +54,13 @@ module Ecm::Galleries
36
54
  end
37
55
 
38
56
  def build_picture_detail_for_asset(asset)
39
- picture_details.build(asset: asset)
57
+ picture_details.build(asset: asset, published: published)
40
58
  end
41
59
  end
42
60
 
43
61
  include PictureDetails
44
62
 
63
+
45
64
  def human
46
65
  name
47
66
  end
@@ -14,7 +14,7 @@ module Ecm
14
14
  # Default options are taken from Ecm::Galleries::Configuration.galleries_helper_render_default_options.
15
15
  # You can set this option in the initializer.
16
16
  #
17
- class GalleriesHelper < ViewHelper::Base
17
+ class GalleriesHelper < Rao::ViewHelper::Base
18
18
  def initialize(context)
19
19
  @context = context
20
20
  end
@@ -16,7 +16,7 @@ module Ecm
16
16
  #
17
17
  # You can pass the image_tag_only option to render just the <img>-tag without a bootstrap card.
18
18
  #
19
- class PicturesHelper < ViewHelper::Base
19
+ class PicturesHelper < Rao::ViewHelper::Base
20
20
  def initialize(context)
21
21
  @context = context
22
22
  end
@@ -1,14 +1,17 @@
1
1
  - if resource.nil?
2
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
3
+ %div{ id: dom_id(resource), class: dom_class(resource) }
4
+ %notextile
5
+ .row
6
+ - resource.picture_details.published.each do |picture_detail|
7
+ .col-md-6.col-lg-3.d-flex.align-items-stretch.mb-4
8
+ = bootstrap_card(additional_css_classes: 'text-center border-0 w-100' ) do
9
+ %a{ href: main_app.url_for(picture_detail.asset.variant(variant_options)), data: { gallery: dom_id(resource) } }
10
+ %img{ src: main_app.url_for(picture_detail.asset) }
11
+ - if show_details
12
+ .card-body
13
+ %h5.card-title
14
+ = picture_detail.title
15
+ %p.card-text
16
+ = picture_detail.description
14
17
 
@@ -1,14 +1,15 @@
1
1
  %h1= @resource.name
2
2
 
3
- .row
4
- - @resource.picture_details.each do |picture_detail|
5
- .col-lg-4.d-flex.align-items-stretch
6
- = bootstrap_card(image_options: { src: main_app.url_for(picture_detail.asset)}, additional_css_classes: 'text-center border-0' ) do
7
- .card-body
8
- %h5.card-title
9
- = picture_detail.title
10
- %p.card-text
11
- = picture_detail.description
3
+ %div{ class: dom_id(@resource), class: dom_class(@resource) }
4
+ .row
5
+ - @resource.picture_details.each do |picture_detail|
6
+ .col-lg-4.d-flex.align-items-stretch
7
+ = bootstrap_card(image_options: { src: main_app.url_for(picture_detail.asset), data: { gallery: "##{dom_id(@resource)}" } }, additional_css_classes: 'text-center border-0' ) do
8
+ .card-body
9
+ %h5.card-title
10
+ = picture_detail.title
11
+ %p.card-text
12
+ = picture_detail.description
12
13
 
13
14
  .row.mt-4
14
15
  .col-12
@@ -13,13 +13,15 @@ de:
13
13
  attributes:
14
14
  ecm/galleries/picture_gallery:
15
15
  id: ID
16
- name: Name
16
+ append_assets: Bilder hinzufügen
17
17
  description: Beschreibung
18
18
  display_code_for_erb: Anzeigecode (erb)
19
+ name: Name
20
+ overwrite_assets: Bilder ersetzen
19
21
  picture_details_count: Bilder
20
22
  preview: Vorschau
21
- published: Veröffentlicht
22
23
  published_at: Veröffentlicht am
24
+ published: Veröffentlicht
23
25
  created_at: Erstellt am
24
26
  updated_at: Aktualisiert am
25
27
  ecm/galleries/picture_detail:
@@ -31,6 +33,7 @@ de:
31
33
  picture_gallery_id: Galerie
32
34
  picture_gallery: Galerie
33
35
  position: Position
36
+ preview: Vorschau
34
37
  published_at: Veröffentlicht am
35
38
  published: Veröffentlicht
36
39
  title: Titel
@@ -31,6 +31,7 @@ en:
31
31
  picture_gallery_id: Gallery
32
32
  picture_gallery: Gallery
33
33
  position: Position
34
+ preview: Preview
34
35
  published_at: Published at
35
36
  published: Published
36
37
  title: Title
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module Galleries
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.4.0'.freeze
4
4
  end
5
5
  end
@@ -29,3 +29,31 @@
29
29
  Ecm::Galleries::PictureGallery Exists (0.3ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "an arbitrary value"], ["LIMIT", 1]]
30
30
  Ecm::Galleries::PictureGallery Exists (0.2ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "AN ARBITRARY VALUE"], ["LIMIT", 1]]
31
31
   (0.3ms) rollback transaction
32
+  (0.0ms) begin transaction
33
+ Ecm::Galleries::PictureGallery Exists (0.3ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" IS NULL LIMIT ? [["LIMIT", 1]]
34
+  (0.1ms) rollback transaction
35
+  (0.1ms) begin transaction
36
+ Ecm::Galleries::PictureGallery Load (0.2ms) SELECT "ecm_galleries_picture_galleries".* FROM "ecm_galleries_picture_galleries" ORDER BY "ecm_galleries_picture_galleries"."id" ASC LIMIT ? [["LIMIT", 1]]
37
+  (1.4ms) SAVEPOINT active_record_1
38
+ Ecm::Galleries::PictureGallery Create (0.3ms) INSERT INTO "ecm_galleries_picture_galleries" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2018-12-25 23:00:18.131979"], ["updated_at", "2018-12-25 23:00:18.131979"]]
39
+  (0.1ms) RELEASE SAVEPOINT active_record_1
40
+  (0.1ms) SAVEPOINT active_record_1
41
+ Ecm::Galleries::PictureGallery Update (0.2ms) UPDATE "ecm_galleries_picture_galleries" SET "name" = ?, "updated_at" = ? WHERE "ecm_galleries_picture_galleries"."id" = ? [["name", "an arbitrary value"], ["updated_at", "2018-12-25 23:00:18.133744"], ["id", 1]]
42
+  (0.1ms) RELEASE SAVEPOINT active_record_1
43
+ Ecm::Galleries::PictureGallery Exists (0.2ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "an arbitrary value"], ["LIMIT", 1]]
44
+ Ecm::Galleries::PictureGallery Exists (0.1ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "AN ARBITRARY VALUE"], ["LIMIT", 1]]
45
+  (0.2ms) rollback transaction
46
+  (0.0ms) begin transaction
47
+ Ecm::Galleries::PictureGallery Exists (0.2ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" IS NULL LIMIT ? [["LIMIT", 1]]
48
+  (0.1ms) rollback transaction
49
+  (0.1ms) begin transaction
50
+ Ecm::Galleries::PictureGallery Load (0.3ms) SELECT "ecm_galleries_picture_galleries".* FROM "ecm_galleries_picture_galleries" ORDER BY "ecm_galleries_picture_galleries"."id" ASC LIMIT ? [["LIMIT", 1]]
51
+  (0.1ms) SAVEPOINT active_record_1
52
+ Ecm::Galleries::PictureGallery Create (0.3ms) INSERT INTO "ecm_galleries_picture_galleries" ("created_at", "updated_at") VALUES (?, ?) [["created_at", "2018-12-25 23:34:25.452537"], ["updated_at", "2018-12-25 23:34:25.452537"]]
53
+  (0.1ms) RELEASE SAVEPOINT active_record_1
54
+  (0.0ms) SAVEPOINT active_record_1
55
+ Ecm::Galleries::PictureGallery Update (0.2ms) UPDATE "ecm_galleries_picture_galleries" SET "name" = ?, "updated_at" = ? WHERE "ecm_galleries_picture_galleries"."id" = ? [["name", "an arbitrary value"], ["updated_at", "2018-12-25 23:34:25.454464"], ["id", 1]]
56
+  (0.1ms) RELEASE SAVEPOINT active_record_1
57
+ Ecm::Galleries::PictureGallery Exists (0.1ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "an arbitrary value"], ["LIMIT", 1]]
58
+ Ecm::Galleries::PictureGallery Exists (0.2ms) SELECT 1 AS one FROM "ecm_galleries_picture_galleries" WHERE "ecm_galleries_picture_galleries"."name" = ? LIMIT ? [["name", "AN ARBITRARY VALUE"], ["LIMIT", 1]]
59
+  (0.3ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_galleries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.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: 2018-12-21 00:00:00.000000000 Z
11
+ date: 2018-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails