class ActionBlocks::SubspaceBuilder
class RecordPathBuilder < ActionBlocks::BaseBuilder
sets :model # currently used by table to find this sets :subspace # What path/url to share to control active navigation sets :recordspace # What recordspace to render sets :dashboard # What path/url of the recordspace dashboard to control active navigation sets :recordboard # What recordboard to render def before_build(parent, *args) # When Creating Links for Records of type @model @model = args[0] # Create Links with this information @subspace = args[1] @recordspace = args[2] @dashboard = args[3] @recordboard = args[4] end def hashify(user) { model: @model, subspace: @subspace, dashboard: @dashboard, recordspace: @recordspace, recordboard: @recordboard } end
end
Attributes
workspace[RW]
Public Instance Methods
before_build(parent, *args)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 154 def before_build(parent, *args) @workspace = parent @title = args[0].to_s.titleize @category = args[0] if args[1] @model_key = "model-#{args[1]}" end end
dashboard_categories()
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 163 def dashboard_categories @dashboards.map(&:category).uniq end
hashify(user)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 186 def hashify(user) { key: key, title: @title, category: @category, model: @model_key, dashboards: @dashboards.map{ |db| db.hashify(user) }, dashboard_categories: hashify_dashboard_categories(user), recordspace_keys: @recordspace_keys } end
hashify_dashboard_categories(user)
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 167 def hashify_dashboard_categories(user) isFirst = true results = [] dashboard_categories.each do |category| results << { first: isFirst, type: 'dashboard_categories', category: category, title: category.to_s.titleize, dashboards: @dashboards. select {|d| d.category == category}. map { |d| d.hashify(user) }, } isFirst = false end return results end
key()
click to toggle source
# File lib/action_blocks/builders/workspace_builder.rb, line 150 def key "subspace-#{@id}".to_sym end