Merge branch 'develop' of github.com:martini/zammad into develop

# Conflicts:
#	app/assets/javascripts/app/views/profile/calendar_subscriptions.jst.eco
This commit is contained in:
Felix Niklas 2015-06-29 17:07:03 +02:00
commit f28ab344f5
4 changed files with 25 additions and 8 deletions

View file

@ -6,6 +6,7 @@
<div class="btn">Default Button</div> <div class="btn">Default Button</div>
<div class="btn btn--slim">Slim Button</div> <div class="btn btn--slim">Slim Button</div>
<div class="btn is-disabled">Disabled Button</div> <div class="btn is-disabled">Disabled Button</div>
<div class="btn" disabled>Disabled Button</div>
<h3>Primary</h3> <h3>Primary</h3>
<div class="btn btn--primary">Primary Button</div> <div class="btn btn--primary">Primary Button</div>

View file

@ -8,10 +8,7 @@
<p><%= @T('See your tickets from within your favorite calendar by adding the following url to your calendar app.') %></p> <p><%= @T('See your tickets from within your favorite calendar by adding the following url to your calendar app.') %></p>
<h3><%= @T('URL') %></h3> <h3><%= @T('URL') %></h3>
<div class="output-input"> <input class="form-control js-select" readonly value="<%= @baseurl %>/ical/tickets">
<output class="js-output"></output>
<input class="form-control js-select" readonly value="<%= @baseurl %>/calendar_subscriptions/tickets">
</div>
<h3><%= @T('Subscription Settings') %></h3> <h3><%= @T('Subscription Settings') %></h3>
<table class="settings-list"> <table class="settings-list">
@ -28,7 +25,7 @@
<td style="text-transform: capitalize"><%= @translationTable[stateType] %> <td style="text-transform: capitalize"><%= @translationTable[stateType] %>
<td><label class="inline-label"><input type="checkbox" name="<%= stateType %>/own"<%= if options.own then ' checked' %>> <%= @T('own tickets') %></label> <td><label class="inline-label"><input type="checkbox" name="<%= stateType %>/own"<%= if options.own then ' checked' %>> <%= @T('own tickets') %></label>
<td><label class="inline-label"><input type="checkbox" name="<%= stateType %>/not_assigned"<%= if options.not_assigned then ' checked' %>> <%= @T('not assigned tickets') %></label> <td><label class="inline-label"><input type="checkbox" name="<%= stateType %>/not_assigned"<%= if options.not_assigned then ' checked' %>> <%= @T('not assigned tickets') %></label>
<td><div class="btn btn--table btn--text js-showLink"><%= @T('Show') %></div><input class="form-control form-control--borderless js-select is-hidden" readonly value="<%= @baseurl %>/calendar_subscriptions/tickets/<%= stateType %>"> <td><div class="btn btn--table btn--text js-showLink"><%= @T('Show') %></div><input class="form-control form-control--borderless js-select is-hidden" readonly value="<%= @baseurl %>/ical/tickets/<%= stateType %>">
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View file

@ -1,5 +1,11 @@
Zammad::Application.routes.draw do 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', to: 'calendar_subscriptions#all', via: :get
match '/calendar_subscriptions/:object', to: 'calendar_subscriptions#object', via: :get match '/calendar_subscriptions/:object', to: 'calendar_subscriptions#object', via: :get
match '/calendar_subscriptions/:object/:method', to: 'calendar_subscriptions#object', via: :get match '/calendar_subscriptions/:object/:method', to: 'calendar_subscriptions#object', via: :get

View file

@ -59,14 +59,19 @@ class CalendarSubscriptions::Tickets
condition: condition, condition: condition,
) )
user_locale = @user.preferences['locale'] || 'en'
translated_ticket = Translation.translate(user_locale, 'ticket')
events_data = [] events_data = []
tickets.each do |ticket| tickets.each do |ticket|
event_data = {} event_data = {}
translated_state = Translation.translate(user_locale, ticket.state.name)
event_data[:dtstart] = Icalendar::Values::Date.new( Time.zone.today ) event_data[:dtstart] = Icalendar::Values::Date.new( Time.zone.today )
event_data[:dtend] = 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}" event_data[:description] = "T##{ticket.number}"
events_data.push event_data events_data.push event_data
@ -98,6 +103,9 @@ class CalendarSubscriptions::Tickets
condition: condition, condition: condition,
) )
user_locale = @user.preferences['locale'] || 'en'
translated_ticket = Translation.translate(user_locale, 'ticket')
events_data = [] events_data = []
tickets.each do |ticket| tickets.each do |ticket|
@ -110,11 +118,13 @@ class CalendarSubscriptions::Tickets
pending_time = Time.zone.today pending_time = Time.zone.today
end end
translated_state = Translation.translate(user_locale, ticket.state.name)
# rubocop:disable Rails/TimeZone # rubocop:disable Rails/TimeZone
event_data[:dtstart] = Icalendar::Values::DateTime.new( pending_time ) event_data[:dtstart] = Icalendar::Values::DateTime.new( pending_time )
event_data[:dtend] = Icalendar::Values::DateTime.new( pending_time ) event_data[:dtend] = Icalendar::Values::DateTime.new( pending_time )
# rubocop:enable Rails/TimeZone # 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}" event_data[:description] = "T##{ticket.number}"
events_data.push event_data events_data.push event_data
@ -138,6 +148,9 @@ class CalendarSubscriptions::Tickets
condition: condition, condition: condition,
) )
user_locale = @user.preferences['locale'] || 'en'
translated_ticket_escalation = Translation.translate(user_locale, 'ticket escalation')
tickets.each do |ticket| tickets.each do |ticket|
next if !ticket.escalation_time next if !ticket.escalation_time
@ -153,7 +166,7 @@ class CalendarSubscriptions::Tickets
event_data[:dtstart] = Icalendar::Values::DateTime.new( escalation_time ) event_data[:dtstart] = Icalendar::Values::DateTime.new( escalation_time )
event_data[:dtend] = Icalendar::Values::DateTime.new( escalation_time ) event_data[:dtend] = Icalendar::Values::DateTime.new( escalation_time )
# rubocop:enable Rails/TimeZone # 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}" event_data[:description] = "T##{ticket.number}"
events_data.push event_data events_data.push event_data