From 0b524b8a407989f008a448f6b9c6662e8ca9b76d Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 5 May 2015 16:29:53 +0800 Subject: [PATCH 01/22] =?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 02/22] 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 03/22] =?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 04/22] =?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 05/22] =?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 06/22] =?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 From c0b78198700562b0a442e51c0d839ea2c51fd3e9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 6 May 2015 14:20:55 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=96=99?= =?UTF-8?q?=E6=97=B6=E6=98=B5=E7=A7=B0=E6=8F=90=E7=A4=BA=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 2 +- config/locales/account/zh.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 785286eea..6c0c3a78a 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -117,7 +117,7 @@
    -

    +

    <%= f.text_field :login, :required => true, :size => 25, :name => "login", :style => 'border:1px solid #d3d3d3;'%> <%= l(:label_max_number) %>
    diff --git a/config/locales/account/zh.yml b/config/locales/account/zh.yml index 97e6ae444..69edc7aa3 100644 --- a/config/locales/account/zh.yml +++ b/config/locales/account/zh.yml @@ -11,7 +11,7 @@ zh: # # 公共变量 # - label_max_number: "登录名是在网站中显示的您的公开标识,只能为英文和数字。" + label_max_number: "登录名是在网站中显示的您的公开标识,只能为下划线、@、.以及英文和数字。" field_login: 登录名 field_password: 密码 From 6bbf8c8f45bbbfc10b9a7cf5696ca820605727cf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 6 May 2015 14:53:25 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E7=95=99=E8=A8=80=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=88=A0=E9=99=A4=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=86=85=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_courses_jours.html.erb | 2 +- app/views/news/_course_show.html.erb | 8 +------- public/stylesheets/courses.css | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 69e600b94..adbbf4780 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -15,7 +15,7 @@ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> - 取  消 + 取  消 <%= l(:button_leave_meassge)%> diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb index 1160f09e3..2ead9173a 100644 --- a/app/views/news/_course_show.html.erb +++ b/app/views/news/_course_show.html.erb @@ -1,9 +1,3 @@ - <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>

    <%= l(:label_course_news) %>

    @@ -39,7 +33,7 @@ <%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>

    - + <%= l(:label_cancel_with_space) %> diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index d93bc8519..bb7294e2e 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -174,7 +174,7 @@ a:hover.work_edit{color: #fff; background: #64bdd9;} .wzan a{ display: block;} a.wzan_img{background:url(images/pic_zan.png) 0 -59px no-repeat; display:block; height:31px; width:30px; color:#fff;} a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;} -.msg_box{ width:670px; height:205px; border-bottom:1px dashed #CCC; padding-top:10px;} +.msg_box{ width:670px; height:225px; border-bottom:1px dashed #CCC; padding-top:10px;} .msg_box h4{ } .msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; } From 4c268b13dd86daf2fbf74ce27ab60d47e237c052 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 6 May 2015 14:55:48 +0800 Subject: [PATCH 09/22] =?UTF-8?q?#2460=E5=8C=BF=E8=AF=84=E5=88=86=E9=85=8D?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/bids/_new_homework_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb index 16f78491b..7a5f628f9 100644 --- a/app/views/bids/_new_homework_form.html.erb +++ b/app/views/bids/_new_homework_form.html.erb @@ -35,7 +35,7 @@

  • - + <%= l(:label_evaluation_description)%>

  • From cba760b8b0815f704e4af79236f71758d3cec6c2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 6 May 2015 15:01:26 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=90=9C=E7=B4=A2=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_course_members.html.erb | 2 +- app/views/projects/_project_members.html.erb | 2 +- app/views/projects/settings/_new_members.html.erb | 2 +- config/locales/projects/zh.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/courses/_course_members.html.erb b/app/views/courses/_course_members.html.erb index 88ac405dc..78dc6c319 100644 --- a/app/views/courses/_course_members.html.erb +++ b/app/views/courses/_course_members.html.erb @@ -21,7 +21,7 @@ <%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>