From 6b7a17de8c72a0d9b4110e43aa2e6dbdbf53c09c Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 5 May 2015 14:11:01 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93Git=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 077bccdad..9d545d89a 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -34,9 +34,9 @@

-

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

- -

建立版本库文件夹,打开命令行执行如下:

+

项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码。

+

通过cmd命令提示符进入代码对应文件夹的根目录,假设当前用户的登录名为user,版本库名称为demo,需要操作的版本库分支为branch。 + 如果是首次提交代码,执行如下命令:

git init

@@ -46,19 +46,19 @@

git commit -m "first commit"

git remote add origin - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git + http://user_demo@repository.trustie.net/user/demo.git

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

+

git push -u origin branch:branch

已经有本地库,还没有配置远程地址,打开命令行执行如下:

-

git remote add origin http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+

git remote add origin http://user_demo@repository.trustie.net/user/demo.git

git add .

@@ -66,14 +66,14 @@

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:master

+

git push -u origin branch:branch

已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:

-

git clone http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git

+

git clone http://user_demo@repository.trustie.net/user/demo.git

git push

@@ -87,7 +87,7 @@

git remote add trustie - http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git + http://user_demo@repository.trustie.net/user/demo.git

git add .

@@ -96,7 +96,7 @@

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u trustie master:master

+

git push -u trustie branch:branch

李海提供

From 0b524b8a407989f008a448f6b9c6662e8ca9b76d Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 5 May 2015 16:29:53 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E5=8F=AA=E6=98=BE=E7=A4=BA=E6=88=91=E7=9A=84=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=20=E6=96=B9=E6=B3=95=E5=AE=9A=E4=B9=89=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 6 ++++++ app/helpers/welcome_helper.rb | 4 ++++ app/views/users/user_projects.html.erb | 4 ++-- config/locales/projects/zh.yml | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index f35210f01..6e067fb83 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -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") diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index f6e205e82..4800a949a 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -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 diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 31b66727f..69dda693e 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -39,9 +39,9 @@ - + - + <% end %> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index e371296a5..d89fc33ee 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -415,3 +415,4 @@ zh: # field_sharing: 共享 label_title_code_review: 代码评审 + label_home_non_project: 您还没有创建项目,您可能对系统的其它项目感兴趣! \ No newline at end of file From c60ea1db842f6b817260368fc955577d1af0526a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 5 May 2015 16:33:01 +0800 Subject: [PATCH 3/7] 111 --- db/schema.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 006b26e91..dcbe017fb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -654,16 +654,6 @@ ActiveRecord::Schema.define(:version => 20150428021035) do 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| t.integer "journal_id" t.integer "user_id" From 2e26e272980ac8b1f5c74d48e5e8b06cfe824a21 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 5 May 2015 17:08:46 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=E5=90=8E=E4=B9=8B=E4=BF=9D=E5=AD=98=E5=9C=A8cookie?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=E5=90=8E?= =?UTF-8?q?=E4=BB=8D=E4=BF=9D=E6=8C=81=E6=94=B6=E8=B5=B7=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_projects.html.erb | 2 +- app/views/repositories/show.html.erb | 2 +- public/javascripts/cookie.js | 39 ++++++++++++++++++++++++ public/javascripts/project.js | 30 +++++++++--------- 4 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 public/javascripts/cookie.js diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 64a9111e0..958d62975 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -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 %> <%= yield :header_tags -%> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 9d545d89a..96e3b84be 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -30,7 +30,7 @@

-
收起Git操作指南
+
收起Git操作指南

diff --git a/public/javascripts/cookie.js b/public/javascripts/cookie.js new file mode 100644 index 000000000..9e14ed810 --- /dev/null +++ b/public/javascripts/cookie.js @@ -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 Date: Tue, 5 May 2015 17:19:06 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=BE=E4=BB=B6?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=20=E8=AF=BE=E7=A8=8B=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/courses_service.rb | 36 ++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 42bf8fe3f..94efb375a 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -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 From 3da5fdfa0fb45bebcd912e42774f64863dc32fae Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 5 May 2015 17:19:31 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AF=BE=E4=BB=B6?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=20=E8=AF=BE=E7=A8=8B=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index f7b03947c..0d0c4651f 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -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 From b39e00b5c7f16ff9bcc9c11d72fa67b19830acc3 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 6 May 2015 09:26:14 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA--=E5=86=85=E5=AE=B9=E5=BF=85=E5=A1=AB=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_form_project.html.erb | 2 +- config/locales/projects/zh.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/messages/_form_project.html.erb b/app/views/messages/_form_project.html.erb index 5724acf47..8e72544b5 100644 --- a/app/views/messages/_form_project.html.erb +++ b/app/views/messages/_form_project.html.erb @@ -25,7 +25,7 @@
  • - + <%= 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个英文字符)" %>
    diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index d89fc33ee..c1850b7e4 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -415,4 +415,4 @@ zh: # field_sharing: 共享 label_title_code_review: 代码评审 - label_home_non_project: 您还没有创建项目,您可能对系统的其它项目感兴趣! \ No newline at end of file + label_home_non_project: 您还没有创建项目,您可以查看系统的其它项目! \ No newline at end of file