diff --git a/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco b/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco index 912bdb204..d4a31f52f 100644 --- a/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco @@ -6,6 +6,7 @@
<%= @T('See your tickets from within your favorite calendar by adding the following url to your calendar app.') %>
<%= @translationTable[stateType] %> | - | <%= @T('Show') %>
+ | <%= @T('Show') %>
<% end %>
diff --git a/config/routes/calendar_subscriptions.rb b/config/routes/calendar_subscriptions.rb
index ef609e982..204d0da0e 100644
--- a/config/routes/calendar_subscriptions.rb
+++ b/config/routes/calendar_subscriptions.rb
@@ -1,5 +1,11 @@
Zammad::Application.routes.draw do
+ # shorter version
+ match '/ical', to: 'calendar_subscriptions#all', via: :get
+ match '/ical/:object', to: 'calendar_subscriptions#object', via: :get
+ match '/ical/:object/:method', to: 'calendar_subscriptions#object', via: :get
+
+ # wording version
match '/calendar_subscriptions', to: 'calendar_subscriptions#all', via: :get
match '/calendar_subscriptions/:object', to: 'calendar_subscriptions#object', via: :get
match '/calendar_subscriptions/:object/:method', to: 'calendar_subscriptions#object', via: :get
diff --git a/lib/calendar_subscriptions/tickets.rb b/lib/calendar_subscriptions/tickets.rb
index 33b92d9b3..fe0d70fb6 100644
--- a/lib/calendar_subscriptions/tickets.rb
+++ b/lib/calendar_subscriptions/tickets.rb
@@ -59,14 +59,19 @@ class CalendarSubscriptions::Tickets
condition: condition,
)
+ user_locale = @user.preferences['locale'] || 'en'
+ translated_ticket = Translation.translate(user_locale, 'ticket')
+
events_data = []
tickets.each do |ticket|
event_data = {}
+ translated_state = Translation.translate(user_locale, ticket.state.name)
+
event_data[:dtstart] = Icalendar::Values::Date.new( Time.zone.today )
event_data[:dtend] = Icalendar::Values::Date.new( Time.zone.today )
- event_data[:summary] = "#{ticket.state.name} ticket: '#{ticket.title}'"
+ event_data[:summary] = "#{translated_state} #{translated_ticket}: '#{ticket.title}'"
event_data[:description] = "T##{ticket.number}"
events_data.push event_data
@@ -98,6 +103,9 @@ class CalendarSubscriptions::Tickets
condition: condition,
)
+ user_locale = @user.preferences['locale'] || 'en'
+ translated_ticket = Translation.translate(user_locale, 'ticket')
+
events_data = []
tickets.each do |ticket|
@@ -110,11 +118,13 @@ class CalendarSubscriptions::Tickets
pending_time = Time.zone.today
end
+ translated_state = Translation.translate(user_locale, ticket.state.name)
+
# rubocop:disable Rails/TimeZone
event_data[:dtstart] = Icalendar::Values::DateTime.new( pending_time )
event_data[:dtend] = Icalendar::Values::DateTime.new( pending_time )
# rubocop:enable Rails/TimeZone
- event_data[:summary] = "#{ticket.state.name} ticket: '#{ticket.title}'"
+ event_data[:summary] = "#{translated_state} #{translated_ticket}: '#{ticket.title}'"
event_data[:description] = "T##{ticket.number}"
events_data.push event_data
@@ -138,6 +148,9 @@ class CalendarSubscriptions::Tickets
condition: condition,
)
+ user_locale = @user.preferences['locale'] || 'en'
+ translated_ticket_escalation = Translation.translate(user_locale, 'ticket escalation')
+
tickets.each do |ticket|
next if !ticket.escalation_time
@@ -153,7 +166,7 @@ class CalendarSubscriptions::Tickets
event_data[:dtstart] = Icalendar::Values::DateTime.new( escalation_time )
event_data[:dtend] = Icalendar::Values::DateTime.new( escalation_time )
# rubocop:enable Rails/TimeZone
- event_data[:summary] = "ticket escalation: '#{ticket.title}'"
+ event_data[:summary] = "#{translated_ticket_escalation}: '#{ticket.title}'"
event_data[:description] = "T##{ticket.number}"
events_data.push event_data
|