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 | |
| parent | 23d950855d6d2524d00b1f0618c008e2529f06a4 (diff) | |
| download | gitlab-ce-d98b1833612af09fb405880ef7acd63a4e2a42fa.tar.gz | |
first pack of tests for milestones
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/projects_helper.rb | 38 | ||||
| -rw-r--r-- | app/helpers/tab_helper.rb | 43 |
2 files changed, 43 insertions, 38 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 16e3d9d0056..f864f6aa3ae 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -16,45 +16,7 @@ module ProjectsHelper nil 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 repository_tab_class - #if controller.controller_name == "repositories" || - #controller.controller_name == "hooks" || - #controller.controller_name == "deploy_keys" - #"current" - #end - 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 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 |
