修改几个bug

This commit is contained in:
ouyangxuhua 2016-01-21 16:57:13 +08:00
parent b6460633d2
commit 594ce8a304
8 changed files with 67 additions and 14 deletions

View File

@ -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

View File

@ -23,7 +23,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
项目通知
新闻
</div>
</div>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>

View File

@ -6,7 +6,7 @@
<div id="new_course_news">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布通知,请先输入通知标题" value="<%= news.title%>" >
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布新闻,请先输入新闻标题" value="<%= news.title%>" >
<p id="title_notice_span"></p>
</div>
<div id="news_editor" style="display: none;">

View File

@ -72,7 +72,7 @@
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">通知: <%= @news.title%></a>
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">新闻: <%= @news.title%></a>
</div>
<div class="cl"></div>

View File

@ -11,7 +11,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
编辑通知
编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
</div>
</div>
<%= labelled_form_for :news, @news, :url => news_path(@news),

View File

@ -35,7 +35,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>

View File

@ -40,7 +40,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => activity},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
</ul>
<% end %>
</li>

View File

@ -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" %>
</div>
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
@ -37,7 +37,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>