about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 02:03:17 -0700
committerkibigo! <marrus-sh@users.noreply.github.com>2017-07-12 02:03:17 -0700
commit79d898ae0ad8c0e66bd63ec3e0904e9e5e7894e8 (patch)
treeee8d832ed2f11e9afe62daf0e586a86004eb8d98 /app/helpers
parentbcf7ee48e94cd2e4d2de28e8854e7f0e2b5cad1f (diff)
parent056b5ed72f6d980bceeb49eb249b8365fe8fce66 (diff)
Merge upstream!! #64 <3 <3
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/admin/filter_helper.rb12
-rw-r--r--app/helpers/application_helper.rb8
-rw-r--r--app/helpers/settings_helper.rb1
3 files changed, 16 insertions, 5 deletions
diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb
index 0dfa30e56..6a57b3d63 100644
--- a/app/helpers/admin/filter_helper.rb
+++ b/app/helpers/admin/filter_helper.rb
@@ -6,15 +6,21 @@ module Admin::FilterHelper
 
   FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS
 
-  def filter_link_to(text, more_params)
-    new_url = filtered_url_for(more_params)
-    link_to text, new_url, class: filter_link_class(new_url)
+  def filter_link_to(text, link_to_params, link_class_params = link_to_params)
+    new_url = filtered_url_for(link_to_params)
+    new_class = filtered_url_for(link_class_params)
+    link_to text, new_url, class: filter_link_class(new_class)
   end
 
   def table_link_to(icon, text, path, options = {})
     link_to safe_join([fa_icon(icon), text]), path, options.merge(class: 'table-action-link')
   end
 
+  def selected?(more_params)
+    new_url = filtered_url_for(more_params)
+    filter_link_class(new_url) == 'selected' ? true : false
+  end
+
   private
 
   def filter_params(more_params)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 36c37fae0..9f50d8bdb 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -31,7 +31,11 @@ module ApplicationHelper
     Rails.env.production? ? site_title : "#{site_title} (Dev)"
   end
 
-  def fa_icon(icon)
-    content_tag(:i, nil, class: 'fa ' + icon.split(' ').map { |cl| "fa-#{cl}" }.join(' '))
+  def fa_icon(icon, attributes = {})
+    class_names = attributes[:class]&.split(' ') || []
+    class_names << 'fa'
+    class_names += icon.split(' ').map { |cl| "fa-#{cl}" }
+
+    content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
   end
 end
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 847eff2e7..af950aa63 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -19,6 +19,7 @@ module SettingsHelper
     io: 'Ido',
     it: 'Italiano',
     ja: '日本語',
+    ko: '한국어',
     nl: 'Nederlands',
     no: 'Norsk',
     oc: 'Occitan',