Merge remote-tracking branch 'origin/szzh' into guange_dev
This commit is contained in:
commit
bd54edd770
|
@ -232,6 +232,7 @@ module Mobile
|
|||
params do
|
||||
requires :token, type: String
|
||||
requires :course_id,type: Integer,desc: '课程id'
|
||||
optional :name,type:String,desc:'课件名称可能包含的字符'
|
||||
end
|
||||
get ":course_id/attachments" do
|
||||
cs = CoursesService.new
|
||||
|
@ -244,6 +245,7 @@ module Mobile
|
|||
params do
|
||||
requires :token,type:String
|
||||
requires :course_id,type:Integer,desc: '课程id'
|
||||
optional :name,type:String,desc:'学生的姓名或者昵称或者学号可能包含的字符'
|
||||
end
|
||||
get ":course_id/members" do
|
||||
cs = CoursesService.new
|
||||
|
|
|
@ -58,12 +58,18 @@ class WelcomeController < ApplicationController
|
|||
else
|
||||
case @first_page.sort_type
|
||||
when 0
|
||||
@my_projects = find_my_projects
|
||||
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
|
||||
@projects = find_miracle_project(10, 3,"created_on desc")
|
||||
#@projects = @projects_all.order("created_on desc")
|
||||
when 1
|
||||
@my_projects = find_my_projects
|
||||
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
#@projects = @projects_all.order("grade desc")
|
||||
when 2
|
||||
@my_projects = find_my_projects
|
||||
@other_projects = @my_projects.count < 9 ? find_miracle_project( 9 - @my_projects.count, 3,"score desc") : []
|
||||
@projects = find_miracle_project(10, 3,"watchers_count desc")
|
||||
#@projects = @projects_all.order("watchers_count desc")
|
||||
|
||||
|
|
|
@ -443,6 +443,10 @@ module WelcomeHelper
|
|||
resultSet.take(limit)
|
||||
end
|
||||
|
||||
def find_my_projects
|
||||
my_projects = User.current.memberships.all(conditions: "projects.project_type = 0")
|
||||
end
|
||||
|
||||
def sort_project_by_hot_rails project_type=0, order_by='score DESC', limit=15
|
||||
# Project.find_by_sql("
|
||||
# SELECT p.id, p.name, p.description, p.identifier, t.project_id
|
||||
|
|
|
@ -433,18 +433,48 @@ class CoursesService
|
|||
result = []
|
||||
@course = Course.find(params[:course_id])
|
||||
@attachments = @course.attachments.order("created_on desc")
|
||||
@attachments.each do |atta|
|
||||
result << {:filename => atta.filename,:description => atta.description,:downloads => atta.downloads,:quotes => atta.quotes.nil? ? 0 :atta.quotes }
|
||||
if !params[:name].nil? && params[:name] != ""
|
||||
@attachments.each do |atta|
|
||||
result << {:filename => atta.filename,
|
||||
:description => atta.description,
|
||||
:downloads => atta.downloads,
|
||||
:quotes => atta.quotes.nil? ? 0 :atta.quotes } if atta.filename.include?(params[:name])
|
||||
|
||||
end
|
||||
else
|
||||
@attachments.each do |atta|
|
||||
result << {:filename => atta.filename,
|
||||
:description => atta.description,
|
||||
:downloads => atta.downloads,
|
||||
:quotes => atta.quotes.nil? ? 0 :atta.quotes }
|
||||
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
# 课程学生列表
|
||||
def course_members params
|
||||
@all_members = student_homework_score(0,params[:course_id], 10,"desc")
|
||||
@all_members = searchmember_by_name(student_homework_score(0,params[:course_id], 10,"desc"),params[:name])
|
||||
end
|
||||
|
||||
private
|
||||
def searchmember_by_name members, name
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
mems = []
|
||||
if name != ""
|
||||
name = name.to_s.downcase
|
||||
members.each do |m|
|
||||
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
|
||||
if(m.user[:login].to_s.downcase.include?(name) || m.user.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
|
||||
mems << m
|
||||
end
|
||||
end
|
||||
else
|
||||
mems = members
|
||||
end
|
||||
mems
|
||||
end
|
||||
def show_homework_info course,bid,current_user,is_course_teacher
|
||||
author_real_name = bid.author.lastname + bid.author.firstname
|
||||
many_times = course.homeworks.index(bid) + 1
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2' %>
|
||||
<%= javascript_include_tag 'project', 'header','select_list_move' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<label class="fl ml3" > <%= l(:field_description) %> :</label>
|
||||
<label class="fl ml3" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="repos_more"><a id="showgithelp" value="hide_help" onclick ="showhelpAndScrollTo('repos_git_more','repos_git_more'); return false;" class="c_dblue lh23">收起Git操作指南</a></div>
|
||||
<div class="repos_more"><a id="showgithelp" value="hide_help" onclick ="showhelpAndScrollTo('repos_git_more'); " class="c_dblue lh23">收起Git操作指南</a></div>
|
||||
<div id="repos_git_more">
|
||||
<br>
|
||||
<div class=" c_dark f14">
|
||||
<p>项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码</p>
|
||||
|
||||
<p>建立版本库文件夹,打开命令行执行如下:</p>
|
||||
<p>项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码。</p>
|
||||
<p>通过cmd命令提示符进入代码对应文件夹的根目录,假设当前用户的登录名为user,版本库名称为demo,需要操作的版本库分支为branch。
|
||||
如果是首次提交代码,执行如下命令:</p>
|
||||
</div>
|
||||
<div class="repos_explain">
|
||||
<p>git init</p>
|
||||
|
@ -46,19 +46,19 @@
|
|||
<p>git commit -m "first commit"</p>
|
||||
|
||||
<p>git remote add origin
|
||||
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git
|
||||
http://user_demo@repository.trustie.net/user/demo.git
|
||||
</p>
|
||||
|
||||
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
|
||||
|
||||
<p>git push -u origin master:master</p>
|
||||
<p>git push -u origin branch:branch</p>
|
||||
</div>
|
||||
<!--repos_explain end-->
|
||||
<div class="c_dark f14">
|
||||
<p>已经有本地库,还没有配置远程地址,打开命令行执行如下:</p>
|
||||
</div>
|
||||
<div class="repos_explain">
|
||||
<p>git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p>
|
||||
<p>git remote add origin http://user_demo@repository.trustie.net/user/demo.git</p>
|
||||
|
||||
<p>git add .</p>
|
||||
|
||||
|
@ -66,14 +66,14 @@
|
|||
|
||||
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
|
||||
|
||||
<p>git push -u origin master:master</p>
|
||||
<p>git push -u origin branch:branch</p>
|
||||
</div>
|
||||
<!--repos_explain end-->
|
||||
<div class="c_dark f14">
|
||||
<p>已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:</p>
|
||||
</div>
|
||||
<div class="repos_explain">
|
||||
<p>git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git</p>
|
||||
<p>git clone http://user_demo@repository.trustie.net/user/demo.git</p>
|
||||
|
||||
<p>git push</p>
|
||||
|
||||
|
@ -87,7 +87,7 @@
|
|||
</div>
|
||||
<div class="repos_explain">
|
||||
<p>git remote add trustie
|
||||
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git
|
||||
http://user_demo@repository.trustie.net/user/demo.git
|
||||
</p>
|
||||
|
||||
<p>git add .</p>
|
||||
|
@ -96,7 +96,7 @@
|
|||
|
||||
<p>git config http.postBuffer 524288000 #设置本地post缓存为500MB</p>
|
||||
|
||||
<p>git push -u trustie master:master</p>
|
||||
<p>git push -u trustie branch:branch</p>
|
||||
|
||||
<p><a href="/users/646" class="c_orange">李海</a>提供</p>
|
||||
</div>
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
</tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -415,3 +415,4 @@ zh:
|
|||
#
|
||||
field_sharing: 共享
|
||||
label_title_code_review: 代码评审
|
||||
label_home_non_project: 您还没有创建项目,您可以查看系统的其它项目!
|
|
@ -0,0 +1,39 @@
|
|||
//保存cookie
|
||||
//n:cookie的名字
|
||||
//v:cookie的值
|
||||
//mins:时间(分钟)
|
||||
//dn:
|
||||
//path:保存路径
|
||||
function cookiesave(n, v, mins, dn, path)
|
||||
{
|
||||
if(n)
|
||||
{
|
||||
|
||||
if(!mins) mins = 365 * 24 * 60;
|
||||
if(!path) path = "/";
|
||||
var date = new Date();
|
||||
|
||||
date.setTime(date.getTime() + (mins * 60 * 1000));
|
||||
|
||||
var expires = "; expires=" + date.toGMTString();
|
||||
|
||||
if(dn) dn = "domain=" + dn + "; ";
|
||||
document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//获取cookie
|
||||
function cookieget(n)
|
||||
{
|
||||
var name = n + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for(var i=0;i<ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(name) == 0){
|
||||
return c.substring(name.length,c.length);}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -61,25 +61,25 @@ function show_more_msg() {
|
|||
|
||||
|
||||
//项目版本库git帮助文档显示
|
||||
function showhelpAndScrollTo(id, focus) {
|
||||
var information = $("#showgithelp");
|
||||
var val = information.attr("value");
|
||||
if (val == "show_help") {
|
||||
$("#showgithelp").text("收起Git操作指南");
|
||||
information.attr("value", "hide_help");
|
||||
$('#' + id).show();
|
||||
if (focus !== null) {
|
||||
$('#' + focus).focus();
|
||||
}
|
||||
$('html, body').animate({scrollTop: $('#' + id).offset().top}, 400);
|
||||
function showhelpAndScrollTo(id) {
|
||||
$('#' + id).toggle();
|
||||
if(cookieget("repositories_visiable") == "true")
|
||||
{
|
||||
cookiesave("repositories_visiable", false,'','','');
|
||||
}
|
||||
else {
|
||||
$("#showgithelp").text("显示Git操作指南");
|
||||
information.attr("value", "show_help");
|
||||
$('#' + id).hide();
|
||||
else
|
||||
{
|
||||
cookiesave("repositories_visiable", true,'','','');
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
if(cookieget("repositories_visiable") == "true")
|
||||
{
|
||||
$('#repos_git_more').hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue