Merge pull request #814 from opf/fix/activity-icon-labels-2250

pull/811/head
Hagen Schink 11 years ago
commit 0beecc4dfc
  1. 29
      app/assets/stylesheets/fonts/openproject_icon_font.css.sass
  2. 12
      app/models/activity/base_activity_provider.rb
  3. 4
      app/models/activity/changeset_activity_provider.rb
  4. 4
      app/models/activity/news_activity_provider.rb
  5. 4
      app/models/activity/time_entry_activity_provider.rb
  6. 7
      app/models/work_package.rb
  7. 3
      app/views/activities/index.html.erb
  8. 7
      app/views/search/index.html.erb
  9. 7
      app/views/users/show.html.erb
  10. 10
      config/locales/de.yml
  11. 11
      config/locales/en.yml
  12. 8
      doc/CHANGELOG.md
  13. 2
      lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
  14. 3
      lib/plugins/acts_as_event/lib/acts_as_event.rb

@ -157,7 +157,7 @@
.icon-cancel:before
content: "\e005"
dt.changeset:before,
dt > .icon-changeset:before,
.icon-changeset:before
content: "\e006"
@ -191,7 +191,7 @@ dt.changeset:before,
.icon-not-watch:before
content: "\e00f"
dt.news:before,
dt > .icon-news:before,
.icon-news:before
content: "\e010"
@ -225,14 +225,14 @@ dt.news:before,
.icon-priority:before
content: "\e01a"
dt.project:before,
dt > .icon-project:before,
.icon-projects:before
content: "\e01b"
.icon-publish:before
content: "\e01c"
dt.message:before,
dt > .icon-message:before,
.icon-quote:before
content: "\e01d"
@ -245,28 +245,23 @@ dt.message:before,
.icon-status:before
content: "\e020"
dt.issue:before,
dt.work_package:before,
dt > .icon-work_package:before,
.icon-ticket:before
content: "\e021"
dt.issue-closed:before,
dt.work_package-closed:before,
dt > .icon-work_package-closed:before,
.icon-ticket-checked:before
content: "\e022"
dt.issue-edit:before,
dt.work_package-edit:before,
dt > .icon-work_package-edit:before,
.icon-ticket-edit:before
content: "\e023"
dt.issue-note:before,
dt.work_package-note:before,
dt > .icon-work_package-note:before,
.icon-ticket-note:before
content: "\e024"
dt.time_entry:before,
dt.time-entry:before,
dt > .icon-time-entry:before,
.icon-time:before
content: "\e025"
@ -324,7 +319,7 @@ dt.time-entry:before,
.icon-attention1:before
content: "\e038"
dt.attachment:before,
dt > .icon-attachment:before,
.icon-attachment:before
content: "\e039"
@ -370,7 +365,7 @@ dt.attachment:before,
.icon-bubble2:before
content: "\e047"
dt.reply:before,
dt > .icon-reply:before,
.icon-bubble3:before
content: "\e048"
@ -762,7 +757,7 @@ dt.reply:before,
.icon-wiki2:before
content: "\e027"
dt.wiki-page:before,
dt > .icon-wiki-page:before,
.icon-wiki-edit:before
content: "\e0c9"

@ -31,6 +31,7 @@
# The base activity provider class provides a default implementation for the #
# most common activity jobs. You may implement the following methods to set #
# the respective activity details: #
# - event_name #
# - event_title #
# - event_type #
# - event_description #
@ -83,7 +84,7 @@ class Activity::BaseActivityProvider
end
def format_event(event, event_data, activity)
[:event_title, :event_type, :event_description, :event_datetime, :event_path, :event_url].each do |a|
[:event_name, :event_title, :event_type, :event_description, :event_datetime, :event_path, :event_url].each do |a|
event[a] = self.send(a, event_data, activity) if self.class.method_defined? a
end
@ -123,4 +124,13 @@ class Activity::BaseActivityProvider
def projection_statement(table, column, name)
table[column].as(name)
end
class UndefinedEventTypeError < StandardError; end
def event_type(event, activity)
raise UndefinedEventTypeError.new('Abstract method event_type called')
end
def event_name(event, activity)
I18n.t(event_type(event, activity).underscore, scope: 'events')
end
end

@ -53,6 +53,10 @@ class Activity::ChangesetActivityProvider < Activity::BaseActivityProvider
protected
def event_type(event, activity)
'changeset'
end
def event_title(event, activity)
revision = format_revision(event)

@ -48,6 +48,10 @@ class Activity::NewsActivityProvider < Activity::BaseActivityProvider
event['title']
end
def event_type(event, activity)
'news'
end
def event_path(event, activity)
Rails.application.routes.url_helpers.news_path(url_helper_parameter(event))
end

@ -60,6 +60,10 @@ class Activity::TimeEntryActivityProvider < Activity::BaseActivityProvider
"#{l_hours(event['time_entry_hours'])} (#{time_entry_object_name})"
end
def event_type(event, activity)
'time-entry'
end
def work_package_title(event)
Activity::WorkPackageActivityProvider.work_package_title(event['journable_id'],
event['work_package_subject'],

@ -172,6 +172,12 @@ class WorkPackage < ActiveRecord::Base
end
end
def self.event_name
Proc.new do |o|
I18n.t(o.event_type.underscore, scope: 'events')
end
end
def self.event_type
Proc.new do |o|
journal = o.last_journal
@ -197,6 +203,7 @@ class WorkPackage < ActiveRecord::Base
acts_as_event title: JournalizedProcs.event_title,
type: JournalizedProcs.event_type,
name: JournalizedProcs.event_name,
url: JournalizedProcs.event_url
register_on_journal_formatter(:id, 'parent_id')

@ -39,7 +39,8 @@ See doc/COPYRIGHT.rdoc for more details.
<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="icon-context <%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
<dt class="<%= e.event_type %> <%= User.current.logged? && e.respond_to?(:event_author) && User.current == e.event_author ? 'me' : nil %>">
<%= icon_wrapper("icon-context icon-#{e.event_type}", e.event_name) %>
<%= avatar(e.event_author, :size => "24") if e.respond_to?(:event_author) %>
<span class="time"><%= format_time(e.event_datetime.to_time, false) %></span>
<%= content_tag('span', link_to(e.project.name, e.project), :class => 'project') if (@project.nil? || @project != e.project) && e.project %>

@ -27,6 +27,10 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<% content_for :header_tags do %>
<%= call_hook :search_index_head %>
<% end %>
<h2><%= l(:label_search) %></h2>
<div class="box">
@ -59,7 +63,8 @@ See doc/COPYRIGHT.rdoc for more details.
<dl id="search-results">
<% @results.each do |e| %>
<dt class="icon-context <%= e.event_type %>">
<dt class="<%= e.event_type %>">
<%= icon_wrapper("icon-context icon-#{e.event_type}", e.event_name) %>
<% if e.project != @project %>
<span class="project"><%= e.project %></span>
<% end %>

@ -27,6 +27,10 @@ See doc/COPYRIGHT.rdoc for more details.
++#%>
<% content_for :header_tags do %>
<%= call_hook :users_show_head %>
<% end %>
<div class="contextual">
<%= link_to(l(:button_edit), edit_user_path(@user), :class => 'icon icon-edit') if User.current.admin? %>
</div>
@ -78,7 +82,8 @@ See doc/COPYRIGHT.rdoc for more details.
<h4><%= format_activity_day(day) %></h4>
<dl>
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
<dt class="icon-context <%= e.event_type %>">
<dt class="<%= e.event_type %>">
<%= icon_wrapper("icon-context icon-#{e.event_type}", e.event_name) %>
<span class="time"><%= format_time(e.event_datetime, false) %></span>
<%= content_tag('span', h(e.project), :class => 'project') %>
<%= link_to format_activity_title(e.event_title), e.event_url %>

@ -520,6 +520,16 @@ de:
error_menu_item_not_created: Menüpunkt konnte nicht hinzugefügt werden.
error_menu_item_not_saved: Menüpunkt konnte nicht aktualisiert werden.
events:
changeset: Changeset bearbeitet
message: Nachricht bearbeitet
news: News
reply: Antwort erstellt
time_entry: Zeiterfassungseintrag-Bearbeitung
wiki_page: Wiki-Bearbeitung
work_package_closed: 'Arbeitspaket geschlossen'
work_package_edit: 'Arbeitspaket bearbeitet'
work_package_note: 'Arbeitspaket kommentiert'
general_csv_decimal_separator: ","
general_csv_encoding: "ISO-8859-1"

@ -517,6 +517,17 @@ en:
error_menu_item_not_created: Menu item could not be added
error_menu_item_not_saved: Menu item could not be saved
events:
changeset: 'Changeset edited'
message: Message edited
news: News
reply: Replied
time_entry: 'Timelog edited'
wiki_page: 'Wiki page edited'
work_package_closed: 'Work Package closed'
work_package_edit: 'Work Package edited'
work_package_note: 'Work Package note added'
general_csv_decimal_separator: "."
general_csv_encoding: "ISO-8859-1"
general_csv_separator: ","

@ -33,6 +33,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#2153` [Accessibility] Required fields MUST be displayed as required - group new
* `#2157` [Accessibility] Required fields MUST be displayed as required - enumeration new
* `#2228` [Accessibility] low contrast in backlogs task view
* `#2250` [Accessibility] activity icon labels
* `#2260` [Accessibility] no-existent alt-text for collapse/expand functionality in grouped work-package list
* `#2734` [API] Access-Key not supported for all controllers
* `#3120` Implement a test suite the spikes can be developed against
@ -42,6 +43,12 @@ See doc/COPYRIGHT.rdoc for more details.
* `#3546` Better icon for Timelines Module
* `#3547` Change color of Apply button in Activity
* `#3667` Better icon for Roadmap
* `#3120` Implement a test suite the spikes can be developed against
* `#3251` [Timelines] Filtering for Responsible filters everything
* `#3453` Highlight project in bread crumb
* `#3546` Better icon for Timelines Module
* `#3547` Change color of Apply button in Activity
* `#3667` Better icon for Roadmap
## 3.0.0pre42
@ -57,6 +64,7 @@ See doc/COPYRIGHT.rdoc for more details.
* `#2160` [Accessibility] Link form elements to their label - new LDAP authentication
* `#2161` [Accessibility] Link form elements to their label - new color
* `#2229` [Accessibility] low contrast in calendar view
* `#2250` [Accessibility] activity icon labels
* `#2258` [Accessibility] linearisation of issue show form
* `#2264` [Accessibility] Table headers for work package hierarchy and relations
* `#2500` Change default configuration in new OpenProject application so new projects are not public by default

@ -54,6 +54,7 @@ module Redmine
end
Event = Struct.new(:provider,
:event_name,
:event_title,
:event_description,
:author_id,
@ -212,6 +213,7 @@ module Redmine
datetime = e['event_datetime'].is_a?(String) ? DateTime.parse(e['event_datetime'])
: e['event_datetime']
event = Redmine::Acts::ActivityProvider::Event.new(self,
nil,
nil,
e['event_description'],
e['event_author'].to_i,

@ -41,6 +41,7 @@ module Redmine
:description => :description,
:author => :author,
:url => {:controller => '/welcome'},
:name => ::I18n.t(self.name.underscore, scope: 'events'),
:type => self.name.underscore.dasherize }
cattr_accessor :event_options
@ -54,7 +55,7 @@ module Redmine
base.extend ClassMethods
end
%w(datetime title description author type).each do |attr|
%w(datetime title description author name type).each do |attr|
src = <<-END_SRC
def event_#{attr}
option = event_options[:#{attr}]

Loading…
Cancel
Save