summaryrefslogtreecommitdiffstats
path: root/app/views/messages
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-24 12:25:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-24 12:25:07 +0000
commit29b3614bcb759214bb1aba77c27ac11c8ef6b15b (patch)
tree1783bd1f65552a4e2cea332bda9f42b1831d4e78 /app/views/messages
parent866e9e2503713c67fd33b389d4e840c04ce1562d (diff)
downloadredmine-29b3614bcb759214bb1aba77c27ac11c8ef6b15b.tar.gz
redmine-29b3614bcb759214bb1aba77c27ac11c8ef6b15b.zip
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
Diffstat (limited to 'app/views/messages')
-rw-r--r--app/views/messages/_form.rhtml8
-rw-r--r--app/views/messages/edit.rhtml6
-rw-r--r--app/views/messages/show.rhtml27
3 files changed, 31 insertions, 10 deletions
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 @@
<div class="box">
<!--[form:message]-->
<p><label><%= l(:field_subject) %></label><br />
-<%= f.text_field :subject, :required => true, :size => 120 %></p>
+<%= f.text_field :subject, :required => true, :size => 120 %>
+
+<% if User.current.allowed_to?(:edit_messages, @project) %>
+ <label><%= f.check_box :sticky %> Sticky</label>
+ <label><%= f.check_box :locked %> Locked</label>
+<% end %>
+</p>
<p><%= f.text_area :content, :required => true, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'message_content' %></p>
<%= 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 @@
+<h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%=h @message.subject %></h2>
+
+<% 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 @@
-<h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%=h @message.subject %></h2>
+<div class="contextual">
+ <%= 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' %>
+</div>
+
+<h2><%= link_to h(@board.name), :controller => 'boards', :action => 'show', :project_id => @project, :id => @board %> &#187; <%=h @topic.subject %></h2>
<div class="message">
-<p><span class="author"><%= authoring @message.created_on, @message.author %></span></p>
+<p><span class="author"><%= authoring @topic.created_on, @topic.author %></span></p>
<div class="wiki">
-<%= textilizable(@message.content, :attachments => @message.attachments) %>
+<%= textilizable(@topic.content, :attachments => @topic.attachments) %>
</div>
-<%= link_to_attachments @message.attachments, :no_author => true %>
+<%= link_to_attachments @topic.attachments, :no_author => true %>
</div>
<br />
-<div class="message reply">
<h3 class="icon22 icon22-comment"><%= l(:label_reply_plural) %></h3>
-<% @message.children.each do |message| %>
+<% @topic.children.each do |message| %>
<a name="<%= "message-#{message.id}" %>"></a>
+ <div class="contextual">
+ <%= 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' %>
+ </div>
+ <div class="message reply">
<h4><%=h message.subject %> - <%= authoring message.created_on, message.author %></h4>
<div class="wiki"><%= textilizable message.content %></div>
<%= link_to_attachments message.attachments, :no_author => true %>
+ </div>
<% end %>
-</div>
-<% if authorize_for('messages', 'reply') %>
+<% if !@topic.locked? && authorize_for('messages', 'reply') %>
<p><%= toggle_link l(:button_reply), "reply", :focus => 'message_content' %></p>
<div id="reply" style="display:none;">
-<% form_for :reply, @reply, :url => {:action => 'reply', :id => @message}, :html => {:multipart => true} do |f| %>
+<% form_for :reply, @reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_submit) %>
<% end %>