From b09de6aec98a751628f68ea183b0c80cfc902122 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 11 Nov 2014 23:34:51 +0100 Subject: [PATCH] Added Tiki if no open but closed tickets exist. --- .../app/controllers/organization_profile.js.coffee | 11 +++++++++++ .../app/controllers/user_profile.js.coffee | 2 +- .../app/controllers/widget/ticket_stats.js.coffee | 10 ++++++++++ .../app/views/widget/ticket_stats_list.jst.eco | 6 ++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/organization_profile.js.coffee b/app/assets/javascripts/app/controllers/organization_profile.js.coffee index a72920d6b..df1acc6f9 100644 --- a/app/assets/javascripts/app/controllers/organization_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/organization_profile.js.coffee @@ -1,4 +1,7 @@ class App.OrganizationProfile extends App.Controller + events: + 'focusout [data-type=update]': 'update' + constructor: (params) -> super @@ -116,6 +119,14 @@ class App.OrganizationProfile extends App.Controller items: actions ) + update: (e) => + console.log('update') + note = $(e.target).ceg() + org = App.Organization.find( @organization_id ) + if org.note isnt note + org.updateAttributes( note: note ) + @log 'notice', 'update', e, note, org + class Router extends App.ControllerPermanent constructor: (params) -> super diff --git a/app/assets/javascripts/app/controllers/user_profile.js.coffee b/app/assets/javascripts/app/controllers/user_profile.js.coffee index 2ecac12f4..8ba02efc1 100644 --- a/app/assets/javascripts/app/controllers/user_profile.js.coffee +++ b/app/assets/javascripts/app/controllers/user_profile.js.coffee @@ -1,6 +1,6 @@ class App.UserProfile extends App.Controller events: - 'focusout [data-type=update]': 'update', + 'focusout [data-type=update]': 'update' constructor: (params) -> super diff --git a/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee b/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee index 9b3cab120..b2593c4b3 100644 --- a/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/ticket_stats.js.coffee @@ -64,10 +64,14 @@ class App.TicketStats extends App.Controller ) limit = 5 + iconClass = '' + if data.user_tickets_open_ids.length is 0 && data.user_tickets_closed_ids.length > 0 + iconClass = 'mood icon supergood-state' new TicketStatsList( el: @$('.js-user-open-tickets') user: @user head: 'Open Ticket' + iconClass: iconClass ticket_ids: data.user_tickets_open_ids limit: limit ) @@ -84,10 +88,14 @@ class App.TicketStats extends App.Controller ticket_volume_by_year: data.user_ticket_volume_by_year ) + iconClass = '' + if data.org_tickets_open_ids.length is 0 && data.org_tickets_closed_ids.length > 0 + iconClass = 'mood icon supergood-state' new TicketStatsList( el: @$('.js-org-open-tickets') user: @user head: 'Open Ticket' + iconClass: iconClass ticket_ids: data.org_tickets_open_ids limit: limit ) @@ -127,10 +135,12 @@ class TicketStatsList extends App.Controller @html App.view('widget/ticket_stats_list')( user: @user head: @head + iconClass: @iconClass ticket_ids: @ticket_ids ticket_ids_show: ticket_ids_show limit: @limit ) + @frontendTimeUpdate() @ticketPopups() diff --git a/app/assets/javascripts/app/views/widget/ticket_stats_list.jst.eco b/app/assets/javascripts/app/views/widget/ticket_stats_list.jst.eco index 1ee3baa19..ee00c46c3 100644 --- a/app/assets/javascripts/app/views/widget/ticket_stats_list.jst.eco +++ b/app/assets/javascripts/app/views/widget/ticket_stats_list.jst.eco @@ -13,6 +13,12 @@ <% end %> +<% if @ticket_ids.length is 0: %> +
+
+ <%- @T('No Tickets') %> +
+<% end %> <% if @ticket_ids.length > @ticket_ids_show.length: %> <%- @T('Show all ...') %> <% end %> \ No newline at end of file