Module: RedmineExtensions::ApplicationHelper

Includes:
RenderingHelper
Defined in:
app/helpers/redmine_extensions/application_helper.rb

Instance Method Summary collapse

Methods included from RenderingHelper

#render_with_fallback

Instance Method Details

#detect_hide_elements(uniq_id, user = nil, default = true) ⇒ Object

hide elements for issues and users



33
34
35
36
# File 'app/helpers/redmine_extensions/application_helper.rb', line 33

def detect_hide_elements(uniq_id, user = nil, default = true)
  return ''.html_safe if uniq_id.blank?
  return 'style="display:none"'.html_safe if !toggle_button_expanded?(uniq_id, user, default)
end

#plugin_settings_path(plugin, *attrs) ⇒ Object

——-= Hack methods =——



7
8
9
10
11
12
13
# File 'app/helpers/redmine_extensions/application_helper.rb', line 7

def plugin_settings_path(plugin, *attrs)
  if plugin.is_a?(Redmine::Plugin) && (plugin.settings[:only_easy] || plugin.settings[:easy_settings])
    redmine_extensions_engine.edit_easy_setting_path(plugin, *attrs)
  else
    super
  end
end

#present(model, options = {}, &block) ⇒ Object

——-= Rendering and presenting methods =——-



17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/redmine_extensions/application_helper.rb', line 17

def present(model, options={}, &block)
  if model.is_a?(RedmineExtensions::BasePresenter)
    presenter = model.update_options(options.merge(view_context: self))
  else
    presenter = RedmineExtensions::BasePresenter.present(model, self, options)
  end
  if block_given?
    yield presenter
  else
    presenter
  end
end

#url_to_entity(entity, options = {}) ⇒ Object



38
39
40
41
42
43
44
45
# File 'app/helpers/redmine_extensions/application_helper.rb', line 38

def url_to_entity(entity, options={})
  m = "url_to_#{entity.class.name.underscore}".to_sym
  if respond_to?(m)
    send(m, entity, options)
  else
    nil
  end
end