diff options
author | Semyon Pupkov <mail@semyonpupkov.com> | 2017-02-12 11:02:26 +0300 |
---|---|---|
committer | Semyon Pupkov <mail@semyonpupkov.com> | 2017-02-15 12:29:48 +0300 |
commit | 0dfccd995aa9bf560e59299f3a4f1705d6981115 (patch) | |
tree | c6ab80041dd2b83ed4c245b0824c2ace70872eb2 /app/helpers/application_helper.rb | |
parent | 1452729304393978ec93b712130dff6687db01b9 (diff) |
Add active_when helper
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/24036
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bee323993a0..6db813d4a02 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -296,4 +296,13 @@ module ApplicationHelper def page_class "issue-boards-page" if current_controller?(:boards) end + + # Returns active css class when condition returns true + # otherwise returns nil. + # + # Example: + # %li{ class: active_when(params[:filter] == '1') } + def active_when(condition) + 'active' if condition + end end |