socialforge/app/views/news/_project_show.html.erb

130 lines
5.3 KiB
Plaintext
Raw Normal View History

2015-03-07 15:32:50 +08:00
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_news) %></h2>
2015-03-07 15:32:50 +08:00
</div>
<script type="text/javascript">
function regexTitle()
{
var name = $("#news_title").val();
if(name.length ==0)
{
2015-04-10 16:59:45 +08:00
$("#title_notice_span").text("<%= l(:label_title_blank)%>");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
else if(name.length <= 60)
{
2015-04-10 16:59:45 +08:00
$("#title_notice_span").text("<%= l(:label_field_correct)%>");
$("#title_notice_span").css('color','#008000');
return true;
}
else
{
2015-04-10 16:59:45 +08:00
$("#title_notice_span").text("<%= l(:label_title_long)%>");
$("#title_notice_span").css('color','#ff0000');
$("#title_notice_span").focus();
return false;
}
}
function submitComment()
{
$("#add_comment_form").submit();
}
function regexDescription()
{
var name = $("#news_description").val();
if(name.length ==0)
{
2015-04-10 16:59:45 +08:00
$("#description_notice_span").text("<%= l(:label_descripition_blank)%>");
$("#description_notice_span").css('color','#ff0000');
$("#description_notice_span").focus();
return false;
}
else
{
2015-04-10 16:59:45 +08:00
$("#description_notice_span").text("<%= l(:label_field_correct)%>");
$("#description_notice_span").css('color','#008000');
return true;
}
}
function submitNews()
{
if(regexTitle() && regexDescription())
{
$("#news-form").submit();
}
}
</script>
<% 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>
<% 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">
<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) %><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" %>
</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>
<% end %>
<% end %>
</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>
<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? %>
</div>
<% content_for :header_tags do %>
<%= stylesheet_link_tag 'scm' %>
<% end %>
<% html_title @news.title -%>