Module: PluginHelper

Defined in:
frontend/app/helpers/plugin_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) form_plugins_for(jsonmodel_type, context)



34
35
36
37
38
39
40
41
42
43
44
45
# File 'frontend/app/helpers/plugin_helper.rb', line 34

def form_plugins_for(jsonmodel_type, context)
  result = ''
  Plugins.plugins_for(jsonmodel_type).each do |plugin|
    parent = Plugins.parent_for(plugin, jsonmodel_type)

    result << render_aspace_partial(:partial => "shared/subrecord_form",
                     :locals => {:form => context, :name => parent['name'],
                       :cardinality => parent['cardinality'].intern, :plugin => true})

  end
  result.html_safe
end

- (Object) show_plugins_for(record, context)



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'frontend/app/helpers/plugin_helper.rb', line 19

def show_plugins_for(record, context)
  result = ''
  jsonmodel_type = record['jsonmodel_type']
  Plugins.plugins_for(jsonmodel_type).each do |plugin|
    name = Plugins.parent_for(plugin, jsonmodel_type)['name']
    if Array(record.send(name)).length > 0
      result << render_aspace_partial(:partial => "#{name}/show",
                       :locals => { name.intern => record.send(name),
                         :context => context, :section_id => "#{jsonmodel_type}_#{name}_" })
    end
  end
  result.html_safe
end


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'frontend/app/helpers/plugin_helper.rb', line 3

def sidebar_plugins_for(record)
  result = ''
  jsonmodel_type = record['jsonmodel_type']
  Plugins.plugins_for(jsonmodel_type).each do |plugin|
    name = Plugins.parent_for(plugin, jsonmodel_type)['name']
    if not controller.action_name === "show" or Array(record.send(name)).length > 0
      result << '<li>'
      result << "<a href='##{jsonmodel_type}_#{name}_'>"
      result << I18n.t("plugins.#{plugin}._plural")
      result << '<span class="glyphicon glyphicon-chevron-right"></span></a></li>'
    end
  end
  result.html_safe
end