Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
This commit is contained in:
commit
a8d19a119a
|
@ -168,6 +168,14 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "设置教辅"
|
||||||
|
params do
|
||||||
|
|
||||||
|
end
|
||||||
|
post 'set_user_as_assitant' do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
desc "返回单个课程"
|
desc "返回单个课程"
|
||||||
params do
|
params do
|
||||||
requires :id, type: Integer
|
requires :id, type: Integer
|
||||||
|
@ -254,6 +262,18 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc '查看用户历次作业成绩'
|
||||||
|
params do
|
||||||
|
requires :token,type:String
|
||||||
|
requires :member_id,type:Integer,desc:'课程member_id'
|
||||||
|
optional :homeworkName,type:String,desc:'作业名称以及作业名称可能包含的字符'
|
||||||
|
end
|
||||||
|
get '/show_member_score/:member_id' do
|
||||||
|
cs = CoursesService.new
|
||||||
|
homeworkscore = cs.show_member_score params
|
||||||
|
present :data,homeworkscore,with: Mobile::Entities::Homeworkscore
|
||||||
|
present :status,0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -83,6 +83,7 @@ module Mobile
|
||||||
params do
|
params do
|
||||||
requires :name, type: String, desc: '用户名关键字'
|
requires :name, type: String, desc: '用户名关键字'
|
||||||
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:'是否搜索注册用户来作为助教'
|
||||||
end
|
end
|
||||||
get 'search/search_user' do
|
get 'search/search_user' do
|
||||||
us = UsersService.new
|
us = UsersService.new
|
||||||
|
|
|
@ -37,7 +37,6 @@ module Mobile
|
||||||
f.send(:attachments)
|
f.send(:attachments)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#homework_attach_expose :user
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class Homeworkscore < Grape::Entity
|
||||||
|
include Redmine::I18n
|
||||||
|
include ApplicationHelper
|
||||||
|
def self.homeworkscore_expose(field)
|
||||||
|
expose field do |f,opt|
|
||||||
|
if f.is_a?(Hash) && f.key?(field)
|
||||||
|
f[field]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
homeworkscore_expose :name
|
||||||
|
homeworkscore_expose :score
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -28,6 +28,7 @@ module Mobile
|
||||||
end
|
end
|
||||||
member_expose :student_id
|
member_expose :student_id
|
||||||
member_expose :score
|
member_expose :score
|
||||||
|
member_expose :id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -244,12 +244,12 @@ update
|
||||||
|
|
||||||
def show
|
def show
|
||||||
## TODO: the below will move to filter, done.
|
## TODO: the below will move to filter, done.
|
||||||
# if !User.current.member_of?(@project)
|
if !User.current.member_of?(@project)
|
||||||
# if @project.hidden_repo
|
if @project.hidden_repo
|
||||||
# render_403
|
render_403
|
||||||
# return -1
|
return -1
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
#if( !User.current.member_of?(@project) || @project.hidden_repo)
|
#if( !User.current.member_of?(@project) || @project.hidden_repo)
|
||||||
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
|
@repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,18 @@ module RepositoriesHelper
|
||||||
:label => l(:label_git_report_last_commit)
|
:label => l(:label_git_report_last_commit)
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 判断项目是否有主版本库
|
||||||
|
def judge_main_repository(pro)
|
||||||
|
if pro.repositories.blank?
|
||||||
|
return false
|
||||||
|
else
|
||||||
|
pro.repositories.sort.each do |rep|
|
||||||
|
rep.is_default?
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
# def cvs_field_tags(form, repository)
|
# def cvs_field_tags(form, repository)
|
||||||
# content_tag('p', form.text_field(
|
# content_tag('p', form.text_field(
|
||||||
# :root_url,
|
# :root_url,
|
||||||
|
|
|
@ -458,6 +458,21 @@ class CoursesService
|
||||||
@all_members = searchmember_by_name(student_homework_score(0,params[:course_id], 10,"desc"),params[:name])
|
@all_members = searchmember_by_name(student_homework_score(0,params[:course_id], 10,"desc"),params[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show_member_score params
|
||||||
|
@member_score = Member.find(params[:member_id]) if params[:member_id]
|
||||||
|
atta = @member_score.student_homework_score[0]
|
||||||
|
result = []
|
||||||
|
atta.each do |t|
|
||||||
|
if !params[:homeworkName].nil? && params[:homeworkName] != ""
|
||||||
|
result << {:name=>t[:name],:score=>t[:score]} if t[:name].include?(params[:homeworkName])
|
||||||
|
else
|
||||||
|
result << {:name=>t[:name],:score=>t[:score]}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def searchmember_by_name members, name
|
def searchmember_by_name members, name
|
||||||
#searchPeopleByRoles(project, StudentRoles)
|
#searchPeopleByRoles(project, StudentRoles)
|
||||||
|
@ -559,4 +574,6 @@ class CoursesService
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
|
@ -205,10 +205,14 @@ class UsersService
|
||||||
"show_changesets" => true
|
"show_changesets" => true
|
||||||
}
|
}
|
||||||
scope = User.logged.status(status)
|
scope = User.logged.status(status)
|
||||||
watcher = User.watched_by(params[:user_id])
|
if params[:is_search_assitant].nil?
|
||||||
watcher.push(params[:user_id])
|
watcher = User.watched_by(params[:user_id])
|
||||||
search_by = params[:search_by] ? params[:search_by] : "0"
|
watcher.push(params[:user_id])
|
||||||
scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present?
|
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?
|
||||||
|
end
|
||||||
scope
|
scope
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,16 +34,17 @@
|
||||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.member_of?(@project) %>
|
<% if User.current.member_of?(@project) %>
|
||||||
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end%>
|
<% end %>
|
||||||
<% unless @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
|
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
|
||||||
|
<% unless @project.hidden_repo || @project.enabled_modules.where("name = 'repository'").empty? || @project.repositories.count == 0 %>
|
||||||
<div class="subNav">
|
<div class="subNav">
|
||||||
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
<%= link_to l(:project_module_repository), {:controller => 'repositories', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
|
||||||
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
<a class="subnav_num">(<%= @project.repositories.count %>)</a>
|
||||||
</div>
|
</div>
|
||||||
<% end %><!--meny end -->
|
<% end %><!--meny 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" onclick="$('#navContent').toggle(500);" id="expand_tools_expand"><%= l(:label_project_more) %></div>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.member_of?(@project) %>
|
<% if User.current.member_of?(@project) %>
|
||||||
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
|
@ -34,7 +34,7 @@
|
||||||
<a class="subnav_num">(<%= attaments_num %>)</a>
|
<a class="subnav_num">(<%= attaments_num %>)</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current.member_of?(@project) %>
|
<% if User.current.member_of?(@project) %>
|
||||||
<%= link_to "+"+l(:label_upload_files), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end%>
|
<% end%>
|
|
@ -72,20 +72,22 @@
|
||||||
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
|
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li >
|
<% unless judge_main_repository(@project) %>
|
||||||
<label class="label02"><%=l(:field_repository_is_default)%>:</label>
|
<li>
|
||||||
<%= f.check_box :is_default, :label => "" %></p>
|
<label class="label02"><%=l(:field_repository_is_default)%>:</label>
|
||||||
</li>
|
<%= f.check_box :is_default, :label => "" %></p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<li >
|
<li >
|
||||||
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%>:</label>
|
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%>:</label>
|
||||||
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>""%>
|
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
|
||||||
<% unless @repository.identifier_frozen? %>
|
<% unless @repository.identifier_frozen? %>
|
||||||
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info)%></span>
|
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
<li >
|
<li >
|
||||||
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
|
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
|
||||||
<%= f.password_field :upassword, :label=> "" %>
|
<%= f.password_field :upassword, :label=> "", :no_label => true %>
|
||||||
<span class="c_grey"><%= l(:label_upassword_info)%></span>
|
<span class="c_grey"><%= l(:label_upassword_info)%></span>
|
||||||
</li>
|
</li>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -152,9 +152,6 @@
|
||||||
|
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= stylesheet_link_tag "scm" %>
|
<%= stylesheet_link_tag "scm" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -124,6 +124,7 @@ zh:
|
||||||
#
|
#
|
||||||
lable_file_sharingarea: 资源共享区
|
lable_file_sharingarea: 资源共享区
|
||||||
|
|
||||||
|
label_upload_source: 上传资源
|
||||||
label_upload_files: 上传文件
|
label_upload_files: 上传文件
|
||||||
label_slected_to_other_project: 选入我的其他项目
|
label_slected_to_other_project: 选入我的其他项目
|
||||||
label_slected_to_project: 选入我的项目
|
label_slected_to_project: 选入我的项目
|
||||||
|
|
10
db/schema.rb
10
db/schema.rb
|
@ -659,6 +659,16 @@ 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"
|
||||||
|
|
Loading…
Reference in New Issue