tabs显示

This commit is contained in:
huangjingquan 2013-09-14 09:51:26 +08:00
parent 131c5ba31b
commit e4cbc7533e
6 changed files with 31 additions and 20 deletions

View File

@ -24,13 +24,10 @@ class ProjectsController < ApplicationController
menu_item l(:label_sort_by_time), :only => :index menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index menu_item l(:label_sort_by_influence), :only => :index
# else
# layout 'base_courses' menu_item l(:label_homework), :only => :homework
# menu_item :overview menu_item l(:label_course_file), :only => :index
# menu_item l(:label_homework), :only => :homework menu_item l(:label_course_news), :only => :index
# menu_item l(:label_course_file), :only => :index
# menu_item l(:label_course_news), :only => :index
# menu_item l(:label_settings), :only => :settings
# end # end

View File

@ -32,6 +32,17 @@ module ApplicationHelper
extend Forwardable extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
#Added by young
#Define the course menu's link class
def link_class(label)
if current_menu_item == label
@class = 'selected'
else
@class = ''
end
return @class
end
#Ended by young
# Return true if user is authorized for controller/action, otherwise false # Return true if user is authorized for controller/action, otherwise false
def authorize_for(controller, action) def authorize_for(controller, action)
User.current.allowed_to?({:controller => controller, :action => action}, @project) User.current.allowed_to?({:controller => controller, :action => action}, @project)

View File

@ -1,6 +1,8 @@
<!-- fq --> <!-- fq -->
<% if @bid.homework_type == 1%> <% if @bid.homework_type == 1%>
<%= render :partial => 'homework' %> <%= render :partial => 'homework' %>
<% else %> <% else %>
<style> <style>
input[type="submit"].bid_btn { input[type="submit"].bid_btn {
@ -88,3 +90,4 @@
<%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %> <%= render :partial => 'project_list', :locals => {:bidding_project => @bidding_project} %>
</div> </div>
<% end %> <% end %>

View File

@ -131,12 +131,12 @@
<div id="content"> <div id="content">
<div class="tabs_new"> <div class="tabs_new">
<ul> <ul>
<li><%= link_to(l(:label_overview), project_path(@project))%></li> <li><%= link_to l(:label_overview), project_path(@project), :class => link_class(:overview)%></li>
<li><%= link_to(l(:label_homework), {:controller => 'projects', :action => 'homework'})%></li> <li><%= link_to l(:label_homework), {:controller => 'projects', :action => 'homework'}, :class => link_class('Homework')%></li>
<li><%= link_to(l(:label_course_file), project_files_path(@project))%></li> <li><%= link_to l(:label_course_file), project_files_path(@project), :class => link_class(:files)%></li>
<li><%= link_to(l(:label_course_news), {:controller => 'news', :action => 'index', :project_id => @project})%></li> <li><%= link_to l(:label_course_news), {:controller => 'news', :action => 'index', :project_id => @project}, :class => link_class(:news)%></li>
<!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> --> <!-- <li><%= link_to(l(:label_course_repository), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => nil, :path => nil, :rev => nil, :course => 1 })%></li> -->
<li><%= link_to(l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project}) %></li></ul> <li><%= link_to l(:label_settings), {:controller => 'projects', :action => 'settings', :id => @project}, :class => link_class(:settings)%></li></ul>
</div> </div>
<%= yield %> <%= yield %>
<%= call_hook :view_layouts_base_content %> <%= call_hook :view_layouts_base_content %>

View File

@ -106,12 +106,11 @@
<!-- end --> <!-- end -->
</div> </div>
<div id="content"> <div id="content">
<div class="tabs_new"> <div class="tabs_new">
<ul> <ul>
<li><%= link_to(l(:label_question_student), { :controller => 'bids', :action => 'show' })%></li> <li><%= link_to l(:label_question_student), { :controller => 'bids', :action => 'show' },:class => link_class(:respond)%></li>
<li><%= link_to(l(:label_homework_commit), { :controller => 'bids', :action => 'show_project' })%></li> <li><%= link_to l(:label_homework_commit), { :controller => 'bids', :action => 'show_project' },:class => link_class(:project)%></li>
<li><%= link_to(l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' })%></li> <li><%= link_to l(:label_homework_respond), { :controller => 'bids', :action => 'homework_respond' },:class => link_class(:homework_respond)%></li>
<ul> <ul>
</div> </div>
<%= yield %> <%= yield %>

View File

@ -75,6 +75,7 @@ module Redmine
controller.current_menu_item controller.current_menu_item
end end
# Renders the application main menu # Renders the application main menu
def render_main_menu(project) def render_main_menu(project)
render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project) render_menu((project && !project.new_record?) ? :project_menu : :application_menu, project)