mirror of
https://github.com/meineerde/redmine.git
synced 2026-03-11 19:53:07 +00:00
added simple message browsing functionality
git-svn-id: http://redmine.rubyforge.org/svn/branches/work@266 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
32f5731947
commit
9b43057aa8
@ -22,6 +22,22 @@ class MailingListsController < ApplicationController
|
||||
|
||||
# GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
|
||||
verify :method => :post, :only => [ :destroy ]
|
||||
|
||||
def messages
|
||||
if params[:year] and params[:year].to_i > 1900
|
||||
@year = params[:year].to_i
|
||||
if params[:month] and params[:month].to_i > 0 and params[:month].to_i < 13
|
||||
@month = params[:month].to_i
|
||||
end
|
||||
end
|
||||
@year ||= Date.today.year
|
||||
@month ||= Date.today.month
|
||||
@date_from = Date.civil(@year, @month, 1)
|
||||
@date_to = (@date_from >> 1)-1
|
||||
|
||||
@messages = @mailing_list.messages.find(:all, :conditions => ["parent_id is null and sent_on>=? and sent_on<=?", @date_from, @date_to])
|
||||
render :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def add
|
||||
@mailing_list = MailingList.new(:project => @project, :admin => logged_in_user)
|
||||
|
||||
34
mailing_lists/app/controllers/mailing_messages_controller.rb
Normal file
34
mailing_lists/app/controllers/mailing_messages_controller.rb
Normal file
@ -0,0 +1,34 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MailingMessagesController < ApplicationController
|
||||
layout 'base'
|
||||
|
||||
before_filter :find_project, :authorize
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@message = MailingMessage.find(params[:id], :include => :mailing_list)
|
||||
@project = @message.mailing_list.project
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
@ -79,6 +79,7 @@ class ProjectsController < ApplicationController
|
||||
def show
|
||||
@custom_values = @project.custom_values.find(:all, :include => :custom_field)
|
||||
@members = @project.members.find(:all, :include => [:user, :role])
|
||||
@mailing_lists = @project.mailing_lists
|
||||
@subprojects = @project.children if @project.children.size > 0
|
||||
@news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
|
||||
@trackers = Tracker.find(:all, :order => 'position')
|
||||
|
||||
19
mailing_lists/app/helpers/mailing_messages_helper.rb
Normal file
19
mailing_lists/app/helpers/mailing_messages_helper.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module MailingMessagesHelper
|
||||
end
|
||||
@ -1,3 +1,20 @@
|
||||
# redMine - project management software
|
||||
# Copyright (C) 2006-2007 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MailingMessage < ActiveRecord::Base
|
||||
belongs_to :mailing_list
|
||||
acts_as_tree :order => 'sent_on'
|
||||
|
||||
9
mailing_lists/app/views/mailing_lists/_thread.rhtml
Normal file
9
mailing_lists/app/views/mailing_lists/_thread.rhtml
Normal file
@ -0,0 +1,9 @@
|
||||
<% unless messages.nil? || messages.empty? %>
|
||||
<ul>
|
||||
<% messages.each do |message| %>
|
||||
<li><%= link_to message.subject, :controller => 'mailing_messages', :action => 'show', :id => message %> <em><%= message.from %> - <%= format_time(message.sent_on) %></em>
|
||||
<%= render :partial => 'mailing_lists/thread', :locals => {:messages => message.children} %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
24
mailing_lists/app/views/mailing_lists/messages.rhtml
Normal file
24
mailing_lists/app/views/mailing_lists/messages.rhtml
Normal file
@ -0,0 +1,24 @@
|
||||
<h2><%= @mailing_list.name %> : <%= "#{month_name(@month).downcase} #{@year}" %></h2>
|
||||
|
||||
<% if @messages.empty? %>
|
||||
<p><em><%= l(:label_no_data) %></em></p>
|
||||
<% else %>
|
||||
<%= render :partial => 'thread', :locals => {:messages => @messages} %>
|
||||
<% end %>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td align="left" style="width:150px">
|
||||
<%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")),
|
||||
{:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1) }},
|
||||
{:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1))}
|
||||
%>
|
||||
</td>
|
||||
<td align="right" style="width:150px">
|
||||
<%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'),
|
||||
{:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1) }},
|
||||
{:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1))}
|
||||
%>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
17
mailing_lists/app/views/mailing_messages/show.rhtml
Normal file
17
mailing_lists/app/views/mailing_messages/show.rhtml
Normal file
@ -0,0 +1,17 @@
|
||||
<h2><%=h @message.mailing_list.name %>: <%=h @message.subject %></h2>
|
||||
<p><em><%= @message.from %>, <%= format_time(@message.sent_on) %></em></p>
|
||||
|
||||
<ul>
|
||||
<% if @message.parent %>
|
||||
<li><%= l(:label_in_reply_to) %>: <%= link_to @message.parent.subject, :controller => 'mailing_messages', :action => 'show', :id => @message.parent %> <em><%= @message.parent.from %> - <%= format_time(@message.parent.sent_on) %></em></li>
|
||||
<% end %>
|
||||
<% unless @message.children.empty? %>
|
||||
<li><%= l(:label_reply_plural) %>:
|
||||
<%= render :partial => 'mailing_lists/thread', :locals => {:messages => @message.children} %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="box">
|
||||
<%= simple_format(auto_link(h(@message.body))) %>
|
||||
</div>
|
||||
@ -62,15 +62,15 @@
|
||||
|
||||
<div id="tab-content-mailing-lists" class="tab-content" style="display:none;">
|
||||
<table class="list">
|
||||
<thead><th><%= l(:field_name) %></th><th><%= l(:field_admin) %></th><th><%= l(:field_is_public) %></th><th><%= l(:field_status) %></th><th><%= l(:field_created_on) %></th><th></th><th></th></thead>
|
||||
<thead><th><%= l(:field_name) %></th><th><%= l(:field_description) %></th><th><%= l(:field_admin) %></th><th><%= l(:field_is_public) %></th><th><%= l(:field_status) %></th><th></th><th></th></thead>
|
||||
<tbody>
|
||||
<% for mailing_list in @project.mailing_lists %>
|
||||
<tr class="<%= cycle 'odd', 'even' %>">
|
||||
<td><%= mailing_list.name %></td>
|
||||
<td><%=h mailing_list.name %></td>
|
||||
<td><%=h mailing_list.description %></td>
|
||||
<td align="center"><%= mailing_list.admin.name if mailing_list.admin %></td>
|
||||
<td align="center"><%= image_tag('true.png') if mailing_list.is_public? %></td>
|
||||
<td align="center"><%= l(mailing_list.status_name) if mailing_list.status_name %></td>
|
||||
<td align="center"><%= format_date(mailing_list.created_on) %></td>
|
||||
<td align="center" style="width:10%"><%= link_to_if_authorized l(:button_edit), {:controller => 'mailing_lists', :action => 'edit', :id => mailing_list}, :class => 'icon icon-edit' %></td>
|
||||
<td align="center" style="width:10%"><%= link_to_if_authorized l(:button_delete), {:controller => 'mailing_lists', :action => 'destroy', :id => mailing_list}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %></td>
|
||||
</tr>
|
||||
|
||||
@ -37,7 +37,16 @@
|
||||
<%= link_to_user member.user %> (<%= member.role.name %>)<br />
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<% unless @mailing_lists.empty? %>
|
||||
<div class="box">
|
||||
<h3 class="icon22 icon22-mail"><%=l(:label_mailing_list_plural)%></h3>
|
||||
<% for list in @mailing_lists %>
|
||||
<%= link_to list.name, :controller => 'mailing_lists', :action => 'messages', :id => list %>: <%=h list.description %><br />
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @subprojects %>
|
||||
<div class="box">
|
||||
<h3 class="icon22 icon22-projects"><%=l(:label_subproject_plural)%></h3>
|
||||
|
||||
@ -318,6 +318,8 @@ label_roadmap: Roadmap
|
||||
label_mailing_list: Liste
|
||||
label_mailing_list_plural: Listes
|
||||
label_mailing_list_new: Nouvelle liste
|
||||
label_in_reply_to: En réponse à
|
||||
label_reply_plural: Réponses
|
||||
|
||||
button_login: Connexion
|
||||
button_submit: Soumettre
|
||||
|
||||
BIN
mailing_lists/public/images/22x22/mail.png
Normal file
BIN
mailing_lists/public/images/22x22/mail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 885 B |
@ -163,6 +163,7 @@ vertical-align: middle;
|
||||
.icon22-comment { background-image: url(../images/22x22/comment.png); }
|
||||
.icon22-package { background-image: url(../images/22x22/package.png); }
|
||||
.icon22-settings { background-image: url(../images/22x22/settings.png); }
|
||||
.icon22-mail { background-image: url(../images/22x22/mail.png); }
|
||||
|
||||
/**************** Content styles ****************/
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'mailing_messages_controller'
|
||||
|
||||
# Re-raise errors caught by the controller.
|
||||
class MailingMessagesController; def rescue_action(e) raise e end; end
|
||||
|
||||
class MailingMessagesControllerTest < Test::Unit::TestCase
|
||||
def setup
|
||||
@controller = MailingMessagesController.new
|
||||
@request = ActionController::TestRequest.new
|
||||
@response = ActionController::TestResponse.new
|
||||
end
|
||||
|
||||
# Replace this with your real tests.
|
||||
def test_truth
|
||||
assert true
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user