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
|
||||
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]
|
||||
|
||||
|
@ -26,12 +26,45 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_users users
|
||||
if users != nil && users.count > 0
|
||||
users.each do |user|
|
||||
@homework.homework_users.build(:user_id => user.id)
|
||||
@homework.save
|
||||
#作业添加成员(参与人员)
|
||||
def add_homework_users
|
||||
if User.current.admin? || User.current == @homework.user
|
||||
#@homework = HomeworkAttach.find(params[:id])
|
||||
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
|
||||
@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
|
||||
|
||||
|
@ -78,8 +111,10 @@ class HomeworkAttachController < ApplicationController
|
|||
def new
|
||||
@bid = Bid.find(params[:id])
|
||||
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 = []
|
||||
#@bid.courses.first.members.each do |member|
|
||||
# @all_user << member.user
|
||||
|
@ -96,30 +131,52 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#获取指定作业的所有成员
|
||||
def members_for_homework homework
|
||||
people = []
|
||||
if homework != nil
|
||||
people << homework.user
|
||||
homework.homework_users do |homework_user|
|
||||
people << homework_user.user
|
||||
end
|
||||
#获取作业成员的集合
|
||||
def get_homework_member_list
|
||||
@homework = HomeworkAttach.find(params[:bid_id])
|
||||
course = @homework.bid.courses.first
|
||||
if User.current.admin? || User.current.member_of?(course)
|
||||
@hoemwork_users = users_for_homework(@homework)
|
||||
@members = members_for_homework(@homework,@hoemwork_users,params[:q])
|
||||
#该课程的学生的集合
|
||||
#@members = course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id)", {:role_id => [5, 10]})
|
||||
@members = paginateHelper @members,10
|
||||
else
|
||||
raise "error"
|
||||
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
|
||||
|
||||
def edit
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
#@homework = HomeworkAttach.find(params[:id])
|
||||
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
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
||||
#@homework = HomeworkAttach.find(params[:id])
|
||||
course = @homework.bid.courses.first
|
||||
if User.current.admin? || User.current.member_of?(course)
|
||||
name = params[:homework_name]
|
||||
description = params[:homework_description]
|
||||
@homework.name = name
|
||||
|
@ -140,7 +197,7 @@ class HomeworkAttachController < ApplicationController
|
|||
end
|
||||
|
||||
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 @homework.destroy
|
||||
respond_to do |format|
|
||||
|
@ -156,7 +213,7 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
#显示作业信息
|
||||
def show
|
||||
@homework = HomeworkAttach.find(params[:id])
|
||||
#@homework = HomeworkAttach.find(params[:id])
|
||||
if User.current.admin? || User.current.member_of?(@homework.bid.courses.first)
|
||||
# 打分统计
|
||||
stars_reates = @homework.
|
||||
|
|
|
@ -155,27 +155,6 @@ module BidsHelper
|
|||
end
|
||||
people.include?(User.current)
|
||||
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
|
||||
# tmp = Hash.new
|
||||
|
|
|
@ -9,35 +9,49 @@ module HomeworkAttachHelper
|
|||
end
|
||||
#作业添加、编辑界面的tab页
|
||||
def homework_settings_tabs f
|
||||
@project = Project.find 76
|
||||
@f = f
|
||||
tabs = [{:name => 'info', :action => :edit_homework, :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
{:name => 'members', :action => :homework_member, :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
|
||||
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
|
||||
]
|
||||
#tabs.select {|tab| User.current.allowed_to?(tab[:action], @homework)}
|
||||
end
|
||||
|
||||
#作业可选成员列表分页
|
||||
def render_new_members_for_homework members
|
||||
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
|
||||
#scope = project.members
|
||||
principal_count = members.count
|
||||
limit = 10
|
||||
principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
offset ||= principal_pages.offset
|
||||
principals = members[offset, limit]
|
||||
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
|
||||
links = pagination_links_full(principal_pages, principal_count, :per_page_links => false,:remote => true)
|
||||
|
||||
s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
|
||||
#principals = paginateHelper members,10
|
||||
#principals = members
|
||||
#principal_count = members.count
|
||||
#limit = 10
|
||||
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
|
||||
#offset ||= principal_pages.offset
|
||||
#principals = members[offset, limit]
|
||||
users = members.map(&:user)
|
||||
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
|
||||
|
||||
#扩展的checkbox生成
|
||||
def member_check_box_tags_ex(name, principals)
|
||||
s = ''
|
||||
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
|
||||
s.html_safe
|
||||
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
|
|
@ -7,6 +7,7 @@ class HomeworkAttach < ActiveRecord::Base
|
|||
belongs_to :bid
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :homework_users, :dependent => :destroy
|
||||
has_many :users, :through => :homework_users
|
||||
seems_rateable :allow_update => true, :dimensions => :quality
|
||||
|
||||
safe_attributes "bid_id",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class HomeworkUser < ActiveRecord::Base
|
||||
attr_accessible :homework_attach_id, :user_id
|
||||
|
||||
belongs_to :homework_attach
|
||||
belongs_to :homework_attach, :foreign_key => :homework_attach_id
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
@ -73,7 +73,8 @@ class User < Principal
|
|||
['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)},
|
||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<%= textilizable @document, :description, :attachments => @document.attachments %>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="border-top:solid 1px #C6E9F1;"></div>
|
||||
<h3><%= l(:label_attachment_plural) %></h3>
|
||||
<%= link_to_attachments @document %>
|
||||
|
||||
|
|
|
@ -1,131 +1,44 @@
|
|||
<%= error_messages_for 'member' %>
|
||||
<%
|
||||
roles = Role.givable.all
|
||||
if @project.project_type == Project::ProjectType_course
|
||||
roles = roles[3..5]
|
||||
else
|
||||
roles = roles[0..2]
|
||||
end
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort
|
||||
%>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% if members.any? %>
|
||||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
||||
<div style="float:left; width:60%;padding-left: 10px;padding-right: 10px"
|
||||
xmlns="http://www.w3.org/1999/html" id = "homework_of_users">
|
||||
<table class="list members" style="width: 100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:10%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 发布人员不能被删除,将发布人员放在第一位 -->
|
||||
<tr id="member-<%= homework.user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
|
||||
<td style="width: 40%"><%= link_to_user homework.user %></td>
|
||||
<td style="text-align: center;width: 50%"> 发布人员 </td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></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>
|
||||
<% hoemwork_users.each do |user| %>
|
||||
<tr id="member-<%= user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
|
||||
<% if homework.user != user %>
|
||||
<td style="width: 40%"><%= link_to_user user %></td>
|
||||
<td style="text-align: center;width: 50%"> 参与人员 </td>
|
||||
<td><%= link_to l(:button_delete),destory_homework_users_homework_attach_path(:user_id=>user),:remote => true, :method => :post %></td>
|
||||
<% end %>
|
||||
<!--end-->
|
||||
<%= call_hook(:view_projects_settings_members_table_row, {:project => @project, :member => member}) %>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? %>
|
||||
<% if @project.applied_projects.any? %>
|
||||
<div id="applied_project_block">
|
||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_apply_project) %></legend>
|
||||
|
||||
<div id="principals_for_applied_member">
|
||||
<%= render_principals_for_applied_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(: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 %>
|
||||
<div class="splitcontentright" style="width: 37%">
|
||||
<%= form_for(hoemwork_users, {:url => add_homework_users_homework_attach_path(homework), :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 get_homework_member_list_homework_attach_index_path(:q => params[:q], :bid_id => params[:id]||homework, :format => 'js') }')" %>
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_new_members_for_homework(members) %>
|
||||
</div>
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</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">
|
||||
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<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 style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong style="vertical-align: top">描 述:</strong>
|
||||
<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>
|
||||
</p>
|
||||
<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>
|
||||
<div class="box">
|
||||
<script type="text/javascript">
|
||||
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|%>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong>标 题:</strong>
|
||||
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
||||
</p>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong style="vertical-align: top">描 述:</strong>
|
||||
<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;" %>
|
||||
</span>
|
||||
</p>
|
||||
<p style="padding-left: 60px">
|
||||
<fieldset style="text-align: left;">
|
||||
<p style="padding-left: 60px">
|
||||
<% options = {:author => true, :deletable => attach_delete(@homework)} %>
|
||||
<%= render :partial => 'attachments/links',
|
||||
:locals => {:attachments => @homework.attachments, :options => options} %>
|
||||
</p>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
</p>
|
||||
<p style="padding-left: 60px;padding-top: 10px;">
|
||||
<span >
|
||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||
</span>
|
||||
</p>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong>标 题:</strong>
|
||||
<%= f.text_field :name, :required => true, :name => "homework_name", :size => 60, :style => "width:490px;"%>
|
||||
</p>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong style="vertical-align: top">描 述:</strong>
|
||||
<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;" %>
|
||||
</span>
|
||||
</p>
|
||||
<p style="padding-left: 60px">
|
||||
<fieldset style="text-align: left;">
|
||||
<p style="padding-left: 60px">
|
||||
<% options = {:author => true, :deletable => attach_delete(@homework)} %>
|
||||
<%= render :partial => 'attachments/links',
|
||||
:locals => {:attachments => @homework.attachments, :options => options} %>
|
||||
</p>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
</p>
|
||||
<p style="padding-left: 60px;padding-top: 10px;">
|
||||
<span >
|
||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||
</span>
|
||||
</p>
|
||||
<% end %>
|
||||
</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,7 +26,8 @@
|
|||
</p>
|
||||
</fieldset>
|
||||
</p>
|
||||
<p style="padding-left: 60px;padding-top: 10px;">
|
||||
|
||||
<p style="padding-left: 60px;padding-top: 5px;">
|
||||
<span >
|
||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||
</span>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %>
|
||||
<style>
|
||||
.softapplication-img .soft-application {
|
||||
float: left;
|
||||
|
@ -6,7 +6,7 @@
|
|||
height: 200px;
|
||||
}
|
||||
</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 %>
|
||||
<p id="notice"><%= notice %></p>
|
||||
<!-- <%= 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">
|
||||
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
|
||||
</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>
|
||||
<td style="padding-left: 40px">
|
||||
|
@ -38,12 +47,12 @@
|
|||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
|
||||
所属任务:<%= link_to(@homework.bid.name, project_for_bid_path(@homework.bid))%>
|
||||
</td>
|
||||
|
||||
</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' %>
|
||||
</td>
|
||||
<td>发布时间:<%=format_time @homework.created_at %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</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
|
||||
collection do
|
||||
get 'get_homework_member_list'
|
||||
match 'addjours', via: [:get, :post]
|
||||
match 'add_jour_reply', 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
|
||||
|
||||
resources :open_source_projects do
|
||||
collection do
|
||||
match 'search', via: [:get, :post]
|
||||
|
|
Loading…
Reference in New Issue