项目新闻使用方块样式

This commit is contained in:
ouyangxuhua 2016-01-21 10:33:53 +08:00
parent 340d404ecd
commit ece9f9dc6f
8 changed files with 453 additions and 153 deletions

View File

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

View File

@ -1,77 +1,36 @@
<style type="text/css">
span{
word-break:break-all;
word-wrap:break-word;
}
</style>
<%
btn_tips = l(:label_news_new)
label_tips = l(:label_news)
%>
<div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2>
</div>
<div class="talk_top">
<p class="fl"><%= l(:label_total_news) %><span><%= @news_count %></span><%= l(:label_project_new_list) %></p>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
function reset_news(){
$("#news_title").val("");
$("#title_notice_span").text("");
$("#description_notice_span").text("");
document.getElementById("news_sticky").checked=false;
$("#news_attachments").html("<%= escape_javascript(render :partial => 'attachments/new_form', :locals => {:container => News.new})%>");
project_news_description_editor.html("");
$("#news_editor").toggle();
}
<% if @is_new%>
$(function(){
$("#news_title").focus();
});
<%end%>
</script>
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
项目通知
</div>
</div>
<% 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') %>
<div class="cl"></div>
<% end %>
<div class="cl"></div>
</div>
<div>
<% if @newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5 list_style">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w_news" %><br />
<div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
<span class="f1"><%= l(:label_create_time) %> <%= format_time(news.created_on) %></span>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
<%= 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} %>
</div>
<!--end-->
<ul class="wlist">
<%= pagination_links_full @news_pages, @news_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% 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)) -%>
<script type='text/javascript'>
$(document).ready(function ($) {
$('.content-text-list').each(function () {
$(this).find('.delete_icon').hide();
$(this).mouseenter(function (event) {
$(this).find('.delete_icon').show();
});
$(this).mouseleave(function (event) {
$(this).find('.delete_icon').hide();
});
});
});
</script>

View File

@ -0,0 +1,56 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "init_activity_KindEditor" %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<% if all_news %>
<% all_news.each do |news| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
init_activity_KindEditor_data(<%= news.id%>, null, "87%");
showNormalImage('activity_description_<%= news.id %>');
});
</script>
<% 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%>

View File

@ -0,0 +1,60 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false) %>
<% end %>
<div class="resources mt10">
<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%>" >
<p id="title_notice_span"></p>
</div>
<div id="news_editor" style="display: none;">
<div class="mt10">
<%= f.check_box :sticky, :value => edit_mode ? news.sticky : 0 %>
<%= label_tag 'news_sticky', l(:label_board_sticky) %>
<div class="cl"></div>
</div>
<div class="mt10">
<div id="news_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
<%= text_area :quote,:quote,:style => 'display:none' %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description, :editor_id => 'project_news_description_editor',
:owner_id => news.nil? ? 0: news.id,
:owner_type => OwnerTypeHelper::NEWS,
:width => '100%',
:height => 300,
:minHeight=>300,
:class => 'talk_text fl',
:input_html => { :id => 'news_content',
:class => 'talk_text fl',
:maxlength => 5000 },
at_id: news.id, at_type: news.class.to_s
%>
<div class="cl"></div>
<p id="description_notice_span"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<div class="fl" id="news_attachments">
<%= render :partial => 'attachments/form_course', :locals => {:container => news, :isReply => false} %>
</div>
</div>
<div class="cl"></div>
<div class="mt5">
<%if !edit_mode %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submitNews();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_news();">取消</a>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submitNews();">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",news_path(news), :class => "fr mr10 mt3"%>
<% end %>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -1,72 +1,173 @@
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_news) %></h2>
</div>
<% if authorize_for('news', 'edit') %>
<div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'project_form', :locals => { :f => f, :is_new => false } %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(@news.author),:width => 42,:height => 42), user_path(@news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5 list_style">
<h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
<%#= 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) %>
<div class="cl"></div>
<div class="mb5" style="word-break:break-all;"><%= textAreailizable(@news, :description) %> </div>
<%= link_to_attachments_course @news %><br />
<%= l(:label_create_time) %> <%= format_time(@news.created_on) %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</a> -->
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {
showNormalImage('message_description_<%= @news.id %>');
});
</script>
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @news.id%>').show();" onmouseout="$('#message_setting_<%= @news.id%>').hide();">
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@news.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@news.author) %>
</div>
<div class="postThemeWrap">
<% if User.current.allowed_to?(:manage_news, @project)%>
<div class="homepagePostSetting" id="message_setting_<%= @news.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @news},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, @project) %>
</li>
<li>
<%= delete_link(
news_path(@news),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, @project) %>
</li>
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">通知: <%= @news.title%></a>
</div>
<div class="cl"></div>
</div>
<!--add comment-->
<% if @news.commentable? %>
<div class="msg_box">
<%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
</p>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box">
<%= text_area 'comment', 'comments', :rows => 5, :style => "width:98%" %>
</div>
<a onclick="submitComment();" class="blue_btn fr" href="javascript:void(0)" ><%= l(:label_comment_add) %></a>
<div class="postDetailCreater">
<% 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 %>
</div>
<div class="postDetailDate mb5"><%= format_time( @news.created_on)%></div>
<div class="cl"></div>
<div class="memo-content upload_img break_word" id="message_description_<%= @news.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
<%= @news.description.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%= link_to_attachments_course @news, :author => false %>
</div>
</div>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="ping_C mb10">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "ping_dispic" %></div>
<div class="ping_discon">
<div class="ping_distop">
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
<div class="cl"></div>
</div>
<div class="cl"></div>
<div class="homepagePostReply">
<% unless @comments.empty? %>
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复(<%=@comments.count %></div>
<div class="homepagePostReplyBannerTime"></div>
</div>
<div class="" id="reply_div_<%=@news.id %>">
<% @comments.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% 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 %>
</div>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.comments.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
l(:button_delete),
{:controller => 'comments',
:action => 'destroy', :id => @news,
:comment_id => reply},
:method => :delete,
:class => 'fr newsGrey',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @news.author == User.current %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if @news.commentable? %>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @news.id %>">
<%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
<div class="box" id="news_comment">
<%= 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 }%>
</div>
<p id="add_reply_news"></p>
<p class="mt10">
<a href="javascript:void(0)" class="grey_btn fr ml10 mr5" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<%= l(:label_comment_with_space) %>
</a>
</p>
<% end %>
<div class="cl"></div>
<p><%= textAreailizable(comment.comments) %></p>
</div>
<div class="ping_disfoot"><%= 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) %>
</div>
</div>
<div class="cl"></div>
</div>
<% end if @comments.any? %>
<% end %>
</div>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title @news.title -%>

View File

@ -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 %>
</div>

View File

@ -1,29 +1,134 @@
<div class="resources mt10">
<div class="homepagePostBrief" onmouseover="$('#act-<%=user_activity.id %>').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像"/></a></div>
<%= 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} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo mt-4"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a></div>
<div class="homepagePostTitle">
<a href="javascript:void(0);" class="postGrey">ckeditor值设置的默认在光标聚焦控件后应自动消失的处理项目新闻</a></div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"><a href="javascript:void(0);" class="c_blue">提交10</a></div>
<div class="homepagePostDeadline">截止时间2015-08-20</div>
<div class="homepagePostTo break_word mt-4">
<% 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" %>
</div>
<div class="homepagePostIntro">作业描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="homepagePostSetting" id="act-<%= user_activity.id %>" style="visibility: hidden">
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
</div>
<% if activity.sticky == 1%>
<span class="sticky_btn_cir ml10">置顶</span>
<% end%>
<div class="cl"></div>
<div class="homepagePostDate fl">
发布时间:<%= format_time(activity.created_on) %>
</div>
<div class="cl"></div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
<% 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}')") %></li>
</ul>
<% end %>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<% count=activity.comments.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
<% end %>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
</div>
<% end %>
</div>
<% replies_all_i = 0 %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.comments.reorder("created_on desc").each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
});
</script>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4">
<% 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) %>
<span id="reply_praise_count_<%=comment.id %>">
<% if comment.author == User.current %>
<span class="fr likeButton"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "#{get_praise_num(comment)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
</span>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.comments.html_safe %></div>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>
</div>
<% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<% end%>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<script type="text/javascript">
$(description_show_hide(<%=user_activity_id %>));
</script>

View File

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