From 84703a3e0174a646fb5d98c064e10d24e0ab5628 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 18 Mar 2016 16:35:36 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=EF=BC=8C?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E4=BD=BF=E7=94=A8https://www=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 ++++ app/helpers/org_member_helper.rb | 2 +- app/views/organizations/setting.html.erb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a5cdb1a1..0c2b14277 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3044,3 +3044,7 @@ def is_default_field? field (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default' end +def host_with_protocol + return Setting.protocol + "://" + Setting.host_name +end + diff --git a/app/helpers/org_member_helper.rb b/app/helpers/org_member_helper.rb index fd70a0516..e16051eaf 100644 --- a/app/helpers/org_member_helper.rb +++ b/app/helpers/org_member_helper.rb @@ -9,7 +9,7 @@ module OrgMemberHelper principals = paginateHelper scope,10 s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| - link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true + link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true } s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" ) end diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 3ef5d547c..af06c4c22 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -96,7 +96,7 @@

添加成员

<%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%> - <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %> + <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%= find_user_not_in_current_org_by_name(@project) %>
From 4fa128841174d4eba336f33e7bfd58bedeb96468 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 21 Mar 2016 12:29:25 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=90=8E=EF=BC=8C=E6=A0=8F=E7=9B=AE=E5=AD=90?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E8=BE=93=E5=85=A5=E6=A1=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_subfields/create.js.erb | 7 +++---- app/views/organizations/setting.html.erb | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 84b69717a..3e08d9f9e 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,7 +4,6 @@ :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); - $("#subfield_name").val(""); -<% else %> - $("#subfield_name").val(""); -<% end %> \ No newline at end of file +<% end %> +$("#subfield_name").val(""); +$("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index af06c4c22..854c7d12e 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -129,7 +129,7 @@

域名目录(用户自定义url,可选)

<% if domain %> - <%= domain.subname %>.trustie.net/ + <%= domain.subname %>.trustie.net/ <% else %> 您还没有子域名,请先在左侧信息栏申请子域名 <% end %> From 675b1ad40392e805a84c67a5d28d622940208e6e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 22 Mar 2016 13:51:19 +0800 Subject: [PATCH 03/19] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E8=BE=93=E5=85=A5=E7=BB=84=E7=BB=87=E5=90=8D?= =?UTF-8?q?=E5=AD=97=E3=80=81=E5=AD=90=E6=A0=8F=E7=9B=AE=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8E=EF=BC=8C=E8=87=AA=E5=8A=A8=E5=8F=98?= =?UTF-8?q?=E6=88=90=E5=B0=8F=E5=86=99=E5=AD=97=E6=AF=8D=EF=BC=9B2.?= =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89=E5=AD=90=E5=9F=9F=E5=90=8D=E5=8F=8A?= =?UTF-8?q?=E5=9F=9F=E5=90=8D=E7=9B=AE=E5=BD=95=E6=94=B9=E6=88=90=E5=B0=8F?= =?UTF-8?q?=E5=86=99=EF=BC=9B3.=E7=BB=84=E7=BB=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AD=90=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E7=82=B9?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=EF=BC=8C=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BF=9D=E6=8C=81=E4=B8=8D=E5=8F=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 2 +- .../organizations/_subfield_list.html.erb | 11 +++++- app/views/organizations/setting.html.erb | 35 +++++++++++++------ ...2032610_change_domain_name_to_lowercase.rb | 14 ++++++++ 4 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20160322032610_change_domain_name_to_lowercase.rb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index ba4c1f18f..bc339319b 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -11,7 +11,7 @@ class OrgSubfieldsController < ApplicationController sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" if SubfieldSubdomainDir.find_by_sql(sql).count == 0 - SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir]) + SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) end end @subfield.update_attributes(:field_type => params[:field_type]) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 0d490df77..133217c70 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -54,7 +54,7 @@
<% end %> <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %> @@ -85,6 +85,9 @@ url: "/org_subfields/" + field_id + "?name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -109,6 +112,9 @@ url: "/org_subfields/" + field_id + "/update_sub_dir?sub_dir_name=" + input_value, type: 'put' }); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } $(show_id).show(); $(edit_id).hide(); @@ -134,6 +140,9 @@ type: 'put' }); } + else{ + $(edit_id).children("input").val($(show_id).html().trim()); + } } else { diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 854c7d12e..ce02a0557 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -57,7 +57,7 @@
组织URL:
http:// - + .trustie.net申请 <% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %> <% if domain.present? and record.present? and record.content == domain.subname %> @@ -129,9 +129,9 @@

域名目录(用户自定义url,可选)

<% if domain %> - <%= domain.subname %>.trustie.net/ + <%= domain.subname %>.trustie.net/ <% else %> - 您还没有子域名,请先在左侧信息栏申请子域名 + 您还没有子域名,请先在左侧信息栏申请子域名 <% end %>
@@ -195,12 +195,25 @@ } } -// $(document).ready(function(){ -// if ( $("#is_public").attr("checked") != true){ -// alert($(this).attr("checked")); -// $("#allow_download").attr("checked", false); -// $("#allow_download").attr("disabled", true); -// $("#allow_down_hint").html(""); -// } -// }); + //输入子域名或者二级目录,自动将输入换成小写 + function observe_input_to_lowercase(id){ + $(id).each(function(){ + var $this = $(this); + var old_input = $this.val(); + var check=function(){ + var val = $this.val(); + if ( old_input != val){ + $this.val(val.toLowerCase()); + old_input = val.toLowerCase(); + } + }; + var reset = function() { + if (timer) { + clearInterval(timer); + } + }; + var timer = setInterval(check, 300); + $this.bind('blur', reset); + }); + } \ No newline at end of file diff --git a/db/migrate/20160322032610_change_domain_name_to_lowercase.rb b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb new file mode 100644 index 000000000..35a82477d --- /dev/null +++ b/db/migrate/20160322032610_change_domain_name_to_lowercase.rb @@ -0,0 +1,14 @@ +class ChangeDomainNameToLowercase < ActiveRecord::Migration + def up + Secdomain.all.each do |domain| + domain.update_attribute(:subname, domain.subname.downcase) + end + + SubfieldSubdomainDir.all.each do |dir| + dir.update_attribute(:name, dir.name.downcase) + end + end + + def down + end +end From fcb189d874d854938cfba19ec276b60f1b38936f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 22 Mar 2016 14:10:36 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E9=A1=BA=E5=BA=8F=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_subfield_list.html.erb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 133217c70..d907ac33e 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -134,19 +134,13 @@ function update_priority(show_id, edit_id, field_id, input_value){ var re = /^[0-9]*[1-9]*[0-9]$/ if(re.test(input_value) && $(show_id).html().trim() != input_value.trim() && input_value.trim() != ''){ - if(confirm("确定修改为" + input_value + "?")){ - $.ajax({ - url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, - type: 'put' - }); - } - else{ - $(edit_id).children("input").val($(show_id).html().trim()); - } + $.ajax({ + url: "/org_subfields/" + field_id + "/update_priority?priority=" + input_value, + type: 'put' + }); } - else - { - $(edit_id).find("input").val($(show_id).html().trim()); + else{ + $(edit_id).children("input").val($(show_id).html().trim()); } $(show_id).show(); $(edit_id).hide(); From f90b25b23044091eb60aefefcd309589f715faaa Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 22 Mar 2016 15:50:06 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E5=90=8D=E7=9C=81=E7=95=A5=E5=8F=B7?= =?UTF-8?q?=E5=A4=AA=E6=97=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_activity_attach.html.erb | 4 ++-- public/stylesheets/courses.css | 1 + public/stylesheets/new_user.css | 1 + public/stylesheets/public.css | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 32e796382..3cc429185 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,14 +3,14 @@
- <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true -%> ( <%= number_to_human_size attachment.filesize %>) - <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, + <%= link_to h(truncate(attachment.author.name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>, <%= format_time(attachment.created_on) %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 7dd3fd74f..b4d07f64f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -419,6 +419,7 @@ a:hover.ping_sub{ background:#14a8b9;} /*.ping_distop span a{ float:right; width:20px; height:20px; background:url(images/star.png) -24px 0 no-repeat; margin-right:3px;}*/ .list_style ol li{list-style-type: decimal;margin-left: 20px;} .list_style ul li{list-style-type: disc;margin-left: 20px;} +span.author { font-size: 0.9em; color: #888; } /* 创建作品 work */ .Newwork{ width:668px; height:418px;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 94e3fa85a..c455a5998 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -99,6 +99,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .mr40{ margin-right:40px !important;} .mr65 {margin-right: 65px;} .mw20{ margin: 0 20px;} +.mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mt-20 {margin-top:-20px;} .mt-4 {margin-top: -4px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0a3732ced..9d37dc1cb 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -180,6 +180,7 @@ h4{ font-size:14px; color:#3b3b3b;} .h150{ height:150px;} .p10 {padding-left:10px; padding-right:10px;} .mw360 {max-width: 360px !important;} +.mw380 {max-width: 380px !important;} .mw400 {max-width: 400px !important;} .mh18 {max-height: 18px;} @@ -1136,4 +1137,4 @@ a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repea .mediaIco{margin: 30px 0 30px 20px;width: 200px;} /*排序样式*/ a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} -a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} +a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} From aa1cbcdf878dfb7d01371d33a8e4cf4a37bb67d9 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 22 Mar 2016 16:44:53 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=95=99=E8=A8=80?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8A=A0=E5=85=A5=E4=B8=AA=E4=BA=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +++- app/views/users/_user_activities.html.erb | 4 +++- app/views/users/show.html.erb | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9039fd041..52a610bc5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1223,7 +1223,7 @@ class UsersController < ApplicationController @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" - course_types = "('Message','News','HomeworkCommon','Poll','Course')" + course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" project_types = "('Message','Issue','ProjectCreateInfo')" principal_types = "JournalsForMessage" if params[:type].present? @@ -1236,6 +1236,8 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) when "course_poll" @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) + when "course_journals" + @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) when "project_issue" @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) when "project_message" diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index eb73f9226..83d2527cf 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -69,7 +69,9 @@ <% when 'Poll' %> <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> <% when 'Course'%> - <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %> + <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => user_activity.id} %> + <% when 'JournalsForMessage'%> + <%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %> <% end %> <% end %> <% when 'Project' %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index fa4eaacbe..2fe9ab079 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -14,6 +14,7 @@
  • <%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
  • <%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> +
  • <%= link_to "课程留言", {:controller => "users", :action => "show", :type => "course_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> @@ -30,7 +31,7 @@
    • 更多
    • -
    • <%= link_to "留言动态", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%> +
    • <%= link_to "个人留言", {:controller => "users", :action => "show", :type => "user_journals"}, :class =>"homepagePostTypeMessage postTypeGrey"%>
    • <%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeMine postTypeGrey"%>
    • <%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
    From 6b3e9ba4b307d3056b6a60be4608a5b929e3239e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Mar 2016 14:29:30 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A7=81=E6=9C=89=E6=88=96?= =?UTF-8?q?=E8=80=85=E5=85=AC=E5=BC=80=E9=80=89=E9=A1=B9=EF=BC=8C=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E6=B8=B8=E5=AE=A2=E4=B8=8B=E8=BD=BD=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=8F=8A=E6=97=B6=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/new.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb index e12bf3849..b0c961d82 100644 --- a/app/views/organizations/new.html.erb +++ b/app/views/organizations/new.html.erb @@ -30,7 +30,7 @@
  • - + (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
  • From fe35bb3b44b76e5d8c405f0bc872708dffb721f4 Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 23 Mar 2016 14:42:27 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=89=93=E5=BC=80?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_programing_work_show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 20d6df9ba..6bcda51da 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -59,7 +59,7 @@ <% if x["status"].to_i != 0 %> 测试错误! 您的输出: -
    <%=x["result"]%>
    +
    <%=x["result"].force_encoding("UTF-8")%>
    正确输出:
    <%=x["output"]%>
    From 1579a86f9fbabe0741d8237b6e01fb0cd9f61f42 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 23 Mar 2016 17:19:25 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E8=80=81=E5=B8=88=E7=BB=99=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E7=9A=84=E4=BD=9C=E5=93=81=E6=89=93=E5=88=86=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=AD=A6=E7=94=9F=E5=86=8D=E6=AC=A1=E7=BC=96=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E8=A6=81=E7=BB=99=E8=80=81=E5=B8=88=E5=92=8C=E5=8A=A9?= =?UTF-8?q?=E6=95=99=E5=8F=91=E6=B6=88=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 9 ++++++++ app/controllers/users_controller.rb | 1 + app/helpers/application_helper.rb | 14 ++++++++++++ app/views/users/_user_message_course.html.erb | 22 +++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index a698823e5..9cdb1fc07 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -63,6 +63,13 @@ class StudentWorkController < ApplicationController homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0 end end + + #修改作品提示消息更新 + student_work_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, StudentWork.name, 0) + student_work_messages.each do |message| + message.update_attribute(:viewed, true) + end + # 作品打分消息状态更新 studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0) studentworks_scores.each do |studentworks_score| @@ -369,6 +376,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + #如果学生作品被打分后修改,应该给老师提示 + send_message_to_teacher(@work) if @homework.homework_type == 3 @student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d05867427..d9a0709b9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -717,6 +717,7 @@ class UsersController < ApplicationController end student_work.save + send_message_to_teacher(student_work) homework.update_attributes(:updated_at => Time.now) update_course_activity(homework.class,homework.id) update_user_activity(homework.class,homework.id) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3a5cdb1a1..1d1a68c72 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2137,6 +2137,20 @@ module ApplicationHelper end + #如果学生作品被打分后修改,应该给老师提示 + def send_message_to_teacher student_work + if StudentWork === student_work + if student_work.student_works_scores.any? + course = student_work.homework_common.course + course.members.map(&:user_id).uniq.each do|user_id| + if User.find(user_id).allowed_to?(:as_teacher, course) + student_work.course_messages << CourseMessage.new(:user_id => user_id, :course_id => course.id, :viewed => false, :status => 1) + end + end + end + end + end + private def wiki_helper diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 7de1ce417..45d833a9a 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -424,6 +424,28 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + + <% if ma.course_message_type == "StudentWork" && ma.status == 1 %> +
      +
    • + <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %> +
    • +
    • + <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "同学", + user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> + ">重新提交了作品: +
    • +
    • + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.homework_common_id), + :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%#= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %> + + +
    • +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> <% if ma.course_message_type == "Course" %>
      From 3fc988757c9889d89fb2d3db0e3a558cb1fe3535 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Mar 2016 10:14:25 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E7=BB=84=E7=BB=87=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E3=80=81=E8=AF=BE=E7=A8=8B=E7=AD=89=E5=9C=A8=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6'=5F'?= =?UTF-8?q?=E3=80=81=E2=80=98/=E2=80=99=E6=B7=BB=E5=8A=A0=E8=BD=AC?= =?UTF-8?q?=E4=B9=89=EF=BC=8C=E4=BD=BF=E8=83=BD=E5=A4=9F=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/principal.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/principal.rb b/app/models/principal.rb index dd376f609..c027f020e 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -42,9 +42,9 @@ class Principal < ActiveRecord::Base if q.blank? where({}) else - pattern = "%#{q}%" + pattern = "%#{q}%".gsub("/","//").gsub("_","/_") # sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ") - sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)" + sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p) escape '/'" params = {:p => pattern} if q =~ /^(.+)\s+(.+)$/ a, b = "#{$1}%", "#{$2}%" @@ -52,7 +52,7 @@ class Principal < ActiveRecord::Base sql << " OR (LOWER(#{table_name}.firstname) LIKE LOWER(:b) AND LOWER(#{table_name}.lastname) LIKE LOWER(:a))" params.merge!(:a => a, :b => b) end - where(sql, params) +p where(sql, params) end } From 589f939bbd1a0ac148b280fee7957ff09fd2382b Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Mar 2016 11:39:38 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E2=80=9C=E5=AD=A6=E7=94=9F=E5=86=8D=E6=AC=A1=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E2=80=9D=E4=B8=AD=E7=9A=84=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=EF=BC=8C=E5=BA=94=E8=AF=A5=E6=89=93=E5=BC=80=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/principal.rb | 2 +- app/views/student_work/_student_work_list.html.erb | 4 ++-- app/views/users/_user_message_course.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/principal.rb b/app/models/principal.rb index c027f020e..2c8465538 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -52,7 +52,7 @@ class Principal < ActiveRecord::Base sql << " OR (LOWER(#{table_name}.firstname) LIKE LOWER(:b) AND LOWER(#{table_name}.lastname) LIKE LOWER(:a))" params.merge!(:a => a, :b => b) end -p where(sql, params) + where(sql, params) end } diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index f9f55456b..8b2f57723 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -46,8 +46,8 @@ <% end%> -
      +
      +
      <%= OrgSubfield.try(:find, params[:field_id]).try(:name) %>
      +
      +
      <%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
      diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 53003c85a..7e49d1780 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -63,7 +63,7 @@
        - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
      @@ -77,7 +77,7 @@
        - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.where("status=1").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
    diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index e3ed492a0..cf68d71f5 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -10,6 +10,9 @@ TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %> + <% if @organization.home_id == document.id %> + 已设为首页 + <% end %>
    <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
    diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 3ef5d547c..c5bb96750 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -19,8 +19,11 @@ '<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id ) } - function update_org(id){ - check_uniq(id); + function update_org(id, old_value, input_value){ + if (old_value == input_value) + { + check_uniq(id); + } if( $checkName){ $("#edit_organization_"+id).submit(); } @@ -77,7 +80,7 @@  允许游客下载 <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %>
    - 保存 + 保存 <% end %>
    diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index b1f2900c9..ccd329852 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -370,7 +370,7 @@ ">回复了作品评论:
  • - <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> + <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id,:show_work_id => ma.course_message.jour.student_work_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %> diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js index 3a05c909d..7c2f1c0cf 100644 --- a/public/javascripts/des_kindEditor.js +++ b/public/javascripts/des_kindEditor.js @@ -131,7 +131,7 @@ function init_des_data(){ }); params.submit_btn.click(function () { params.editor.sync(); - params.form[0].submit(); + params.form.submit(); }); params.textarea.data('init', 1); $(this).show(); From 7108e6d763d97be0aaba63088b890b60034900bc Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 09:22:05 +0800 Subject: [PATCH 13/19] =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=9F=A5=E8=AF=A2=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 123f1fc96..ed7dad53f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1213,8 +1213,8 @@ class UsersController < ApplicationController params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false) join_course_messages.update_all(:viewed => true) end - shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) - shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) + shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id) + shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id) @page = params[:page] ? params[:page].to_i + 1 : 0 user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")" user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")" From 04b4823ac21c15ec13719ed9b9ce328434941c1b Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 10:27:28 +0800 Subject: [PATCH 14/19] =?UTF-8?q?user=5Factivities=20=E5=8A=A0cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_activities.html.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index eb73f9226..5061acbc1 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -56,6 +56,7 @@ <% unless user_activity.act_type == "ProjectCreateInfo" %> <% act= user_activity.act %> + <% cache (user_activity) do %> <% case user_activity.container_type.to_s %> <% when 'Course' %> <% if act %> @@ -100,9 +101,11 @@ <% end %> <% end %> <% end %> + <% end %> <% else %> <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %> <% end %> + <% end %> <% end %> From bd5dd24164f67ac3265c631f6a6483333df28566 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 10:55:08 +0800 Subject: [PATCH 15/19] add alias name to farge_activitiy index --- db/migrate/20160324074942_add_index_to_forge_activities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20160324074942_add_index_to_forge_activities.rb b/db/migrate/20160324074942_add_index_to_forge_activities.rb index 5623e8056..b53c98c94 100644 --- a/db/migrate/20160324074942_add_index_to_forge_activities.rb +++ b/db/migrate/20160324074942_add_index_to_forge_activities.rb @@ -1,5 +1,5 @@ class AddIndexToForgeActivities < ActiveRecord::Migration def change - add_index :forge_activities, [:project_id, :forge_act_id, :created_at] + add_index :forge_activities, [:project_id, :forge_act_id, :created_at], :name => 'forge_cat_project_id' end end From 5cc31fb51130fe36a1decea007e9e774e99684dd Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 25 Mar 2016 12:30:33 +0800 Subject: [PATCH 16/19] =?UTF-8?q?=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=B8=A6=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E6=9D=A1=E4=BB=B6=EF=BC=8C=E5=A6=82tag=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E3=80=81=E6=90=9C=E7=B4=A2=E6=9D=A1=E4=BB=B6=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_order_filter.html.erb | 9 +++++++++ app/views/files/_subfield_files.html.erb | 12 ++---------- app/views/files/search_files_in_subfield.js.erb | 2 ++ .../files/search_org_subfield_tag_attachment.js.erb | 4 +++- public/javascripts/des_kindEditor.js | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 app/views/files/_org_order_filter.html.erb diff --git a/app/views/files/_org_order_filter.html.erb b/app/views/files/_org_order_filter.html.erb new file mode 100644 index 000000000..7fcf115f8 --- /dev/null +++ b/app/views/files/_org_order_filter.html.erb @@ -0,0 +1,9 @@ +<% if @order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort => "created_on:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort => "downloads:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort => "quotes:desc", :order => order,:tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 +<% else %> + 按 <%= link_to "时间",params.merge(:sort => "created_on:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort => "downloads:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort =>"quotes:asc", :order => order, :tag_name => tag_name,:name => search_name),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 +<% end %> \ No newline at end of file diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb index 9e0dd41d0..516e42c68 100644 --- a/app/views/files/_subfield_files.html.erb +++ b/app/views/files/_subfield_files.html.erb @@ -56,16 +56,8 @@
  • 共有 <%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %> 个资源

    -

    - <% if @order == "asc" %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 - <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %>  /  - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 - <% end %> +

    + <%= render :partial => 'files/org_order_filter', :locals => {:order => @order, :sort => @sort, :tag_name => @tag_name, :search_name => nil} %>

    diff --git a/app/views/files/search_files_in_subfield.js.erb b/app/views/files/search_files_in_subfield.js.erb index 77c364817..f1056debd 100644 --- a/app/views/files/search_files_in_subfield.js.erb +++ b/app/views/files/search_files_in_subfield.js.erb @@ -5,4 +5,6 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); $("#attachment_count").html("<%= @result.count %>"); + $("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter', + :locals => {:sort => @sort, :order => @order, :tag_name => @tag_name, :search_name => @q}) %>"); <% end %> \ No newline at end of file diff --git a/app/views/files/search_org_subfield_tag_attachment.js.erb b/app/views/files/search_org_subfield_tag_attachment.js.erb index fe4aed937..775fd24a4 100644 --- a/app/views/files/search_org_subfield_tag_attachment.js.erb +++ b/app/views/files/search_org_subfield_tag_attachment.js.erb @@ -1,3 +1,5 @@ $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'org_subfield_list', :locals => {org_subfield: @org_subfield,all_attachments: @result,sort:@sort,order:@order,org_subfield_attachments:@searched_attach})%>"); -$("#attachment_count").html("<%= @result.count %>"); \ No newline at end of file +$("#attachment_count").html("<%= @result.count %>"); +$("#org_sort").html("<%= escape_javascript(render :partial => 'org_order_filter', + :locals => {:sort => @sort, :order => @order, :tag_name => @tag_name,:search_name => @q}) %>"); \ No newline at end of file diff --git a/public/javascripts/des_kindEditor.js b/public/javascripts/des_kindEditor.js index 7c2f1c0cf..126d2a334 100644 --- a/public/javascripts/des_kindEditor.js +++ b/public/javascripts/des_kindEditor.js @@ -54,7 +54,7 @@ function nh_check_field(params){ params.content.sync(); if(params.content.isEmpty()){ - params.contentmsg.html('内容不能为空'); + params.contentmsg.html('请输入文章描述'); params.contentmsg.css({color:'#ff0000'}); }else{ params.contentmsg.html('填写正确'); From aeb694a68e3191012f154fc351c87fa62da24e22 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 13:57:00 +0800 Subject: [PATCH 17/19] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E5=88=A0?= =?UTF-8?q?=E9=99=A4blog=5Fcomment=E6=97=B6=E5=88=A0=E9=99=A4user=5Factivi?= =?UTF-8?q?ties=E5=86=85=E5=AE=B9=E3=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 8 ++++---- app/views/users/_user_activities.html.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index 7220eec27..0224a587d 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -71,18 +71,18 @@ class BlogCommentsController < ApplicationController @course.save redirect_to course_path(:id=>params[:course_id]) else - @article.children.delete - @article.delete + @article.children.destroy + @article.destroy redirect_to user_blogs_path(:user_id=>User.current) end else#如果是回复被删, if params[:course_id] #如果带了course_id过来了,那么这是要跳到课程大纲去的 - @article.delete + @article.destroy redirect_to syllabus_course_path(:id=>params[:course_id]) else root = @article.root - @article.delete + @article.destroy redirect_to user_blog_blog_comment_path(:user_id=>root.author_id,:blog_id=>root.blog_id,:id=>root.id) end diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 5061acbc1..6e590d293 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -56,7 +56,7 @@ <% unless user_activity.act_type == "ProjectCreateInfo" %> <% act= user_activity.act %> - <% cache (user_activity) do %> + <% cache (act) do %> <% case user_activity.container_type.to_s %> <% when 'Course' %> <% if act %> From 4f5e0837072af9dde8d831e8c82c17367139e43a Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 16:06:14 +0800 Subject: [PATCH 18/19] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=EF=BC=8C=E7=BC=93=E5=AD=98=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 +- app/views/users/_user_activities.html.erb | 105 +++++++++++----------- 2 files changed, 57 insertions(+), 51 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ed7dad53f..3c779420b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1250,7 +1250,8 @@ class UsersController < ApplicationController # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" # 减少数据库交互 - user_ids = "(" + @user.id.to_s + "," + User.watched_by(@user.id).map{|u| u.id }.join(',') + ")" + watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) + user_ids = "(" + @user.id.to_s + watched_user_ids + ")" watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",") blog_ids = "(" + watched_user_blog_ids + ")" diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 6e590d293..63ae98280 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -54,59 +54,64 @@ sd_create_editor_from_data(<%= user_activity.id %>, null, "100%", "<%= user_activity.class.to_s %>"); }); - <% unless user_activity.act_type == "ProjectCreateInfo" %> - <% act= user_activity.act %> - <% cache (act) do %> - <% case user_activity.container_type.to_s %> - <% when 'Course' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'HomeworkCommon' %> - <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> - <% when 'News' %> - <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% when 'Message'%> - <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> - <% when 'Poll' %> - <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> - <% when 'Course'%> - <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %> - <% end %> - <% end %> - <% when 'Project' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'Issue' %> - <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> - <% when 'Message' %> - <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> - <% when 'ProjectCreateInfo'%> - <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% end %> - <% end %> - <% when 'Principal' %> - <% if act %> - <% case user_activity.act_type.to_s %> - <% when 'JournalsForMessage' %> - <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %> - <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %> + <% if user_activity.act_type == "ProjectCreateInfo" %> + <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %> + <% else %> + <% act= user_activity.act %> + <%if act %> + + <% case user_activity.container_type.to_s %> + <% when 'Course' %> + <% case user_activity.act_type.to_s %> + <% when 'HomeworkCommon' %> + <% cache (act) do %> + <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> + <% end %> + <% when 'News' %> + <% cache [act.id, act.comments.count] do %> + <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> + <% when 'Message'%> + <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> + <% when 'Poll' %> + <%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %> + <% when 'Course'%> + <% cache (act) do %> + <%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %> + <%end%> + <% end %> + <% when 'Project' %> + <% case user_activity.act_type.to_s %> + <% when 'Issue' %> + <% cache [act.id, act.journals.count, act.attachments.count] do%> + <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> + <% end %> + <% when 'Message' %> + <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %> + <% when 'ProjectCreateInfo'%> + <% cache (act) do %> + <%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> + <% end %> + <% when 'Principal' %> + <% case user_activity.act_type.to_s %> + <% when 'JournalsForMessage' %> + <% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %> + <%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %> + <% end %> + <% end %> + <% when 'Blog'%> + <% cache (act) do %> + <% case user_activity.act_type.to_s %> + <% when 'BlogComment' %> + <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> + <% end %> <% end %> - <% end %> + + <% end %> <% end %> - <% when 'Blog'%> - <%if act %> - <% case user_activity.act_type.to_s %> - <% when 'BlogComment' %> - <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> - <% end %> - <% end %> - <% end %> - <% end %> - <% else %> - <%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %> <% end %> - - <% end %> <% end %> <% if user_activities.count == 10%> From 3b48b3add75e3a59b14848a0a2d45703457363ee Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 25 Mar 2016 16:26:33 +0800 Subject: [PATCH 19/19] refactor cache --- app/views/users/_user_activities.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 63ae98280..26090d104 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -68,7 +68,7 @@ <%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %> <% end %> <% when 'News' %> - <% cache [act.id, act.comments.count] do %> + <% cache [act, act.comments.count] do %> <%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> <% end %> <% when 'Message'%> @@ -83,7 +83,7 @@ <% when 'Project' %> <% case user_activity.act_type.to_s %> <% when 'Issue' %> - <% cache [act.id, act.journals.count, act.attachments.count] do%> + <% cache [act, act.journals.count, act.attachments.count] do%> <%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %> <% end %> <% when 'Message' %>