Module: Katello::ApplicationHelper
- Includes:
- LayoutHelper
- Defined in:
- app/helpers/katello/application_helper.rb
Instance Method Summary
collapse
#javascript, #stylesheet, #trunc_with_tooltip
Instance Method Details
#a_link(name, href, html_options) ⇒ Object
59
60
61
62
63
|
# File 'app/helpers/katello/application_helper.rb', line 59
def a_link(name, href, html_options)
tag_options = tag_options(html_options)
link = "<a href=\"#{href}\"#{tag_options}>#{name}</a>"
return link.respond_to?(:html_safe) ? link.html_safe : link
end
|
#current_user ⇒ Object
5
6
7
|
# File 'app/helpers/katello/application_helper.rb', line 5
def current_user
User.current
end
|
formats the date time if the dat is not nil
10
11
12
13
|
# File 'app/helpers/katello/application_helper.rb', line 10
def format_time(date, options = {})
return I18n.l(date, options) if date
""
end
|
#no_content_view ⇒ Object
69
70
71
|
# File 'app/helpers/katello/application_helper.rb', line 69
def no_content_view
_('No Content View')
end
|
#select_content_view ⇒ Object
65
66
67
|
# File 'app/helpers/katello/application_helper.rb', line 65
def select_content_view
_('Select Content View')
end
|
#selected_content_view(content_view) ⇒ Object
73
74
75
|
# File 'app/helpers/katello/application_helper.rb', line 73
def selected_content_view(content_view)
content_view.nil? ? no_content_view : content_view.id
end
|
#sort(field, options = {}, html_options = {}) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'app/helpers/katello/application_helper.rb', line 27
def sort(field, options = {}, html_options = {})
unless options[:as]
id = field.to_s.downcase == "id"
options[:as] = id ? field.to_s.upcase : field.to_s.humanize
end
ascend = "#{field}|ASC"
descend = "#{field}|DESC"
ascending = params[:order] == ascend
new_sort = ascending ? descend : ascend
selected = [ascend, descend].include?(params[:order])
if selected
css_classes = html_options[:class] ? html_options[:class].split(" ") : []
if ascending
options[:as] = "▲ #{options[:as]}"
css_classes << "ascending"
else
options[:as] = "▼ #{options[:as]}"
css_classes << "descending"
end
html_options[:class] = css_classes.join(" ")
end
url_options = params.merge(:order => new_sort)
options[:as] = raw(options[:as]) if defined?(RailsXss)
a_link(options[:as], html_escape(url_for(url_options)), html_options)
end
|