From 600f5de32e28bbe7d6c6d6748db8dd3cef7faba1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 16:11:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E4=B8=AA=E4=BA=BA=E5=8D=9A=E5=AE=A2=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=90=8E=EF=BC=8C=E8=B7=B3=E8=BD=AC=E5=88=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blog_comments_controller.rb | 10 +++++++--- app/views/blog_comments/edit.html.erb | 2 +- app/views/blog_comments/show.html.erb | 2 +- app/views/users/_user_blog.html.erb | 2 +- public/stylesheets/new_user.css | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb index ae6aff794..df6ba10d2 100644 --- a/app/controllers/blog_comments_controller.rb +++ b/app/controllers/blog_comments_controller.rb @@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController render_attachment_warning_if_needed(@article) else end - if params[:is_homepage] - redirect_to user_blogs_path(params[:user_id]) + if params[:in_act] + redirect_to user_path(params[:user_id]) else - redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) + if params[:is_homepage] + redirect_to user_blogs_path(params[:user_id]) + else + redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) + end end end def destroy diff --git a/app/views/blog_comments/edit.html.erb b/app/views/blog_comments/edit.html.erb index 43a8aae92..704342fc0 100644 --- a/app/views/blog_comments/edit.html.erb +++ b/app/views/blog_comments/edit.html.erb @@ -1,5 +1,5 @@ <% if User.current.logged? && User.current.id == @user.id %> - <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT', + <%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT', :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> <%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %> <% end %> diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index 6f4397569..ce8f52f25 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -45,7 +45,7 @@
  • <%= link_to( l(:button_edit), - {:action => 'edit', :id => @article.id}, + {:action => 'edit', :id => @article.id,:in_act => params[:in_act]}, :class => 'postOptionLink' ) if User.current && User.current.id == @article.author.id %>
  • diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 581bfb53c..7658bc581 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -15,7 +15,7 @@
    - <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id), :class => "postGrey" %> + <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
    <% if activity.sticky == 1%> 置顶 diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index b1f950960..ee0c08a14 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -693,7 +693,7 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} -a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} +a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} From b6460633d22145132bae3df0e9259c330ad20d6c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 16:15:45 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=8D=9A=E5=AE=A2?= =?UTF-8?q?=E6=8C=89=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E5=80=92=E6=8E=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blogs_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index 0202224ed..42e70bcf0 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -2,7 +2,7 @@ class BlogsController < ApplicationController before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage] before_filter :find_user def index - @articls = @user.blog.articles + @articls = @user.blog.articles.order("updated on desc") @article = BlogComment.new respond_to do |format| format.html {render :layout=>'new_base_user'} From 594ce8a3040ec34bcdb2ca7849865bfb59ac7ef0 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 21 Jan 2016 16:57:13 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=A0=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 21 ++++++++++++++----- app/views/news/_project_news.html.erb | 2 +- app/views/news/_project_news_new.html.erb | 2 +- app/views/news/_project_show.html.erb | 2 +- app/views/news/edit.html.erb | 2 +- .../organizations/_org_subfield_news.html.erb | 16 +++++++++++++- app/views/users/_course_news.html.erb | 16 +++++++++++++- app/views/users/_project_news.html.erb | 20 +++++++++++++++--- 8 files changed, 67 insertions(+), 14 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b1c384ae4..38d148907 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1791,13 +1791,24 @@ class UsersController < ApplicationController def share_news_to_project news = News.find(params[:send_id]) project_ids = params[:project_ids] + # project_ids.each do |project_id| + # if Project.find(project_id).news.map(&:id).exclude?(news.id) + # project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) + # news.attachments.each do |attach| + # project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + # :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + # :is_public => attach.is_public, :quotes => 0) + # end + # end + # end project_ids.each do |project_id| - if Project.find(project_id).news.map(&:id).exclude?(news.id) - project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now) + project = Project.find(project_id) + if project.news.map(&:id).exclude?(news.id) + message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id) news.attachments.each do |attach| - project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, - :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, - :is_public => attach.is_public, :quotes => 0) + message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest, + :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype, + :is_public => attach.is_public, :quotes => 0) end end end diff --git a/app/views/news/_project_news.html.erb b/app/views/news/_project_news.html.erb index fa2a99cd7..1b4c51cd0 100644 --- a/app/views/news/_project_news.html.erb +++ b/app/views/news/_project_news.html.erb @@ -23,7 +23,7 @@
    - 项目通知 + 新闻
    <% if @project && User.current.allowed_to?(:manage_news, @project) %> diff --git a/app/views/news/_project_news_new.html.erb b/app/views/news/_project_news_new.html.erb index 0e9b03c6f..e3d63ba9c 100644 --- a/app/views/news/_project_news_new.html.erb +++ b/app/views/news/_project_news_new.html.erb @@ -6,7 +6,7 @@
    - +

    <%end%>
    diff --git a/app/views/news/edit.html.erb b/app/views/news/edit.html.erb index 76259f5d7..116000a8e 100644 --- a/app/views/news/edit.html.erb +++ b/app/views/news/edit.html.erb @@ -11,7 +11,7 @@
    - 编辑通知 + 编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
    <%= labelled_form_for :news, @news, :url => news_path(@news), diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb index 074d15a42..1e7ae72df 100644 --- a/app/views/organizations/_org_subfield_news.html.erb +++ b/app/views/organizations/_org_subfield_news.html.erb @@ -35,7 +35,21 @@
  • <% if User.current.logged? %>
      -
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %>
    • +
    • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • + <%= link_to( + l(:button_edit), + {:action => 'edit', :id => activity}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
    • +
    • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if activity.author == User.current %> +
    <% end %>
  • diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb index 67d09d365..30053f6c6 100644 --- a/app/views/users/_course_news.html.erb +++ b/app/views/users/_course_news.html.erb @@ -40,7 +40,21 @@
  • <% if User.current.logged? %>
      -
    • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
    • +
    • + <%= link_to( + l(:button_edit), + {:action => 'edit', :id => activity}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
    • +
    • + <%= delete_link( + news_path(activity), + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if User.current.allowed_to?(:manage_news, activity.course) %> +
    <% end %>
  • diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index eb4941668..f7a779eb6 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -10,8 +10,8 @@ <%= 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" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>