This commit is contained in:
huangjingquan 2013-10-07 22:23:42 +08:00
parent 606c998247
commit cab5fb8b52
13 changed files with 81 additions and 58 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,9 +22,10 @@
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
<!-- added by bai 增加了“年度”和“学期” -->
<p><table><tr><td>
<% unless @course.nil? %>
<% if @course.time == 2008 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008' selected='selected'>2008</option>
<option value = '2009'>2009</option>
@ -38,7 +39,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2009 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009' selected='selected'>2009</option>
@ -52,7 +53,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2010 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -66,7 +67,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2011 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -81,7 +82,7 @@
<% elsif @course.time == 2012 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -95,7 +96,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2013 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -109,7 +110,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2014 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -123,7 +124,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2015 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -137,7 +138,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2016 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -151,7 +152,7 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% elsif @course.time == 2017 %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -164,7 +165,7 @@
<option value = '2016'>2016</option>
<option value = '2017' selected='selected'>2017</option>".html_safe %></td></tr></table></p>
<% else %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_time) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<td class="info" style="width: 10px">
<%= select_tag 'time', "<option value = '2008'>2008</option>
<option value = '2009'>2009</option>
@ -178,11 +179,11 @@
<option value = '2017'>2017</option>".html_safe %></td></tr></table></p>
<% end %>
<% end %>
<% end %></td>
<td>
<% unless @course.nil? %>
<% if @course.term == l(:label_spring) %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}' selected='selected'>#{l(:label_spring)}</option>
<option value = '#{l(:label_summer)}'>#{l(:label_summer)}</option>
@ -190,7 +191,7 @@
<option value = '#{l(:label_winter)}'>#{l(:label_winter)}</option>".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_summer)%>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_summer)}' selected='selected'>#{l(:label_summer)}</option>
@ -198,7 +199,7 @@
<option value = '#{l(:label_winter)}'>#{l(:label_winter)}</option>".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_autumn)%>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_summer)}'>#{l(:label_summer)}</option>
@ -206,7 +207,7 @@
<option value = '#{l(:label_winter)}'>#{l(:label_winter)}</option>".html_safe %></td></tr></table></p>
<% elsif @course.term == l(:label_winter)%>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_summer)}'>#{l(:label_summer)}</option>
@ -214,7 +215,7 @@
<option value = '#{l(:label_winter)}' selected='selected'>#{l(:label_winter)}</option>".html_safe %></td></tr></table></p>
<% else %>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_term) %><span class="required"> *&nbsp;&nbsp;</span></strong></td>
<p><table><tr>
<td class="info" style="width: 10px">
<%= select_tag 'term', "<option value = '#{l(:label_spring)}'>#{l(:label_spring)}</option>
<option value = '#{l(:label_summer)}'>#{l(:label_summer)}</option>
@ -223,7 +224,7 @@
<% end %>
<% end %>
<% end %></td></tr></table></p>
<!-- end -->

View File

@ -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 %>
<ul class="user_project_sort">
<ul class="user_project_sort">
<% for membership in @memberships %>
<li>
<% if @user.roles_for_project(membership.project).first.to_s == 'Manager' || @user.roles_for_project(membership.project).first.to_s == 'TA' %>
<table width="660" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(membership.project), :class => 'avatar'), project_path(membership.project) %></td>
@ -53,10 +55,11 @@
</table></td>
</tr>
</table>
</table><% end %>
</li>
<% end %>
</ul>
<% end %>

View File

@ -2,10 +2,9 @@
<% if @bid.size > 0%>
<% @bid.each do |bids|%>
<h2><%= link_to(Project.find(bids[0]).name, project_path(bids[0])) %></h2>
<!-- <h2><%= link_to(Project.find(bids[0]).name, project_path(bids[0])) %></h2> -->
<% for bid in bids[1]%>
<% unless @user == bid.author %>
<table width="95%" border="0" style="padding-left: 10px; padding-top: 10px;">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to(image_tag(url_to_avatar(bid.author), :class => 'avatar'), user_path(bid.author), :class => "avatar") %></td>
@ -39,7 +38,7 @@
</table></td>
</tr>
</table>
<% end %>
<% end %>
<% end %>

View File

@ -1,11 +1,20 @@
<!-- added by fq -->
<%= 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 %>

View File

@ -505,6 +505,7 @@ zh:
label_requirement: 需求
label_new_course: 课程
label_new_homework: 作业
label_new_contest: 竞赛
label_requirement_focus: 关注需求
label_developer: 用户
label_enterprise_into: 进入企业

View File

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