1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Добавлен функционал подтверждения при удалении объекта

This commit is contained in:
Denis Shakhov 2015-10-11 21:47:50 +07:00
parent 5e22fff995
commit 5823baf3b1
7 changed files with 23 additions and 9 deletions

View file

@ -539,7 +539,7 @@ $config['components'] = array(
// Базовые компоненты
'css-reset', 'css-helpers', 'typography', 'forms', 'grid', 'ls-vendor', 'ls-core', 'ls-component', 'lightbox', 'avatar', 'slider', 'details', 'alert', 'dropdown', 'button', 'block',
'nav', 'tooltip', 'tabs', 'modal', 'table', 'text', 'uploader', 'email', 'field', 'pagination', 'editor', 'more', 'crop',
'performance', 'toolbar', 'actionbar', 'badge', 'autocomplete', 'icon', 'item', 'highlighter', 'jumbotron', 'notification', 'blankslate',
'performance', 'toolbar', 'actionbar', 'badge', 'autocomplete', 'icon', 'item', 'highlighter', 'jumbotron', 'notification', 'blankslate', 'confirm',
// Компоненты LS CMS
'favourite', 'vote', 'auth', 'media', 'property', 'photo', 'note', 'user-list-add', 'subscribe', 'content', 'report', 'comment',

View file

@ -46,7 +46,7 @@
{else}
{$actions[] = [
'url' => "{router page='blog'}delete/{$blog->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}",
'classes' => 'js-blog-remove',
'classes' => 'js-confirm-remove-default',
'text' => $aLang.common.remove
]}
{/if}

View file

@ -26,10 +26,17 @@ ls.talk = (function ($) {
form_action: $('#talk-form-action')
}
$('.js-talk-form-action').on('click', function (e) {
$('.js-talk-form-action:not([data-action=remove])').on('click', function (e) {
_this.formAction( $(this).data('action') );
});
$('.js-talk-form-action[data-action=remove]').lsConfirm({
message: ls.lang.get('common.remove_confirm'),
onconfirm: function () {
_this.formAction( 'remove' );
}
})
// Выбор получателей в форме добавления
$('.js-talk-add-user-choose').lsUserFieldChoose({
urls: {
@ -41,10 +48,10 @@ ls.talk = (function ($) {
/**
* Установка экшена формы
*/
this.formAction = function(sName) {
this.formSetAction = function(action) {
if ( ! this.elements.form.find('input[type=checkbox]:checked').length ) return;
this.elements.form_action.val(sName);
this.elements.form_action.val(action);
this.elements.form.submit();
};

View file

@ -42,7 +42,7 @@
[ 'text' => {component 'favourite' classes="js-favourite-talk" target=$talk}, 'mods' => 'icon', 'classes' => 'js-talk-message-root-favourite' ]
]],
[ 'buttons' => [
[ 'icon' => 'trash', 'url' => "{$talk->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => {lang 'common.remove'}, 'show' => $oUserCurrent->getId() == $talk->getUser()->getId() || $oUserCurrent->isAdministrator() ]
[ 'icon' => 'trash', 'url' => "{$talk->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => {lang 'common.remove'}, 'show' => $oUserCurrent->getId() == $talk->getUser()->getId() || $oUserCurrent->isAdministrator(), 'classes' => 'js-confirm-remove-default' ]
]]
]}
</div>

View file

@ -73,7 +73,7 @@
{block 'topic_header_actions'}
{$items = [
[ 'icon' => 'edit', 'url' => $topic->getUrlEdit(), 'text' => $aLang.common.edit, 'show' => $topic->getIsAllowEdit() ],
[ 'icon' => 'trash', 'url' => "{$topic->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => $aLang.common.remove, 'show' => $topic->getIsAllowDelete() ]
[ 'icon' => 'trash', 'url' => "{$topic->getUrlDelete()}?security_ls_key={$LIVESTREET_SECURITY_KEY}", 'text' => $aLang.common.remove, 'show' => $topic->getIsAllowDelete(), 'classes' => 'js-confirm-remove-default' ]
]}
{/block}

View file

@ -30,7 +30,6 @@ jQuery(document).ready(function($){
$( 'input[type=text], textarea' ).placeholder();
}
/**
* Form validate
* Валидатор нужно иниц-ть до иниц-ии аякс форм, чтобы избежать валидации аякс-полей после сабмита формы
@ -38,6 +37,14 @@ jQuery(document).ready(function($){
$('.js-form-validate').parsley();
/**
* Подтверждение удаления
*/
$('.js-confirm-remove-default').lsConfirm({
message: ls.lang.get('common.remove_confirm')
});
/**
* Notification
*/

@ -1 +1 @@
Subproject commit 3dbb35b7075e1de0b4b86b65d9c741d4983ce518
Subproject commit ecd77c7f75cecd35881bb0b2d7fc1dabe872b514