first pack of tests for milestones

This commit is contained in:
Dmitriy Zaporozhets 2012-04-09 01:01:42 +03:00
parent 23d950855d
commit d98b183361
8 changed files with 145 additions and 48 deletions

View file

@ -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

43
app/helpers/tab_helper.rb Normal file
View file

@ -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

View file

@ -10,7 +10,7 @@
= link_to "Network", graph_project_path(@project), :class => current_page?(:controller => "projects", :action => "graph", :id => @project) ? "current" : nil
- if @project.issues_enabled
= link_to project_issues_filter_path(@project), :class => (controller.controller_name == "issues") ? "current" : nil do
= link_to project_issues_filter_path(@project), :class => issues_tab? ? "current" : nil do
Issues
%span.count= @project.issues.opened.count
- if @project.merge_requests_enabled
@ -19,7 +19,7 @@
%span.count= @project.merge_requests.opened.count
- if @project.wall_enabled
= link_to wall_project_path(@project), :class => current_page?(:controller => "projects", :action => "wall", :id => @project) ? "current" : nil do
= link_to wall_project_path(@project), :class => wall_tab? ? "current" : nil do
Wall
- if @project.wiki_enabled