summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb6
-rw-r--r--app/helpers/icons_helper.rb23
-rw-r--r--app/helpers/queries_helper.rb2
-rw-r--r--app/helpers/repositories_helper.rb4
-rw-r--r--app/helpers/settings_helper.rb6
-rw-r--r--app/helpers/watchers_helper.rb3
6 files changed, 38 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 50519c890..9bb26bdec 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -518,7 +518,7 @@ module ApplicationHelper
def render_flash_messages
s = +''
flash.each do |k, v|
- s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
+ s << content_tag('div', notice_icon(k) + v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
end
s.html_safe
end
@@ -1576,7 +1576,9 @@ module ApplicationHelper
def render_error_messages(errors)
html = +""
if errors.present?
- html << "<div id='errorExplanation'><ul>\n"
+ html << "<div id='errorExplanation'>\n"
+ html << notice_icon('error')
+ html << "<ul>\n"
errors.each do |error|
html << "<li>#{h error}</li>\n"
end
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index 99006308e..948f68752 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -67,6 +67,29 @@ module IconsHelper
sprite_icon(icon_name, **options)
end
+ def scm_change_icon(action, name, **options)
+ icon_name = case action
+ when 'A'
+ "add"
+ when 'D'
+ "circle-minus"
+ else
+ "circle-dot-filled"
+ end
+ sprite_icon(icon_name, name, size: 14)
+ end
+
+ def notice_icon(type, **options)
+ icon_name = case type
+ when 'notice'
+ 'checked'
+ when 'warning', 'error'
+ 'warning'
+ end
+
+ sprite_icon(icon_name, **options)
+ end
+
private
def svg_sprite_icon(icon_name, size: DEFAULT_ICON_SIZE, sprite: DEFAULT_SPRITE, css_class: nil)
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index 3775dcd3f..ca7168f27 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -192,6 +192,8 @@ module QueriesHelper
value =
if [:hours, :spent_hours, :total_spent_hours, :estimated_hours, :total_estimated_hours, :estimated_remaining_hours].include? column.name
format_hours(value)
+ elsif column.is_a?(QueryCustomFieldColumn)
+ format_object(value, thousands_delimiter: column.custom_field.thousands_delimiter?)
else
format_object(value)
end
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 7a6978979..c72816367 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -96,7 +96,7 @@ module RepositoriesHelper
if s = tree[file][:s]
style << ' folder'
path_param = to_path_param(@repository.relative_path(file))
- text = link_to(h(text), :controller => 'repositories',
+ text = link_to(sprite_icon("folder-open", h(text)), :controller => 'repositories',
:action => 'show',
:id => @project,
:repository_id => @repository.identifier_param,
@@ -108,7 +108,7 @@ module RepositoriesHelper
elsif c = tree[file][:c]
style << " change-#{c.action}"
path_param = to_path_param(@repository.relative_path(c.path))
- text = link_to(h(text), :controller => 'repositories',
+ text = link_to(scm_change_icon(c.action, h(text)), :controller => 'repositories',
:action => 'entry',
:id => @project,
:repository_id => @repository.identifier_param,
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 1fb57b2d7..39a836a03 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -48,7 +48,11 @@ module SettingsHelper
errors.each do |name, message|
s << content_tag('li', content_tag('b', l("setting_#{name}")) + " " + message)
end
- content_tag('div', content_tag('ul', s), :id => 'errorExplanation')
+
+ h = ''.html_safe
+ h << notice_icon('error')
+ h << content_tag('ul', s)
+ content_tag('div', h, :id => 'errorExplanation')
end
def setting_value(setting)
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index 882325c18..6e6366846 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -26,6 +26,7 @@ module WatchersHelper
watched = Watcher.any_watched?(objects, user)
css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ')
+ icon = watched ? 'unwatch' : 'watch'
text = watched ? l(:button_unwatch) : l(:button_watch)
url = watch_path(
:object_type => objects.first.class.to_s.underscore,
@@ -33,7 +34,7 @@ module WatchersHelper
)
method = watched ? 'delete' : 'post'
- link_to sprite_icon('fav', text), url, :remote => true, :method => method, :class => css
+ link_to sprite_icon(icon, text), url, :remote => true, :method => method, :class => css
end
# Returns the css class used to identify watch links for a given +object+