diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-04-09 01:01:42 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-04-09 01:01:42 +0300 |
commit | d98b1833612af09fb405880ef7acd63a4e2a42fa (patch) | |
tree | aeaccad8bca98675765206f2856db2509c3c29bf /app/helpers/tab_helper.rb | |
parent | 23d950855d6d2524d00b1f0618c008e2529f06a4 (diff) | |
download | gitlab-ce-d98b1833612af09fb405880ef7acd63a4e2a42fa.tar.gz |
first pack of tests for milestones
Diffstat (limited to 'app/helpers/tab_helper.rb')
-rw-r--r-- | app/helpers/tab_helper.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/helpers/tab_helper.rb b/app/helpers/tab_helper.rb new file mode 100644 index 00000000000..091853b66c3 --- /dev/null +++ b/app/helpers/tab_helper.rb @@ -0,0 +1,43 @@ +module TabHelper + def issues_tab? + controller.controller_name == "issues" || controller.controller_name == "milestones" + end + + def wall_tab? + current_page?(:controller => "projects", :action => "wall", :id => @project) + end + + def project_tab_class + [:show, :files, :team, :edit, :update].each do |action| + return "current" if current_page?(:controller => "projects", :action => action, :id => @project) + end + + if controller.controller_name == "snippets" || + controller.controller_name == "hooks" || + controller.controller_name == "deploy_keys" || + controller.controller_name == "team_members" + "current" + end + end + + def tree_tab_class + controller.controller_name == "refs" ? + "current" : nil + end + + def commit_tab_class + if controller.controller_name == "commits" || + controller.controller_name == "repositories" || + controller.controller_name == "protected_branches" + "current" + end + end + + def branches_tab_class + if current_page?(branches_project_repository_path(@project)) || + controller.controller_name == "protected_branches" || + current_page?(project_repository_path(@project)) + 'active' + end + end +end |