Sha256: 93e3cede85bf911a9a63f8746fa1ad31fc3ed5c4a332eb26c180be8ae5c97d53
Contents?: true
Size: 1.7 KB
Versions: 3
Compression:
Stored size: 1.7 KB
Contents
require 'fiona7/recursive_object_finder' module Fiona7 class ReleaseCollector def initialize(obj_id) @obj = Fiona7::WriteObj.find(obj_id) @finder = Fiona7::RecursiveObjectFinder.new(@obj) end def call [ images, downloads, referenced, linked ].compact end def self.call(obj_id) self.new(obj_id).call end protected def images objs = @finder.images.select {|o| o.really_edited? } if objs.any? group = { title: t(:"fiona7.release.images"), objs: objs_to_items(objs, true) } end end def downloads objs = @finder.downloads.select {|o| o.really_edited? } if objs.any? group = { title: t(:"fiona7.release.downloads"), objs: objs_to_items(objs, true) } end end def referenced objs = @finder.referenced.select {|o| o.really_edited? } if objs.any? group = { title: t(:"fiona7.release.referenced"), objs: objs_to_items(objs, true) } end end def linked objs = @finder.linked.select {|o| o.really_edited? } if objs.any? group = { title: t(:"fiona7.release.linked"), objs: objs_to_items(objs, false) } end end def objs_to_items(objs, checked=true) items = objs.map do |obj| { id: obj.id, title: (obj.title.presence || obj.path), description: obj.obj_class, checked: checked } end end def t(key, options={}) I18n.t(key, {locale: (Scrivito::Configuration.ui_locale || I18n.locale)}.merge(options)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
infopark_fiona7-1.6.1.1.5 | lib/fiona7/release_collector.rb |
infopark_fiona7-1.6.1.1.1 | lib/fiona7/release_collector.rb |
infopark_fiona7-1.6.1.1.0 | lib/fiona7/release_collector.rb |