diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 501ecf03b..586caf4a7 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -221,6 +221,8 @@ class App.ChannelEmailAccountOverview extends App.Controller events: 'click .js-channelNew': 'wizard' 'click .js-channelDelete': 'delete' + 'click .js-channelDisable': 'disable' + 'click .js-channelEnable': 'enable' 'click .js-channelGroupChange': 'groupChange' 'click .js-editInbound': 'editInbound' 'click .js-editOutbound': 'editOutbound' @@ -329,6 +331,30 @@ class App.ChannelEmailAccountOverview extends App.Controller callback: @load ) + disable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = false + item.save( + done: => + @load() + fail: => + @load() + ) + + enable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = true + item.save( + done: => + @load() + fail: => + @load() + ) + groupChange: (e) => e.preventDefault() id = $(e.target).closest('.action').data('id') diff --git a/app/assets/javascripts/app/controllers/_channel/facebook.coffee b/app/assets/javascripts/app/controllers/_channel/facebook.coffee index ad3bc184e..53634bde9 100644 --- a/app/assets/javascripts/app/controllers/_channel/facebook.coffee +++ b/app/assets/javascripts/app/controllers/_channel/facebook.coffee @@ -5,6 +5,8 @@ class Index extends App.ControllerSubContent 'click .js-new': 'new' 'click .js-edit': 'edit' 'click .js-delete': 'delete' + 'click .js-disable': 'disable' + 'click .js-enable': 'enable' 'click .js-configApp': 'configApp' constructor: -> @@ -108,6 +110,30 @@ class Index extends App.ControllerSubContent callback: @load ) + disable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = false + item.save( + done: => + @load() + fail: => + @load() + ) + + enable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = true + item.save( + done: => + @load() + fail: => + @load() + ) + description: (e) => new App.ControllerGenericDescription( description: App.Twitter.description diff --git a/app/assets/javascripts/app/controllers/_channel/twitter.coffee b/app/assets/javascripts/app/controllers/_channel/twitter.coffee index 7e181e546..448ba774f 100644 --- a/app/assets/javascripts/app/controllers/_channel/twitter.coffee +++ b/app/assets/javascripts/app/controllers/_channel/twitter.coffee @@ -5,6 +5,8 @@ class Index extends App.ControllerSubContent 'click .js-edit': 'edit' 'click .js-delete': 'delete' 'click .js-configApp': 'configApp' + 'click .js-disable': 'disable' + 'click .js-enable': 'enable' constructor: -> super @@ -107,6 +109,30 @@ class Index extends App.ControllerSubContent callback: @load ) + disable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = false + item.save( + done: => + @load() + fail: => + @load() + ) + + enable: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Channel.find(id) + item.active = true + item.save( + done: => + @load() + fail: => + @load() + ) + description: (e) => new App.ControllerGenericDescription( description: App.Twitter.description diff --git a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco index eb65b6a52..eb09af0ce 100644 --- a/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco +++ b/app/assets/javascripts/app/views/channel/email_account_overview.jst.eco @@ -41,7 +41,7 @@

<%- @T('You have no configured account right now.') %>

<% else: %> <% for channel in @account_channels: %> -
+
@@ -135,7 +135,12 @@
-
<%- @T('Delete') %>
+ <% if channel.active is true: %> +
<%- @T('Disable') %>
+ <% else: %> +
<%- @T('Enable') %>
+ <% end %> +
<%- @T('Delete') %>
<% end %> diff --git a/app/assets/javascripts/app/views/facebook/list.jst.eco b/app/assets/javascripts/app/views/facebook/list.jst.eco index 657a79b70..4278eb38e 100644 --- a/app/assets/javascripts/app/views/facebook/list.jst.eco +++ b/app/assets/javascripts/app/views/facebook/list.jst.eco @@ -11,7 +11,7 @@
<% for channel in @channels: %> -
+

<%- @Icon('status', 'supergood-color inline') %> <%= channel.options.user.name %> <%= channel.options.user.id %>

@@ -33,8 +33,13 @@
-
<%- @T('Delete') %>
-
<%- @T('Edit') %>
+
<%- @T('Delete') %>
+ <% if channel.active is true: %> +
<%- @T('Disable') %>
+ <% else: %> +
<%- @T('Enable') %>
+ <% end %> +
<%- @T('Edit') %>
<% end %> diff --git a/app/assets/javascripts/app/views/twitter/list.jst.eco b/app/assets/javascripts/app/views/twitter/list.jst.eco index 9c6c1b572..6eaeca7c6 100644 --- a/app/assets/javascripts/app/views/twitter/list.jst.eco +++ b/app/assets/javascripts/app/views/twitter/list.jst.eco @@ -11,7 +11,7 @@
<% for channel in @channels: %> -
+

<%- @Icon('status', 'supergood-color inline') %> <%= channel.options.user.name %> @<%= channel.options.user.screen_name %>

@@ -61,8 +61,13 @@
-
<%- @T('Delete') %>
-
<%- @T('Edit') %>
+
<%- @T('Delete') %>
+ <% if channel.active is true: %> +
<%- @T('Disable') %>
+ <% else: %> +
<%- @T('Enable') %>
+ <% end %> +
<%- @T('Edit') %>
<% end %>