##// END OF EJS Templates
Add an icon to each event on the activity view....
Jean-Philippe Lang -
r1327:6d2a89142af2
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -33,6 +33,7 class Journal < ActiveRecord::Base
33 acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id}: #{o.issue.subject}" + ((s = o.new_status) ? " (#{s})" : '') },
33 acts_as_event :title => Proc.new {|o| "#{o.issue.tracker.name} ##{o.issue.id}: #{o.issue.subject}" + ((s = o.new_status) ? " (#{s})" : '') },
34 :description => :notes,
34 :description => :notes,
35 :author => :user,
35 :author => :user,
36 :type => Proc.new {|o| (s = o.new_status) && s.is_closed? ? 'issue-closed' : 'issue-edit' },
36 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
37 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
37
38
38 def save
39 def save
@@ -28,6 +28,7 class Message < ActiveRecord::Base
28 :date_column => 'created_on'
28 :date_column => 'created_on'
29 acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"},
29 acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"},
30 :description => :content,
30 :description => :content,
31 :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'},
31 :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id, :id => o.id}}
32 :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id, :id => o.id}}
32
33
33 attr_protected :locked, :sticky
34 attr_protected :locked, :sticky
@@ -32,6 +32,7 class WikiContent < ActiveRecord::Base
32 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
32 acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"},
33 :description => :comments,
33 :description => :comments,
34 :datetime => :updated_on,
34 :datetime => :updated_on,
35 :type => 'wiki-page',
35 :url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
36 :url => Proc.new {|o| {:controller => 'wiki', :id => o.page.wiki.project_id, :page => o.page.title, :version => o.version}}
36
37
37 def text=(plain)
38 def text=(plain)
@@ -6,7 +6,7
6 <h3><%= format_activity_day(day) %></h3>
6 <h3><%= format_activity_day(day) %></h3>
7 <dl>
7 <dl>
8 <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
8 <% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
9 <dt class="<%= e.class.name.downcase %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
9 <dt class="<%= e.event_type %>"><span class="time"><%= format_time(e.event_datetime, false) %></span>
10 <%= 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>
10 <%= 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>
11 <dd><% unless e.event_description.blank? -%>
11 <dd><% unless e.event_description.blank? -%>
12 <span class="description"><%= format_activity_description(e.event_description) %></span><br />
12 <span class="description"><%= format_activity_description(e.event_description) %></span><br />
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -169,11 +169,21 div#issue-changesets .changeset { border-bottom: 1px solid #ddd; }
169 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
169 div#issue-changesets p { margin-top: 0; margin-bottom: 1em;}
170
170
171 div#activity dl { margin-left: 2em; }
171 div#activity dl { margin-left: 2em; }
172 div#activity dd { margin-bottom: 1em; }
172 div#activity dd { margin-bottom: 1em; padding-left: 18px; }
173 div#activity dt { margin-bottom: 1px; }
173 div#activity dt { margin-bottom: 1px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
174 div#activity dt .time { color: #777; font-size: 80%; }
174 div#activity dt .time { color: #777; font-size: 80%; }
175 div#activity dd .description { font-style: italic; }
175 div#activity dd .description { font-style: italic; }
176 div#activity span.project:after { content: " -"; }
176 div#activity span.project:after { content: " -"; }
177 div#activity dt.issue { background-image: url(../images/ticket.png); }
178 div#activity dt.issue-edit { background-image: url(../images/ticket_edit.png); }
179 div#activity dt.issue-closed { background-image: url(../images/ticket_checked.png); }
180 div#activity dt.changeset { background-image: url(../images/changeset.png); }
181 div#activity dt.news { background-image: url(../images/news.png); }
182 div#activity dt.message { background-image: url(../images/message.png); }
183 div#activity dt.reply { background-image: url(../images/comments.png); }
184 div#activity dt.wiki-page { background-image: url(../images/wiki_edit.png); }
185 div#activity dt.attachment { background-image: url(../images/attachment.png); }
186 div#activity dt.document { background-image: url(../images/document.png); }
177
187
178 div#roadmap fieldset.related-issues { margin-bottom: 1em; }
188 div#roadmap fieldset.related-issues { margin-bottom: 1em; }
179 div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; }
189 div#roadmap fieldset.related-issues ul { margin-top: 0.3em; margin-bottom: 0.3em; }
@@ -144,7 +144,7 class ProjectsControllerTest < Test::Unit::TestCase
144 :content => /#{2.days.ago.to_date.day}/,
144 :content => /#{2.days.ago.to_date.day}/,
145 :sibling => { :tag => "dl",
145 :sibling => { :tag => "dl",
146 :child => { :tag => "dt",
146 :child => { :tag => "dt",
147 :attributes => { :class => 'journal' },
147 :attributes => { :class => 'issue-edit' },
148 :child => { :tag => "a",
148 :child => { :tag => "a",
149 :content => /(#{IssueStatus.find(2).name})/,
149 :content => /(#{IssueStatus.find(2).name})/,
150 }
150 }
@@ -25,11 +25,12 module Redmine
25 module ClassMethods
25 module ClassMethods
26 def acts_as_event(options = {})
26 def acts_as_event(options = {})
27 return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
27 return if self.included_modules.include?(Redmine::Acts::Event::InstanceMethods)
28 options[:datetime] ||= 'created_on'
28 options[:datetime] ||= :created_on
29 options[:title] ||= 'title'
29 options[:title] ||= :title
30 options[:description] ||= 'description'
30 options[:description] ||= :description
31 options[:author] ||= 'author'
31 options[:author] ||= :author
32 options[:url] ||= {:controller => 'welcome'}
32 options[:url] ||= {:controller => 'welcome'}
33 options[:type] ||= self.name.underscore.dasherize
33 cattr_accessor :event_options
34 cattr_accessor :event_options
34 self.event_options = options
35 self.event_options = options
35 send :include, Redmine::Acts::Event::InstanceMethods
36 send :include, Redmine::Acts::Event::InstanceMethods
@@ -41,11 +42,17 module Redmine
41 base.extend ClassMethods
42 base.extend ClassMethods
42 end
43 end
43
44
44 %w(datetime title description author).each do |attr|
45 %w(datetime title description author type).each do |attr|
45 src = <<-END_SRC
46 src = <<-END_SRC
46 def event_#{attr}
47 def event_#{attr}
47 option = event_options[:#{attr}]
48 option = event_options[:#{attr}]
48 option.is_a?(Proc) ? option.call(self) : send(option)
49 if option.is_a?(Proc)
50 option.call(self)
51 elsif option.is_a?(Symbol)
52 send(option)
53 else
54 option
55 end
49 end
56 end
50 END_SRC
57 END_SRC
51 class_eval src, __FILE__, __LINE__
58 class_eval src, __FILE__, __LINE__
General Comments 0
You need to be logged in to leave comments. Login now