etabliocms_galleries 0.0.9 → 0.0.10

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.
@@ -20,17 +20,21 @@ module EtabliocmsGalleries
20
20
  accepts_nested_attributes_for :pictures, :allow_destroy => true
21
21
 
22
22
  def set_pictures
23
- pictures_array.each do |file|
24
- pictures.build(:data => file)
23
+ if pictures_array.present?
24
+ pictures_array.each do |file|
25
+ pictures.build(:data => file,
26
+ :title => file.original_filename,
27
+ :position => pictures_array.index(file))
28
+ end
25
29
  end
26
30
  end
27
31
 
28
32
  def self.attachables_for_select
29
33
  sum = []
30
34
  sum += EtabliocmsPages::Page.all if defined?(EtabliocmsPages)
31
- EtabliocmsGalleries.attachables.each {|string| sum += eval(string) } if EtabliocmsGalleries.attachables.present?
32
-
33
- sum.map { |item|
35
+ EtabliocmsGalleries.attachables.each { |string| sum += eval(string) } if EtabliocmsGalleries.attachables.present?
36
+
37
+ sum.map { |item|
34
38
  title = item.is_a?(EtabliocmsPages::Page) ? "#{' '*2*item.level}#{item.title}" : item.title
35
39
  ["#{I18n.t("activerecord.attributes.#{item.class.to_s.underscore}.class_name")}: #{title}".html_safe, "#{item.class}##{item.id}"] }
36
40
  end
@@ -1,3 +1,3 @@
1
1
  module EtabliocmsGalleries
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etabliocms_galleries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: