Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
uri-confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
iasinov committed Apr 8, 2016
1 parent 6277b9e commit 03935f7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions resources/scripts/spiral/vault.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,15 @@ $(document).ready(function () {
$('.button-collapse').toggleClass('active');
}
});

$(document).on('click', '.js-vault-confirm', function (e) {
var text = $(e.target).hasClass('js-vault-confirm')
? $(e.target).data('confirm')
: $(e.target).parent('.js-vault-confirm').data('confirm');
if (!window.confirm(text)) {
e.preventDefault();
e.stopPropagation();
}
});

})
19 changes: 19 additions & 0 deletions source/views/elements/uriconfirm.dark.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php #compile
$this->runtimeVariable('__uri__parameters__', '${parameters}${data}${options}');
?>
<?php
/**
* @var mixed $__uri__parameters__
*/
$uri = vault()->uri(
'${href}${target}',
!empty($__uri__parameters__) ? $__uri__parameters__ : []
)->withFragment('${fragment}${section}${segment}');
?>
<a href="<?= (string)$uri ?>" class="js-vault-confirm ${class}" data-confirm="${confirm|Are you sure?}" node:attributes="exclude:class">
<?php #compile
ob_start(); ?>${icon}<?php #compile
if (!empty(ob_get_clean())) { ?><i class="material-icons ${icon-size|tiny}">${icon}</i><?php } #compile ?>${context}<?php #compile
ob_start(); ?>${post-icon}<?php #compile
if (!empty(ob_get_clean())) { ?><i class="material-icons ${post-icon-size|tiny}">${post-icon}</i><?php } #compile ?>
</a>

0 comments on commit 03935f7

Please sign in to comment.