From 902cfdcbe9e4b37d26ee1e0ce6f831124e2c162a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 15 Jan 2016 10:29:55 +0800 Subject: [PATCH 01/24] =?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/news/show.html.erb b/app/views/news/show.html.erb index 846be063f..4f6ca056e 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -2,6 +2,8 @@ <%= render :partial => 'project_show', locals: {project: @project} %> <% elsif @course %> <%= render :partial => 'course_show', locals: {course: @course} %> +<% elsif @organization %> + <%= render :partial => 'organization_show', :locals => {:org_subfield => @org_subfield} %> <% end %> \ No newline at end of file diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index be212fb29..45721fd1b 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -114,7 +114,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 753 }); - $('#BluePopupBox').parent().css("border","3px solid #269ac9"); + $('#BluePopupBox').parent().resizable("disable"); + $('#BluePopupBox').parent().removeClass("ui-state-disabled"); + $('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.ProBtn').live('click', function(){ $("#BluePopupBox").dialog("open"); @@ -205,7 +207,9 @@ $(function(){ dialogClass: 'BluePopupBox', minWidth: 290 }); - $('#GroupPopupBox').parent().css("border","3px solid #269ac9"); + $('#GroupPopupBox').parent().resizable("disable"); + $('#GroupPopupBox').parent().removeClass("ui-state-disabled"); + $('#GroupPopupBox').parent().css("border","3px solid #269ac9").css("padding","10px"); $('a.groupBtn').live('click', function(){ $("#GroupPopupBox").dialog("open"); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index fb5e64523..64cd2e959 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1,3 +1,4 @@ + /* CSS Document */ /* 2015-06-26 */ body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} @@ -555,7 +556,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no- /*.navHomepageProfile ul li ul {display:none;} .navHomepageProfile ul li:hover ul {display:block;}*/ .homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;} -.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;} +.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px; margin-top:10px;} .homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;} .homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;} .homepagePortraitImage:hover {border:1px solid #269ac9;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 234905c7a..7770fa1ac 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -306,7 +306,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;white-space:nowrap;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;} .bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;white-space:nowrap;} -.grey_border{border:1px solid #dddddd !important; } +.grey_border{border:1px solid #dddddd !important;} /* commonpic */ .pic_date{ display:block; background:url(../images/new_project/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;} .pic_add{ display:block; background:url(../images/new_project/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;} From 3b180aca90990ed1bbd5366e396172577a55e55b Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 20 Jan 2016 18:37:47 +0800 Subject: [PATCH 16/24] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 24 ++++++- app/controllers/words_controller.rb | 6 +- app/views/users/_jour_form.html.erb | 19 ++++++ app/views/users/_user_jours_list.html.erb | 32 +++++++++ app/views/users/user_newfeedback.html.erb | 78 +++++++--------------- app/views/users/user_newfeedback.js.erb | 1 + public/images/mes_icon.png | Bin 0 -> 2459 bytes public/javascripts/new_user.js | 37 ++++++++++ public/stylesheets/share.css | 2 +- 9 files changed, 140 insertions(+), 59 deletions(-) create mode 100644 app/views/users/_jour_form.html.erb create mode 100644 app/views/users/_user_jours_list.html.erb create mode 100644 app/views/users/user_newfeedback.js.erb create mode 100644 public/images/mes_icon.png diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 449d8b9de..b7e507b28 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -746,14 +746,34 @@ class UsersController < ApplicationController end end # end - jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @page = params[:page] ? params[:page].to_i + 1 : 0 + if params[:type].present? + case params[:type] + when "public" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + when "private" + jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + else + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + @jour_count = jours.count + @jour = jours.limit(10).offset(@page * 10) + end + @type = params[:type] if User.current == @user jours.update_all(:is_readed => true, :status => false) jours.each do |journal| fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) end end - @jour = paginateHelper jours,10 @state = false render :layout=>'new_base_user' end diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index ebd46caa7..8115f3f91 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -225,11 +225,11 @@ class WordsController < ApplicationController def leave_user_message if User.current.logged? @user = User.find(params[:id]) - if params[:new_form][:user_message].size>0 && User.current.logged? && @user + if params[:new_form][:content].size>0 && User.current.logged? && @user if params[:private] && params[:private] == '1' - @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1) + @user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1) else - @user.add_jour(User.current, params[:new_form][:user_message]) + @user.add_jour(User.current, params[:new_form][:content]) end end redirect_to feedback_path(@user) diff --git a/app/views/users/_jour_form.html.erb b/app/views/users/_jour_form.html.erb new file mode 100644 index 000000000..13bf6d79a --- /dev/null +++ b/app/views/users/_jour_form.html.erb @@ -0,0 +1,19 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %> + +<%= error_messages_for 'message' %> +
  • + <%= text_area :quote,:quote,:style => 'display:none' %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :content, :editor_id => 'jour_content_editor', + :width => '99.7%', + :height => 40, + :minHeight=>40, + :input_html => { :id => 'jour_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +
  • +
    diff --git a/app/views/users/_user_jours_list.html.erb b/app/views/users/_user_jours_list.html.erb new file mode 100644 index 000000000..cc5a589b5 --- /dev/null +++ b/app/views/users/_user_jours_list.html.erb @@ -0,0 +1,32 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <%#= javascript_include_tag "init_KindEditor","user" %> +<% end %> + +<%if jours %> + <% jours.each do |jour|%> + <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> + + <%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id} %> + <%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <% end %> + <%end%> +<% end%> +<% if (jours.count + page * 10) < count %> + <%= link_to "点击展开更多",feedback_path(@user.id, :type => type, :page => page),:id => "show_more_jours",:remote => "true",:class => "loadMore mt10 f_grey"%> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index 1035f5656..24f625e03 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,68 +1,40 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> - <%= javascript_include_tag "init_KindEditor","user" %> -<% end %> - - -
    +
    -
    留言
    -
    - +
    留言
    +
      +
    • +
        +
      • <%= link_to "全部", {:controller => "users", :action => "user_newfeedback", :type => nil}, :class =>"resourcesTypeAll resourcesGrey"%>
      • +
      • <%= link_to "留言", {:controller => "users", :action => "user_newfeedback", :type => "public"}, :class => "mesIcon resourcesGrey"%>
      • +
      • <%= link_to "私信", {:controller => "users", :action => "user_newfeedback", :type => "private"}, :class => "personalIcon resourcesGrey"%>
      • +
      +
    • +
    +
    -
    -
    - <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> - -

    - -
    - - 留言 - 私信
    - <% end%> -
    -
    - -
    - <%if @jour%> - <% @jour.each do |jour|%> - <% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %> - <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> - <% end %> - <%end%> - <% end%> - -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
    -
    +
    +
    <%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %> +
    + <%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%> + <%=render :partial => "jour_form", :locals => {:f => f} %> + + 留言 + 私信 + <% end %> +
    + <%=render :partial => "users/user_jours_list", :locals => {:jours =>@jour, :page => 0, :type => @type, :count => @jour_count} %>
    - \ No newline at end of file diff --git a/app/views/users/user_newfeedback.js.erb b/app/views/users/user_newfeedback.js.erb new file mode 100644 index 000000000..cfac4cef2 --- /dev/null +++ b/app/views/users/user_newfeedback.js.erb @@ -0,0 +1 @@ +$("#show_more_jours").replaceWith("<%= escape_javascript( render :partial => 'users/user_jours_list',:locals => {:jours => @jour, :page => @page,:type => @type, :count => @jour_count} )%>"); diff --git a/public/images/mes_icon.png b/public/images/mes_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4a37cca0cabf24a62cfcdb371b03e048afd1e5ee GIT binary patch literal 2459 zcmeAS@N?(olHy`uVBq!ia0vp^xeN@9%Q)D8tg;1MQ-PFZiEBhjaDG}zd16s2gJVj5 zQmTSyZen_BP-l zO)W`OsL0L9E4HezRRWu91!RMS^_3LBN=mYAl^~9a@C{IK&M!(;Fx4~GO*SwzR4_Bs zGc++ZGc(jtFfuSS(l-DiGhIUyD^oKoBXb2PPy*Ukl#*r@}n3+2no0=FJx|%v!SeRHkTNpVz zIvW}}SvbS=y5uL9=BDPA!1Sgd^jhH53rY&P1wfl!Qj0RnQd8WD@^clyUbf1_?G{s< z=0WwQ;C71{PQCg-$LND17Ac}(Lcr7mV#1RxkONQnsd>QEUIa|mZ*GYBF)*<4d%8G= zRNQ)V*S{k)ROZ0P>T|W{ditjR7uckvWYCl$sHv;7LC8d@DEPuLo+9OoY8@GY-HSpK zbhEC8X)V-P>|5{2(W}5R*{rSG#Anf_WA?_M-@Pn<-fPwR%%tbNVC}vS_jZ5ZSDyZ$ z#^(FnnT_dMOGAF;PhH?BY~t9gmeIuKdx3>_)&kC1V3FVP3u|{hU#zusmzVFlps8lZ z-(H;LwaV*j%pBV(UiZRQZL;gre>peM@5tSIYNqd(t*Y96(zm92*{RFEpWfWN zW)0saeWqt~gG{|=UAZgQE$_hC3m|g_2r)R-D|9Ndz$zB+1IY$J@>96CUeE_j%llZ9hLZZHTd(|tT_HP zyO|R2vZg)GFZ`WY^}HfSe*UuEmebF9x9ys5ympE2^K`$jab8!IpU?369Co?H{7Ch! zlgmu}kAAZ){1OtZ_P+mb?(_X_bq4~@$Ip#i6S{6rrm&T!sRdvT@8SM9GZ?>!xJQ~3M!W7XG;KUU~`<3IM;UwlUF z{v&snYuj(xSnM+*hM@o za-Y0wIq%m$PsNX2VDY^GOAep}qLx8|h@Skdee1vNHMFtWWEgt2t0MRJ#1e5^#jkdD zAD(~w__6=`n#j#ZKg7+``+2cZnep548#h)hyPX@@_V4A^xAqOY)`j=>_1(+PVDAuH zn{jZL?Uq+T8JBgko%m8$nVL+;|UO}l!E zYcf7Iq(_;y&%7pa>)^R9Chaq)@xEmcS2D~NGxIgxT6N~IdgPA##mMFsr^5@%_bA*1~WUmeaROWxn?I9Z}}3Y`nIUf zGiR-B@v{;sIXSC&#kCsqtOP6G{@+ueb?)b}3w#2(Nl8h^A06#p-z{k(WxT>wy8rg6 zyzMtt9nHew$rzyA^3>W>$9O0^c{=x8E5oZ}@H6eER=4!-9R@n(-Ik zPLr|smhU*s&XoUZ=gu`2ru`Y>3v=H09jm@|d85NknSiesE;MPS%@us>{Lh3Lns=p4 zfVmkIQ}EnOya-BMg9-!G*e6Pa7j7L)J16NPD5VitI~gL28K@8>7y(I!L(q#?DH9^H f(X!&dngUdxCqzGtxt)Lim(^>bP0l+XkKGm_$b literal 0 HcmV?d00001 diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 567d2322f..f273f0b77 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -55,6 +55,43 @@ function show_more_project(url){ ); } +//个人留言 +function jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("0"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function private_jour_submit(){ + if(jourReplyVerify()){ + $("#private_flag").val("1"); + jour_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值 + $("#user_feedback_new").submit(); + } +} + +function jourReplyVerify() { + var content = jour_content_editor.html();//$.trim($("#message_content").val()); + if (jour_content_editor.isEmpty()) { + $("#jour_content_span").text("回复不能为空"); + $("#jour_content_span").css('color', '#ff0000'); + $("#submit_feedback_user").one('click',function() { + jour_submit(); + }); + $("#private_submit_feedback_user").one('click',function() { + private_jour_submit(); + }); + return false; + } + else { + $("#jour_content_span").text("填写正确"); + $("#jour_content_span").css('color', '#008000'); + return true; + } +} + //老师提交 新建/修改 作业 function submit_homework(id){ if(!regex_homework_name()){ diff --git a/public/stylesheets/share.css b/public/stylesheets/share.css index 43e0bc8f6..02d91304f 100644 --- a/public/stylesheets/share.css +++ b/public/stylesheets/share.css @@ -35,7 +35,7 @@ ul.subNavArrow:hover li ul {display:block;} a.mesIcon {background:url(../images/mes_icon.png) -5px -73px no-repeat; padding-left:23px;} a.personalIcon {background:url(../images/mes_icon.png) -6px -16px no-repeat; padding-left:23px;} .mesType {background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 15px; left:-50px; font-size:12px; color:#888888; display:none; line-height:2; z-index:999; white-space:nowrap;} -a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#cecece; padding:3px 10px;} +a.greyBtn2 {float:right; text-align:center; font-size:12px; color:#ffffff; background-color:#aaaaaa; padding:3px 10px;} .PMTag {padding:0px 5px; background-color:#555555; border-radius:3px; color:#ffffff;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} From ece9f9dc6fb65395719072d44b52a1d23975bda9 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 10:33:53 +0800 Subject: [PATCH 17/24] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B9=E5=9D=97=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/news_controller.rb | 15 ++ app/views/news/_project_news.html.erb | 105 +++------ app/views/news/_project_news_detail.html.erb | 56 +++++ app/views/news/_project_news_new.html.erb | 60 +++++ app/views/news/_project_show.html.erb | 223 ++++++++++++++----- app/views/news/edit.html.erb | 4 +- app/views/users/_project_news.html.erb | 141 ++++++++++-- config/routes.rb | 2 + 8 files changed, 453 insertions(+), 153 deletions(-) create mode 100644 app/views/news/_project_news_detail.html.erb create mode 100644 app/views/news/_project_news_new.html.erb diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 8d0309588..5c9c48904 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -155,6 +155,21 @@ class NewsController < ApplicationController #modify by nwb if @project @news = News.new(:project => @project, :author => User.current) + @news.safe_attributes = params[:news] + @news.save_attachments(params[:attachments]) + if @news.save + if params[:asset_id] + ids = params[:asset_id].split(',') + update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS + end + render_attachment_warning_if_needed(@news) + #flash[:notice] = l(:notice_successful_create) + redirect_to project_news_index_url(@project) + else + redirect_to project_news_index_url(@project) + #layout_file = 'base_courses' + #render :action => 'new', :layout => layout_file + end elsif @course @news = News.new(:course => @course, :author => User.current) #render :layout => 'base_courses' diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index efbb74e46..fa2a99cd7 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -1,77 +1,36 @@ - -<% - btn_tips = l(:label_news_new) - label_tips = l(:label_news) -%> -
    -

    <%= label_tips %>

    -
    -
    -

    <%= l(:label_total_news) %><%= @news_count %><%= l(:label_project_new_list) %>

    + + + +
    +
    +
    + 项目通知 +
    +
    <% if @project && User.current.allowed_to?(:manage_news, @project) %> - <%= link_to(btn_tips, new_project_news_path(@project), - :class => 'problem_new_btn fl c_dorange') %> -
    - - <% end %> -
    -
    - -
    - <% if @newss.empty? %> -

    - <%= l(:label_no_data) %> -

    - <% else %> - <% @newss.each do |news| %> -
    - <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
    - <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - <%= l(:label_add_news) %>:<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w_news" %>
    -
    -

    <%=textAreailizable news.description %>

    - - <%= l(:label_create_time) %> :<%= format_time(news.created_on) %> -
    -
    -
    - + <%= labelled_form_for @news, :url =>{:controller=>'news',:action => 'new', :project_id => @project.id}, + :html => {:nhname=>'form',:multipart => true, :id => 'news-form'} do |f| %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => false} %> <% end %> <% end %> + <%= render :partial=> 'project_news_detail',:locals =>{:all_news => @newss, :page => 0} %>
    - -
      - <%= pagination_links_full @news_pages, @news_count, :per_page_links => false, :remote => false, :flag => true%> -
    - - <% other_formats_links do |f| %> - <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> - <% end %> - - <% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> - <%= stylesheet_link_tag 'scm' %> - <% end %> - - <% html_title(l(:label_news_plural)) -%> - - diff --git a/app/views/news/_project_news_detail.html.erb b/app/views/news/_project_news_detail.html.erb new file mode 100644 index 000000000..fdb035bf5 --- /dev/null +++ b/app/views/news/_project_news_detail.html.erb @@ -0,0 +1,56 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false) %> + <%= javascript_include_tag "init_activity_KindEditor" %> +<% end %> + + +<% if all_news %> + <% all_news.each do |news| %> + + <% if news %> + <%= render :partial => 'users/project_news', :locals => {:activity => news, :user_activity_id => news.id} %> + <% end %> + <% end %> + + <% if all_news.count == 10 %> + <%= link_to "点击展开更多",news_index_path(:project_id => @project.id ,:page => page),:id => "show_more_project_news",:remote => "true",:class => "loadMore mt10 f_grey"%> + <% end %> +<% end%> + diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb new file mode 100644 index 000000000..0e9b03c6f --- /dev/null +++ b/app/views/news/_project_news_new.html.erb @@ -0,0 +1,60 @@ +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> + +
    +
    +
    +
    + +

    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/news/_project_show.html.erb b/app/views/news/_project_show.html.erb index 463b0f489..7a62ec314 100644 --- a/app/views/news/_project_show.html.erb +++ b/app/views/news/_project_show.html.erb @@ -1,72 +1,173 @@ -
    -

    <%= l(:label_news) %>

    -
    - -<% if authorize_for('news', 'edit') %> - +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <% end %> -
    - <%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %> -
    -

    <%=h @news.title %>

    - <%#= watcher_link(@news, User.current) %> - <%= link_to(l(:button_edit), - edit_news_path(@news), - :class => 'talk_edit fr', - :accesskey => accesskey(:edit), - :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %> - <%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %> -
    -
    <%= textAreailizable(@news, :description) %>
    - <%= link_to_attachments_course @news %>
    - <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %> - + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %> +
    +
    + <% if User.current.allowed_to?(:manage_news, @project)%> + + <%end%> +
    -
    - -<% if @news.commentable? %> -
    - <%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %> -

    - <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %> -
    - <%= text_area 'comment', 'comments', :rows => 5, :style => "width:98%" %> -
    - <%= l(:label_comment_add) %> +
    + <% if @news.try(:author).try(:realname) == ' ' %> + <%= link_to @news.try(:author), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> + <% else %> + <%= link_to @news.try(:author).try(:realname), user_path(@news.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> <% end %> - <% end %> +
    +
    <%= format_time( @news.created_on)%>
    +
    +
    + <%= @news.description.html_safe%> +
    +
    +
    + <%= link_to_attachments_course @news, :author => false %> +
    -<% comments = @comments.reverse %> -<% comments.each do |comment| %> - <% next if comment.new_record? %> -
    -
    <%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "ping_dispic" %>
    -
    -
    - <%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><%= format_time(comment.created_on) %> +
    +
    +
    +
    + <% unless @comments.empty? %> +
    +
    回复(<%=@comments.count %>)
    +
    +
    +
    + <% @comments.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% if reply.try(:author).try(:realname) == ' ' %> + <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> + <% end %> +
    +
    + <%= reply.comments.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if @news.commentable? %> +
    + +
    +
    + <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %> +
    + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :comments, :editor_id => 'comment_editor', + :owner_id => @comment.nil? ? 0: @comment.id, + :owner_type => OwnerTypeHelper::COMMENT, + :width => '99%', + :height => 100, + :minHeight=>100, + :input_html => { :id => 'comment_content', + :class => 'talk_text fl', + :maxlength => 5000 }%> +
    +

    +

    + + <%= l(:label_cancel_with_space) %> + + + <%= l(:label_comment_with_space) %> + +

    + <% end %>
    -

    <%= textAreailizable(comment.comments) %>

    -
    -
    <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment}, - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:button_delete) %>
    -
    -
    - <% end if @comments.any? %> + <% end %> +
    -<% content_for :header_tags do %> - <%= stylesheet_link_tag 'scm' %> -<% end %> -<% html_title @news.title -%> diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index 24d7f2040..76259f5d7 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -18,8 +18,10 @@ :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> <% if @org_subfield %> <%= render :partial => 'edit_for_org_subfield', :locals => {:f => f, :news => @news} %> - <% else %> + <% elsif @course %> <%= render :partial => 'course_news_new', :locals => {:f => f, :news => @news, :edit_mode => true, :course => @course} %> + <% elsif @project %> + <%= render :partial => 'project_news_new', :locals => {:f => f, :news => @news, :edit_mode => true} %> <% end %> <% end %>
    diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 3ea1479c5..57597d6e4 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -1,29 +1,134 @@ -
    -
    +
    +
    - 用户头像
    + <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> + <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> +
    - - -
    - -
    截止时间:2015-08-20
    +
    + <% if @ctivity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目通知", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
    -
    (作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
    -
    -
    \ No newline at end of file + <% count=activity.comments.count %> +
    +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> + +
    +
    <%#= format_date(activity.updated_on) %>
    + <%if count>3 %> + + <% end %> +
    + + <% replies_all_i = 0 %> + <% if count > 0 %> +
    +
      + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
    • +
      + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
      +
      +
      + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> + + <% if comment.author == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + +
      +
      + <%= comment.comments.html_safe %>
      +
      +
      +
    • + <% end %> +
    +
    + <% end %> + +
    +
    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
    +
    +
    + <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
    + +
    +

    + <% end%> +
    +
    +
    +
    +
    +
    +
    + diff --git a/config/routes.rb b/config/routes.rb index c2b089c02..3531f4b5f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -464,6 +464,8 @@ RedmineApp::Application.routes.draw do get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report' get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details' post '/users/:id/user_activities', :to => 'users#show', :as => "user_activities" + match 'projects/:project_id/news/index', :to => 'news#index', :via => [:get, :post], :as => 'new_course_news' + match 'projects/:project_id/news/new', :to => 'news#new', :via => [:get, :post] post '/courses/:id/course_activity', :to => 'courses#show', :as => 'course_activity' get '/boards/:id/boards_topic', :to =>'boards#show', :as => 'boards_topic' From f15847371c83315e100a21ec05ec7407fd3d1e04 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Jan 2016 10:36:30 +0800 Subject: [PATCH 18/24] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=BF=87=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_activity_attach.html.erb | 2 +- public/stylesheets/new_user.css | 1 + public/stylesheets/public.css | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/attachments/_activity_attach.html.erb b/app/views/attachments/_activity_attach.html.erb index 9bd7d9d2f..32e796382 100644 --- a/app/views/attachments/_activity_attach.html.erb +++ b/app/views/attachments/_activity_attach.html.erb @@ -3,7 +3,7 @@
    - <%= link_to_short_attachment attachment,:length=> 58, :class => 'mw400 hidden link_file_a fl newsBlue', :download => true -%> + <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> ( diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 64cd2e959..88a5757ec 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;} +.mw400 {max-width: 400px !important;} .mt-20 {margin-top:-20px;} .mt-4 {margin-top: -4px;} .mt0 {margin-top: 0px !important;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 7770fa1ac..79b441f25 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -170,7 +170,7 @@ h4{ font-size:14px; color:#3b3b3b;} .h70{ height:70px;} .h150{ height:150px;} .p10 {padding-left:10px; padding-right:10px;} -.mw400 {max-width: 400px;} +.mw400 {max-width: 400px !important;} .mh18 {max-height: 18px;} /* Font & background Color */ From 247924af26a3a1ecb22034845e4179a041320553 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 21 Jan 2016 11:24:26 +0800 Subject: [PATCH 19/24] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 1 - .../organizations/_org_course_homework.html.erb | 1 - .../organizations/_org_course_message.html.erb | 3 --- .../organizations/_org_course_news.html.erb | 3 --- .../organizations/_org_course_poll.html.erb | 3 --- .../organizations/_org_project_issue.html.erb | 3 --- .../_org_subfield_message.html.erb | 3 --- .../organizations/_project_message.html.erb | 3 --- app/views/projects/_attachment_acts.html.erb | 10 +++------- app/views/projects/_project_news.html.erb | 5 +---- app/views/users/_course_homework.html.erb | 1 - app/views/users/_course_message.html.erb | 4 +--- app/views/users/_course_news.html.erb | 5 +---- app/views/users/_course_poll.html.erb | 3 --- app/views/users/_intro_content.html.erb | 3 ++- app/views/users/_project_issue.html.erb | 3 --- app/views/users/_project_message.html.erb | 3 --- app/views/users/_user_blog.html.erb | 1 - app/views/users/_user_homework_detail.html.erb | 1 - public/javascripts/application.js | 17 ----------------- public/stylesheets/courses.css | 2 +- public/stylesheets/new_user.css | 2 +- public/stylesheets/project.css | 2 +- 23 files changed, 11 insertions(+), 71 deletions(-) diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 0c97bb07a..4ca86e7ae 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -223,5 +223,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 83933b4a1..ffee90ede 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -346,5 +346,4 @@ $("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap'); $("#moreProject_<%=user_activity_id %>").show(); }); - $(description_show_hide(<%=user_activity_id %>)); \ No newline at end of file diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb index ca7e6a7d5..339ff8b26 100644 --- a/app/views/organizations/_org_course_message.html.erb +++ b/app/views/organizations/_org_course_message.html.erb @@ -157,6 +157,3 @@ <% end %>
    - diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb index 606b9aecd..b6e2f74ef 100644 --- a/app/views/organizations/_org_course_news.html.erb +++ b/app/views/organizations/_org_course_news.html.erb @@ -121,6 +121,3 @@
    - diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb index 49ec66496..7e09e2215 100644 --- a/app/views/organizations/_org_course_poll.html.erb +++ b/app/views/organizations/_org_course_poll.html.erb @@ -56,6 +56,3 @@
    <% end %> - diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb index 2e43c7089..763a76d5e 100644 --- a/app/views/organizations/_org_project_issue.html.erb +++ b/app/views/organizations/_org_project_issue.html.erb @@ -139,6 +139,3 @@
    - diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb index 1e13c4c95..96ed6adff 100644 --- a/app/views/organizations/_org_subfield_message.html.erb +++ b/app/views/organizations/_org_subfield_message.html.erb @@ -133,6 +133,3 @@ - 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 20/24] =?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" %>