修改了fork里的格式及若干国际化

修改了给项目留言回复的权限
隐藏了作业列表的“发布作业”
This commit is contained in:
baiyu 2013-10-02 21:47:18 +08:00
parent 64f36f2c9d
commit 56e5e55589
17 changed files with 67 additions and 13 deletions

View File

@ -43,7 +43,7 @@ class ProjectsController < ApplicationController
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
:statistics, :feedback, :course, :enterprise_course, :course_enterprise] :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond]
before_filter :authorize_global, :only => [:new, :create] before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
#by young #by young

View File

@ -4,6 +4,12 @@ class TestController < ApplicationController
def index def index
# @users = User.where('status = ?', 1)
# for user in @users
# if user.user_extensions.nil?
# UserExtensions.create(:user_id => user.id)
# end
# end
# @message = Message.all # @message = Message.all
# @message.each do |m| # @message.each do |m|

View File

@ -54,7 +54,8 @@ class UsersController < ApplicationController
helper :words helper :words
#added by young #added by young
def user_projects def user_projects
@memberships = @user.memberships.all(:conditions => Project.visible_condition(User.current)) cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1"
@memberships = @user.memberships.all(:conditions => cond)
events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
@events_by_day = events.group_by(&:event_date) @events_by_day = events.group_by(&:event_date)

View File

@ -17,6 +17,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
include AvatarHelper
module ProjectsHelper module ProjectsHelper
def link_to_version(version, options = {}) def link_to_version(version, options = {})
return '' unless version && version.is_a?(Version) return '' unless version && version.is_a?(Version)

View File

@ -218,7 +218,8 @@
<td class="info" style="width: 10px"> <td class="info" style="width: 10px">
<%= select_tag 'identity', "<option value = '0'>#{l(:label_teacher)}</option> <%= select_tag 'identity', "<option value = '0'>#{l(:label_teacher)}</option>
<option value = '1'>#{l(:label_student)}</option> <option value = '1'>#{l(:label_student)}</option>
<option value = '2'>#{l(:label_other)}</option>".html_safe %></td></tr></table></p> <option value = '2'>#{l(:label_enterprise)}</option>
<option value = '3'>#{l(:label_developer)}</option> ".html_safe %></td></tr></table></p>
<p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_gender) %></strong></td> <p><table><tr><td class="info" align="right" style="width: 90px"><strong><%= l(:label_gender) %></strong></td>

View File

@ -23,6 +23,12 @@
<tr> <tr>
<td><span class="font_lighter"><%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<strong><%= link_to bid.biding_projects.count, project_for_bid_path(bid) %></strong>) </span><span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span><span class="font_lighter"> <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<strong><%= link_to bid.watcher_users.count, respond_path(bid) %></strong>)</span></td> <td><span class="font_lighter"><%= l(:label_x_homework_project, :count => bid.biding_projects.count) %>(<strong><%= link_to bid.biding_projects.count, project_for_bid_path(bid) %></strong>) </span><span class="font_lighter"><%= l(:label_x_responses, :count => bid.commit) %>(<strong><%= link_to bid.commit, respond_path(bid) %></strong>)</span><span class="font_lighter"> <%= l(:label_x_followers, :count => bid.watcher_users.count) %>(<strong><%= link_to bid.watcher_users.count, respond_path(bid) %></strong>)</span></td>
</tr> </tr>
<% unless bid.courses.empty? %>
<% teacher = Course.find_by_extra(bid.courses.first.identifier).teacher %>
<tr>
<td><span class="font_lighter">课程名称:<%= link_to bid.courses.first.name, project_path(bid.courses.first)%>&nbsp;&nbsp;教师:<%= link_to teacher.lastname+teacher.firstname, user_path(teacher) %></span></td>
</tr>
<% end %>
<% end %> <% end %>
</table></td> </table></td>
<td width="200" align="right" class="a"><span class="font_lighter"> <%= format_time bid.created_on %></span></td> <td width="200" align="right" class="a"><span class="font_lighter"> <%= format_time bid.created_on %></span></td>

View File

@ -1,9 +1,12 @@
<!-- fq --> <!-- fq --> <!-- modified by bai -->
<%= error_messages_for 'bid' %> <%= error_messages_for 'bid' %>
<!--[form:project]--> <!--[form:project]-->
<p><%= l(:label_homeworks_form_new_description) %></p> <p><%= l(:label_homeworks_form_new_description) %></p>
<p>选择课程<%= select_tag 'course', course_options_for_select(@courses) %></p>
<!-- modified by bai -->
<p style="margin-left:-68px;padding-right: 20px;"><strong><%= l(:label_choose_course) %><span class="required"> *&nbsp;</span></strong><%= select_tag 'course', course_options_for_select(@courses) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %></p> <p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :value => @bid.name %></p>
<!-- end -->
<p style="margin-left:-10px;padding-right: 20px;"> <p style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p> <%= f.text_area :description, :rows => 8, :value => @bid.description, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT %></p>

View File

@ -1,5 +1,5 @@
<!-- fq --> <!-- fq -->
<h3><%=l(:label_new_call)%></h3> <h3><%=l(:label_course_homework_new)%></h3>
<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_fork', :id => @bid.id} do |f| %> <%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_fork', :id => @bid.id} do |f| %>
<div class="box tabular"> <div class="box tabular">

View File

@ -12,9 +12,9 @@
<td valign="center"><% if User.current.logged? %> <td valign="center"><% if User.current.logged? %>
<!-- <div class='icon icon-add'> --> <!-- <div class='icon icon-add'> -->
<% unless @project_type == '1' %>
<%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %> <%= link_to(l(:label_new_call), {:controller => 'bids', :action => 'new_bid'}, :class => 'icon icon-add') %>
<% end %>
<!-- <%= toggle_link l(:label_new_call), 'put-bid-form', {:focus => 'project_id'} %> --> <!-- <%= toggle_link l(:label_new_call), 'put-bid-form', {:focus => 'project_id'} %> -->
<!-- </div> --> <!-- </div> -->
<% end %></td> <% end %></td>

View File

@ -38,7 +38,18 @@
<% @course = Course.find_by_extra(@project.identifier)%> <% @course = Course.find_by_extra(@project.identifier)%>
<table> <table>
<tr> <tr>
<td><%= link_to image_tag(url_to_avatar(@project), :class => 'avatar2') %></td> <td>
<% if(@project.project_type==1)%>
<% if get_avatar?(@project)%>
<%= link_to image_tag(url_to_avatar(@project), :class => "avatar2"), project_path(@project) %>
<% else %>
<%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(@project)%>
<% end %>
<% else %>
<%= link_to image_tag(url_to_avatar(@project), :class => "avatar2") %>
<% end %>
<!--<%= link_to image_tag(url_to_avatar(@project), :class => 'avatar2') %>--></td>
<td align="center"> <td align="center">
<div class="info_font" style=" word-wrap: break-word; word-break: break-all"> <div class="info_font" style=" word-wrap: break-word; word-break: break-all">
<%= @project.name %> <%= @project.name %>

View File

@ -122,7 +122,7 @@
<td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.occupation %></td> <td style="padding-left: 8px" width="70px"><%= l(:field_occupation) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.occupation %></td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %></td> <td style="padding-left: 8px" width="70px"><%= l(:label_location) %>:</td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"><%= @user.user_extensions.location %><%= @user.user_extensions.location_city %></td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px" width="70px"> <td style="padding-left: 8px" width="70px">

View File

@ -1,7 +1,15 @@
<!--Added by nie--> <!--Added by nie-->
<div class="project-block"> <div class="project-block">
<div class="img-tag"> <div class="img-tag">
<% if(@project.project_type==1)%>
<% if get_avatar?(project)%>
<%= link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %> <%= link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %>
<% else %>
<%= link_to image_tag('../images/avatars/Project/course.jpg', :class => "avatar2"), project_path(project)%>
<% end %>
<% else %>
<%=link_to image_tag(url_to_avatar(project), :class => "avatar2"), project_path(project) %>
<% end %>
</div> </div>
<div class="wiki-description"> <div class="wiki-description">
<p> <p>
@ -39,6 +47,10 @@
<% if @admin.size > 0 %> <% if @admin.size > 0 %>
<%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %> <%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %> <% end %>
<% if(@project.project_type==1)%>
&nbsp;&nbsp;&nbsp;大学:
<%= @admin.first.user.user_extensions.occupation %>
<% end %>
</div> </div>
<div class="licences"> <div class="licences">
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %> <%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %>

View File

@ -8,9 +8,11 @@
<tr> <tr>
<td width="16%"><span style="margin-left:0px"><%= l(:label_new_course)%></span></td> <td width="16%"><span style="margin-left:0px"><%= l(:label_new_course)%></span></td>
<td valign="center"> <td valign="center">
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %> <% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td> <%= link_to(l(:label_course_new), {:controller => 'projects', :action => 'new', :course => 1, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %></td>
<% end %> <% end %>
<% end %>
<td align="right"> <td align="right">
<div class="project-search"> <div class="project-search">
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>

View File

@ -6,11 +6,16 @@
</p> </p>
<% else %> <% else %>
<p class="font_description"> <p class="font_description">
<%= l(:label_project_course_unadd) %><%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> <%= l(:label_project_course_unadd) %>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %>
<% end %>
</p> </p>
<% end %> <% end %>
<% else %> <% else %>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1}, :class => 'icon icon-add' %> <%= 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 %> <% for membership in @memberships %>
<li> <li>

View File

@ -1508,6 +1508,8 @@ zh:
label_teacher_homework: 教师姓名 label_teacher_homework: 教师姓名
label_student: 学生 label_student: 学生
label_other: 其他 label_other: 其他
label_enterprise: 企业
label_developer: 开发者
label_gender: 性别 label_gender: 性别
label_gender_male: label_gender_male:
label_gender_female: label_gender_female:
@ -1519,6 +1521,9 @@ zh:
label_main_term: 课程学期 label_main_term: 课程学期
label_teacher_work_unit: 教师单位 label_teacher_work_unit: 教师单位
label_course_time: 课程年度 label_course_time: 课程年度
label_i_new_activity: 有了新活动在
label_choose_course: 选择课程
#end #end
label_course: 课程 label_course: 课程

View File

@ -466,7 +466,7 @@ RedmineApp::Application.routes.draw do
match 'calls/:id/set_reward',:controller => 'bids',:action => 'set_reward',:as => 'set_reward' match 'calls/:id/set_reward',:controller => 'bids',:action => 'set_reward',:as => 'set_reward'
## 测试用 ## 测试用
# match 'test/index', :controller => 'test', :action => 'index' match 'test/index', :controller => 'test', :action => 'index'
# added by young # added by young
match 'calls', :controller => 'bids', :action => 'index' match 'calls', :controller => 'bids', :action => 'index'

View File

@ -223,8 +223,9 @@ end
Redmine::MenuManager.map :top_enterprise_menu do |menu| Redmine::MenuManager.map :top_enterprise_menu do |menu|
menu.push :home, :home_path menu.push :home, :home_path
menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
menu.push :requirement, {:controller => 'bids', :action => 'index', :project_type => 0 } menu.push :requirement, {:controller => 'bids', :action => 'index', :project_type => 0 }
menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 0 } menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 0 }
menu.push :college_into, {:controller=>'projects', :action=>'course_enterprise', :project_type => 1 } menu.push :college_into, {:controller=>'projects', :action=>'course_enterprise', :project_type => 1 }
# menu.push :investor, :home_path # menu.push :investor, :home_path