diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index eabb7adc4..e3cc685a7 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -21,6 +21,8 @@ class BidsController < ApplicationController @offset, @limit = api_offset_and_limit({:limit => 10}) if @project_type == '1' @bids = Bid.visible.where('reward_type = ?', 3) + # elsif + # @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4) else @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 1, 2) end @@ -38,7 +40,7 @@ class BidsController < ApplicationController @bids = @bids.offset(@offset).limit(@limit).all.reverse else limit = @bid_count % @limit - limit = @limit if limit == 0 + limit = @limit if limit == 0 @bids = @bids.offset(@offset).limit(limit).all.reverse end @s_state = 0 @@ -47,7 +49,7 @@ class BidsController < ApplicationController @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse else limit = @bid_count % @limit - limit = @limit if limit == 0 + limit = @limit if limit == 0 @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse end @s_state = 1 @@ -56,7 +58,7 @@ class BidsController < ApplicationController @bids = @bids.offset(@offset).limit(@limit).all.reverse else limit = @bid_count % @limit - limit = @limit if limit == 0 + limit = @limit if limit == 0 @bids = @bids.offset(@offset).limit(@limit).all.reverse end @s_state = 0 @@ -66,7 +68,7 @@ class BidsController < ApplicationController @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse else limit = @bid_count % @limit - limit = @limit if limit == 0 + limit = @limit if limit == 0 @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse end @s_state = 1 diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index f05625322..2d1d0bba7 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -41,8 +41,7 @@ class BoardsController < ApplicationController end end - def show - + def show respond_to do |format| format.html { sort_init 'updated_on', 'desc' @@ -61,7 +60,7 @@ class BoardsController < ApplicationController preload(:author, {:last_reply => :author}). all @message = Message.new(:board => @board) - if @project.project_type ==1 + if @project.project_type ==1 render :action => 'show', :layout => 'base_courses' else render :action => 'show', :layout => !request.xhr? diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 67c057eef..51486f252 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -49,7 +49,7 @@ class DocumentsController < ApplicationController def show @attachments = @document.attachments.all - if @project.project_type + if @project.project_type ==1 render :action => 'show', :layout => 'base_courses' end end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 56422dcd6..afa602d61 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -49,7 +49,7 @@ class MessagesController < ApplicationController all @reply = Message.new(:subject => "RE: #{@message.subject}") - if @message.board.project.project_type + if @message.board.project.project_type ==1 render :action => "show", :layout => "base_courses"#by young else render :action => "show", :layout => "base_projects"#by young diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index bf02dabce..a434fcc5a 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -66,9 +66,8 @@ class NewsController < ApplicationController def show @comments = @news.comments - @comments.reverse! if User.current.wants_comments_in_reverse_order? - @course_tag = @project.project_type - if @course_tag + @comments.reverse! if User.current.wants_comments_in_reverse_order? + if @project.project_type == 1 render :layout => 'base_courses' end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f7a9442ee..7d9098095 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -122,22 +122,20 @@ class UsersController < ApplicationController # end # added by fq - def user_courses - case params[:type] - when "2" - @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) - + def user_courses + case params[:type] + when "2" + @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) @memberships = [] @membership.each do |membership| if membership.project.project_type == 1 - @membership << membership - end + @membership << membership + end end @state = 2 - + when "1" - @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) - + @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) @memberships = [] @membership.each do |membership| if membership.project.project_type == 1 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index ab163f804..1bddaeb2a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -94,22 +94,33 @@ module UsersHelper def user_course(state) content = ''.html_safe + if @user.user_extensions.identity == 0 + case state + when 0 + s = content_tag('span', '我执教的课程', :class => "current-page") + content << content_tag('li', s) + content << content_tag('li', link_to('我发布的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") + when 1 + s = content_tag('span', '我发布的作业', :class => "current-page") + content << content_tag('li', link_to('我执教的课程', {:controller => 'users', :action => 'user_courses'})) + content << content_tag('li', s, :class => "current-page") + content_tag('div', content, :class => "pagination") + end + else case state when 0 - s = content_tag('span', '我的课程', :class => "current-page") + s = content_tag('span', '我参入的课程', :class => "current-page") content << content_tag('li', s) content << content_tag('li', link_to('我的作业', {:controller => 'users', :action => 'user_courses', :type => 1})) + content_tag('div', content, :class => "pagination") when 1 s = content_tag('span', '我的作业', :class => "current-page") - content << content_tag('li', link_to('我的课程', {:controller => 'users', :action => 'user_courses'})) - content << content_tag('li', s, :class => "current-page") - when 2 - s = content_tag('span', '课程通知', :class => "current-page") - content << content_tag('li', link_to('课程通知', {:controller => 'users', :action => 'user_courses'})) - content << content_tag('li', s, :class => "current-page") - end + content << content_tag('li', link_to('我参入的课程', {:controller => 'users', :action => 'user_courses', :type => 0})) + content << content_tag('li', s, :class => "current-page") content_tag('div', content, :class => "pagination") - +end + end end # added by huang diff --git a/app/views/projects/_course_form.html.erb b/app/views/projects/_course_form.html.erb index e17b1f447..9b794f22a 100644 --- a/app/views/projects/_course_form.html.erb +++ b/app/views/projects/_course_form.html.erb @@ -22,9 +22,10 @@ <%= l(:text_command) %> +

<% unless @course.nil? %> <% if @course.time == 2008 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -38,7 +39,7 @@ ".html_safe %>

<% elsif @course.time == 2009 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -52,7 +53,7 @@ ".html_safe %>

<% elsif @course.time == 2010 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -66,7 +67,7 @@ ".html_safe %>

<% elsif @course.time == 2011 %> -

+

<%= l(:label_time) %> *  
+ -
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -81,7 +82,7 @@ <% elsif @course.time == 2012 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -95,7 +96,7 @@ ".html_safe %>

<% elsif @course.time == 2013 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -109,7 +110,7 @@ ".html_safe %>

<% elsif @course.time == 2014 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -123,7 +124,7 @@ ".html_safe %>

<% elsif @course.time == 2015 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -137,7 +138,7 @@ ".html_safe %>

<% elsif @course.time == 2016 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -151,7 +152,7 @@ ".html_safe %>

<% elsif @course.time == 2017 %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -164,7 +165,7 @@ ".html_safe %>

<% else %> -

+

<%= l(:label_time) %> *  
<%= l(:label_term) %> *   <%= select_tag 'time', " @@ -178,11 +179,11 @@ ".html_safe %>

<% end %> - <% end %> - + <% end %>
<% unless @course.nil? %> <% if @course.term == l(:label_spring) %> -

+

<%= l(:label_term) %> *  
<%= select_tag 'term', " @@ -190,7 +191,7 @@ ".html_safe %>

<% elsif @course.term == l(:label_summer)%> -

+

<%= l(:label_term) %> *  
<%= select_tag 'term', " @@ -198,7 +199,7 @@ ".html_safe %>

<% elsif @course.term == l(:label_autumn)%> -

+

<%= l(:label_term) %> *  
<%= select_tag 'term', " @@ -206,7 +207,7 @@ ".html_safe %>

<% elsif @course.term == l(:label_winter)%> -

+

<%= l(:label_term) %> *  
<%= select_tag 'term', " @@ -214,7 +215,7 @@ ".html_safe %>

<% else %> -

+

<%= l(:label_term) %> *  
<%= select_tag 'term', " @@ -223,7 +224,7 @@ <% end %> - <% end %> + <% end %>

diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index 3b2c6fa7a..47d78c4fb 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -16,9 +16,11 @@ <% if User.current.user_extensions.identity == 0 %> <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> <% end %> -
    +
      <% for membership in @memberships %> +
    • + <% if @user.roles_for_project(membership.project).first.to_s == 'Manager' || @user.roles_for_project(membership.project).first.to_s == 'TA' %> @@ -53,10 +55,11 @@
      <%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %>
- +

<% end %> + <% end %> + <% end %> diff --git a/app/views/users/_my_homework.html.erb b/app/views/users/_my_homework.html.erb index 4c4bd2138..e00e84691 100644 --- a/app/views/users/_my_homework.html.erb +++ b/app/views/users/_my_homework.html.erb @@ -2,10 +2,9 @@ <% if @bid.size > 0%> <% @bid.each do |bids|%> -

<%= link_to(Project.find(bids[0]).name, project_path(bids[0])) %>

- + <% for bid in bids[1]%> - +<% unless @user == bid.author %> @@ -39,7 +38,7 @@
<%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %>
- +<% end %> <% end %> <% end %> diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index 409a38acd..46fa0ae05 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,11 +1,20 @@ + <%= user_course @state%> <% if @state == 0 %> +<% if @user.user_extensions.identity == 0 %> <%= render :partial => 'my_course' %> +<% else %> +<%= render :partial => 'my_joinedcourse' %> +<% end %> <% elsif @state == 1 %> +<% if @user.user_extensions.identity == 0 %> +<%= render :partial => 'my_create_homework' %> +<% else %> <%= render :partial => 'my_homework' %> +<% end %> <% else @state == 2 %> -<%= render :partial => 'my_notice' %> +<%= render :partial => 'my_joinedcourse' %> <% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3a7f9a85b..2b68508b6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -505,6 +505,7 @@ zh: label_requirement: 需求 label_new_course: 课程 label_new_homework: 作业 + label_new_contest: 竞赛 label_requirement_focus: 关注需求 label_developer: 用户 label_enterprise_into: 进入企业 diff --git a/lib/redmine.rb b/lib/redmine.rb index 132d5fd58..156fb5c8e 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -239,6 +239,7 @@ Redmine::MenuManager.map :top_college_menu do |menu| menu.push :home, :home_path menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1 } menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 } + # menu.push :new_contest, {:controller => 'bids', :action => 'index', :project_type => 1 } menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 1 }, :caption => :label_project_plural menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 1 } menu.push :enterprise_into, {:controller=>'projects', :action=>'enterprise_course', :project_type => 0 }