From 29b3614bcb759214bb1aba77c27ac11c8ef6b15b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 24 Nov 2007 12:25:07 +0000 Subject: Forums enhancements: * messages can now be edited/deleted (explicit permissions need to be given) * topics can be locked so that no reply can be added (only by users allowed to edit messages) * topics can be marked as sticky so that they always appear at the top of the list (only by users allowed to edit messages) git-svn-id: http://redmine.rubyforge.org/svn/trunk@926 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/messages/_form.rhtml | 8 +++++++- app/views/messages/edit.rhtml | 6 ++++++ app/views/messages/show.rhtml | 27 ++++++++++++++++++--------- 3 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 app/views/messages/edit.rhtml (limited to 'app/views/messages') diff --git a/app/views/messages/_form.rhtml b/app/views/messages/_form.rhtml index 25d88cd44..c2f7fb569 100644 --- a/app/views/messages/_form.rhtml +++ b/app/views/messages/_form.rhtml @@ -3,7 +3,13 @@


-<%= f.text_field :subject, :required => true, :size => 120 %>

+<%= f.text_field :subject, :required => true, :size => 120 %> + +<% if User.current.allowed_to?(:edit_messages, @project) %> + + +<% end %> +

<%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %>

<%= wikitoolbar_for 'message_content' %> diff --git a/app/views/messages/edit.rhtml b/app/views/messages/edit.rhtml new file mode 100644 index 000000000..808b6ea27 --- /dev/null +++ b/app/views/messages/edit.rhtml @@ -0,0 +1,6 @@ +

<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%=h @message.subject %>

+ +<% form_for :message, @message, :url => {:action => 'edit'}, :html => {:multipart => true} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> + <%= submit_tag l(:button_save) %> +<% end %> diff --git a/app/views/messages/show.rhtml b/app/views/messages/show.rhtml index e39c09d50..bb7e2b7f3 100644 --- a/app/views/messages/show.rhtml +++ b/app/views/messages/show.rhtml @@ -1,28 +1,37 @@ -

<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%=h @message.subject %>

+
+ <%= link_to_if_authorized l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'icon icon-edit' %> + <%= link_to_if_authorized l(:button_delete), {:action => 'destroy', :id => @topic}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %> +
+ +

<%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> » <%=h @topic.subject %>

-

<%= authoring @message.created_on, @message.author %>

+

<%= authoring @topic.created_on, @topic.author %>

-<%= textilizable(@message.content, :attachments => @message.attachments) %> +<%= textilizable(@topic.content, :attachments => @topic.attachments) %>
-<%= link_to_attachments @message.attachments, :no_author => true %> +<%= link_to_attachments @topic.attachments, :no_author => true %>

-

<%= l(:label_reply_plural) %>

-<% @message.children.each do |message| %> +<% @topic.children.each do |message| %> "> +
+ <%= link_to_if_authorized l(:button_edit), {:action => 'edit', :id => message}, :class => 'icon icon-edit' %> + <%= link_to_if_authorized l(:button_delete), {:action => 'destroy', :id => message}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del' %> +
+

<%=h message.subject %> - <%= authoring message.created_on, message.author %>

<%= textilizable message.content %>
<%= link_to_attachments message.attachments, :no_author => true %> +
<% end %> -
-<% if authorize_for('messages', 'reply') %> +<% if !@topic.locked? && authorize_for('messages', 'reply') %>

<%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %>