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/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'} 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/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 @@