Added destroy option.

This commit is contained in:
Martin Edenhofer 2013-02-01 09:07:28 +01:00
parent 11ff582c6d
commit dcc7ba4535
4 changed files with 12 additions and 6 deletions

View file

@ -46,6 +46,7 @@ class App.ControllerTable extends App.Controller
overview = data.overview || data.model.configure_overview || []
attributes = data.attributes || data.model.configure_attributes || {}
header = data.header
destroy = data.model.configure_delete
# check if table is empty
if _.isEmpty(data.objects)
@ -117,6 +118,7 @@ class App.ControllerTable extends App.Controller
checkbox: data.checkbox
radio: data.radio
groupBy: data.groupBy
destroy: destroy
)
# convert to jquery object

View file

@ -91,6 +91,7 @@ class App.Overview extends Spine.Model
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
]
@configure_delete = true
@configure_overview = [
'name',
'link',

View file

@ -9,6 +9,7 @@ class App.TextModule extends App.Model
{ name: 'updated_at', display: 'Updated', type: 'time', readonly: 1 },
{ name: 'active', display: 'Active', tag: 'boolean', note: 'boolean', 'default': true, 'null': false, 'class': 'span4' },
]
@configure_delete = true
@configure_overview = [
'name',
'keywords',

View file

@ -10,9 +10,9 @@
<% for row in @header: %>
<th <% if row.style: %>style="<%= row.style %>"<% end %>><%- @T( row.display ) %></th>
<% end %>
<!--
<th>Destory</th>
-->
<% if @destroy: %>
<th class="span2"><%- @T('Destory') %></th>
<% end %>
</tr>
</thead>
<tbody>
@ -54,10 +54,12 @@
<% end %>
<!--
<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>
<% end %>
</tbody>