Skip to content

Commit

Permalink
Added modal confirm-delete
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 20, 2013
1 parent 57f5f57 commit 34bbf46
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 26 deletions.
15 changes: 3 additions & 12 deletions app/views/backend/assets/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

{{-- Page content --}}
@section('content')


<div class="page-header">
<h3>
Assets
Expand All @@ -30,12 +28,9 @@
<th class="span2">@lang('admin/assets/table.asset_tag')</th>
<th class="span2"><span class="line"></span>@lang('admin/assets/table.title')</th>
<th class="span2"><span class="line"></span>@lang('admin/assets/table.serial')</th>
<th class="span3"><span class="line"></span>@lang('admin/assets/table.checkoutto')</th>
<th class="span2"><span class="line"></span>@lang('admin/assets/table.checkoutto')</th>
<th class="span2"><span class="line"></span>@lang('admin/assets/table.location')</th>
<th class="span1"><span class="line"></span>@lang('admin/assets/table.change')</th>
<th class="span2"><span class="line"></span>@lang('admin/assets/table.purchase_date')</th>
<!-- <th class="span2"><span class="line"></span>@lang('admin/assets/table.purchase_cost')</th> -->
<!-- <th class="span2"><span class="line"></span>@lang('admin/assets/table.book_value')</th> -->
<th class="span2"><span class="line"></span>@lang('table.actions')</th>
</tr>
</thead>
Expand Down Expand Up @@ -65,21 +60,17 @@
<a href="{{ route('checkout/asset', $asset->id) }}" class="btn-flat success">Checkout</a>
@endif
</td>
<td>{{ $asset->purchase_date }}</td>
<!-- <td>${{ number_format($asset->purchase_cost) }}</td> -->
<!-- <td>${{ number_format($asset->depreciation()) }}</td> -->
<td nowrap="nowrap">

<a href="{{ route('update/asset', $asset->id) }}" class="btn-flat white">@lang('button.edit')</a>
<a href="{{ route('delete/asset', $asset->id) }}" class="btn-flat danger">@lang('button.delete')</a>

<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/asset', $asset->id) }}" data-content="Are you sure you wish to delete this asset?" data-title="Delete this asset?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>


@if ($assets->getTotal() > 10)
{{ $assets->links() }}
@endif
Expand Down
2 changes: 1 addition & 1 deletion app/views/backend/categories/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</td>
<td>
<a href="{{ route('update/category', $category->id) }}" class="btn-flat white"> @lang('button.edit')</a>
<a href="{{ route('delete/category', $category->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/category', $category->id) }}" data-content="Are you sure you wish to delete the {{ $category->name }} category?" data-title="Delete this category?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion app/views/backend/depreciations/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<td>{{ $depreciation->months }} @lang('admin/depreciations/table.months') </td>
<td>
<a href="{{ route('update/depreciations', $depreciation->id) }}" class="btn-flat white">@lang('button.edit')</a>
<a href="{{ route('delete/depreciations', $depreciation->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/depreciations', $depreciation->id) }}" data-content="Are you sure you wish to delete the {{ $depreciation->name }} depreciation class?" data-title="Delete {{ $depreciation->name }}?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion app/views/backend/groups/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<td>{{ $group->created_at->diffForHumans() }}</td>
<td>
<a href="{{ route('update/group', $group->id) }}" class="btn-flat white">@lang('button.edit')</a>
<a href="{{ route('delete/group', $group->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/group', $group->id) }}" data-content="Are you sure you wish to delete the {{ $group->name }} group?" data-title="Delete {{ $group->name }}?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
Expand Down
18 changes: 18 additions & 0 deletions app/views/backend/layouts/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,28 @@
// jQuery Knobs
$(".knob").knob();
// confirm delete modal
$('.delete-asset').click(function(evnt) {
var href = $(this).attr('href');
var message = $(this).attr('data-content');
var title = $(this).attr('data-title');
if (!$('#dataConfirmModal').length) {
$('body').append('<div id="dataConfirmModal" class="modal" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close " data-dismiss="modal" aria-hidden="true">×</button><h3 id="dataConfirmLabel">'+title+'</h3></div><div class="modal-body">'+message+'</div><div class="modal-footer"><button class="btn-flat white" data-dismiss="modal" aria-hidden="true">No</button> <a class="btn-flat danger" id="dataConfirmOK">Yes</a></div></div>');
}
$('#dataConfirmModal').find('.modal-body').text(message);
$('#dataConfirmOK').attr('href', href);
$('#dataConfirmModal').modal({show:true});
})
});
</script>


Expand Down
6 changes: 5 additions & 1 deletion app/views/backend/licenses/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@
</td>
<td>
<a href="{{ route('update/license', $license->id) }}" class="btn-flat white"> @lang('button.edit')</a>
<a href="{{ route('delete/license', $license->id) }}" class="btn-flat danger"> @lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/license', $license->id) }}" data-content="Are you sure you wish to delete the {{ $license->name }} license?" data-title="Delete {{ $license->name }}?" onClick="return false;">@lang('button.delete')</a>




</td>
</tr>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion app/views/backend/locations/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<td>{{ $location->city }}, {{ $location->state }} {{ $location->country }} </td>
<td>
<a href="{{ route('update/location', $location->id) }}" class="btn-flat white"> @lang('button.edit')</a>
<a href="{{ route('delete/location', $location->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/location', $location->id) }}" data-content="Are you sure you wish to delete the {{ $location->name }} location?" data-title="Delete {{ $location->name }}?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
Expand Down
2 changes: 1 addition & 1 deletion app/views/backend/manufacturers/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<td>{{ $manufacturer->name }}</td>
<td>
<a href="{{ route('update/manufacturer', $manufacturer->id) }}" class="btn-flat white">@lang('button.edit')</a>
<a href="{{ route('delete/manufacturer', $manufacturer->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/manufacturer', $manufacturer->id) }}" data-content="Are you sure you wish to delete the {{ $manufacturer->name }} manufacturer?" data-title="Delete {{ $manufacturer->name }}?" onClick="return false;">@lang('button.delete')</a>
</td>
</tr>
@endforeach
Expand Down
11 changes: 4 additions & 7 deletions app/views/backend/models/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,21 @@
<th class="span3">@lang('admin/models/table.title')</th>
<th class="span3"><span class="line"></span>@lang('admin/models/table.modelnumber')</th>
<th class="span1"><span class="line"></span>@lang('admin/models/table.numassets')</th>
<th class="span1"><span class="line"></span>@lang('admin/models/table.created_at')</th>
<th class="span2"><span class="line"></span>@lang('admin/models/table.created_at')</th>
<th class="span3"><span class="line"></span>@lang('table.actions')</th>
</tr>
</thead>
<tbody>
@foreach ($models as $model)
<tr>
<td>{{ $model->name }}



</td>
<td>{{ $model->name }}</td>
<td>{{ $model->modelno }}</td>
<td>{{ ($model->assets->count()) }}</td>
<td>{{ $model->created_at->diffForHumans() }}</td>
<td>
<a href="{{ route('update/model', $model->id) }}" class="btn-flat white">@lang('button.edit')</a>
<a href="{{ route('delete/model', $model->id) }}" class="btn-flat danger">@lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/model', $model->id) }}" data-content="Are you sure you wish to delete the {{ $model->name }} model?" data-title="Delete {{ $model->name }}?" onClick="return false;">@lang('button.delete')</a>

</td>
</tr>
@endforeach
Expand Down
3 changes: 2 additions & 1 deletion app/views/backend/users/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
@else
<a href="{{ route('update/user', $user->id) }}" class="btn-flat white"><i class="icon-pencil"></i> @lang('button.edit')</a>
@if (Sentry::getId() !== $user->id)
<a href="{{ route('delete/user', $user->id) }}" class="btn-flat danger"><i class="icon-remove icon-white"></i> @lang('button.delete')</a>
<a class="btn-flat danger delete-asset" data-toggle="modal" href="{{ route('delete/user', $user->id) }}" data-content="Are you sure you wish to delete the user {{ $user->fullName() }}?" data-title="Delete {{ $user->first_name }}?" onClick="return false;"><i class="icon-remove icon-white"></i> @lang('button.delete')</a>

@else
<span class="btn-flat danger disabled"><i class="icon-remove icon-white"></i> @lang('button.delete')</span>
@endif
Expand Down

0 comments on commit 34bbf46

Please sign in to comment.