class ActionBlocks::DashboardBuilder
Attributes
subspace[RW]
workspace[RW]
Public Instance Methods
before_build(parent, *args)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 208 def before_build(parent, *args) @subspace = parent @workspace = @subspace.workspace @category = args[0] @title = @category.to_s.titleize if args[1] @model_key = "model-#{args[1]}" end end
has_unique_dashlets()
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 220 def has_unique_dashlets @dashlets.group_by(&:key).each do |k, dashlets| if(dashlets.length > 1) d = dashlets.first errors.add(:dashlets, "Duplicate #{d.type.inspect} added to dashboard #{workspace.id}/#{subspace.id}/#{id} with id #{d.id.inspect}") end end end
hashify(user)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 229 def hashify(user) { key: key, title: @title, model: @model_key, category: @category, dashlet_keys: @dashlets.map(&:key) } end