Added destroy option.
This commit is contained in:
parent
11ff582c6d
commit
dcc7ba4535
4 changed files with 12 additions and 6 deletions
|
@ -46,6 +46,7 @@ class App.ControllerTable extends App.Controller
|
||||||
overview = data.overview || data.model.configure_overview || []
|
overview = data.overview || data.model.configure_overview || []
|
||||||
attributes = data.attributes || data.model.configure_attributes || {}
|
attributes = data.attributes || data.model.configure_attributes || {}
|
||||||
header = data.header
|
header = data.header
|
||||||
|
destroy = data.model.configure_delete
|
||||||
|
|
||||||
# check if table is empty
|
# check if table is empty
|
||||||
if _.isEmpty(data.objects)
|
if _.isEmpty(data.objects)
|
||||||
|
@ -117,6 +118,7 @@ class App.ControllerTable extends App.Controller
|
||||||
checkbox: data.checkbox
|
checkbox: data.checkbox
|
||||||
radio: data.radio
|
radio: data.radio
|
||||||
groupBy: data.groupBy
|
groupBy: data.groupBy
|
||||||
|
destroy: destroy
|
||||||
)
|
)
|
||||||
|
|
||||||
# convert to jquery object
|
# convert to jquery object
|
||||||
|
|
|
@ -91,6 +91,7 @@ class App.Overview extends Spine.Model
|
||||||
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
||||||
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||||
]
|
]
|
||||||
|
@configure_delete = true
|
||||||
@configure_overview = [
|
@configure_overview = [
|
||||||
'name',
|
'name',
|
||||||
'link',
|
'link',
|
||||||
|
|
|
@ -9,6 +9,7 @@ class App.TextModule extends App.Model
|
||||||
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
|
||||||
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
|
||||||
]
|
]
|
||||||
|
@configure_delete = true
|
||||||
@configure_overview = [
|
@configure_overview = [
|
||||||
'name',
|
'name',
|
||||||
'keywords',
|
'keywords',
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
<% for row in @header: %>
|
<% for row in @header: %>
|
||||||
<th <% if row.style: %>style="<%= row.style %>"<% end %>><%- @T( row.display ) %></th>
|
<th <% if row.style: %>style="<%= row.style %>"<% end %>><%- @T( row.display ) %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--
|
<% if @destroy: %>
|
||||||
<th>Destory</th>
|
<th class="span2"><%- @T('Destory') %></th>
|
||||||
-->
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -54,10 +54,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<!--
|
<!--
|
||||||
<td><%= object.updated_at %></td>
|
<td><%= object.updated_at %></td>
|
||||||
<td>
|
|
||||||
<a data-type="destroy">Destroy</a>
|
|
||||||
</td>
|
|
||||||
-->
|
-->
|
||||||
|
<% if @destroy: %>
|
||||||
|
<td>
|
||||||
|
<a data-type="destroy">x</a>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue