Use attribute data-confirm

This commit is contained in:
touffies
2013-11-05 16:39:52 +01:00
parent e13c5dc3d5
commit 1426984f55
3 changed files with 13 additions and 47 deletions

View File

@@ -33,7 +33,7 @@
<div id="account-info" class="panel-collapse collapse in">
{loop type="customer" name="customer.info"}
<div class="panel-body">
<p class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</p>
<p class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME|ucwords} {$LASTNAME|upper}</p>
{loop type="address" name="address.default" default="true"}
<ul class="list-info">
<li>
@@ -87,7 +87,7 @@
<td>
<ul class="list-address">
<li>
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME} {$LASTNAME}</span>
<span class="fn">{loop type="title" name="customer.title.info" id=$TITLE}{$SHORT}{/loop} {$FIRSTNAME|ucwords} {$LASTNAME|upper}</span>
{if $COMPANY}
<span class="org">{$COMPANY}</span>
{/if}
@@ -119,7 +119,7 @@
<div class="group-btn">
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="{intl l="Edit this address"}"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
{if $DEFAULT != 1}
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address" data-toggle="confirm" data-confirm-title="{intl l="Do you really want to delete this address ?"}" title="{intl l="Remove this address"}" ><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address" data-confirm="{intl l="Do you really want to delete this address ?"}" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
{/if}
</div>
</td>

View File

@@ -48,10 +48,10 @@
});
// Confirm Dialog
$(document).on('click.confirm', '[data-toggle="confirm"]', function (e) {
$(document).on('click.confirm', '[data-confirm]', function (e) {
var $this = $(this),
href = $this.attr('href'),
title = $this.attr('data-confirm-title') ? $this.attr('data-confirm-title') : 'Are you sure?';
title = $this.attr('data-confirm') != '' ? $this.attr('data-confirm') : 'Are you sure?';
bootbox.confirm(title, function(confirm) {
if(confirm){

View File

@@ -48,18 +48,19 @@
<table class="table table-address" role="presentation" summary="Address Books">
<tbody>
{loop type="address" name="customer.addresses" customer="current"}
{assign var="isDeliveryAddressChecked" value="0"}
{if $isPost}
{if $value == $ID}
{assign var="isDeliveryAddressChecked" value="true"}
{assign var="isDeliveryAddressChecked" value="1"}
{/if}
{elseif $DEFAULT}
{assign var="isDeliveryAddressChecked" value="true"}
{assign var="isDeliveryAddressChecked" value="1"}
{/if}
<tr>
<th>
<div class="radio">
<label for="delivery-address_{$ID}">
<input type="radio" name="{$name}" value="{$ID}"{if isDeliveryAddressChecked } checked="checked"{/if} id="delivery-address_{$ID}">
<input type="radio" name="{$name}" value="{$ID}"{if $isDeliveryAddressChecked} checked="checked"{/if} id="delivery-address_{$ID}">
{$LABEL|default:"{intl l='Address %nb' nb={$LOOP_COUNT}}"}
</label>
</div>
@@ -97,14 +98,12 @@
<div class="group-btn">
<a href="{url path="/address/update/{$ID}"}" class="btn btn-edit-address" data-toggle="tooltip" title="{intl l="Edit this address"}"><i class="icon-pencil"></i> <span>{intl l="Edit"}</span></a>
{if $DEFAULT != 1}
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address js-remove-address" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
<a href="{url path="/address/delete/{$ID}"}" class="btn btn-remove-address" data-confirm="{intl l="Do you really want to delete this address ?"}" title="{intl l="Remove this address"}" data-toggle="tooltip"><i class="icon-remove"></i> <span>{intl l="Cancel"}</span></a>
{/if}
</div>
</td>
</tr>
{/loop}
</tbody>
</table>
</div>
@@ -123,14 +122,15 @@
</div>
<div class="panel-body">
{loop type="delivery" name="deliveries" force_return="true"}
{assign var="isDeliveryMethodChecked" value="0"}
<div class="radio">
{form_field form=$form field='delivery-module'}
{if $isPost}
{if $value == $ID}
{assign var="isDeliveryMethodChecked" value="true"}
{assign var="isDeliveryMethodChecked" value="1"}
{/if}
{elseif $LOOP_COUNT == 1}
{assign var="isDeliveryMethodChecked" value="true"}
{assign var="isDeliveryMethodChecked" value="1"}
{/if}
<label for="delivery-method_{$ID}">
<input type="radio" name="{$name}" id="delivery-method_{$ID}"{if $isDeliveryMethodChecked} checked="checked"{/if} value="{$ID}">
@@ -152,38 +152,4 @@
</article>
</div>
<div class="modal fade" id="address-delete-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{intl l="Delete address"}</h3>
</div>
<div class="modal-body">
{intl l="Do you really want to delete this address ?"}
</div>
<div class="modal-footer">
<a href="#" type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true"><span class="glyphicon glyphicon-remove"></span> {intl l="No"}</a>
<a href="#" id="address-delete-link" type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span> {intl l="Yes"}</a>
</div>
</div>
</div>
</div>
{/block}
{block name="javascript-initialization"}
<script type="text/javascript">
jQuery(function($cart) {
$cart(".js-remove-address").click(function(e){
e.preventDefault();
$cart("#address-delete-link").attr("href", $cart(this).attr("href"));
$cart('#address-delete-modal').modal('show');
})
});
</script>
{/block}