etabliocms_galleries 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -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.
|
24
|
-
|
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
|