]> source.dussan.org Git - redmine.git/commitdiff
Add an icon to each event on the activity view.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Apr 2008 16:54:14 +0000 (16:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 Apr 2008 16:54:14 +0000 (16:54 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1342 e93f8b46-1217-0410-a6f0-8f06a7374b81

17 files changed:
app/models/journal.rb
app/models/message.rb
app/models/wiki_content.rb
app/views/projects/activity.rhtml
public/images/attachment.png
public/images/changeset.png [new file with mode: 0644]
public/images/comments.png [new file with mode: 0644]
public/images/document.png [new file with mode: 0644]
public/images/message.png [new file with mode: 0644]
public/images/news.png [new file with mode: 0644]
public/images/ticket.png [new file with mode: 0644]
public/images/ticket_checked.png [new file with mode: 0644]
public/images/ticket_edit.png [new file with mode: 0644]
public/images/wiki_edit.png [new file with mode: 0644]
public/stylesheets/application.css
test/functional/projects_controller_test.rb
vendor/plugins/acts_as_event/lib/acts_as_event.rb

index 7c5e3d3bf10e39675b86d604f9dcec38c57bfb7c..1376d349e3f0eb56c0473708ba197d000af586cd 100644 (file)
@@ -33,6 +33,7 @@ class Journal < ActiveRecord::Base
   acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id}: #{o.issue.subject}" + ((s = o.new_status) ? " (#{s})" : '') },
                 :description => :notes,
                 :author => :user,
+                :type => Proc.new {|o| (s = o.new_status) && s.is_closed? ? 'issue-closed' : 'issue-edit' },
                 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
 
   def save
index 12b1cd990fbc412a6ff821b8f60e2d62f7d84add..a18d126c9add21d1a2e557fafd81b450e3827adf 100644 (file)
@@ -28,6 +28,7 @@ class Message < ActiveRecord::Base
                      :date_column => 'created_on'
   acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"},
                 :description => :content,
+                :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'},
                 :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id, :id => o.id}}
   
   attr_protected :locked, :sticky
index 13915c2740af42b596f178e689ff905d78c3d49f..724354ad66cb4910ad95df43e01678b4cd82f402 100644 (file)
@@ -32,6 +32,7 @@ class WikiContent < ActiveRecord::Base
     acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
                   :description => :comments,
                   :datetime => :updated_on,
+                  :type => 'wiki-page',
                   :url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
 
     def text=(plain)
index 0cf7a50006cea8c6b892383ab757ab9e3366f2c2..c2f2f9ebd2834c6b54771913f7880dbc8dbd5916 100644 (file)
@@ -6,7 +6,7 @@
 <h3><%= format_activity_day(day) %></h3>
 <dl>
 <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
-  <dt class="<%= e.class.name.downcase %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
+  <dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
   <%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %> <%= link_to h(truncate(e.event_title, 100)), e.event_url %></dt>
   <dd><% unless e.event_description.blank? -%>
   <span class="description"><%= format_activity_description(e.event_description) %></span><br />
index eea26921b695b377e2a51cbbb78f638514565a32..b7ce3c445ec04fa8d16a939340d070752937354a 100644 (file)
Binary files a/public/images/attachment.png and b/public/images/attachment.png differ
diff --git a/public/images/changeset.png b/public/images/changeset.png
new file mode 100644 (file)
index 0000000..67de2c6
Binary files /dev/null and b/public/images/changeset.png differ
diff --git a/public/images/comments.png b/public/images/comments.png
new file mode 100644 (file)
index 0000000..39433cf
Binary files /dev/null and b/public/images/comments.png differ
diff --git a/public/images/document.png b/public/images/document.png
new file mode 100644 (file)
index 0000000..d00b9b2
Binary files /dev/null and b/public/images/document.png differ
diff --git a/public/images/message.png b/public/images/message.png
new file mode 100644 (file)
index 0000000..252ea14
Binary files /dev/null and b/public/images/message.png differ
diff --git a/public/images/news.png b/public/images/news.png
new file mode 100644 (file)
index 0000000..6a2ecce
Binary files /dev/null and b/public/images/news.png differ
diff --git a/public/images/ticket.png b/public/images/ticket.png
new file mode 100644 (file)
index 0000000..244e6ca
Binary files /dev/null and b/public/images/ticket.png differ
diff --git a/public/images/ticket_checked.png b/public/images/ticket_checked.png
new file mode 100644 (file)
index 0000000..4b1dfbc
Binary files /dev/null and b/public/images/ticket_checked.png differ
diff --git a/public/images/ticket_edit.png b/public/images/ticket_edit.png
new file mode 100644 (file)
index 0000000..291bfc7
Binary files /dev/null and b/public/images/ticket_edit.png differ
diff --git a/public/images/wiki_edit.png b/public/images/wiki_edit.png
new file mode 100644 (file)
index 0000000..bdc333a
Binary files /dev/null and b/public/images/wiki_edit.png differ
index 7c3e0fde7f277e3424f3e9f443d989a3b7af79bf..682e95ddee99635ab33ffd973a13981903b9fb5b 100644 (file)
@@ -169,11 +169,21 @@ div#issue-changesets .changeset { border-bottom: 1px solid #ddd; }
 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
 
 div#activity dl { margin-left: 2em; }
-div#activity dd { margin-bottom: 1em; }
-div#activity dt { margin-bottom: 1px; }
+div#activity dd { margin-bottom: 1em; padding-left: 18px; }
+div#activity dt { margin-bottom: 1px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
 div#activity dt .time { color: #777; font-size: 80%; }
 div#activity dd .description { font-style: italic; }
 div#activity span.project:after { content: " -"; }
+div#activity dt.issue { background-image: url(../images/ticket.png); }
+div#activity dt.issue-edit { background-image: url(../images/ticket_edit.png); }
+div#activity dt.issue-closed { background-image: url(../images/ticket_checked.png); }
+div#activity dt.changeset { background-image: url(../images/changeset.png); }
+div#activity dt.news { background-image: url(../images/news.png); }
+div#activity dt.message { background-image: url(../images/message.png); }
+div#activity dt.reply { background-image: url(../images/comments.png); }
+div#activity dt.wiki-page { background-image: url(../images/wiki_edit.png); }
+div#activity dt.attachment { background-image: url(../images/attachment.png); }
+div#activity dt.document { background-image: url(../images/document.png); }
 
 div#roadmap fieldset.related-issues { margin-bottom: 1em; }
 div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; }
index 75b4673a1fa3e5c6de0e001265b6aa31f60b04e2..eb5795152e4b3c3b0722f8bc56cfba30c1687166 100644 (file)
@@ -144,7 +144,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
                :content => /#{2.days.ago.to_date.day}/,
                :sibling => { :tag => "dl",
                  :child => { :tag => "dt",
-                   :attributes => { :class => 'journal' },
+                   :attributes => { :class => 'issue-edit' },
                    :child => { :tag => "a",
                      :content => /(#{IssueStatus.find(2).name})/,
                    }
index a0d1822ad0dc0dba31f4b51a687dd88aa233faed..d7f437a5e22515825fd81d49a53a55b32ab0edf1 100644 (file)
@@ -25,11 +25,12 @@ module Redmine
       module ClassMethods
         def acts_as_event(options = {})
           return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
-          options[:datetime] ||= 'created_on'
-          options[:title] ||= 'title'
-          options[:description] ||= 'description'
-          options[:author] ||= 'author'
+          options[:datetime] ||= :created_on
+          options[:title] ||= :title
+          options[:description] ||= :description
+          options[:author] ||= :author
           options[:url] ||= {:controller => 'welcome'}
+          options[:type] ||= self.name.underscore.dasherize
           cattr_accessor :event_options
           self.event_options = options 
           send :include, Redmine::Acts::Event::InstanceMethods
@@ -41,11 +42,17 @@ module Redmine
           base.extend ClassMethods
         end
         
-        %w(datetime title description author).each do |attr|
+        %w(datetime title description author type).each do |attr|
           src = <<-END_SRC
             def event_#{attr}
               option = event_options[:#{attr}]
-              option.is_a?(Proc) ? option.call(self) : send(option)
+              if option.is_a?(Proc)
+                option.call(self)
+              elsif option.is_a?(Symbol)
+                send(option)
+              else
+                option
+              end
             end
           END_SRC
           class_eval src, __FILE__, __LINE__