Added set default and delete actions to overview.
This commit is contained in:
parent
19a6347ac9
commit
d692690da5
2 changed files with 30 additions and 2 deletions
|
@ -2,6 +2,8 @@ class Index extends App.ControllerContent
|
|||
events:
|
||||
'click .js-new': 'new'
|
||||
'click .js-edit': 'edit'
|
||||
'click .js-delete': 'delete'
|
||||
'click .js-default': 'default'
|
||||
'click .js-description': 'description'
|
||||
|
||||
constructor: ->
|
||||
|
@ -102,6 +104,28 @@ class Index extends App.ControllerContent
|
|||
large: true
|
||||
)
|
||||
|
||||
delete: (e) =>
|
||||
e.preventDefault()
|
||||
id = $(e.target).closest('.action').data('id')
|
||||
item = App.Calendar.find(id)
|
||||
new App.ControllerGenericDestroyConfirm(
|
||||
item: item
|
||||
container: @el.closest('.content')
|
||||
callback: @load
|
||||
)
|
||||
|
||||
default: (e) =>
|
||||
e.preventDefault()
|
||||
id = $(e.target).closest('.action').data('id')
|
||||
item = App.Calendar.find(id)
|
||||
item.default = true
|
||||
item.save(
|
||||
done: =>
|
||||
@load()
|
||||
fail: =>
|
||||
@load()
|
||||
)
|
||||
|
||||
description: (e) =>
|
||||
new App.ControllerGenericDescription(
|
||||
description: App.Calendar.description
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<div class="action-block action-block--flex">
|
||||
<div class="label"><%- @T('Public Holidays') %></div>
|
||||
<table class="table table-fluid">
|
||||
<% if _.isEmpty(calendar.public_holidays_preview): %>-<% end %>
|
||||
<% for holiday, meta of calendar.public_holidays_preview: %>
|
||||
<tr <% if !meta.active: %>class="is-inactive"<% end %>><td><%- @Tdate(holiday) %></td><td><%= meta.summary %></td></tr>
|
||||
<% end %>
|
||||
|
@ -61,8 +62,11 @@
|
|||
</div>
|
||||
<div class="action-controls">
|
||||
<% if !calendar.default: %>
|
||||
<div class="sla-toggle btn btn--danger btn--secondary js-toggle"><%- @T('Delete') %></div>
|
||||
<div class="sla-toggle btn btn--secondary js-toggle"><%- @T('Set as Default') %></div>
|
||||
<div class="sla-toggle btn btn--danger btn--secondary js-delete"><%- @T('Delete') %></div>
|
||||
<div class="sla-toggle btn btn--secondary js-default"><%- @T('Set as Default') %></div>
|
||||
<% else: %>
|
||||
<div class="btn btn--danger btn--secondary is-disabled"><%- @T('Delete') %></div>
|
||||
<div class="btn btn--secondary is-disabled"><%- @T('Is Default') %></div>
|
||||
<% end %>
|
||||
<div class="sla-edit btn js-edit"><%- @T('Edit') %></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue