From 902cfdcbe9e4b37d26ee1e0ce6f831124e2c162a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jan 2016 10:29:55 +0800 Subject: [PATCH 01/35] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=88=9B=E5=BB=BA=E5=8A=A8=E6=80=81=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=98=BE=E7=A4=BA=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 9 +-------- app/views/organizations/_org_course_create.html.erb | 6 +----- app/views/organizations/_project_create.html.erb | 6 +----- app/views/projects/_project_create.html.erb | 6 +----- app/views/users/_course_create.html.erb | 6 +----- app/views/users/_project_create.html.erb | 6 +----- 6 files changed, 6 insertions(+), 33 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index 24e955d15..0194a2a9d 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -1,7 +1,6 @@ require 'elasticsearch/model' class Course < ActiveRecord::Base include Redmine::SafeAttributes - include ApplicationHelper STATUS_ACTIVE = 1 STATUS_CLOSED = 5 @@ -71,7 +70,7 @@ class Course < ActiveRecord::Base validates_length_of :description, :maximum => 10000 before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 - after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity + after_update :update_files_public,:update_course_ealasticsearch_index after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index @@ -429,12 +428,6 @@ class Course < ActiveRecord::Base end end end -#动态的更新 -def update_activity - update_course_activity(self.class, self.id) - update_user_activity(self.class, self.id) - update_org_activity(self.class, self.id) -end # Delete the previous articles index in Elasticsearch # Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil diff --git a/app/views/organizations/_org_course_create.html.erb b/app/views/organizations/_org_course_create.html.erb index a5544ab07..dc1e0ee81 100644 --- a/app/views/organizations/_org_course_create.html.erb +++ b/app/views/organizations/_org_course_create.html.erb @@ -17,13 +17,9 @@
<%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %>
-
+
创建时间:<%= format_time(activity.created_at) %>
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %> -
-
- diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb index df43b1af2..baa687107 100644 --- a/app/views/organizations/_project_message.html.erb +++ b/app/views/organizations/_project_message.html.erb @@ -134,6 +134,3 @@ - diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb index adc21fdcc..de0820bff 100644 --- a/app/views/projects/_attachment_acts.html.erb +++ b/app/views/projects/_attachment_acts.html.erb @@ -22,18 +22,14 @@ 发布时间:<%= format_time(activity.created_on) %>

<%= textAreailizable activity, :description %>

-
+
- - - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 7a797535a..2614462d7 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -120,7 +120,4 @@
- - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 5aeaea20e..651a284e4 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -347,5 +347,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 8b28d13e9..5abd08224 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -177,6 +177,4 @@ <% end %> - + diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 606b9aecd..100a1a1bf 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -120,7 +120,4 @@
- - + \ No newline at end of file diff --git a/app/views/users/_course_poll.html.erb b/app/views/users/_course_poll.html.erb index 3e29b255b..970fb516e 100644 --- a/app/views/users/_course_poll.html.erb +++ b/app/views/users/_course_poll.html.erb @@ -55,6 +55,3 @@ <% end %> - diff --git a/app/views/users/_intro_content.html.erb b/app/views/users/_intro_content.html.erb index d5806c078..668a26cec 100644 --- a/app/views/users/_intro_content.html.erb +++ b/app/views/users/_intro_content.html.erb @@ -1,4 +1,4 @@ -
+
<%= content.to_s.html_safe%>
@@ -8,5 +8,6 @@ var postContent = $("#intro_content_<%= user_activity_id%>").html(); postContent = postContent.replace(/ /g," "); $("#intro_content_<%= user_activity_id%>").html(postContent); + description_show_hide(<%=user_activity_id %>); }); \ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index e342256d4..009e63404 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -151,6 +151,3 @@
- diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index db65562e6..d4a7a9e60 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -167,6 +167,3 @@ - diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 5b109a56d..581bfb53c 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -144,5 +144,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index ee0c5595b..b3e14d174 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -348,5 +348,4 @@ $("#relatePWrap_<%=homework_common.id %>").toggleClass('relatePWrap'); $("#moreProject_<%=homework_common.id %>").show(); }); - $(homework_description_show_hide(<%=homework_common.id %>)); \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 193b358dc..e94954a10 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -23,23 +23,6 @@ function description_show_hide(id){ }); } -function homework_description_show_hide(id){ - showNormalImage('homework_description_'+id); - if($("#intro_content_"+id).height() > 810) { - $("#intro_content_show_"+id).show(); - } - $("#intro_content_show_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_show_"+id).hide(); - $("#intro_content_hide_"+id).show(); - }); - $("#intro_content_hide_"+id).click(function(){ - $("#homework_description_"+id).toggleClass("maxh360"); - $("#intro_content_hide_"+id).hide(); - $("#intro_content_show_"+id).show(); - }); -} - function cleanArray (actual){ var newArray = new Array(); for (var i = 0; i< actual.length; i++){ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index de5190290..810cd0fec 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,7 +1099,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 88a5757ec..b1f950960 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -841,7 +841,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;display: inline} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 46364eee0..c671f30ec 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1109,7 +1109,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em, .homepagePostIntro span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} From c303f7ff3fb07eacca19001491d52b50b579e2dd Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 14:33:31 +0800 Subject: [PATCH 22/35] =?UTF-8?q?=E5=B0=86=E5=88=86=E4=BA=AB=E7=9A=84js?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=BB=9F=E4=B8=80=EF=BC=8C=E5=88=86=E4=BA=AB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=81=E9=80=9A=E7=9F=A5=E7=AD=89=E5=9D=87?= =?UTF-8?q?=E5=8F=AF=E5=A4=8D=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 10 +- app/views/files/_course_list.html.erb | 4 +- app/views/files/_file_tools.html.erb | 4 +- app/views/files/_org_subfield_list.html.erb | 4 +- app/views/files/_tool_settings.html.erb | 4 +- app/views/files/index.html.erb | 98 --------------- app/views/news/index.html.erb | 113 ----------------- app/views/news/index.js.erb | 2 +- .../org_subfields/_show_post_type.html.erb | 115 ----------------- app/views/org_subfields/show.html.erb | 98 --------------- .../organizations/_org_subfield_news.html.erb | 2 +- app/views/users/_course_news.html.erb | 2 +- app/views/users/_project_news.html.erb | 2 +- .../users/_resource_share_for_orgs.html.erb | 4 +- ..._resource_share_for_project_popup.html.erb | 4 +- .../users/_resource_share_popup.html.erb | 4 +- .../users/_share_news_to_course.html.erb | 4 +- app/views/users/_share_news_to_org.html.erb | 4 +- .../users/_share_news_to_project.html.erb | 4 +- app/views/users/user_resource.html.erb | 96 +------------- public/javascripts/application.js | 117 ++++++++++++++++++ 21 files changed, 153 insertions(+), 542 deletions(-) diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 5c9c48904..0962deb10 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -46,15 +46,16 @@ class NewsController < ApplicationController @course = Course.find(params[:course_id]) end if @project + @page = params[:page] ? params[:page].to_i + 1 : 0 scope = @project ? @project.news.visible : News.visible @news_count = scope.count - @news_pages = Paginator.new @news_count, @limit, params['page'] - @offset ||= @news_pages.offset + #@news_pages = Paginator.new @news_count, @limit, params['page'] + #@offset ||= @news_pages.offset @newss = scope.all(:include => [:author, :project], :order => "#{News.table_name}.created_on DESC", - :offset => @offset, - :limit => @limit) + :offset => @page * 10, + :limit => 10) respond_to do |format| format.html { @@ -63,6 +64,7 @@ class NewsController < ApplicationController render :layout => false if request.xhr? } + format.js format.api format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f1d96d22c..47c08d2fb 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -43,7 +43,7 @@ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>