From 09ea833dcbd122c668c5ae81d638894f873be903 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Fri, 30 May 2014 20:52:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E9=80=9A=E7=9F=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_contestnotifications.html.erb | 28 ++++++ app/views/contestnotifications/_form.html.erb | 18 +++- app/views/contestnotifications/edit.html.erb | 17 +++- app/views/contestnotifications/new.html.erb | 2 +- app/views/contestnotifications/show.html.erb | 93 ++++++++++++++++++- 5 files changed, 151 insertions(+), 7 deletions(-) create mode 100644 app/views/contestnotifications/_contestnotifications.html.erb diff --git a/app/views/contestnotifications/_contestnotifications.html.erb b/app/views/contestnotifications/_contestnotifications.html.erb new file mode 100644 index 000000000..0866ea198 --- /dev/null +++ b/app/views/contestnotifications/_contestnotifications.html.erb @@ -0,0 +1,28 @@ + + + + + + + +
+ + + + + + + + + + +
<%=link_to contestnotification.author,contestnotification_path(contestnotification)%> + <%= l(:label_project_newshare) %> <%= link_to h(contestnotification.title), news_path(contestnotification) %> +

<%=h contestnotification.description%>

<%= contestnotification.created_on %><%= link_to l(:label_project_newother),contestnotification_path(contestnotification)%> + <%= "(#{l(:label_x_comments, :count => contestnotification.comments_count)})" if contestnotification.comments_count > 0 %> +
diff --git a/app/views/contestnotifications/_form.html.erb b/app/views/contestnotifications/_form.html.erb index 7fb5b719f..ee49a15e6 100644 --- a/app/views/contestnotifications/_form.html.erb +++ b/app/views/contestnotifications/_form.html.erb @@ -1,4 +1,4 @@ -<%= form_for(@contestnotification) do |f| %> + + + +<%= error_messages_for @contestnotification %> +
+ <% str =l(:label_news_new) %> +
+
+

<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;" %>

+ +

<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %>

+

<%= render :partial => 'attachments/form', :locals => {:container => @contestnotification} %>

+
+ +<%= wikitoolbar_for 'news_description' %> diff --git a/app/views/contestnotifications/edit.html.erb b/app/views/contestnotifications/edit.html.erb index 1db3cd205..6d680f2e6 100644 --- a/app/views/contestnotifications/edit.html.erb +++ b/app/views/contestnotifications/edit.html.erb @@ -1,6 +1,19 @@ -

Editing contestnotification

+ + +

<%=l(:label_news)%>

+ +<%= labelled_form_for @contestnotification, :html => { :id => 'news-form', :multipart => true, :method => :put } do |f| %> +<%= render :partial => 'form', :locals => { :f => f } %> +<%= submit_tag l(:button_save) %> +<%= preview_link preview_news_path(:project_id => @contest, :id => @contestnotification), 'news-form' %> +<% end %> +
+ +<% content_for :header_tags do %> + <%= stylesheet_link_tag 'scm' %> +<% end %> diff --git a/app/views/contestnotifications/new.html.erb b/app/views/contestnotifications/new.html.erb index f29bf784e..cd5920273 100644 --- a/app/views/contestnotifications/new.html.erb +++ b/app/views/contestnotifications/new.html.erb @@ -11,6 +11,6 @@ :html => { :id => 'news-form', :multipart => true } do |f| %> <%= render :partial => 'news/form', :locals => { :f => f } %> <%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %> - <%= preview_link preview_news_path(:project_id => @project), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%> + <%= preview_link preview_news_path(:contest_id => @contest), 'news-form' ,target='preview',{:class => 'whiteButton m3p10'}%> <% end %>
diff --git a/app/views/contestnotifications/show.html.erb b/app/views/contestnotifications/show.html.erb index 310f8b579..3b3a53fd8 100644 --- a/app/views/contestnotifications/show.html.erb +++ b/app/views/contestnotifications/show.html.erb @@ -1,4 +1,4 @@ -

<%= notice %>

+ + + +
+ <%= watcher_link(@contestnotification, 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_contestnotification, @contest) %> + <%= delete_link news_path(@contestnotification) if User.current.allowed_to?(:manage_contestnotification, @contest) %> +
+ +

<%=h @contestnotification.title %>

+ +<% if authorize_for('contestnotification', 'edit') %> + +<% end %> + +
+ +
+ <%= textilizable(@contestnotification, :description) %> +
+ <%= link_to_attachments @contestnotification %> +
+ + <% if @contestnotification.commentable? %> +

+ <%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %> +

+ <%= form_tag({:controller => 'comments', :action => 'create', :id => @contestnotification}, :id => "add_comment_form", :style => "display:none;") do %> +
+ <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %> + <%= wikitoolbar_for 'comment_comments' %> +
+

+ <%= submit_tag l(:button_add) %> +

+ <% end %> + <% end %> + + <% html_title @contestnotification.title -%> + + <% content_for :header_tags do %> + <%= stylesheet_link_tag 'scm' %> + <% end %> + + +
+
+

<%= l(:label_comment_plural) %>

+ <% comments = @comments.reverse %> + <% comments.each do |comment| %> + <% next if comment.new_record? %> + + + + + +
<%= image_tag(url_to_avatar(comment.author), :class => "avatar")%> + + + + + + + + + + + +
<%= link_to_user(comment.author) if comment.respond_to?(:author) %> <%= l(:label_project_newadd) %><%= l(:label_comment_plural) %>
+

+ <%= textilizable(comment.comments) %> +

<%= format_time(comment.created_on) %><%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @contestnotification, :comment_id => comment}, + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
+ <% end if @comments.any? %> +
+ +