Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
a8670ba6fc
|
@ -2,7 +2,7 @@ class HomeworkAttachController < ApplicationController
|
||||||
###############################
|
###############################
|
||||||
#判断当前角色权限时需先找到当前操作的project
|
#判断当前角色权限时需先找到当前操作的project
|
||||||
before_filter :find_project_by_bid_id, :only => [:new]
|
before_filter :find_project_by_bid_id, :only => [:new]
|
||||||
before_filter :find_project_by_hoemwork_id, :only => [:edit,:update,:destroy]
|
before_filter :find_project_by_hoemwork_id, :only => [:edit,:update,:destroy,:show,:add_homework_users,:destory_homework_users]
|
||||||
#判断当前角色是否有操作权限
|
#判断当前角色是否有操作权限
|
||||||
#勿删 before_filter :authorize, :only => [:new,:edit,:update,:destroy]
|
#勿删 before_filter :authorize, :only => [:new,:edit,:update,:destroy]
|
||||||
|
|
||||||
|
@ -26,12 +26,45 @@ class HomeworkAttachController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_users users
|
#作业添加成员(参与人员)
|
||||||
if users != nil && users.count > 0
|
def add_homework_users
|
||||||
users.each do |user|
|
if User.current.admin? || User.current == @homework.user
|
||||||
@homework.homework_users.build(:user_id => user.id)
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
@homework.save
|
if params[:membership]
|
||||||
|
if params[:membership][:user_ids]
|
||||||
|
attrs = params[:membership].dup
|
||||||
|
user_ids = attrs.delete(:user_ids)
|
||||||
|
user_ids.each do |user_id|
|
||||||
|
@homework.homework_users.build(:user_id => user_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@homework.save
|
||||||
|
@hoemwork_users = users_for_homework(@homework)
|
||||||
|
@members = members_for_homework(@homework,@hoemwork_users,params[:q])
|
||||||
|
@members = paginateHelper @members,10
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render_403 :message => :notice_not_authorized
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#作业删除成员(参与人员)
|
||||||
|
def destory_homework_users
|
||||||
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
|
if User.current.admin? || User.current == @homework.user
|
||||||
|
homework_user = @homework.homework_users.where("user_id = #{params[:user_id]}").first
|
||||||
|
homework_user.destroy
|
||||||
|
@hoemwork_users = users_for_homework(@homework)
|
||||||
|
@members = members_for_homework(@homework,@hoemwork_users,params[:q])
|
||||||
|
@members = paginateHelper @members,10
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
else
|
||||||
|
render_403 :message => :notice_not_authorized
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,8 +111,10 @@ class HomeworkAttachController < ApplicationController
|
||||||
def new
|
def new
|
||||||
@bid = Bid.find(params[:id])
|
@bid = Bid.find(params[:id])
|
||||||
if User.current.admin? || User.current.member_of?(@bid.courses.first)
|
if User.current.admin? || User.current.member_of?(@bid.courses.first)
|
||||||
@members = @bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id <> #{User.current.id}", {:role_id => [5, 10]})
|
#该课程的学生的集合(新建不实现功能:添加成员)
|
||||||
|
#@members = @bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id <> #{User.current.id}", {:role_id => [5, 10]})
|
||||||
|
|
||||||
|
#@members = paginateHelper @members,10
|
||||||
#@all_user = []
|
#@all_user = []
|
||||||
#@bid.courses.first.members.each do |member|
|
#@bid.courses.first.members.each do |member|
|
||||||
# @all_user << member.user
|
# @all_user << member.user
|
||||||
|
@ -96,30 +131,52 @@ class HomeworkAttachController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#获取指定作业的所有成员
|
#获取作业成员的集合
|
||||||
def members_for_homework homework
|
def get_homework_member_list
|
||||||
people = []
|
@homework = HomeworkAttach.find(params[:bid_id])
|
||||||
if homework != nil
|
course = @homework.bid.courses.first
|
||||||
people << homework.user
|
if User.current.admin? || User.current.member_of?(course)
|
||||||
homework.homework_users do |homework_user|
|
@hoemwork_users = users_for_homework(@homework)
|
||||||
people << homework_user.user
|
@members = members_for_homework(@homework,@hoemwork_users,params[:q])
|
||||||
end
|
#该课程的学生的集合
|
||||||
|
#@members = course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => [5, 10]})
|
||||||
|
@members = paginateHelper @members,10
|
||||||
else
|
else
|
||||||
|
raise "error"
|
||||||
end
|
end
|
||||||
people
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#获取指定作业的所有成员
|
||||||
|
def users_for_homework homework
|
||||||
|
homework.nil? ? [] : (homework.users + [homework.user])
|
||||||
|
end
|
||||||
|
|
||||||
|
#获取可选成员列表
|
||||||
|
#homework:作业
|
||||||
|
#users:该作业所有成员
|
||||||
|
def members_for_homework homework,users,q
|
||||||
|
homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and user_id not in (:users)", {:role_id => [5, 10],:users => users}).joins(:user).where("users.login like '%#{q}%'")
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@homework = HomeworkAttach.find(params[:id])
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
||||||
|
#@members = @homework.bid.courses.first.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => [5, 10]})
|
||||||
|
@hoemwork_users = users_for_homework(@homework)
|
||||||
|
@members = members_for_homework(@homework,@hoemwork_users,params[:q])
|
||||||
|
@members = paginateHelper @members,10
|
||||||
else
|
else
|
||||||
render_403 :message => :notice_not_authorized
|
render_403 :message => :notice_not_authorized
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@homework = HomeworkAttach.find(params[:id])
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
course = @homework.bid.courses.first
|
||||||
|
if User.current.admin? || User.current.member_of?(course)
|
||||||
name = params[:homework_name]
|
name = params[:homework_name]
|
||||||
description = params[:homework_description]
|
description = params[:homework_description]
|
||||||
@homework.name = name
|
@homework.name = name
|
||||||
|
@ -140,7 +197,7 @@ class HomeworkAttachController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@homework = HomeworkAttach.find(params[:id])
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
||||||
if @homework.destroy
|
if @homework.destroy
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -156,7 +213,7 @@ class HomeworkAttachController < ApplicationController
|
||||||
|
|
||||||
#显示作业信息
|
#显示作业信息
|
||||||
def show
|
def show
|
||||||
@homework = HomeworkAttach.find(params[:id])
|
#@homework = HomeworkAttach.find(params[:id])
|
||||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
||||||
# 打分统计
|
# 打分统计
|
||||||
stars_reates = @homework.
|
stars_reates = @homework.
|
||||||
|
|
|
@ -155,27 +155,6 @@ module BidsHelper
|
||||||
end
|
end
|
||||||
people.include?(User.current)
|
people.include?(User.current)
|
||||||
end
|
end
|
||||||
#当前用户是不是指定课程的学生
|
|
||||||
def is_cur_course_student? course
|
|
||||||
#people = []
|
|
||||||
#course.members.includes(:user, :roles).each do |member|
|
|
||||||
# if [5,10].include? member.roles.first.id
|
|
||||||
# people << member.user
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
#people.include?(User.current)
|
|
||||||
#修改:能新建占位且不能新建任务的角色判定为学生
|
|
||||||
is_student = false
|
|
||||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
|
||||||
@membership.each do |membership|
|
|
||||||
unless(membership.project.project_type==0)
|
|
||||||
if !User.current.allowed_to?({:controller => "projects", :action => "new_homework"}, membership.project, :global => false) && User.current.allowed_to?({:controller => "homework_attach", :action => "new"}, membership.project, :global => false)
|
|
||||||
is_student = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
is_student
|
|
||||||
end
|
|
||||||
|
|
||||||
# def select_option_helper option
|
# def select_option_helper option
|
||||||
# tmp = Hash.new
|
# tmp = Hash.new
|
||||||
|
|
|
@ -9,35 +9,49 @@ module HomeworkAttachHelper
|
||||||
end
|
end
|
||||||
#作业添加、编辑界面的tab页
|
#作业添加、编辑界面的tab页
|
||||||
def homework_settings_tabs f
|
def homework_settings_tabs f
|
||||||
@project = Project.find 76
|
|
||||||
@f = f
|
@f = f
|
||||||
tabs = [{:name => 'info', :action => :edit_homework, :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||||
{:name => 'members', :action => :homework_member, :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||||
]
|
]
|
||||||
#tabs.select {|tab| User.current.allowed_to?(tab[:action], @homework)}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#作业可选成员列表分页
|
#作业可选成员列表分页
|
||||||
def render_new_members_for_homework members
|
def render_new_members_for_homework members
|
||||||
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||||
#scope = project.members
|
#scope = project.members
|
||||||
principal_count = members.count
|
#principals = paginateHelper members,10
|
||||||
limit = 10
|
#principals = members
|
||||||
principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
#principal_count = members.count
|
||||||
offset ||= principal_pages.offset
|
#limit = 10
|
||||||
principals = members[offset, limit]
|
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||||
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
|
#offset ||= principal_pages.offset
|
||||||
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false,:remote => true)
|
#principals = members[offset, limit]
|
||||||
|
users = members.map(&:user)
|
||||||
s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
|
||||||
|
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
|
||||||
|
link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
|
||||||
|
return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||||
end
|
end
|
||||||
|
|
||||||
#扩展的checkbox生成
|
#扩展的checkbox生成
|
||||||
def member_check_box_tags_ex(name, principals)
|
def member_check_box_tags_ex(name, principals)
|
||||||
s = ''
|
s = ''
|
||||||
principals.each do |member|
|
principals.each do |member|
|
||||||
s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.user.name }</label>\n"
|
s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
|
||||||
end
|
end
|
||||||
s.html_safe
|
s.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def paginateHelper obj, pre_size=20
|
||||||
|
@obj_count = obj.count
|
||||||
|
@obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
|
||||||
|
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
|
||||||
|
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
|
||||||
|
elsif obj.kind_of? Array
|
||||||
|
obj[@obj_pages.offset, @obj_pages.per_page]
|
||||||
|
else
|
||||||
|
logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
|
||||||
|
raise RuntimeError, 'unknow type, Please input you type into this helper.'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -7,6 +7,7 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
belongs_to :bid
|
belongs_to :bid
|
||||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||||
has_many :homework_users, :dependent => :destroy
|
has_many :homework_users, :dependent => :destroy
|
||||||
|
has_many :users, :through => :homework_users
|
||||||
seems_rateable :allow_update => true, :dimensions => :quality
|
seems_rateable :allow_update => true, :dimensions => :quality
|
||||||
|
|
||||||
safe_attributes "bid_id",
|
safe_attributes "bid_id",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class HomeworkUser < ActiveRecord::Base
|
class HomeworkUser < ActiveRecord::Base
|
||||||
attr_accessible :homework_attach_id, :user_id
|
attr_accessible :homework_attach_id, :user_id
|
||||||
|
|
||||||
belongs_to :homework_attach
|
belongs_to :homework_attach, :foreign_key => :homework_attach_id
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,7 +73,8 @@ class User < Principal
|
||||||
['none', :label_user_mail_option_none]
|
['none', :label_user_mail_option_none]
|
||||||
]
|
]
|
||||||
|
|
||||||
belongs_to :homework_user
|
has_many :homework_users
|
||||||
|
has_many :homework_attaches, :through => :homework_users
|
||||||
|
|
||||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
<div class="wiki">
|
<div class="wiki">
|
||||||
<%= textilizable @document, :description, :attachments => @document.attachments %>
|
<%= textilizable @document, :description, :attachments => @document.attachments %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div style="border-top:solid 1px #C6E9F1;"></div>
|
||||||
<h3><%= l(:label_attachment_plural) %></h3>
|
<h3><%= l(:label_attachment_plural) %></h3>
|
||||||
<%= link_to_attachments @document %>
|
<%= link_to_attachments @document %>
|
||||||
|
|
||||||
|
|
|
@ -1,131 +1,44 @@
|
||||||
<%= error_messages_for 'member' %>
|
<%= error_messages_for 'member' %>
|
||||||
<%
|
<div style="float:left; width:60%;padding-left: 10px;padding-right: 10px"
|
||||||
roles = Role.givable.all
|
xmlns="http://www.w3.org/1999/html" id = "homework_of_users">
|
||||||
if @project.project_type == Project::ProjectType_course
|
<table class="list members" style="width: 100%">
|
||||||
roles = roles[3..5]
|
<thead>
|
||||||
else
|
<tr>
|
||||||
roles = roles[0..2]
|
<th><%= l(:label_user) %></th>
|
||||||
end
|
<th><%= l(:label_role_plural) %></th>
|
||||||
members = @project.member_principals.includes(:roles, :principal).all.sort
|
<th style="width:10%"></th>
|
||||||
%>
|
</tr>
|
||||||
|
</thead>
|
||||||
<div class="splitcontentleft">
|
<tbody>
|
||||||
<% if members.any? %>
|
<!-- 发布人员不能被删除,将发布人员放在第一位 -->
|
||||||
<table class="list members">
|
<tr id="member-<%= homework.user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
|
||||||
<thead>
|
<td style="width: 40%"><%= link_to_user homework.user %></td>
|
||||||
<tr>
|
<td style="text-align: center;width: 50%"> 发布人员 </td>
|
||||||
<th><%= l(:label_user) %></th>
|
<td></td>
|
||||||
<th><%= l(:label_role_plural) %></th>
|
|
||||||
<th style="width:15%"></th>
|
|
||||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
<% hoemwork_users.each do |user| %>
|
||||||
<tbody>
|
<tr id="member-<%= user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
|
||||||
<% members.each do |member| %>
|
<% if homework.user != user %>
|
||||||
<% next if member.new_record? %>
|
<td style="width: 40%"><%= link_to_user user %></td>
|
||||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
<td style="text-align: center;width: 50%"> 参与人员 </td>
|
||||||
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
|
<td><%= link_to l(:button_delete),destory_homework_users_homework_attach_path(:user_id=>user),:remote => true, :method => :post %></td>
|
||||||
<td class="roles">
|
|
||||||
<span id="member-<%= member.id %>-roles">
|
|
||||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
|
||||||
</span>
|
|
||||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
|
||||||
:method => :put,
|
|
||||||
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
|
||||||
) do |f| %>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<% roles.each do |role| %>
|
|
||||||
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
|
||||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
|
|
||||||
<% end %></p>
|
|
||||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
|
||||||
<p><%= submit_tag l(:button_change), :class => "small" %>
|
|
||||||
<%= link_to_function l(:button_cancel),
|
|
||||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
|
||||||
%></p>
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
|
||||||
<% if @project.project_type == 1 %>
|
|
||||||
<% if member.roles.first.to_s == "Manager" %>
|
|
||||||
<td class="buttons"></td>
|
|
||||||
<% else %>
|
|
||||||
<td class="buttons">
|
|
||||||
<%= link_to_function l(:button_edit),
|
|
||||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
|
||||||
:class => 'icon icon-edit' %>
|
|
||||||
<%= delete_link membership_path(member),
|
|
||||||
:remote => true,
|
|
||||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
|
||||||
</td>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<td class="buttons">
|
|
||||||
<%= link_to_function l(:button_edit),
|
|
||||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
|
||||||
:class => 'icon icon-edit' %>
|
|
||||||
<%= delete_link membership_path(member),
|
|
||||||
:remote => true,
|
|
||||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
|
||||||
</td>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--end-->
|
|
||||||
<%= call_hook(:view_projects_settings_members_table_row, {:project => @project, :member => member}) %>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end; reset_cycle %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% else %>
|
|
||||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright" style="width: 37%">
|
||||||
<% if roles.any? %>
|
<%= form_for(hoemwork_users, {:url => add_homework_users_homework_attach_path(homework), :remote => true, :method => :post}) do |f| %>
|
||||||
<% if @project.applied_projects.any? %>
|
<fieldset>
|
||||||
<div id="applied_project_block">
|
<legend><%= l(:label_member_new) %></legend>
|
||||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
||||||
<fieldset>
|
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript get_homework_member_list_homework_attach_index_path(:q => params[:q], :bid_id => params[:id]||homework, :format => 'js') }')" %>
|
||||||
<legend><%= l(:label_apply_project) %></legend>
|
<div id="principals_for_new_member">
|
||||||
|
<%= render_new_members_for_homework(members) %>
|
||||||
<div id="principals_for_applied_member">
|
</div>
|
||||||
<%= render_principals_for_applied_members(@project) %>
|
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||||
</div>
|
</fieldset>
|
||||||
<!--show the roles which will select-->
|
|
||||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
|
||||||
<% roles.each do |role| %>
|
|
||||||
|
|
||||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
|
||||||
<% end %></p>
|
|
||||||
|
|
||||||
<p><%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
|
|
||||||
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
|
||||||
<fieldset>
|
|
||||||
<legend><%= l(:label_member_new) %></legend>
|
|
||||||
|
|
||||||
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
|
||||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
|
||||||
|
|
||||||
<div id="principals_for_new_member">
|
|
||||||
<%= render_principals_for_new_members(@project) %>
|
|
||||||
</div>
|
|
||||||
<!--show the roles which will select-->
|
|
||||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
|
||||||
<% roles.each do |role| %>
|
|
||||||
|
|
||||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
|
||||||
<% end %></p>
|
|
||||||
|
|
||||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
|
||||||
</fieldset>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div id="principals_for_new_member">
|
||||||
|
<%= render_new_members_for_homework(members) %>
|
||||||
|
</div>
|
|
@ -1,13 +1,12 @@
|
||||||
<div class="box">
|
<div class="box">
|
||||||
|
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong>标 题:</strong>
|
<strong>标 题:</strong>
|
||||||
<%= @f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
|
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
|
||||||
</p>
|
</p>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong style="vertical-align: top">描 述:</strong>
|
<strong style="vertical-align: top">描 述:</strong>
|
||||||
<span style="margin-left:-10px;padding-right: 20px;">
|
<span style="margin-left:-10px;padding-right: 20px;">
|
||||||
<%= @f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
<%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p style="padding-left: 60px">
|
<p style="padding-left: 60px">
|
|
@ -0,0 +1 @@
|
||||||
|
$('#content2').html('<%= escape_javascript(render(:partial => 'homework_member', :locals => {:members => @members,:hoemwork_users =>@hoemwork_users,:homework => @homework} )) %>');
|
|
@ -0,0 +1 @@
|
||||||
|
$('#content2').html('<%= escape_javascript(render(:partial => 'homework_member', :locals => {:members => @members,:hoemwork_users =>@hoemwork_users,:homework => @homework} )) %>');
|
|
@ -1,35 +1,63 @@
|
||||||
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=raw l(:label_new_homework)%> </p>
|
<script type="text/javascript">
|
||||||
<div class="box">
|
function switchTab(ProTag) {
|
||||||
|
var display_index = 3 - ProTag;
|
||||||
|
document.getElementById("tab" + ProTag).className = "selected";
|
||||||
|
document.getElementById("tab" + display_index).className = "";
|
||||||
|
document.getElementById("content" + ProTag).style.display = "";
|
||||||
|
document.getElementById("content" + display_index).style.display = "none";
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=raw l(:label_edit_homework)%> </p>
|
||||||
|
<div class="tabs">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a id = "tab1" href="#" class = "selected" onclick="switchTab(1);this.blur();return false;">
|
||||||
|
<%= l(:label_information_plural) %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a id="tab2" href="#" onclick="switchTab(2); this.blur(); return false;">
|
||||||
|
<%= l(:label_member_plural) %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="box" id="content1">
|
||||||
<%= form_for(@homework) do |f|%>
|
<%= form_for(@homework) do |f|%>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong>标 题:</strong>
|
<strong>标 题:</strong>
|
||||||
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
||||||
</p>
|
</p>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<strong style="vertical-align: top">描 述:</strong>
|
<strong style="vertical-align: top">描 述:</strong>
|
||||||
<span style="margin-left:-10px;padding-right: 20px;">
|
<span style="margin-left:-10px;padding-right: 20px;">
|
||||||
<%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
<%= f.text_area :description, :rows => 8, :name => "homework_description", :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p style="padding-left: 60px">
|
<p style="padding-left: 60px">
|
||||||
<fieldset style="text-align: left;">
|
<fieldset style="text-align: left;">
|
||||||
<p style="padding-left: 60px">
|
<p style="padding-left: 60px">
|
||||||
<% options = {:author => true, :deletable => attach_delete(@homework)} %>
|
<% options = {:author => true, :deletable => attach_delete(@homework)} %>
|
||||||
<%= render :partial => 'attachments/links',
|
<%= render :partial => 'attachments/links',
|
||||||
:locals => {:attachments => @homework.attachments, :options => options} %>
|
:locals => {:attachments => @homework.attachments, :options => options} %>
|
||||||
</p>
|
</p>
|
||||||
<legend>
|
<legend>
|
||||||
<%= l(:label_attachment_plural) %>
|
<%= l(:label_attachment_plural) %>
|
||||||
</legend>
|
</legend>
|
||||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||||
<%= render :partial => 'attachments/form' %>
|
<%= render :partial => 'attachments/form' %>
|
||||||
</p>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</p>
|
</p>
|
||||||
<p style="padding-left: 60px;padding-top: 10px;">
|
<p style="padding-left: 60px;padding-top: 10px;">
|
||||||
<span >
|
<span >
|
||||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="content2" style="display: none" >
|
||||||
|
<%= render :partial => "homework_member",:locals => {:members => @members,:hoemwork_users =>@hoemwork_users,:homework => @homework} %>
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
$('#principals_for_new_member').replaceWith('<%= j(render :partial => "member_list_partial", locals:{members: @members})%>');
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
</p>
|
</p>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</p>
|
</p>
|
||||||
<p style="padding-left: 60px;padding-top: 10px;">
|
|
||||||
|
<p style="padding-left: 60px;padding-top: 5px;">
|
||||||
<span >
|
<span >
|
||||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %>
|
||||||
<style>
|
<style>
|
||||||
.softapplication-img .soft-application {
|
.softapplication-img .soft-application {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -6,7 +6,7 @@
|
||||||
height: 200px;
|
height: 200px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% is_student = is_cur_course_student? @homework.bid.courses.first %>
|
<% is_student = is_cur_course_student @homework.bid.courses.first %>
|
||||||
<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
|
<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
|
||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
|
<!-- <%= image_tag(url_to_avatar(@user), :class => "avatar2") %> -->
|
||||||
|
@ -23,7 +23,16 @@
|
||||||
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
|
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
|
||||||
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
|
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
|
||||||
</td>
|
</td>
|
||||||
<td>发布时间:<%=format_time @homework.created_at %></td>
|
<td>
|
||||||
|
参与人员:
|
||||||
|
<% @homework.users.each do |homework_user| %>
|
||||||
|
<%= link_to homework_user, user_path(homework_user)%>
|
||||||
|
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
|
||||||
|
<br/>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 40px">
|
<td style="padding-left: 40px">
|
||||||
|
@ -38,12 +47,12 @@
|
||||||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
|
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
|
||||||
所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
|
所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 40px" colspan="2">平均评分:
|
<td style="padding-left: 40px">平均评分:
|
||||||
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
<%= rating_for @homework, :static => true, dimension: :quality, class: 'rateable div_inline' %>
|
||||||
</td>
|
</td>
|
||||||
|
<td>发布时间:<%=format_time @homework.created_at %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<div class="top-content">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="info_font" style="width: 240px; color: #15bccf">高校课程实践社区</td>
|
||||||
|
<td style="width: auto; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'projects', :action => 'course'%></a></td>
|
||||||
|
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> >
|
||||||
|
<span><%= link_to(homework_attach.bid.courses.first.name.to_s, homework_project_path(homework_attach.bid.courses.first)) if homework_attach.bid.courses.first%></span> >
|
||||||
|
<%=link_to(homework_attach.bid.name, respond_path(homework_attach.bid)) %> > <span><%= link_to homework_attach.name.nil? ? homework_attach.attachments.first.filename : homework_attach.name,homework_attach_path(homework_attach)%></span></p></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
|
@ -26,11 +26,18 @@ RedmineApp::Application.routes.draw do
|
||||||
|
|
||||||
resources :homework_attach do
|
resources :homework_attach do
|
||||||
collection do
|
collection do
|
||||||
|
get 'get_homework_member_list'
|
||||||
match 'addjours', via: [:get, :post]
|
match 'addjours', via: [:get, :post]
|
||||||
match 'add_jour_reply', via: [:get,:post]
|
match 'add_jour_reply', via: [:get,:post]
|
||||||
match 'destroy_jour', via: [:get,:post]
|
match 'destroy_jour', via: [:get,:post]
|
||||||
|
|
||||||
|
end
|
||||||
|
member do
|
||||||
|
match 'add_homework_users', via:[:get,:post]
|
||||||
|
match 'destory_homework_users',via:[:get,:post]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :open_source_projects do
|
resources :open_source_projects do
|
||||||
collection do
|
collection do
|
||||||
match 'search', via: [:get, :post]
|
match 'search', via: [:get, :post]
|
||||||
|
|
Loading…
Reference in New Issue