Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
3c810a0cee
|
@ -274,6 +274,13 @@ module Mobile
|
||||||
get ":course_id/members" do
|
get ":course_id/members" do
|
||||||
cs = CoursesService.new
|
cs = CoursesService.new
|
||||||
count = cs.course_members params
|
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 :data, count, with: Mobile::Entities::Member
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
@ -290,6 +297,20 @@ module Mobile
|
||||||
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
||||||
present :status,0
|
present :status,0
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,6 +85,7 @@ module Mobile
|
||||||
requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名'
|
requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名'
|
||||||
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
|
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
|
||||||
optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户'
|
optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户'
|
||||||
|
optional :user_id,type:Integer,desc:'用户id'
|
||||||
end
|
end
|
||||||
get 'search/search_user' do
|
get 'search/search_user' do
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
|
|
|
@ -315,7 +315,7 @@ class AccountController < ApplicationController
|
||||||
#根据home_url生产正则表达式
|
#根据home_url生产正则表达式
|
||||||
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
|
||||||
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''
|
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
|
else
|
||||||
if last_login_on == ''
|
if last_login_on == ''
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
|
@ -333,7 +333,7 @@ class AccountController < ApplicationController
|
||||||
token = Token.get_or_create_permanent_login_token(user)
|
token = Token.get_or_create_permanent_login_token(user)
|
||||||
cookie_options = {
|
cookie_options = {
|
||||||
:value => token.value,
|
:value => token.value,
|
||||||
:expires => 7.days.from_now,
|
:expires => 1.month.from_now,
|
||||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
||||||
:httponly => true
|
:httponly => true
|
||||||
|
|
|
@ -852,7 +852,7 @@ class CoursesController < ApplicationController
|
||||||
#验证是否显示课程
|
#验证是否显示课程
|
||||||
def can_show_course
|
def can_show_course
|
||||||
@first_page = FirstPage.find_by_page_type('project')
|
@first_page = FirstPage.find_by_page_type('project')
|
||||||
if @first_page.show_course == 2
|
if @first_page.try(:show_course) == 2
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -118,11 +118,11 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#if user.active? || (User.current.admin? && user.logged?)
|
#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
|
#else
|
||||||
# name
|
# name
|
||||||
#end
|
#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
|
else
|
||||||
h(user.to_s)
|
h(user.to_s)
|
||||||
end
|
end
|
||||||
|
@ -131,7 +131,7 @@ module ApplicationHelper
|
||||||
def link_to_isuue_user(user, options={})
|
def link_to_isuue_user(user, options={})
|
||||||
if user.is_a?(User)
|
if user.is_a?(User)
|
||||||
name = h(user.name(options[:format]))
|
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
|
else
|
||||||
h(user.to_s)
|
h(user.to_s)
|
||||||
end
|
end
|
||||||
|
@ -140,7 +140,7 @@ module ApplicationHelper
|
||||||
def link_to_settings_user(user, options={})
|
def link_to_settings_user(user, options={})
|
||||||
if user.is_a?(User)
|
if user.is_a?(User)
|
||||||
name = h(user.name(options[:format]))
|
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
|
else
|
||||||
h(user.to_s)
|
h(user.to_s)
|
||||||
end
|
end
|
||||||
|
@ -155,7 +155,7 @@ module ApplicationHelper
|
||||||
else
|
else
|
||||||
name = user.login
|
name = user.login
|
||||||
end
|
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
|
else
|
||||||
h(user.to_s)
|
h(user.to_s)
|
||||||
end
|
end
|
||||||
|
@ -2086,21 +2086,21 @@ module ApplicationHelper
|
||||||
hidden_non_project = Setting.find_by_name("hidden_non_project")
|
hidden_non_project = Setting.find_by_name("hidden_non_project")
|
||||||
visiable = !(hidden_non_project && hidden_non_project.value == "0")
|
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_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.project_domain}
|
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.contest_domain}
|
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_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'}
|
# 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'}
|
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
||||||
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :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"}
|
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
|
||||||
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :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'}
|
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_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.project_domain}
|
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
|
||||||
|
|
||||||
#@nav_dispaly_project_label
|
#@nav_dispaly_project_label
|
||||||
nav_list = Array.new
|
nav_list = Array.new
|
||||||
|
|
|
@ -11,7 +11,7 @@ module GitlabHelper
|
||||||
PROJECT_PATH_CUT = 40
|
PROJECT_PATH_CUT = 40
|
||||||
# gitlab版本库所在服务器
|
# gitlab版本库所在服务器
|
||||||
# 注意REPO_IP_ADDRESS必须以http://开头,暂时只支持HTTP协议,未支持SSH
|
# 注意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"
|
REPO_IP_ADDRESS = "http://192.168.137.100"
|
||||||
GITLAB_API = "/api/v3"
|
GITLAB_API = "/api/v3"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ module RepositoriesHelper
|
||||||
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||||
end
|
end
|
||||||
PROJECT_PATH_CUT = 40
|
PROJECT_PATH_CUT = 40
|
||||||
REPO_IP_ADDRESS = Setting.repository_domain
|
REPO_IP_ADDRESS = Setting.host_repository
|
||||||
|
|
||||||
def format_revision(revision)
|
def format_revision(revision)
|
||||||
if revision.respond_to? :format_identifier
|
if revision.respond_to? :format_identifier
|
||||||
|
|
|
@ -508,6 +508,12 @@ class CoursesService
|
||||||
end
|
end
|
||||||
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
|
private
|
||||||
def searchmember_by_name members, name
|
def searchmember_by_name members, name
|
||||||
#searchPeopleByRoles(project, StudentRoles)
|
#searchPeopleByRoles(project, StudentRoles)
|
||||||
|
|
|
@ -125,8 +125,8 @@
|
||||||
:file_count => l(:label_file_count),
|
:file_count => l(:label_file_count),
|
||||||
:delete_all_files => l(:text_are_you_sure_all)
|
:delete_all_files => l(:text_are_you_sure_all)
|
||||||
} %>
|
} %>
|
||||||
<% if container.nil? %>
|
<% if defined?(container) %>
|
||||||
<span id="upload_file_count" :class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
<span id="upload_file_count" class="c_grey"><%= l(:label_no_file_uploaded)%></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
|
<div id="upload_progressbar" style="height:14px; margin-bottom: 10px;display: block"></div>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
|
<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %>
|
||||||
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
|
||||||
<span><%= l(:button_upload_photo) %></span>
|
<span><%= l(:button_upload_photo) %></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
:size => "1",
|
:size => "1",
|
||||||
:multiple => true,
|
:multiple => true,
|
||||||
:data => {
|
:data => {
|
||||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
:max_file_size => Setting.upload_avatar_max_size,
|
||||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
:max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
|
||||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||||
:file_type => Redmine::Configuration['pic_types'].to_s,
|
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||||
:type_support_message => l(:error_pic_type),
|
:type_support_message => l(:error_pic_type),
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
|
|
||||||
<!-- modified by longjun -->
|
<!-- modified by longjun -->
|
||||||
<%= link_to l(:label_create_new_projects),
|
<%= 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'
|
:target => '_blank'
|
||||||
%>
|
%>
|
||||||
<!-- end longjun -->
|
<!-- end longjun -->
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
<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%>">
|
<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>
|
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||||
|
<input type="password" style="top: -100000px;position: fixed;">
|
||||||
</li>
|
</li>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<li class="ml45">
|
<li class="ml45">
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<!-- added by fq -->
|
<script>$(function(){$("img").removeAttr("alt");});</script>
|
||||||
<!--display the board-->
|
|
||||||
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
|
<div class="borad-topic-count">共有 <%=link_to @forum.memos.count %> 个贴子</div>
|
||||||
<div style="padding-top: 10px">
|
<div style="padding-top: 10px">
|
||||||
<% if memos.any? %>
|
<% if memos.any? %>
|
||||||
|
|
|
@ -31,5 +31,5 @@
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<ul class="wlist">
|
<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>
|
</ul>
|
|
@ -55,7 +55,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- more -->
|
<!-- more -->
|
||||||
<div class="subNav subNav_jiantou" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
|
<div class="subNav subNav_jiantou" id="expand_tools_expand" nhtype="toggle4cookie" data-id="expand_tool_more" data-target="#navContent" data-val="retract"><%= l(:label_project_more) %></div>
|
||||||
<ul class="navContent" id="navContent">
|
<ul class="navContent" id="navContent">
|
||||||
<%= render 'projects/tools_expand' %>
|
<%= render 'projects/tools_expand' %>
|
||||||
</ul>
|
</ul>
|
|
@ -27,13 +27,13 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
|
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
|
||||||
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
|
<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+')',
|
<%=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?%>
|
{:class => 'my-message'} if User.current.logged?%>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -67,17 +67,17 @@ end
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=User.current%> <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>
|
<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>
|
||||||
<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>
|
||||||
<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>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -18,15 +18,15 @@
|
||||||
<% if User.current.logged? -%>
|
<% if User.current.logged? -%>
|
||||||
|
|
||||||
<li id="current_user_li">
|
<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;">
|
<ul id="user_sub_menu" style="right: 0px;display: none;">
|
||||||
<% unless User.current.projects.empty? %>
|
<% unless User.current.projects.empty? %>
|
||||||
<li id="my_projects_li">
|
<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">
|
<ul id="my_projects_ul">
|
||||||
<% User.current.projects.each do |project| %>
|
<% User.current.projects.each do |project| %>
|
||||||
<li title="<%=project.name%>">
|
<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>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<% if User.current.projects.count>0 %>
|
<% if User.current.projects.count>0 %>
|
||||||
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
<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;">
|
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
|
||||||
<% User.current.projects.each do |project| %>
|
<% User.current.projects.each do |project| %>
|
||||||
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
|
<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>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</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" >
|
<a href="javascript:void(0)" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||||
<%= l(:label_search)%>
|
<%= l(:label_search)%>
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<div class="cl"></div>
|
||||||
<span id="project_name_span" style="float: left"></span>
|
<span id="project_name_span" style="float: left"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
<!--邀请加入-->
|
<!--邀请加入-->
|
||||||
<div class="subNavBox">
|
<div class="subNavBox">
|
||||||
<% if User.current.member_of?(@project) %>
|
<% if User.current.member_of?(@project) %>
|
||||||
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" onclick="$('#navContent_invit').toggle(500);"><%= l(:label_invite)%></div>
|
<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit"><%= l(:label_invite)%></div>
|
||||||
<ul class="navContent " style="display:block" id="navContent_invit">
|
<ul class="navContent " style="display:block" id="navContent_invit">
|
||||||
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
|
<li><%= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>
|
||||||
<% if User.current.allowed_to?(:manage_members, @project) %>
|
<% if User.current.allowed_to?(:manage_members, @project) %>
|
||||||
|
|
|
@ -190,16 +190,16 @@
|
||||||
<% unless @user.user_extensions.nil? %>
|
<% unless @user.user_extensions.nil? %>
|
||||||
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
|
<% if @user.user_extensions.identity == 0 || @user.user_extensions.identity == 1 %>
|
||||||
<tr>
|
<tr>
|
||||||
|
<% unless @user.user_extensions.school.nil? %>
|
||||||
<td style=" float: right" width="70px">
|
<td style=" float: right" width="70px">
|
||||||
<span style="float: right"><%= l(:field_occupation) %>:</span>
|
<span style="float: right"><%= l(:field_occupation) %>:</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
|
<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>
|
<a href="http://course.trustie.net/?school_id=<%= @user.user_extensions.school.id%>"><%= @user.user_extensions.school.name %></a>
|
||||||
<% end %>
|
|
||||||
</td>
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% elsif @user.user_extensions.identity == 3 %>
|
<% elsif @user.user_extensions.identity == 3 && @user.user_extensions.occupation.empty? %>
|
||||||
<tr>
|
<tr>
|
||||||
<td style=" float: right" width="70px">
|
<td style=" float: right" width="70px">
|
||||||
<span style="float: right"> <%= l(:field_occupation) %>:</span>
|
<span style="float: right"> <%= l(:field_occupation) %>:</span>
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function get_school(value){
|
function get_school(value){
|
||||||
var prefix = '';
|
var prefix = '';
|
||||||
if(location.href.indexOf('ros') >= 0)
|
if(location.href.indexOf('ros') >= 0)
|
||||||
|
@ -36,14 +33,9 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function test(id){
|
function test(id){
|
||||||
location.href = encodeURI('http://<%= Setting.host_course %>/?school_id='+id);
|
location.href = encodeURI('http://<%= Setting.host_course %>/?school_id='+id);
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
function ssearch(){
|
function ssearch(){
|
||||||
//alert($("#key_word").val());
|
//alert($("#key_word").val());
|
||||||
var value = $("#key_word").val();
|
var value = $("#key_word").val();
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<% memberships = user.memberships.all(:conditions => cond) %>
|
<% memberships = user.memberships.all(:conditions => cond) %>
|
||||||
<%= l(:label_x_contribute_to, :count => memberships.count) %>
|
<%= l(:label_x_contribute_to, :count => memberships.count) %>
|
||||||
<% for member in memberships %>
|
<% 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 %>
|
<% end %>
|
||||||
<p>
|
<p>
|
||||||
<%# unless user.memberships.empty? %>
|
<%# unless user.memberships.empty? %>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
<%= ":" unless user_courses.empty? %>
|
<%= ":" unless user_courses.empty? %>
|
||||||
<% for course in user_courses %>
|
<% for course in user_courses %>
|
||||||
<%# if course.name != nil %>
|
<%# 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 %>
|
<% end %>
|
||||||
<%# end %>
|
<%# end %>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
|
<%= l(:label_x_course_contribute_to, :count => user_courses.count) %>
|
||||||
<%= ":" unless user_courses.empty? %>
|
<%= ":" unless user_courses.empty? %>
|
||||||
<% for course in user_courses %>
|
<% 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 %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<%= ":" unless user_courses.empty? %>
|
<%= ":" unless user_courses.empty? %>
|
||||||
<% for course in user_courses %>
|
<% for course in user_courses %>
|
||||||
<%# if course.name != nil %>
|
<%# 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 %>
|
<% end %>
|
||||||
<%# end %>
|
<%# end %>
|
||||||
|
|
|
@ -1520,3 +1520,5 @@ en:
|
||||||
label_no_courses: You do not participate in any course, please search the curriculum, course, or create a course!
|
label_no_courses: You do not participate in any course, please search the curriculum, course, or create a course!
|
||||||
label_commit_failed: commit failed
|
label_commit_failed: commit failed
|
||||||
#api end
|
#api end
|
||||||
|
error_upload_avatar_to_large: "too big (%{max_size})"
|
||||||
|
|
||||||
|
|
|
@ -1983,3 +1983,4 @@ zh:
|
||||||
label_media: 媒体
|
label_media: 媒体
|
||||||
label_code: 代码
|
label_code: 代码
|
||||||
|
|
||||||
|
error_upload_avatar_to_large: "超过大小限制 (%{max_size})"
|
||||||
|
|
|
@ -60,7 +60,9 @@ per_page_options:
|
||||||
default: '25,50,100'
|
default: '25,50,100'
|
||||||
mail_from:
|
mail_from:
|
||||||
default: trustieforge@gmail.com
|
default: trustieforge@gmail.com
|
||||||
|
upload_avatar_max_size:
|
||||||
|
format: int
|
||||||
|
default: 5242880
|
||||||
### delayjob for send email.
|
### delayjob for send email.
|
||||||
delayjob_enabled:
|
delayjob_enabled:
|
||||||
default: 1
|
default: 1
|
||||||
|
@ -254,16 +256,6 @@ tags_max_length:
|
||||||
tags_show_search_results:
|
tags_show_search_results:
|
||||||
format: int
|
format: int
|
||||||
default: 5
|
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:
|
please_chose:
|
||||||
default: 请选择
|
default: 请选择
|
||||||
hidden_non_project:
|
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
|
17
db/schema.rb
17
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20150505025537) do
|
ActiveRecord::Schema.define(:version => 20150514133640) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -541,6 +541,7 @@ ActiveRecord::Schema.define(:version => 20150505025537) do
|
||||||
t.integer "is_teacher_score", :default => 0
|
t.integer "is_teacher_score", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "homework_attaches", ["bid_id"], :name => "bid_id"
|
||||||
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
|
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
|
||||||
|
|
||||||
create_table "homework_evaluations", :force => true do |t|
|
create_table "homework_evaluations", :force => true do |t|
|
||||||
|
@ -555,7 +556,9 @@ ActiveRecord::Schema.define(:version => 20150505025537) do
|
||||||
t.integer "bid_id"
|
t.integer "bid_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "homework_for_courses", ["bid_id"], :name => "bid_id"
|
||||||
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
|
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
|
||||||
|
add_index "homework_for_courses", ["course_id"], :name => "course_id"
|
||||||
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
|
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
|
||||||
|
|
||||||
create_table "homework_users", :force => true do |t|
|
create_table "homework_users", :force => true do |t|
|
||||||
|
@ -659,16 +662,6 @@ ActiveRecord::Schema.define(:version => 20150505025537) do
|
||||||
|
|
||||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||||
|
|
||||||
create_table "journal_details_copy", :force => true do |t|
|
|
||||||
t.integer "journal_id", :default => 0, :null => false
|
|
||||||
t.string "property", :limit => 30, :default => "", :null => false
|
|
||||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
|
||||||
t.text "old_value"
|
|
||||||
t.text "value"
|
|
||||||
end
|
|
||||||
|
|
||||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
|
||||||
|
|
||||||
create_table "journal_replies", :id => false, :force => true do |t|
|
create_table "journal_replies", :id => false, :force => true do |t|
|
||||||
t.integer "journal_id"
|
t.integer "journal_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
@ -1172,10 +1165,12 @@ ActiveRecord::Schema.define(:version => 20150505025537) do
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.integer "student_idCopy"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
|
add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
|
||||||
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
|
add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
|
||||||
|
add_index "students_for_courses", ["student_id"], :name => "student_id"
|
||||||
|
|
||||||
create_table "taggings", :force => true do |t|
|
create_table "taggings", :force => true do |t|
|
||||||
t.integer "tag_id"
|
t.integer "tag_id"
|
||||||
|
|
|
@ -267,7 +267,7 @@ Redmine::AccessControl.map do |map|
|
||||||
end
|
end
|
||||||
#by young
|
#by young
|
||||||
Redmine::MenuManager.map :top_menu do |menu|
|
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 :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 :project_deposit, { :controller => 'projects', :action => 'index', :project_type => 0}, :caption => :label_project_deposit
|
||||||
menu.push :software_user, {:controller => 'users', :action => 'index'}
|
menu.push :software_user, {:controller => 'users', :action => 'index'}
|
||||||
|
@ -336,7 +336,7 @@ end
|
||||||
########fq
|
########fq
|
||||||
Redmine::MenuManager.map :bid_menu do |menu|
|
Redmine::MenuManager.map :bid_menu do |menu|
|
||||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_user_response
|
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' },
|
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||||
end
|
end
|
||||||
|
@ -422,7 +422,7 @@ Redmine::MenuManager.map :course_menu do |menu|
|
||||||
|
|
||||||
end
|
end
|
||||||
Redmine::MenuManager.map :user_menu do |menu|
|
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'},
|
menu.push :user_course, {:controller => 'users', :action => 'user_courses'},
|
||||||
:if => Proc.new {|u| if User.current == u || User.current.admin?
|
:if => Proc.new {|u| if User.current == u || User.current.admin?
|
||||||
membership = u.coursememberships.all
|
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
|
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_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?
|
:if => Proc.new {|u| if User.current.admin?
|
||||||
memberships = u.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
memberships = u.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
|
||||||
else
|
else
|
||||||
|
@ -443,24 +443,24 @@ Redmine::MenuManager.map :user_menu do |menu|
|
||||||
memberships || watch_projects
|
memberships || watch_projects
|
||||||
}
|
}
|
||||||
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
# 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
|
end
|
||||||
Redmine::MenuManager.map :user_enterprise_menu do |menu|
|
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 :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
|
||||||
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
|
end
|
||||||
Redmine::MenuManager.map :user_menu_self do |menu|
|
Redmine::MenuManager.map :user_menu_self do |menu|
|
||||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.project_domain }
|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_name }
|
||||||
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.user_domain}
|
menu.push :user_information, {:controller => 'users', :action => 'info', :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 :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
|
||||||
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
|
end
|
||||||
#end
|
#end
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
* jQuery File Upload Validation Plugin 1.1.3
|
||||||
|
* https://github.com/blueimp/jQuery-File-Upload
|
||||||
|
*
|
||||||
|
* Copyright 2013, Sebastian Tschan
|
||||||
|
* https://blueimp.net
|
||||||
|
*
|
||||||
|
* Licensed under the MIT license:
|
||||||
|
* http://www.opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* global define, require, window */
|
||||||
|
|
||||||
|
(function (factory) {
|
||||||
|
'use strict';
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// Register as an anonymous AMD module:
|
||||||
|
define([
|
||||||
|
'jquery',
|
||||||
|
'./jquery.fileupload-process'
|
||||||
|
], factory);
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
|
// Node/CommonJS:
|
||||||
|
factory(require('jquery'));
|
||||||
|
} else {
|
||||||
|
// Browser globals:
|
||||||
|
factory(
|
||||||
|
window.jQuery
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}(function ($) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Append to the default processQueue:
|
||||||
|
$.blueimp.fileupload.prototype.options.processQueue.push(
|
||||||
|
{
|
||||||
|
action: 'validate',
|
||||||
|
// Always trigger this action,
|
||||||
|
// even if the previous action was rejected:
|
||||||
|
always: true,
|
||||||
|
// Options taken from the global options map:
|
||||||
|
acceptFileTypes: '@',
|
||||||
|
maxFileSize: '@',
|
||||||
|
minFileSize: '@',
|
||||||
|
maxNumberOfFiles: '@',
|
||||||
|
disabled: '@disableValidation'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// The File Upload Validation plugin extends the fileupload widget
|
||||||
|
// with file validation functionality:
|
||||||
|
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
||||||
|
|
||||||
|
options: {
|
||||||
|
/*
|
||||||
|
// The regular expression for allowed file types, matches
|
||||||
|
// against either file type or file name:
|
||||||
|
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||||
|
// The maximum allowed file size in bytes:
|
||||||
|
maxFileSize: 10000000, // 10 MB
|
||||||
|
// The minimum allowed file size in bytes:
|
||||||
|
minFileSize: undefined, // No minimal file size
|
||||||
|
// The limit of files to be uploaded:
|
||||||
|
maxNumberOfFiles: 10,
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Function returning the current number of files,
|
||||||
|
// has to be overriden for maxNumberOfFiles validation:
|
||||||
|
getNumberOfFiles: $.noop,
|
||||||
|
|
||||||
|
// Error and info messages:
|
||||||
|
messages: {
|
||||||
|
maxNumberOfFiles: 'Maximum number of files exceeded',
|
||||||
|
acceptFileTypes: 'File type not allowed',
|
||||||
|
maxFileSize: 'File is too large',
|
||||||
|
minFileSize: 'File is too small'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
processActions: {
|
||||||
|
|
||||||
|
validate: function (data, options) {
|
||||||
|
if (options.disabled) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
var dfd = $.Deferred(),
|
||||||
|
settings = this.options,
|
||||||
|
file = data.files[data.index],
|
||||||
|
fileSize;
|
||||||
|
if (options.minFileSize || options.maxFileSize) {
|
||||||
|
fileSize = file.size;
|
||||||
|
}
|
||||||
|
if ($.type(options.maxNumberOfFiles) === 'number' &&
|
||||||
|
(settings.getNumberOfFiles() || 0) + data.files.length >
|
||||||
|
options.maxNumberOfFiles) {
|
||||||
|
file.error = settings.i18n('maxNumberOfFiles');
|
||||||
|
} else if (options.acceptFileTypes &&
|
||||||
|
!(options.acceptFileTypes.test(file.type) ||
|
||||||
|
options.acceptFileTypes.test(file.name))) {
|
||||||
|
file.error = settings.i18n('acceptFileTypes');
|
||||||
|
} else if (fileSize > options.maxFileSize) {
|
||||||
|
file.error = settings.i18n('maxFileSize');
|
||||||
|
} else if ($.type(fileSize) === 'number' &&
|
||||||
|
fileSize < options.minFileSize) {
|
||||||
|
file.error = settings.i18n('minFileSize');
|
||||||
|
} else {
|
||||||
|
delete file.error;
|
||||||
|
}
|
||||||
|
if (file.error || data.files.error) {
|
||||||
|
data.files.error = true;
|
||||||
|
dfd.rejectWith(this, [data]);
|
||||||
|
} else {
|
||||||
|
dfd.resolveWith(this, [data]);
|
||||||
|
}
|
||||||
|
return dfd.promise();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}));
|
|
@ -1,14 +1,43 @@
|
||||||
$(function() {
|
$(function() {
|
||||||
var $upload_file = $('.upload_file');
|
var $upload_file = $('.upload_file');
|
||||||
|
|
||||||
|
function endsWith(str, suffix) {
|
||||||
|
return str.indexOf(suffix, str.length - suffix.length) !== -1;
|
||||||
|
}
|
||||||
|
var validateImage = function(file) {
|
||||||
|
var types = $upload_file.attr('data-file-type').split(",");
|
||||||
|
var check = false;
|
||||||
|
$.each(types, function(n, e) {
|
||||||
|
if (endsWith(file.name, e)) {
|
||||||
|
check = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!check) {
|
||||||
|
alert($upload_file.attr("data-type-support-message") + $upload_file.attr("data-file-type"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (file.size && file.size > parseInt($upload_file.attr('data-max-file-size'))) {
|
||||||
|
alert($upload_file.attr("data-max-file-size-message"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
$('.upload_file').fileupload({
|
$('.upload_file').fileupload({
|
||||||
url: '/upload_avatar.json?source_type=' + $('.upload_file').attr('data-source-type') +
|
url: '/upload_avatar.json?source_type=' + $('.upload_file').attr('data-source-type') +
|
||||||
'&source_id=' + $('.upload_file').attr('data-source-id'),
|
'&source_id=' + $('.upload_file').attr('data-source-id'),
|
||||||
|
add: function(e, data) {
|
||||||
|
if (!validateImage(data.files[0])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
data.submit();
|
||||||
|
},
|
||||||
formData: function(form) {
|
formData: function(form) {
|
||||||
var data = form.serializeArray();
|
var data = form.serializeArray();
|
||||||
var auth = null;
|
var auth = null;
|
||||||
for (var key in data) {
|
for (var key in data) {
|
||||||
if (data[key].name == "authenticity_token") {
|
if (data[key].name == "authenticity_token") {
|
||||||
auth = data[key];break;
|
auth = data[key];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return [auth];
|
return [auth];
|
||||||
|
|
|
@ -385,3 +385,44 @@ function submitProjectBoard()
|
||||||
$("#message-form").submit();
|
$("#message-form").submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//cookie记忆html区块 显示/隐藏 的代码 start
|
||||||
|
$(function(){
|
||||||
|
var personalized_expand_key = "personalized_expand";
|
||||||
|
function personalized_init(){
|
||||||
|
var personalized_map = cookieget(personalized_expand_key);
|
||||||
|
if(personalized_map!=false){
|
||||||
|
personalized_map = JSON.parse(personalized_map);
|
||||||
|
$("*[nhtype='toggle4cookie']").each(function(){
|
||||||
|
var personalized_id=$(this).data('id');
|
||||||
|
var val = personalized_map[personalized_id];
|
||||||
|
if(val!=undefined && val!=$(this).data('val')){
|
||||||
|
personalized_click($(this),0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function personalized_click(obj,timeout){
|
||||||
|
var target = $(obj.data('target'));
|
||||||
|
var oldval = obj.data('val');
|
||||||
|
var val='';
|
||||||
|
if(oldval=='expand'){val='retract';}else{val='expand';}
|
||||||
|
obj.data('val',val);
|
||||||
|
var personalized_map = cookieget(personalized_expand_key);
|
||||||
|
if(personalized_map == false){
|
||||||
|
personalized_map={};
|
||||||
|
}else{
|
||||||
|
personalized_map = JSON.parse(personalized_map);
|
||||||
|
}
|
||||||
|
var personalized_id=obj.data('id');
|
||||||
|
personalized_map[personalized_id]=val;
|
||||||
|
cookiesave(personalized_expand_key,JSON.stringify(personalized_map));
|
||||||
|
target.toggle(timeout);
|
||||||
|
}
|
||||||
|
$("*[nhtype='toggle4cookie']").click(function(){
|
||||||
|
personalized_click($(this),500);
|
||||||
|
});
|
||||||
|
|
||||||
|
personalized_init();
|
||||||
|
});
|
||||||
|
//cookie记忆html区块 显示/隐藏 的代码 end
|
|
@ -7,6 +7,7 @@ h2, .wiki h1 {font-size: 20px;}
|
||||||
h3, .wiki h2 {font-size: 15px; padding-left: 5px}
|
h3, .wiki h2 {font-size: 15px; padding-left: 5px}
|
||||||
h4, .wiki h3 {font-size: 13px;}
|
h4, .wiki h3 {font-size: 13px;}
|
||||||
h4 {border-bottom: 1px dotted #bbb;}
|
h4 {border-bottom: 1px dotted #bbb;}
|
||||||
|
li{list-style-type:none;}
|
||||||
/*huang*/
|
/*huang*/
|
||||||
/*current position*/
|
/*current position*/
|
||||||
.contest_count{
|
.contest_count{
|
||||||
|
@ -1597,7 +1598,8 @@ blockquote {
|
||||||
margin-right: 0.4em;
|
margin-right: 0.4em;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: "Microsoft YaHei";
|
font-family: "Microsoft YaHei";
|
||||||
background: url('../images/requirements/reference.jpg')
|
background: url('../images/requirements/reference.jpg');
|
||||||
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
blockquote blockquote { margin-left: 0;}
|
blockquote blockquote { margin-left: 0;}
|
||||||
|
@ -2779,4 +2781,4 @@ div.repos_explain{
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
.upload_img img{max-width: 580px;}
|
.upload_img img{max-width: 100%;}
|
||||||
|
|
|
@ -487,6 +487,7 @@ blockquote {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: "Microsoft YaHei";
|
font-family: "Microsoft YaHei";
|
||||||
background: url('../images/requirements/reference.jpg');
|
background: url('../images/requirements/reference.jpg');
|
||||||
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
|
a.member_search_edit {width: 43px;background: #15bccf;color: #fff;text-align: center;text-decoration: none;padding: 2px;}
|
||||||
.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
|
.min_search_edit {width: 150px;height: 20px;border: 1px solid #d0d0d0 !important;color: #666;}
|
||||||
|
|
|
@ -388,6 +388,7 @@ blockquote {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-family: "Microsoft YaHei";
|
font-family: "Microsoft YaHei";
|
||||||
background: url(http://test.forge.trustie.net/images/requirements/xreference.jpg.pagespeed.ic.h4inUJNyH0.jpg);
|
background: url(http://test.forge.trustie.net/images/requirements/xreference.jpg.pagespeed.ic.h4inUJNyH0.jpg);
|
||||||
|
background-size: 100% 100%;
|
||||||
}
|
}
|
||||||
/*上传项目图片*/
|
/*上传项目图片*/
|
||||||
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
.upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
#coding=utf-8
|
||||||
|
#
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :course do
|
||||||
|
name 'name'
|
||||||
|
time '2015'
|
||||||
|
term 'term'
|
||||||
|
class_period 1
|
||||||
|
password '111'
|
||||||
|
description 'description'
|
||||||
|
is_public 1
|
||||||
|
open_student 1
|
||||||
|
association :teacher, factory: :user
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
factory :user do
|
factory :user do
|
||||||
login "ExampleUser"
|
login "factoryuser"
|
||||||
mail "user@example.com"
|
mail "user@example.com"
|
||||||
password "foobar"
|
password "foobar111"
|
||||||
password_confirmation "foobar"
|
password_confirmation "foobar111"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
|
@ -29,6 +29,10 @@ RSpec.configure do |config|
|
||||||
# instead of true.
|
# instead of true.
|
||||||
config.use_transactional_fixtures = true
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
config.before(:suite) do
|
||||||
|
require_relative "seeds"
|
||||||
|
end
|
||||||
|
|
||||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||||
# based on their file location, for example enabling you to call `get` and
|
# based on their file location, for example enabling you to call `get` and
|
||||||
# `post` in specs under `spec/controllers`.
|
# `post` in specs under `spec/controllers`.
|
||||||
|
|
|
@ -1,6 +1,22 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
require 'shared_account_spec'
|
||||||
|
|
||||||
RSpec.describe "Account request", :type => :request do
|
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
|
describe "用户登录" do
|
||||||
let(:user){FactoryGirl.create(:user)}
|
let(:user){FactoryGirl.create(:user)}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
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[:class_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{expect(assigns(:course)).to be_instance_of(Course)}
|
||||||
|
it{expect(response).to redirect_to(settings_course_url(assigns(:course), course_type: 1))}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "配置课程" do
|
||||||
|
let (:course) {FactoryGirl.create(:course)}
|
||||||
|
|
||||||
|
context "修改课程图片" do
|
||||||
|
include Rack::Test::Methods
|
||||||
|
let(:avatar) {Rack::Test::UploadedFile.new("#{Rails.root}/spec/fixtures/test.jpg",'image/jpg')}
|
||||||
|
context "正常图片上传成功" do
|
||||||
|
subject(:resp) {post upload_avatar_path(source_type: 'Course', source_id: course.id, format: :json),"avatar"=>{image: avatar}}
|
||||||
|
it{ expect(subject).to be_ok }
|
||||||
|
it{ expect(subject.body).not_to be_empty }
|
||||||
|
end
|
||||||
|
|
||||||
|
it "不是图片,上传失败"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,6 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe "作业打包下载", :type => :request do
|
||||||
|
describe "单独下载某学生作业" do
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
if Role.count <= 0
|
||||||
|
ActiveRecord::Base.connection.execute(
|
||||||
|
|
||||||
|
%Q{
|
||||||
|
INSERT INTO `roles` (`id`, `name`, `position`, `assignable`, `builtin`, `permissions`, `issues_visibility`)
|
||||||
|
VALUES
|
||||||
|
(1,'Non member',1,1,1,'---\n- :upload_attachments\n- :memos_attachments_download\n- :add_project\n- :projects_attachments_download\n- :add_course\n- :course_attachments_download\n- :view_course_files\n- :add_messages\n- :delete_own_messages\n- :view_calendar\n- :view_documents\n- :view_files\n- :view_gantt\n- :view_issues\n- :save_queries\n- :comment_news\n- :browse_repository\n- :view_changesets\n- :view_time_entries\n- :view_wiki_pages\n- :view_wiki_edits\n','default'),
|
||||||
|
(2,'Anonymous',2,1,2,'---\n- :memos_attachments_download\n- :view_course_files\n- :view_calendar\n- :view_documents\n- :view_files\n- :view_gantt\n- :view_issues\n- :browse_repository\n- :view_changesets\n- :view_time_entries\n- :view_wiki_pages\n- :view_wiki_edits\n','default'),
|
||||||
|
(3,'Manager',3,1,0,'---\n- :upload_attachments\n- :memos_attachments_download\n- :add_project\n- :edit_project\n- :close_project\n- :select_project_modules\n- :manage_members\n- :manage_versions\n- :add_subprojects\n- :is_manager\n- :projects_attachments_download\n- :as_teacher\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :quote_project\n- :manage_boards\n- :add_messages\n- :edit_messages\n- :edit_own_messages\n- :delete_messages\n- :delete_own_messages\n- :view_calendar\n- :view_code_review\n- :add_code_review\n- :edit_code_review\n- :delete_code_review\n- :assign_code_review\n- :code_review_setting\n- :add_documents\n- :edit_documents\n- :delete_documents\n- :view_documents\n- :manage_files\n- :view_files\n- :view_gantt\n- :manage_categories\n- :view_issues\n- :add_issues\n- :edit_issues\n- :manage_issue_relations\n- :manage_subtasks\n- :set_issues_private\n- :set_own_issues_private\n- :add_issue_notes\n- :edit_issue_notes\n- :edit_own_issue_notes\n- :view_private_notes\n- :set_notes_private\n- :move_issues\n- :delete_issues\n- :manage_public_queries\n- :save_queries\n- :view_issue_watchers\n- :add_issue_watchers\n- :delete_issue_watchers\n- :manage_news\n- :comment_news\n- :manage_repository\n- :browse_repository\n- :view_changesets\n- :commit_access\n- :manage_related_issues\n- :log_time\n- :view_time_entries\n- :edit_time_entries\n- :edit_own_time_entries\n- :manage_project_activities\n- :manage_wiki\n- :rename_wiki_pages\n- :delete_wiki_pages\n- :view_wiki_pages\n- :export_wiki_pages\n- :view_wiki_edits\n- :edit_wiki_pages\n- :delete_wiki_pages_attachments\n- :protect_wiki_pages\n','all'),
|
||||||
|
(4,'Developer',4,1,0,'---\n- :add_project\n- :manage_members\n- :manage_versions\n- :projects_attachments_download\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :paret_in_homework\n- :select_contest_modules\n- :quote_project\n- :contest_attachments_download\n- :manage_contestnotifications\n- :notificationcomment_contestnotifications\n- :manage_boards\n- :add_messages\n- :edit_own_messages\n- :delete_own_messages\n- :view_calendar\n- :view_documents\n- :do_dts\n- :manage_files\n- :view_files\n- :view_gantt\n- :manage_categories\n- :view_issues\n- :add_issues\n- :edit_issues\n- :manage_issue_relations\n- :manage_subtasks\n- :set_issues_private\n- :set_own_issues_private\n- :add_issue_notes\n- :edit_own_issue_notes\n- :view_private_notes\n- :set_notes_private\n- :move_issues\n- :manage_public_queries\n- :save_queries\n- :view_issue_watchers\n- :add_issue_watchers\n- :delete_issue_watchers\n- :manage_news\n- :comment_news\n- :manage_repository\n- :browse_repository\n- :view_changesets\n- :commit_access\n- :manage_related_issues\n- :log_time\n- :view_time_entries\n- :edit_own_time_entries\n- :view_wiki_pages\n- :export_wiki_pages\n- :view_wiki_edits\n- :protect_wiki_pages\n','default'),
|
||||||
|
(5,'Reporter',5,1,0,'---\n- :upload_attachments\n- :memos_attachments_download\n- :add_project\n- :projects_attachments_download\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :manage_boards\n- :add_messages\n- :edit_own_messages\n- :delete_own_messages\n- :view_calendar\n- :view_code_review\n- :add_documents\n- :view_documents\n- :view_files\n- :view_gantt\n- :view_issues\n- :add_issues\n- :add_issue_notes\n- :edit_own_issue_notes\n- :save_queries\n- :comment_news\n- :browse_repository\n- :view_changesets\n- :log_time\n- :view_time_entries\n- :view_wiki_pages\n- :export_wiki_pages\n- :view_wiki_edits\n- :edit_wiki_pages\n- :delete_wiki_pages_attachments\n','default'),
|
||||||
|
(7,'TeachingAsistant',6,1,0,'---\n- :add_project\n- :edit_project\n- :manage_members\n- :projects_attachments_download\n- :as_teacher\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :manage_boards\n- :add_messages\n- :delete_own_messages\n- :view_calendar\n- :view_documents\n- :manage_files\n- :view_files\n- :view_gantt\n- :view_issues\n- :add_issues\n- :add_issue_notes\n- :save_queries\n- :manage_news\n- :comment_news\n- :browse_repository\n- :view_changesets\n- :view_time_entries\n- :view_wiki_pages\n- :export_wiki_pages\n- :view_wiki_edits\n- :edit_wiki_pages\n- :delete_wiki_pages_attachments\n','default'),
|
||||||
|
(9,'Teacher',7,1,0,'---\n- :upload_attachments\n- :memos_attachments_download\n- :add_project\n- :edit_project\n- :close_project\n- :select_project_modules\n- :manage_members\n- :manage_versions\n- :add_subprojects\n- :projects_attachments_download\n- :as_teacher\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :manage_boards\n- :add_messages\n- :edit_messages\n- :edit_own_messages\n- :delete_messages\n- :delete_own_messages\n- :view_calendar\n- :add_documents\n- :edit_documents\n- :delete_documents\n- :view_documents\n- :manage_files\n- :view_files\n- :view_gantt\n- :manage_categories\n- :view_issues\n- :add_issues\n- :edit_issues\n- :manage_issue_relations\n- :manage_subtasks\n- :set_issues_private\n- :set_own_issues_private\n- :add_issue_notes\n- :edit_own_issue_notes\n- :view_private_notes\n- :set_notes_private\n- :move_issues\n- :delete_issues\n- :manage_public_queries\n- :save_queries\n- :view_issue_watchers\n- :add_issue_watchers\n- :delete_issue_watchers\n- :manage_news\n- :comment_news\n- :manage_repository\n- :browse_repository\n- :view_changesets\n- :commit_access\n- :manage_related_issues\n- :log_time\n- :view_time_entries\n- :edit_time_entries\n- :edit_own_time_entries\n- :manage_project_activities\n- :manage_wiki\n- :rename_wiki_pages\n- :delete_wiki_pages\n- :view_wiki_pages\n- :export_wiki_pages\n- :view_wiki_edits\n- :edit_wiki_pages\n- :delete_wiki_pages_attachments\n- :protect_wiki_pages\n','default'),
|
||||||
|
(10,'Student',8,1,0,'---\n- :upload_attachments\n- :memos_attachments_download\n- :add_project\n- :projects_attachments_download\n- :as_student\n- :add_course\n- :edit_course\n- :close_course\n- :select_course_modules\n- :view_course_journals_for_messages\n- :course_attachments_download\n- :view_course_files\n- :view_homework_attaches\n- :paret_in_homework\n- :manage_boards\n- :add_messages\n- :edit_own_messages\n- :delete_own_messages\n- :view_calendar\n- :view_documents\n- :view_files\n- :view_gantt\n- :view_issues\n- :add_issues\n- :add_issue_notes\n- :save_queries\n- :comment_news\n- :browse_repository\n- :view_changesets\n- :view_time_entries\n- :view_wiki_pages\n- :view_wiki_edits\n','default');
|
||||||
|
}
|
||||||
|
|
||||||
|
)
|
||||||
|
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