Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed and cleaned up Blocks javascript.
- Loading branch information
Showing
7 changed files
with
96 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/system/Zikula/Module/BlocksModule/Resources/public/js/Zikula.Blocks.Admin.Common.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright Zikula Foundation 2013 - license GNU/LGPLv3 (or at your option, any later version). | ||
|
||
/******************************************************************************* | ||
* Toggle block | ||
*******************************************************************************/ | ||
( function($) { | ||
$(document).ready(function() { | ||
$('.z-admin-content .label[data-bid]').click( function(e) { | ||
e.preventDefault(); | ||
var a = $(this) | ||
$.ajax({ | ||
url: 'index.php?module=ZikulaBlocksModule&type=ajax&func=toggleblock', | ||
data: { | ||
bid: a.data('bid') | ||
}, | ||
success: function(response) { | ||
// toggle label | ||
a.parent().find('a').toggleClass('hide'); | ||
|
||
} | ||
}); | ||
}); | ||
}); | ||
})(jQuery); |
60 changes: 60 additions & 0 deletions
60
...stem/Zikula/Module/BlocksModule/Resources/public/js/Zikula.Blocks.Admin.Modifyposition.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright Zikula Foundation 2013 - license GNU/LGPLv3 (or at your option, any later version). | ||
|
||
/******************************************************************************* | ||
* Sort blocks in a block position | ||
*******************************************************************************/ | ||
( function($) {$(document).ready(function() { | ||
|
||
// Return a helper with preserved width of cells | ||
var fixHelper = function(e, ui) { | ||
ui.children().each(function() { | ||
$(this).width($(this).width()); | ||
}); | ||
return ui; | ||
}; | ||
|
||
$("#assignedblocklist tbody").sortable({ | ||
connectWith: "#unassignedblocklist tbody", | ||
helper: fixHelper, | ||
placeholder: "warning", | ||
update: function(event, ui) { | ||
// Make sure to always show a dropzone. | ||
if ($('#assignedblocklist tbody tr').length <= 1) { | ||
$('#assignedblocklist .sortable-placeholder').fadeIn(); | ||
} else { | ||
$('#assignedblocklist .sortable-placeholder').fadeOut(); | ||
} | ||
|
||
var blockorder = new Array(); | ||
$('#assignedblocklist > tbody > tr').each( function() { | ||
var bid = $(this).data('bid'); | ||
if (bid !== undefined) { | ||
blockorder.push(bid); | ||
} | ||
}); | ||
|
||
$.ajax({ | ||
url: 'index.php?module=ZikulaBlocksModule&type=ajax&func=changeblockorder', | ||
data: { | ||
position: $('#position').val(), | ||
blockorder: blockorder | ||
} | ||
}); | ||
} | ||
}).disableSelection(); | ||
|
||
$("#unassignedblocklist tbody").sortable({ | ||
connectWith: "#assignedblocklist tbody", | ||
helper: fixHelper, | ||
placeholder: "warning", | ||
update: function(event, ui) { | ||
// Make sure to always show a dropzone. | ||
if ($('#unassignedblocklist tbody tr').length <= 1) { | ||
$('#unassignedblocklist .sortable-placeholder').fadeIn(); | ||
} else { | ||
$('#unassignedblocklist .sortable-placeholder').fadeOut(); | ||
} | ||
} | ||
}).disableSelection(); | ||
|
||
});})(jQuery); |
68 changes: 0 additions & 68 deletions
68
src/system/Zikula/Module/BlocksModule/Resources/public/js/blocks.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/system/Zikula/Module/BlocksModule/Resources/views/blocks_admin_view.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
src/system/Zikula/Module/BlocksModule/Resources/views/blocks_block_extmenu_modify.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters