Added channel quick enable/disable buttons.
This commit is contained in:
parent
81df51f274
commit
fa8bf6e65f
6 changed files with 101 additions and 8 deletions
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<p><%- @T('You have no configured account right now.') %></p>
|
||||
<% else: %>
|
||||
<% for channel in @account_channels: %>
|
||||
<div class="action" data-id="<%- channel.id %>">
|
||||
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%- channel.id %>">
|
||||
<div class="action-flow" style="width: 100%;">
|
||||
<div class="action-block action-block--flex">
|
||||
<div class="horizontal">
|
||||
|
@ -135,7 +135,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="action-controls">
|
||||
<div class="sla-toggle btn btn--danger btn--secondary js-channelDelete"><%- @T('Delete') %></div>
|
||||
<% if channel.active is true: %>
|
||||
<div class="btn btn--secondary js-channelDisable"><%- @T('Disable') %></div>
|
||||
<% else: %>
|
||||
<div class="btn btn--secondary js-channelEnable"><%- @T('Enable') %></div>
|
||||
<% end %>
|
||||
<div class="btn btn--danger btn--secondary js-channelDelete"><%- @T('Delete') %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="page-content">
|
||||
<% for channel in @channels: %>
|
||||
<div class="action" data-id="<%= channel.id %>">
|
||||
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%= channel.id %>">
|
||||
<div class="action-block action-row">
|
||||
<h2><%- @Icon('status', 'supergood-color inline') %> <%= channel.options.user.name %> <span class="text-muted"><%= channel.options.user.id %></span></h2>
|
||||
</div>
|
||||
|
@ -33,8 +33,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="action-controls">
|
||||
<div class="sla-toggle btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
|
||||
<div class="sla-edit btn js-edit"><%- @T('Edit') %></div>
|
||||
<div class="btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
|
||||
<% if channel.active is true: %>
|
||||
<div class="btn btn--secondary js-disable"><%- @T('Disable') %></div>
|
||||
<% else: %>
|
||||
<div class="btn btn--secondary js-enable"><%- @T('Enable') %></div>
|
||||
<% end %>
|
||||
<div class="btn js-edit"><%- @T('Edit') %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="page-content">
|
||||
<% for channel in @channels: %>
|
||||
<div class="action" data-id="<%= channel.id %>">
|
||||
<div class="action <% if channel.active isnt true: %>is-inactive<% end %>" data-id="<%= channel.id %>">
|
||||
<div class="action-block action-row">
|
||||
<h2><%- @Icon('status', 'supergood-color inline') %> <%= channel.options.user.name %> <span class="text-muted">@<%= channel.options.user.screen_name %></span></h2>
|
||||
</div>
|
||||
|
@ -61,8 +61,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="action-controls">
|
||||
<div class="sla-toggle btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
|
||||
<div class="sla-edit btn js-edit"><%- @T('Edit') %></div>
|
||||
<div class="btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
|
||||
<% if channel.active is true: %>
|
||||
<div class="btn btn--secondary js-disable"><%- @T('Disable') %></div>
|
||||
<% else: %>
|
||||
<div class="btn btn--secondary js-enable"><%- @T('Enable') %></div>
|
||||
<% end %>
|
||||
<div class="btn js-edit"><%- @T('Edit') %></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue