新闻页面调整

This commit is contained in:
huang 2015-04-11 11:48:39 +08:00
parent 7577f4cbbc
commit 8f6b095fdb
2 changed files with 59 additions and 83 deletions

View File

@ -27,6 +27,11 @@
} }
} }
function submitComment()
{
$("#add_comment_form").submit();
}
function regexDescription() function regexDescription()
{ {
var name = $("#news_description").val(); var name = $("#news_description").val();
@ -54,104 +59,71 @@
} }
</script> </script>
<div class="contextual">
<%= watcher_link(@news, User.current) %>
<%= link_to(l(:button_edit),
edit_news_path(@news),
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<%= delete_link news_path(@news) if User.current.allowed_to?(:manage_news, @project) %>
</div>
<h3><strong><%=h @news.title %></strong></h3>
<% if authorize_for('news', 'edit') %> <% if authorize_for('news', 'edit') %>
<div id="edit-news" style="display:none;"> <div id="edit-news" style="display:none;">
<%= labelled_form_for :news, @news, :url => news_path(@news), <%= labelled_form_for :news, @news, :url => news_path(@news),
:html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %> <%= render :partial => 'project_form', :locals => { :f => f, :is_new => false } %>
<%#= submit_tag l(:button_save) %>
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'ButtonColor m3p10' %>
<%#= preview_link preview_news_path(:project_id => @project, :id => @news), 'news-form',target='preview',{:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'ButtonColor m3p10'%>
<% end %> <% end %>
<div id="preview" class="wiki"></div> <div id="preview" class="wiki"></div>
</div> </div>
<% end %> <% end %>
<div id="comments" style="margin-bottom:16px;"> <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 style="margin:15px"> <div class="problem_txt fl mt5">
<span class="font_description"> <h4 class="r_txt_tit mb5"> <%=h @news.title %></h4>
<%= textilizable(@news, :description) %> <%#= watcher_link(@news, User.current) %>
</span> <%= link_to(l(:button_edit),
<br/> edit_news_path(@news),
<%= link_to_attachments @news %> :class => 'talk_edit fr',
<br/> :accesskey => accesskey(:edit),
<!--add comment--> :onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @project) %>
<% if @news.commentable? %> <%= delete_link news_path(@news),:class => 'talk_edit fr' if User.current.allowed_to?(:manage_news, @project) %>
<p> <div class="cl"></div>
<div class="mb5"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> <%= format_time(@news.created_on) %></div>
<%= link_to_attachments_course @news %>
<!--<a href="#" class=" link_file">附件爱覅俄方if.zip(27.5kB)</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" %> <%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %>
</p> </p>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> <%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box"> <div class="box">
<%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %> <%= text_area 'comment', 'comments', :rows => 5, :style => "width:98%" %>
<%= wikitoolbar_for 'comment_comments' %>
</div> </div>
<p> <a onclick="submitComment();" class="blue_btn fr mt10" href="javascript:void(0)" ><%= l(:label_comment_add) %></a>
<%= submit_tag l(:button_add) %>
</p>
<% end %> <% end %>
<% end %> <% end %>
</div>
<% html_title @news.title -%> <% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<!--dispaly comments-->
<div class="line_heng"></div>
</div>
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
<% comments = @comments.reverse %>
<% comments.each do |comment| %>
<% next if comment.new_record? %> <% next if comment.new_record? %>
<table width="660px" border="0" align="center"> <div class="ping_C mb10">
<tr> <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>
<td colspan="2" valign="top" width="50" > <div class="ping_discon">
<%= image_tag(url_to_avatar(comment.author), :class => "avatar")%> <div class="ping_distop">
</td> <%= 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>
<td> <div class="cl"></div>
<table width="580px" border="0"> <p><%= textAreailizable(comment.comments) %></p>
<tr> </div>
<td colspan="2" valign="top"> <div class="ping_disfoot"><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
<strong><%= link_to_user(comment.author) if comment.respond_to?(:author) %> </strong> :data => {:confirm => l(:text_are_you_sure)},
<span class="font_lighter"><%= l(:label_project_newadd) %></span> :method => :delete,
<%= l(:label_comment_plural) %> :title => l(:button_delete) %>
</td> </div>
</tr> </div>
<tr> <div class="cl"></div>
<td colspan="2" width="580px" > </div>
<span class="font_description">
<%= textilizable(comment.comments) %>
</span>
</td>
</tr>
<tr>
<td align="left">
<span class="font_lighter"> <%= format_time(comment.created_on) %></span>
</td>
<td width="200" align="right" class="a">
<%= 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) %>
</td>
</tr>
</table></td>
</tr>
</table>
<% end if @comments.any? %> <% end if @comments.any? %>
</div> </div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title @news.title -%>

View File

@ -337,4 +337,8 @@ a:hover.st_add{ color:#ff8e15;}
padding-left: 20px; padding-left: 20px;
padding-top: 2px; padding-top: 2px;
padding-bottom: 3px; padding-bottom: 3px;
} }
/*新闻*/
.msg_box{ width:670px; height:173px; border-bottom:1px dashed #CCC; padding-top:10px;}
.msg_box h4{ }
.msg_box textarea{width:658px;height:90px;padding:5px;overflow:hidden;background-color: #ffffff; border:1px solid #CCC; margin:5px 0px; color:#666; font-size:12px; }