Merge branch 'szzh' into develop
This commit is contained in:
commit
10997bf331
|
@ -170,10 +170,26 @@ module Mobile
|
|||
|
||||
desc "设置教辅"
|
||||
params do
|
||||
|
||||
requires :token,type:String
|
||||
requires :user_id,type:Integer,desc: '用户id'
|
||||
requires :course_id,type:Integer,desc:'课程id'
|
||||
end
|
||||
get 'set_user_as_assitant' do
|
||||
cs = CoursesService.new
|
||||
cs.set_as_assitant_teacher params
|
||||
present :status, 0
|
||||
end
|
||||
post 'set_user_as_assitant' do
|
||||
|
||||
desc "删除教辅"
|
||||
params do
|
||||
requires :token,type:String
|
||||
requires :user_id,type:Integer,desc: '用户id'
|
||||
requires :course_id,type:Integer,desc:'课程id'
|
||||
end
|
||||
get 'del_user_as_assitant' do
|
||||
cs = CoursesService.new
|
||||
cs.del_assitant_teacher params
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc "返回单个课程"
|
||||
|
@ -187,7 +203,7 @@ module Mobile
|
|||
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
||||
#course = Course.find(params[:id])
|
||||
present :data, course, with: Mobile::Entities::Course
|
||||
present :status, 0
|
||||
{ status: 0}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -258,6 +274,13 @@ module Mobile
|
|||
get ":course_id/members" do
|
||||
cs = CoursesService.new
|
||||
count = cs.course_members params
|
||||
# 我如果在学生当中,那么我将放在第一位
|
||||
count.each do |m|
|
||||
if m.user.id == current_user.id
|
||||
count.delete m
|
||||
count.unshift m
|
||||
end
|
||||
end
|
||||
present :data, count, with: Mobile::Entities::Member
|
||||
present :status, 0
|
||||
end
|
||||
|
@ -274,6 +297,20 @@ module Mobile
|
|||
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
||||
present :status,0
|
||||
end
|
||||
|
||||
desc '发布课程通知'
|
||||
params do
|
||||
requires :token,type:String
|
||||
requires :course_id,type:Integer,desc:'课程id'
|
||||
requires :title,type:String,desc:'通知标题'
|
||||
requires :desc,type:String,desc:'通知描述'
|
||||
end
|
||||
post ':course_id/create_course_notice' do
|
||||
cs = CoursesService.new
|
||||
news = cs.create_course_notice params,current_user
|
||||
present :data,news,with:Mobile::Entities::News
|
||||
present :status,0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,6 +96,21 @@ module Mobile
|
|||
present :status, 0
|
||||
end
|
||||
|
||||
desc '创建作业'
|
||||
params do
|
||||
requires :token,type:String
|
||||
requires :work_name,type:String,desc:'作业名称'
|
||||
requires :work_desc,type:String,desc:'作业描述'
|
||||
requires :work_deadline,type:String,desc:'截止日期'
|
||||
requires :is_blind_appr,type:Integer,desc:'是否匿评'
|
||||
requires :blind_appr_num,type:Integer,desc:'匿评分配数'
|
||||
requires :course_id,type:Integer,desc: '课程id'
|
||||
end
|
||||
post 'create_home_work' do
|
||||
Homeworks.get_service.create_home_work params,current_user
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -84,6 +84,8 @@ module Mobile
|
|||
requires :name, type: String, desc: '用户名关键字'
|
||||
requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名'
|
||||
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
|
||||
optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户'
|
||||
optional :user_id,type:Integer,desc:'用户id'
|
||||
end
|
||||
get 'search/search_user' do
|
||||
us = UsersService.new
|
||||
|
|
|
@ -9,7 +9,7 @@ module Mobile
|
|||
u[f]
|
||||
elsif u.is_a?(::User)
|
||||
if u.respond_to?(f)
|
||||
u.send(f)
|
||||
u.send(f) unless u.user_extensions.nil?
|
||||
else
|
||||
case f
|
||||
when :img_url
|
||||
|
@ -17,9 +17,9 @@ module Mobile
|
|||
when :gender
|
||||
u.nil? || u.user_extensions.nil? || u.user_extensions.gender.nil? ? 0 : u.user_extensions.gender
|
||||
when :work_unit
|
||||
get_user_work_unit u
|
||||
get_user_work_unit u unless u.user_extensions.nil?
|
||||
when :location
|
||||
get_user_location u
|
||||
get_user_location u unless u.user_extensions.nil?
|
||||
when :brief_introduction
|
||||
u.nil? || u.user_extensions.nil? ? "" : u.user_extensions.brief_introduction
|
||||
end
|
||||
|
|
|
@ -315,7 +315,7 @@ class AccountController < ApplicationController
|
|||
#根据home_url生产正则表达式
|
||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
|
||||
redirect_to user_activities_path(user,host: Setting.user_domain)
|
||||
redirect_to user_activities_path(user,host: Setting.host_user)
|
||||
else
|
||||
if last_login_on == ''
|
||||
redirect_to my_account_url
|
||||
|
@ -333,7 +333,7 @@ class AccountController < ApplicationController
|
|||
token = Token.get_or_create_permanent_login_token(user)
|
||||
cookie_options = {
|
||||
:value => token.value,
|
||||
:expires => 7.days.from_now,
|
||||
:expires => 1.month.from_now,
|
||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||
:httponly => true
|
||||
|
|
|
@ -852,7 +852,7 @@ class CoursesController < ApplicationController
|
|||
#验证是否显示课程
|
||||
def can_show_course
|
||||
@first_page = FirstPage.find_by_page_type('project')
|
||||
if @first_page.show_course == 2
|
||||
if @first_page.try(:show_course) == 2
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,11 +118,11 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
#if user.active? || (User.current.admin? && user.logged?)
|
||||
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
|
||||
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
|
||||
#else
|
||||
# name
|
||||
#end
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
|
||||
else
|
||||
h(user.to_s)
|
||||
end
|
||||
|
@ -131,7 +131,7 @@ module ApplicationHelper
|
|||
def link_to_isuue_user(user, options={})
|
||||
if user.is_a?(User)
|
||||
name = h(user.name(options[:format]))
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "pro_info_p"
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
|
||||
else
|
||||
h(user.to_s)
|
||||
end
|
||||
|
@ -140,7 +140,7 @@ module ApplicationHelper
|
|||
def link_to_settings_user(user, options={})
|
||||
if user.is_a?(User)
|
||||
name = h(user.name(options[:format]))
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl"
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "w90 c_orange fl"
|
||||
else
|
||||
h(user.to_s)
|
||||
end
|
||||
|
@ -155,7 +155,7 @@ module ApplicationHelper
|
|||
else
|
||||
name = user.login
|
||||
end
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class]
|
||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => options[:class]
|
||||
else
|
||||
h(user.to_s)
|
||||
end
|
||||
|
@ -2076,21 +2076,21 @@ module ApplicationHelper
|
|||
hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||
visiable = !(hidden_non_project && hidden_non_project.value == "0")
|
||||
|
||||
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
||||
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
||||
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
|
||||
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.host_course}
|
||||
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.host_name}
|
||||
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.host_contest}
|
||||
|
||||
# course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
|
||||
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
||||
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.host_course}
|
||||
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
|
||||
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
|
||||
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.host_user}
|
||||
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
||||
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
||||
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
|
||||
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
||||
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
|
||||
project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.project_domain}
|
||||
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.host_name}
|
||||
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
|
||||
|
||||
#@nav_dispaly_project_label
|
||||
nav_list = Array.new
|
||||
|
|
|
@ -11,7 +11,7 @@ module GitlabHelper
|
|||
PROJECT_PATH_CUT = 40
|
||||
# gitlab版本库所在服务器
|
||||
# 注意REPO_IP_ADDRESS必须以http://开头,暂时只支持HTTP协议,未支持SSH
|
||||
#REPO_IP_ADDRESS = "http://" + Setting.repository_domain
|
||||
#REPO_IP_ADDRESS = "http://" + Setting.host_repository
|
||||
REPO_IP_ADDRESS = "http://192.168.137.100"
|
||||
GITLAB_API = "/api/v3"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module RepositoriesHelper
|
|||
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||
end
|
||||
PROJECT_PATH_CUT = 40
|
||||
REPO_IP_ADDRESS = Setting.repository_domain
|
||||
REPO_IP_ADDRESS = Setting.host_repository
|
||||
|
||||
def format_revision(revision)
|
||||
if revision.respond_to? :format_identifier
|
||||
|
|
|
@ -473,6 +473,47 @@ class CoursesService
|
|||
result
|
||||
end
|
||||
|
||||
# 设置人员为课程教辅
|
||||
def set_as_assitant_teacher params
|
||||
members = []
|
||||
#找到课程
|
||||
course = Course.find(params[:course_id])
|
||||
#新建课程人员
|
||||
|
||||
member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id])
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
member.course_group_id = 0
|
||||
members << member
|
||||
course.members << members
|
||||
#将课程人员设置为教辅
|
||||
end
|
||||
|
||||
def del_assitant_teacher params
|
||||
member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id])
|
||||
member.each do |m|
|
||||
m.destroy
|
||||
end
|
||||
user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id])
|
||||
if user_admin.size > 0
|
||||
user_admin.each do |user|
|
||||
user.destroy
|
||||
end
|
||||
end
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id])
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
end
|
||||
end
|
||||
|
||||
def create_course_notice params ,current_user
|
||||
n = News.new(:course_id =>params[:course_id], :author_id => current_user.id,:title =>params[:title],:description=> params[:desc])
|
||||
n.save
|
||||
{:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
end
|
||||
|
||||
private
|
||||
def searchmember_by_name members, name
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
|
@ -576,4 +617,6 @@ class CoursesService
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
end
|
|
@ -231,6 +231,29 @@ class HomeworkService
|
|||
anonymous_repy(jour)
|
||||
end
|
||||
end
|
||||
|
||||
# 发布作业
|
||||
def create_home_work params,current_user
|
||||
@bid = Bid.new
|
||||
@bid.name = params[:work_name]
|
||||
@bid.description = params[:work_desc]
|
||||
# @bid.is_evaluation = params[:is_blind_appr]
|
||||
@bid.evaluation_num = params[:blind_appr_num]
|
||||
@bid.open_anonymous_evaluation = params[:is_blind_appr]
|
||||
@bid.reward_type = 3
|
||||
@bid.deadline = params[:work_deadline]
|
||||
@bid.budget = 0
|
||||
@bid.author_id = current_user.id
|
||||
@bid.commit = 0
|
||||
@bid.homework_type = 1
|
||||
# @bid.
|
||||
if @bid.save
|
||||
HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id)
|
||||
unless @bid.watched_by?(current_user)
|
||||
@bid.add_watcher(current_user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 学生匿评列表
|
||||
def student_jour_list params
|
||||
|
|
|
@ -211,7 +211,8 @@ class UsersService
|
|||
search_by = params[:search_by] ? params[:search_by] : "0"
|
||||
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
|
||||
else
|
||||
scope = scope.like(params[:name],search_by) if params[:name].present?
|
||||
teachers = searchTeacherAndAssistant(Course.find(params[:course_id]))
|
||||
scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present?
|
||||
end
|
||||
scope
|
||||
end
|
||||
|
|
|
@ -2,26 +2,30 @@
|
|||
<% if defined?(container) && container && container.saved_attachments %>
|
||||
<% if isReply %>
|
||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
<span id="attachments_p<%= i %>" class="sub_btn">
|
||||
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
|
||||
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% container.attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public')%>
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
|
||||
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -56,7 +60,9 @@
|
|||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
<span id="upload_file_count<%= container.id %>" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% if container.nil? %>
|
||||
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% end %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<span class="ispublic-label"><%= l(:field_is_public)%>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false, :class => 'is_public_checkbox')%>
|
||||
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), 'data-containerid'=>"#{container.id}",:method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
|
@ -41,7 +41,7 @@
|
|||
// file.click();
|
||||
// }
|
||||
</script>
|
||||
<span class="add_attachment">
|
||||
<span class="add_attachment" data-containerid="<%= container.id %>">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file#{container.id}.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
|
||||
|
@ -60,7 +60,8 @@
|
|||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
:delete_all_files => l(:text_are_you_sure_all),
|
||||
:containerid => "#{container.id}"
|
||||
} %>
|
||||
<span id="upload_file_count<%=container.id %>" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
|
@ -124,7 +125,9 @@
|
|||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% if container.nil? %>
|
||||
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||
<% end %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
|
|
|
@ -1,8 +1,26 @@
|
|||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields>span').length;
|
||||
if(count<=0){
|
||||
$("#upload_file_count").text(<%= l(:label_no_file_uploaded)%>);
|
||||
$(".remove_all").remove();
|
||||
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
|
||||
if(containerid==undefined){
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields>span').length;
|
||||
if(count<=0){
|
||||
$("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
|
||||
$(".remove_all").remove();
|
||||
}else{
|
||||
$("#upload_file_count").html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}else{
|
||||
$("#upload_file_count").html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
|
||||
}
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields'+containerid+'>span').length;
|
||||
if(count<=0){
|
||||
$('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
|
||||
var remove_all_html_obj = $(".remove_all").filter(function(index){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
remove_all_html_obj.remove();
|
||||
}else{
|
||||
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
|
@ -68,6 +68,7 @@
|
|||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="display: none" id="project_show_<%= topic.id%>">
|
||||
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
|
||||
<span class="g-arr-down">
|
||||
|
@ -125,7 +126,7 @@
|
|||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
<br/>
|
||||
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
|
||||
<br/>
|
||||
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
||||
|
|
|
@ -33,20 +33,21 @@
|
|||
%>
|
||||
</p>
|
||||
|
||||
<p style="margin-left:-10px;padding-right: 20px;">
|
||||
<p>
|
||||
<%= f.text_area :description,
|
||||
:rows => 5,
|
||||
:class => 'wiki-edit',
|
||||
:style => "font-size:small;width:490px;margin-left:10px;",
|
||||
:size => 60,
|
||||
:rows => 4,
|
||||
:style => "width:490px;",
|
||||
:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT,
|
||||
:placeholder => "#{l(:label_contest_description)}"
|
||||
%>
|
||||
</p>
|
||||
|
||||
<p style="margin-left:-10px;">
|
||||
<p>
|
||||
<%= f.text_field :password,
|
||||
:size => 60,
|
||||
:style => "width:488px;margin-left: 10px;"
|
||||
:rows => 4,
|
||||
:style => "width:490px;"
|
||||
%>
|
||||
</p>
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
|
||||
<!-- modified by longjun -->
|
||||
<%= link_to l(:label_create_new_projects),
|
||||
new_project_path(:course => 0, :project_type => 0, :host => Setting.project_domain),
|
||||
new_project_path(:course => 0, :project_type => 0, :host => Setting.host_name),
|
||||
:target => '_blank'
|
||||
%>
|
||||
<!-- end longjun -->
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<input type="password" style="top: -100000px;position: fixed;">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<!-- added by fq -->
|
||||
<!--display the board-->
|
||||
<script>$(function(){$("img").removeAttr("alt");});</script>
|
||||
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if memos.any? %>
|
||||
|
|
|
@ -31,5 +31,5 @@
|
|||
</div>
|
||||
<% end -%>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
<%= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %>
|
||||
</ul>
|
|
@ -46,59 +46,52 @@
|
|||
<!--属性-->
|
||||
<div class="pro_info_box mb10">
|
||||
<%= issue_fields_rows do |rows| %>
|
||||
<ul class="fl">
|
||||
|
||||
<li><p class="label"><span class="c_red f12">*</span> 状态 : </p>
|
||||
|
||||
<p class="pro_info_p"><%= @issue.status.name %></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li><p class="label"><span class="c_red f12">*</span> 优先级 : </p>
|
||||
<span class="pro_info_p"><%= @issue.priority.name %></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<ul class="fl" >
|
||||
<li><p class="label03" > 状态 : </p><p class="pro_info_p"><%= @issue.status.name %></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('assigned_to_id') %>
|
||||
<li><p class="label"> 指派给 : </p>
|
||||
<span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "-" %></span>
|
||||
</li>
|
||||
<li><p class="label03" > 指派给 : </p><span class="pro_info_p"><%= @issue.assigned_to ? link_to_isuue_user(@issue.assigned_to) : "--" %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
|
||||
<li><p class="label"> 目标版本 : </p>
|
||||
<span class="pro_info_p"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "-") %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="fl ml90">
|
||||
<% unless @issue.disabled_core_fields.include?('start_date') %>
|
||||
<li><p class="label02"> 开始日期 : </p>
|
||||
|
||||
<p class="pro_info_p"><%= format_date(@issue.start_date) %></p></li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('due_date') %>
|
||||
<li><p class="label02"> 计划完成日期 : </p>
|
||||
<span class="pro_info_p"><%= format_date(@issue.due_date) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
|
||||
|
||||
<li><p class="label02"> 预期时间 : </p>
|
||||
<span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="fl" >
|
||||
<li><p class="label03" > 优先级 : </p><span class="pro_info_p" style="width:50px;"><%= @issue.priority.name %></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('done_ratio') %>
|
||||
<li><p class="label02"> % 完成 : </p>
|
||||
<span class="pro_info_p"><%= @issue.done_ratio %>%</span>
|
||||
</li>
|
||||
<li><p class="label03" > % 完成 : </p><span class="pro_info_p" style="width:50px;"><%= @issue.done_ratio %>%</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
|
||||
<ul class="fl " >
|
||||
<% unless @issue.disabled_core_fields.include?('start_date') %>
|
||||
<li><p class="label03" style="width:50px;" > 开始 : </p><p class="pro_info_p"><%= format_date(@issue.start_date) %></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('estimated_hours') %>
|
||||
<li><p class="label03" style="width:50px;"> 周期 : </p><span class="pro_info_p"><%= l_hours(@issue.estimated_hours) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="fl " >
|
||||
<% unless @issue.disabled_core_fields.include?('due_date') %>
|
||||
<li><p class="label03" > 计划完成 : </p><span class="pro_info_p" style="width:120px;"><%= format_date(@issue.due_date)? format_date(@issue.due_date) : "--" %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% unless @issue.disabled_core_fields.include?('fixed_version_id') %>
|
||||
<li><p class="label03" > 目标版本 : </p><span class="pro_info_p" style="width:120px;"><%= (@issue.fixed_version ? link_to_version(@issue.fixed_version, :class => "pro_info_p") : "--") %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %><!--pro_info_box end-->
|
||||
<%#= render_custom_fields_rows(@issue) %>
|
||||
<%#= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
|
||||
</div>
|
||||
|
|
|
@ -169,15 +169,15 @@ function cookieget(n)
|
|||
<div class="side_center">
|
||||
<div class="custom_service">
|
||||
<% get_memo %>
|
||||
<% if @public_forum %>
|
||||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
|
||||
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
|
||||
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
|
||||
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if @public_forum %>
|
||||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||
<%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
|
||||
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||
<%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %>
|
||||
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
|
||||
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;" id="" onclick="f_submit();"><%= l(:label_submit)%></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="msgserver">
|
||||
<a href="http://user.trustie.net/users/34/user_newfeedback" style="color: #15BCCF;"><%= l(:label_technical_support) %>白 羽</a>
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
<% end %>
|
||||
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
|
||||
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
|
||||
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')',
|
||||
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain },
|
||||
{ :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user },
|
||||
{:class => 'my-message'} if User.current.logged?%>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -67,17 +67,17 @@ end
|
|||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged? -%>
|
||||
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user }, {:class => 'my-message'} if User.current.logged? -%>
|
||||
</li>
|
||||
<li>
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.host_course} %>
|
||||
</li>
|
||||
<li>
|
||||
<%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
||||
<%=link_to l(:label_my_projects),{:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li>
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
<% if User.current.logged? -%>
|
||||
|
||||
<li id="current_user_li">
|
||||
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.user_domain}, :class => "uses_name"%>
|
||||
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, :class => "uses_name"%>
|
||||
<ul id="user_sub_menu" style="right: 0px;display: none;">
|
||||
<% unless User.current.projects.empty? %>
|
||||
<li id="my_projects_li">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain}, :class => "parent" %>
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name}, :class => "parent" %>
|
||||
<ul id="my_projects_ul">
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
<li>
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
|
||||
<%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<% if User.current.projects.count>0 %>
|
||||
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
|
||||
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %>
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<br />
|
||||
<div class="cl"></div>
|
||||
<span id="project_name_span" style="float: left"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<%=link_to l(:field_homepage), home_path %> >
|
||||
<%=link_to l(:field_homepage), home_path %> >
|
||||
<span>
|
||||
<%=link_to @user.name, user_path %>
|
||||
</span>
|
||||
|
@ -122,7 +122,7 @@
|
|||
<strong class="font_small_watch">
|
||||
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@user.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist"%>
|
||||
</strong>
|
||||
|
||||
|
||||
<strong class="font_small_watch">
|
||||
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@user.watcher_users.count.to_s+")", :controller=>"users", :action=>"user_fanslist" %>
|
||||
</strong>
|
||||
|
@ -190,16 +190,16 @@
|
|||
<% unless @user.user_extensions.nil? %>
|
||||
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
|
||||
<tr>
|
||||
<% unless @user.user_extensions.school.nil? %>
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"><%= l(:field_occupation) %>:</span>
|
||||
</td>
|
||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
||||
<% unless @user.user_extensions.school.nil? %>
|
||||
<a href="http://course.trustie.net/?school_id=<%= @user.user_extensions.school.id%>"><%= @user.user_extensions.school.name %></a>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% elsif @user.user_extensions.identity == 3 %>
|
||||
<% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation.empty? %>
|
||||
<tr>
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:field_occupation) %>:</span>
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get_school(value){
|
||||
var prefix = '';
|
||||
if(location.href.indexOf('ros') >= 0)
|
||||
|
@ -36,14 +33,9 @@
|
|||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function test(id){
|
||||
location.href = encodeURI('http://<%= Setting.host_course %>/?school_id='+id);
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
function ssearch(){
|
||||
//alert($("#key_word").val());
|
||||
var value = $("#key_word").val();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||
<%= l(:label_x_contribute_to, :count => memberships.count) %>
|
||||
<% for member in memberships %>
|
||||
<%= link_to member.project.name, {:controller => 'projects', :action => 'show',id: member.project.id, host: Setting.project_domain } %><%= (memberships.last == member) ? '' : ',' %>
|
||||
<%= link_to member.project.name, {:controller => 'projects', :action => 'show',id: member.project.id, host: Setting.host_name } %><%= (memberships.last == member) ? '' : ',' %>
|
||||
<% end %>
|
||||
<p>
|
||||
<%# unless user.memberships.empty? %>
|
||||
|
@ -45,7 +45,7 @@
|
|||
<%= ":" unless user_courses.empty? %>
|
||||
<% for course in user_courses %>
|
||||
<%# if course.name != nil %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
|
||||
<%= ":" unless user_courses.empty? %>
|
||||
<% for course in user_courses %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<% end %>
|
||||
</p>
|
||||
</td>
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<%= ":" unless user_courses.empty? %>
|
||||
<% for course in user_courses %>
|
||||
<%# if course.name != nil %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
|
|
|
@ -254,16 +254,6 @@ tags_max_length:
|
|||
tags_show_search_results:
|
||||
format: int
|
||||
default: 5
|
||||
user_domain:
|
||||
default: user.trustie.net
|
||||
project_domain:
|
||||
default: forge.trustie.net
|
||||
contest_domain:
|
||||
default: contest.trustie.net
|
||||
course_domain:
|
||||
default: course.trustie.net
|
||||
repository_domain:
|
||||
default: repository.trustie.net
|
||||
please_chose:
|
||||
default: 请选择
|
||||
hidden_non_project:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class AddHostConfigToSettings < ActiveRecord::Migration
|
||||
def change
|
||||
Setting.create(name: 'host_course', value: 'course.trustie.net')
|
||||
Setting.create(name: 'host_contest', value: 'contest.trustie.net')
|
||||
Setting.create(name: 'host_user', value: 'user.trustie.net')
|
||||
Setting.create(name: 'host_repository', value: 'repository.trustie.net')
|
||||
end
|
||||
end
|
2967
db/schema.rb
2967
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -267,7 +267,7 @@ Redmine::AccessControl.map do |map|
|
|||
end
|
||||
#by young
|
||||
Redmine::MenuManager.map :top_menu do |menu|
|
||||
menu.push :home, {:host => Setting.user_domain}
|
||||
menu.push :home, {:host => Setting.host_user}
|
||||
menu.push :course_practice, {:controller => 'projects', :action => 'course', :project_type => 1}
|
||||
menu.push :project_deposit, { :controller => 'projects', :action => 'index', :project_type => 0}, :caption => :label_project_deposit
|
||||
menu.push :software_user, {:controller => 'users', :action => 'index'}
|
||||
|
@ -336,7 +336,7 @@ end
|
|||
########fq
|
||||
Redmine::MenuManager.map :bid_menu do |menu|
|
||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_user_response
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project', :host => Setting.project_domain }, :caption => :label_bidding_project
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project', :host => Setting.host_name }, :caption => :label_bidding_project
|
||||
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||
end
|
||||
|
@ -422,7 +422,7 @@ Redmine::MenuManager.map :course_menu do |menu|
|
|||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_user }
|
||||
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},
|
||||
:if => Proc.new {|u| if User.current == u || User.current.admin?
|
||||
membership = u.coursememberships.all
|
||||
|
@ -432,7 +432,7 @@ Redmine::MenuManager.map :user_menu do |menu|
|
|||
FirstPage.find_by_page_type('project').show_course != 2 && membership && membership.count > 0
|
||||
}
|
||||
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects_index', :host => Setting.project_domain},
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects_index', :host => Setting.host_name},
|
||||
:if => Proc.new {|u| if User.current.admin?
|
||||
memberships = u.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
||||
else
|
||||
|
@ -443,24 +443,24 @@ Redmine::MenuManager.map :user_menu do |menu|
|
|||
memberships || watch_projects
|
||||
}
|
||||
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_enterprise_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_user }
|
||||
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
|
||||
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu_self do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.project_domain }
|
||||
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.user_domain}
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_name }
|
||||
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.host_user}
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user}
|
||||
|
||||
end
|
||||
#end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* Redmine - project management software
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||
|
||||
function postUpMsg(attachmentId)
|
||||
{
|
||||
$.ajax({
|
||||
url: '/attachments/renderTag',
|
||||
url: '/attachments/renderTag',
|
||||
type: "GET",
|
||||
data: {
|
||||
attachmentId: attachmentId
|
||||
|
@ -25,39 +25,39 @@ function reload(fileSpan) {
|
|||
|
||||
function addFile_board(inputEl, file, eagerUpload, id) {
|
||||
|
||||
var attachments_frame = '#attachments_fields' + id;
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
deleteallfiles = $(inputEl).data('deleteAllFiles');
|
||||
var attachmentId = addFile.nextAttachmentId++;
|
||||
var attachments_frame = '#attachments_fields' + id;
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
deleteallfiles = $(inputEl).data('deleteAllFiles');
|
||||
var attachmentId = addFile.nextAttachmentId++;
|
||||
|
||||
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
|
||||
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
|
||||
|
||||
fileSpan.append(
|
||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('descriptionPlaceholder') } ).toggle(!eagerUpload),
|
||||
$('<span >'+$(inputEl).data('fieldIsPublic')+':</span>').attr({ 'class': 'ispublic-label' }) ,
|
||||
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload' }).click(function(){
|
||||
if(confirm($(inputEl).data('areYouSure'))){
|
||||
removeFile();
|
||||
if(!eagerUpload){
|
||||
(function(e){
|
||||
reload(e);
|
||||
})(fileSpan);
|
||||
fileSpan.append(
|
||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('descriptionPlaceholder') } ).toggle(!eagerUpload),
|
||||
$('<span >'+$(inputEl).data('fieldIsPublic')+':</span>').attr({ 'class': 'ispublic-label' }) ,
|
||||
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-containerid':id }).click(function(){
|
||||
if(confirm($(inputEl).data('areYouSure'))){
|
||||
removeFile();
|
||||
if(!eagerUpload){
|
||||
(function(e){
|
||||
reload(e);
|
||||
})(fileSpan);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}).toggle(!eagerUpload),
|
||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||
).appendTo(attachments_frame);
|
||||
}).toggle(!eagerUpload),
|
||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||
).appendTo(attachments_frame);
|
||||
|
||||
if(eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
if(eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||
|
||||
}
|
||||
return attachmentId;
|
||||
}
|
||||
return attachmentId;
|
||||
}
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
function addFile(inputEl, file, eagerUpload) {
|
||||
|
||||
|
@ -99,132 +99,166 @@ addFile.nextAttachmentId = 1;
|
|||
|
||||
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
||||
|
||||
function onLoadstart(e) {
|
||||
fileSpan.removeClass('ajax-waiting');
|
||||
fileSpan.addClass('ajax-loading');
|
||||
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
|
||||
}
|
||||
|
||||
function onProgress(e) {
|
||||
if(e.lengthComputable) {
|
||||
this.progressbar( 'value', e.loaded * 100 / e.total );
|
||||
function onLoadstart(e) {
|
||||
fileSpan.removeClass('ajax-waiting');
|
||||
fileSpan.addClass('ajax-loading');
|
||||
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function actualUpload(file, attachmentId, fileSpan, inputEl) {
|
||||
|
||||
ajaxUpload.uploading++;
|
||||
|
||||
uploadBlob(file, $(inputEl).data('upload-path'), attachmentId, {
|
||||
loadstartEventHandler: onLoadstart.bind(progressSpan),
|
||||
progressEventHandler: onProgress.bind(progressSpan)
|
||||
})
|
||||
.done(function(result) {
|
||||
progressSpan.progressbar( 'value', 100 ).remove();
|
||||
fileSpan.find('input.description, a').css('display', 'inline-block');
|
||||
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
||||
})
|
||||
.fail(function(result) {
|
||||
progressSpan.text(result.statusText);
|
||||
if($("#network_issue"))
|
||||
{
|
||||
$("#network_issue").show();
|
||||
function onProgress(e) {
|
||||
if(e.lengthComputable) {
|
||||
this.progressbar( 'value', e.loaded * 100 / e.total );
|
||||
}
|
||||
}).always(function() {
|
||||
ajaxUpload.uploading--;
|
||||
fileSpan.removeClass('ajax-loading');
|
||||
var form = fileSpan.parents('form');
|
||||
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
||||
$('input:submit', form).removeAttr('disabled');
|
||||
}
|
||||
|
||||
function actualUpload(file, attachmentId, fileSpan, inputEl) {
|
||||
|
||||
ajaxUpload.uploading++;
|
||||
|
||||
uploadBlob(file, $(inputEl).data('upload-path'), attachmentId, {
|
||||
loadstartEventHandler: onLoadstart.bind(progressSpan),
|
||||
progressEventHandler: onProgress.bind(progressSpan)
|
||||
})
|
||||
.done(function(result) {
|
||||
progressSpan.progressbar( 'value', 100 ).remove();
|
||||
fileSpan.find('input.description, a').css('display', 'inline-block');
|
||||
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
||||
})
|
||||
.fail(function(result) {
|
||||
progressSpan.text(result.statusText);
|
||||
if($("#network_issue"))
|
||||
{
|
||||
$("#network_issue").show();
|
||||
}
|
||||
}).always(function() {
|
||||
ajaxUpload.uploading--;
|
||||
fileSpan.removeClass('ajax-loading');
|
||||
var form = fileSpan.parents('form');
|
||||
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
||||
$('input:submit', form).removeAttr('disabled');
|
||||
}
|
||||
form.dequeue('upload');
|
||||
});
|
||||
|
||||
//gcm files count and add delete_all link
|
||||
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
var containerid=$(inputEl).data('containerid');
|
||||
if(containerid==undefined){
|
||||
var count=$('#attachments_fields>span').length;
|
||||
$('#upload_file_count').html("<span id=\"count\">"+count+"</span>"+$(inputEl).data('fileCount'));
|
||||
if(count>=1){
|
||||
var add_attachs=$('.add_attachment');
|
||||
var delete_all=$('.remove_all');
|
||||
if(delete_all.length<1){
|
||||
add_attachs.append($("<a> </a>").attr({"href":"javascript:void(0)", 'class': 'remove_all',"onclick": "removeAll()"}));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var count=$('#attachments_fields'+containerid+'>span').length;
|
||||
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+$(inputEl).data('fileCount'));
|
||||
if(count>=1){
|
||||
var add_attachs=$('.add_attachment').filter(function(index){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
var delete_all=$('.remove_all').filter(function(index){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
if(delete_all.length<1){
|
||||
add_attachs.append($("<a> </a>").attr({
|
||||
"href":"javascript:void(0)",
|
||||
'class': 'remove_all',
|
||||
'data-containerid': containerid,
|
||||
"onclick": "removeAll('"+containerid+"')"
|
||||
}));
|
||||
}
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
||||
}
|
||||
form.dequeue('upload');
|
||||
});
|
||||
|
||||
//gcm files count and add delete_all link
|
||||
|
||||
var count=$('#attachments_fields>span').length;
|
||||
$('#upload_file_count').html("<span id=\"count\">"+count+"</span>"+$(inputEl).data('fileCount'));
|
||||
if(count>=1){
|
||||
var add_attachs=$('.add_attachment');
|
||||
var delete_all=$('.remove_all');
|
||||
if(delete_all.length<1){
|
||||
add_attachs.append($("<a> </a>").attr({"href":"javascript:void(0)", 'class': 'remove_all',"onclick": "removeAll()"}));
|
||||
}
|
||||
}
|
||||
//gcm
|
||||
|
||||
//gcm
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var progressSpan = $('<div>').insertAfter(fileSpan.find('input.filename'));
|
||||
progressSpan.progressbar();
|
||||
fileSpan.addClass('ajax-waiting');
|
||||
var progressSpan = $('<div>').insertAfter(fileSpan.find('input.filename'));
|
||||
progressSpan.progressbar();
|
||||
fileSpan.addClass('ajax-waiting');
|
||||
|
||||
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
|
||||
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
|
||||
|
||||
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
|
||||
actualUpload(file, attachmentId, fileSpan, inputEl);
|
||||
else
|
||||
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl));
|
||||
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
|
||||
actualUpload(file, attachmentId, fileSpan, inputEl);
|
||||
else
|
||||
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl));
|
||||
}
|
||||
|
||||
ajaxUpload.uploading = 0;
|
||||
|
||||
function removeFile() {
|
||||
$(this).parent('span').remove();
|
||||
return false;
|
||||
$(this).parent('span').remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
//gcm delete all file
|
||||
function removeAll(){
|
||||
if(confirm(deleteallfiles)){
|
||||
$(".remove-upload").removeAttr("data-confirm");
|
||||
$(".remove-upload").click();
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
function removeAll(containerid){
|
||||
if(confirm(deleteallfiles)){
|
||||
if(containerid==undefined){
|
||||
$(".remove-upload").removeAttr("data-confirm");
|
||||
$(".remove-upload").click();
|
||||
}else{
|
||||
var arr = $(".remove-upload").filter(function(){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
arr.removeAttr("data-confirm");
|
||||
arr.click();
|
||||
}
|
||||
}
|
||||
// return false;
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
||||
//gcm
|
||||
|
||||
function uploadBlob(blob, uploadUrl, attachmentId, options) {
|
||||
|
||||
var actualOptions = $.extend({
|
||||
loadstartEventHandler: $.noop,
|
||||
progressEventHandler: $.noop
|
||||
}, options);
|
||||
if(uploadUrl.indexOf('?') > 0){
|
||||
uploadUrl = uploadUrl + '&attachment_id=' + attachmentId;
|
||||
}else{
|
||||
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
|
||||
}
|
||||
if (blob instanceof window.File) {
|
||||
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
|
||||
}
|
||||
var actualOptions = $.extend({
|
||||
loadstartEventHandler: $.noop,
|
||||
progressEventHandler: $.noop
|
||||
}, options);
|
||||
if(uploadUrl.indexOf('?') > 0){
|
||||
uploadUrl = uploadUrl + '&attachment_id=' + attachmentId;
|
||||
}else{
|
||||
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
|
||||
}
|
||||
if (blob instanceof window.File) {
|
||||
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
|
||||
}
|
||||
|
||||
return $.ajax(uploadUrl, {
|
||||
type: 'POST',
|
||||
contentType: 'application/octet-stream',
|
||||
beforeSend: function(jqXhr) {
|
||||
jqXhr.setRequestHeader('Accept', 'application/js');
|
||||
},
|
||||
xhr: function() {
|
||||
var xhr = $.ajaxSettings.xhr();
|
||||
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
|
||||
xhr.upload.onprogress = actualOptions.progressEventHandler;
|
||||
return xhr;
|
||||
},
|
||||
data: blob,
|
||||
cache: false,
|
||||
processData: false
|
||||
});
|
||||
return $.ajax(uploadUrl, {
|
||||
type: 'POST',
|
||||
contentType: 'application/octet-stream',
|
||||
beforeSend: function(jqXhr) {
|
||||
jqXhr.setRequestHeader('Accept', 'application/js');
|
||||
},
|
||||
xhr: function() {
|
||||
var xhr = $.ajaxSettings.xhr();
|
||||
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
|
||||
xhr.upload.onprogress = actualOptions.progressEventHandler;
|
||||
return xhr;
|
||||
},
|
||||
data: blob,
|
||||
cache: false,
|
||||
processData: false
|
||||
});
|
||||
}
|
||||
|
||||
function addInputFiles(inputEl) {
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
|
||||
if (inputEl.files) {
|
||||
// upload files using ajax
|
||||
uploadAndAttachFiles(inputEl.files, inputEl);
|
||||
// $(inputEl).remove();
|
||||
// $(inputEl).remove();
|
||||
} else {
|
||||
// browser not supporting the file API, upload on form submission
|
||||
var attachmentId;
|
||||
|
@ -260,18 +294,18 @@ function addInputFiles_board(inputEl, id) {
|
|||
}
|
||||
function uploadAndAttachFiles(files, inputEl) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
|
||||
var sizeExceeded = false;
|
||||
$.each(files, function() {
|
||||
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
||||
});
|
||||
if (sizeExceeded) {
|
||||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {addFile(inputEl, this, true);});
|
||||
}
|
||||
var sizeExceeded = false;
|
||||
$.each(files, function() {
|
||||
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
||||
});
|
||||
if (sizeExceeded) {
|
||||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {addFile(inputEl, this, true);});
|
||||
}
|
||||
}
|
||||
function uploadAndAttachFiles_board(files, inputEl, id) {
|
||||
|
||||
|
@ -290,37 +324,63 @@ function uploadAndAttachFiles_board(files, inputEl, id) {
|
|||
}
|
||||
function handleFileDropEvent(e) {
|
||||
|
||||
$(this).removeClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
$(this).removeClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
|
||||
if ($.inArray('Files', e.dataTransfer.types) > -1) {
|
||||
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
|
||||
}
|
||||
if ($.inArray('Files', e.dataTransfer.types) > -1) {
|
||||
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
|
||||
}
|
||||
}
|
||||
|
||||
function dragOverHandler(e) {
|
||||
$(this).addClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
$(this).addClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
}
|
||||
|
||||
function dragOutHandler(e) {
|
||||
$(this).removeClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
$(this).removeClass('fileover');
|
||||
blockEventPropagation(e);
|
||||
}
|
||||
|
||||
function setupFileDrop() {
|
||||
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
|
||||
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
|
||||
|
||||
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
|
||||
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
|
||||
|
||||
$('form div.box').has('input:file').each(function() {
|
||||
$(this).on({
|
||||
dragover: dragOverHandler,
|
||||
dragleave: dragOutHandler,
|
||||
drop: handleFileDropEvent
|
||||
});
|
||||
});
|
||||
}
|
||||
$('form div.box').has('input:file').each(function() {
|
||||
$(this).on({
|
||||
dragover: dragOverHandler,
|
||||
dragleave: dragOutHandler,
|
||||
drop: handleFileDropEvent
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(setupFileDrop);
|
||||
$(function(){
|
||||
$(".file_selector").each(function() {
|
||||
deleteallfiles = $(this).data('deleteAllFiles');
|
||||
var containerid = $(this).data('containerid');
|
||||
if (containerid == undefined)containerid = '';
|
||||
var count = $('#attachments_fields' + containerid + '>span').length;
|
||||
if (count >= 1) {
|
||||
$('#upload_file_count' + containerid).html("<span id=\"count\">" + count + "</span>" + $(this).data('fileCount'));
|
||||
var add_attachs = $('.add_attachment').filter(function (index) {
|
||||
return $(this).data('containerid') == containerid;
|
||||
});
|
||||
var delete_all = $('.remove_all').filter(function (index) {
|
||||
return $(this).data('containerid') == containerid;
|
||||
});
|
||||
if (delete_all.length < 1) {
|
||||
add_attachs.append($("<a> </a>").attr({
|
||||
"href": "javascript:void(0)",
|
||||
'class': 'remove_all',
|
||||
'data-containerid': containerid,
|
||||
"onclick": "removeAll('" + containerid + "')"
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
|
@ -7,6 +7,7 @@ h2, .wiki h1 {font-size: 20px;}
|
|||
h3, .wiki h2 {font-size: 15px; padding-left: 5px}
|
||||
h4, .wiki h3 {font-size: 13px;}
|
||||
h4 {border-bottom: 1px dotted #bbb;}
|
||||
li{list-style-type:none;}
|
||||
/*huang*/
|
||||
/*current position*/
|
||||
.contest_count{
|
||||
|
@ -2779,4 +2780,4 @@ div.repos_explain{
|
|||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.upload_img img{max-width: 580px;}
|
||||
.upload_img img{max-width: 580px;width: 100%;}
|
||||
|
|
|
@ -87,11 +87,11 @@ a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;}
|
|||
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
|
||||
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}
|
||||
.pro_pic_box{ margin-left:60px; }
|
||||
.pro_pic{ width:100px; height:75px;line-height:73px;border:2px solid #CCC; margin:10px 0; text-align: center;}
|
||||
.pro_info_box{ margin-left:60px; background:#f0fbff; height:80px; padding:10px 0;}
|
||||
.pro_pic{ width:100px; border:2px solid #CCC; margin:10px 0;}
|
||||
.pro_info_box{ margin-left:60px; border:1px dashed #CCC; height:45px; padding:10px 0;}
|
||||
.pro_info_box ul{}
|
||||
.pro_info_box ul li{ margin-bottom:10px;}
|
||||
.pro_info_p{ color:#0781b4 !important; float:left; width:160px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;padding-top:2.5px;}
|
||||
.pro_info_box ul li{ height:24px;}
|
||||
.pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
|
||||
.edit_pro_box{overflow:hidden;display:none; margin-bottom:30px; border-bottom:1px dashed #CCC; padding-bottom:10px;}
|
||||
/****翻页***/
|
||||
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||
|
@ -354,6 +354,9 @@ a:hover.st_add{ color:#ff8e15;}
|
|||
.newpro_box textarea{ height:150px; float:left; margin-bottom:10px;}
|
||||
.newpro_box select{ height:29px; float:left; margin-bottom:10px;}
|
||||
/*.label{ width:80px; text-align:right; font-size:14 background-image: url(../images/true.png); }*/
|
||||
.label02{ width:110px; text-align:right; font-size:14px; display:block; float:left;}
|
||||
.label03{ width:70px; text-align:right; display:block; float:left;}
|
||||
.collapsible{ border-left:none;border-right:none;border-bottom:none; border-top:1px solid #e4e4e4; padding-top:10px; }
|
||||
.icon-reload { background-image: url(../images/reload.png); }
|
||||
.icon {
|
||||
background-position: 0% 50%;
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
FactoryGirl.define do
|
||||
factory :course do
|
||||
name '课程名'
|
||||
time '2015'
|
||||
term '春季课程'
|
||||
period 1
|
||||
password '111'
|
||||
description '课程描述'
|
||||
is_public 1
|
||||
open_student 1
|
||||
association :teacher, factory: :user
|
||||
end
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :user do
|
||||
login "ExampleUser"
|
||||
login "factoryuser"
|
||||
mail "user@example.com"
|
||||
password "foobar"
|
||||
password_confirmation "foobar"
|
||||
password "foobar111"
|
||||
password_confirmation "foobar111"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
require 'rails_helper'
|
||||
require 'shared_account_spec'
|
||||
|
||||
RSpec.describe "Account request", :type => :request do
|
||||
|
||||
describe "注册用户" do
|
||||
include_context "create user"
|
||||
it "正常注册可以成功" do
|
||||
shared_register
|
||||
expect(response).to redirect_to(my_account_url)
|
||||
end
|
||||
|
||||
it "修改用户资料" do
|
||||
shared_register
|
||||
shared_update_user
|
||||
expect(response).to redirect_to(user_url(session[:user_id]))
|
||||
end
|
||||
end
|
||||
|
||||
describe "用户登录" do
|
||||
let(:user){FactoryGirl.create(:user)}
|
||||
|
||||
|
@ -10,7 +26,7 @@ RSpec.describe "Account request", :type => :request do
|
|||
end
|
||||
|
||||
context "正常登录" do
|
||||
before{post signin_path, username: user.login, password: user.password}
|
||||
before{ post signin_path, username: user.login, password: user.password }
|
||||
it "登录成功,正常跳转" do
|
||||
expect(response).to redirect_to(my_account_url)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
require 'rails_helper'
|
||||
require 'shared_account_spec'
|
||||
|
||||
RSpec.describe "课程", :type => :request do
|
||||
let(:course){FactoryGirl.attributes_for(:course)}
|
||||
describe "创建课程" do
|
||||
include_context "create user"
|
||||
before {
|
||||
shared_register
|
||||
shared_update_user
|
||||
}
|
||||
context "参数正确,成功创建课程" do
|
||||
before{
|
||||
uu = current_user
|
||||
allow(User).to receive(:current).and_return(uu)
|
||||
allow(uu).to receive(:allowed_to?).and_return(123)
|
||||
post courses_path,
|
||||
"course[name]"=> course[:name],
|
||||
"class_period"=> course[:period],
|
||||
"time"=> course[:time],
|
||||
"term"=> course[:term],
|
||||
"course[password]"=>course[:password],
|
||||
"course[description]"=> course[:description],
|
||||
"course[is_public]"=> course[:is_public],
|
||||
"course[open_student]"=> course[:open_student]
|
||||
}
|
||||
it{
|
||||
puts User.current.allowed_to?(1,2)
|
||||
binding.pry
|
||||
}
|
||||
it{expect(response).to have_http_status(:success)}
|
||||
it{expect(assigns(:course)).to be_a_new(Course)}
|
||||
it{expect(response).to redirect_to(course_url(assigns(:course)))}
|
||||
end
|
||||
end
|
||||
|
||||
describe "配置课程" do
|
||||
context "修改课程图片" do
|
||||
it "正常图片上传成功" do
|
||||
end
|
||||
|
||||
it "不是图片,上传失败"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "作业打包下载", :type => :request do
|
||||
describe "单独下载某学生作业" do
|
||||
end
|
||||
end
|
|
@ -0,0 +1,42 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_context "create user" do
|
||||
let(:user) {FactoryGirl.attributes_for(:user)}
|
||||
def shared_register
|
||||
post register_path, user: user
|
||||
end
|
||||
|
||||
def shared_update_user
|
||||
post my_account_url,
|
||||
login: user[:login],
|
||||
identity: 0,
|
||||
technical_title: "教授",
|
||||
no: '',
|
||||
"user[lastname]" => 'lastname',
|
||||
"user[firstname]" => 'firstname',
|
||||
enterprise_name: '',
|
||||
gender: 1,
|
||||
province: '',
|
||||
occupation: "",
|
||||
"user[mail]" => user[:mail],
|
||||
"user[language]" => "zh",
|
||||
province: '',
|
||||
city: '',
|
||||
"user[mail_notification]" => "all",
|
||||
"user_extensions[birthday]" => '',
|
||||
"user_extensions[gender]" => 1,
|
||||
"user_extensions[brief_introduction]" => '',
|
||||
"user_extensions[location]" => '',
|
||||
"user_extensions[occupation]" => '',
|
||||
"user_extensions[work_experience]" => '',
|
||||
"user_extensions[zip_code]" => ''
|
||||
end
|
||||
|
||||
def shared_login
|
||||
post signin_path, username: user[:login], password: user[:password]
|
||||
end
|
||||
|
||||
def current_user
|
||||
User.find(session[:user_id])
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue