diff options
author | mistic100 <mistic@piwigo.org> | 2014-05-24 16:24:52 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2014-05-24 16:24:52 +0000 |
commit | ad10a97f4ac3ffad5508b90da45b5c5a63db95ff (patch) | |
tree | 5d31569cbd3784fee3ed7662dd838d281d3910cc /admin/themes/default/template/include/add_album.inc.tpl | |
parent | fea2a4efd1ad085def7cf84cc444325d0815b62e (diff) |
feature 3077 : use selectize on batch_manager_global, cat_modify and photos_add_direct
+ rewrite "add album" popup (more flexible and working with selectize)
git-svn-id: http://piwigo.org/svn/trunk@28533 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/themes/default/template/include/add_album.inc.tpl')
-rw-r--r-- | admin/themes/default/template/include/add_album.inc.tpl | 83 |
1 files changed, 6 insertions, 77 deletions
diff --git a/admin/themes/default/template/include/add_album.inc.tpl b/admin/themes/default/template/include/add_album.inc.tpl index 08ada07a4..f2d87146f 100644 --- a/admin/themes/default/template/include/add_album.inc.tpl +++ b/admin/themes/default/template/include/add_album.inc.tpl @@ -1,86 +1,15 @@ -{footer_script}{literal} -jQuery(document).ready(function(){ - jQuery(".addAlbumOpen").colorbox({ - inline: true, - href: "#addAlbumForm", - onComplete: function() { - var $albumSelect = jQuery("#albumSelect"); +{include file='include/colorbox.inc.tpl'} - jQuery("input[name=category_name]").focus(); - - jQuery("#category_parent").html('<option value="0">------------</option>') - .append($albumSelect.html()) - .val($albumSelect.val() || 0); - } - }); - - jQuery("#addAlbumForm form").submit(function() { - jQuery("#categoryNameError").text(""); - - var parent_id = jQuery("select[name=category_parent] option:selected").val(), - name = jQuery("input[name=category_name]").val(); - - jQuery.ajax({ - url: "ws.php", - dataType: 'json', - data: { - format: 'json', - method: 'pwg.categories.add', - parent: parent_id, - name: name - }, - beforeSend: function() { - jQuery("#albumCreationLoading").show(); - }, - success: function(data) { - jQuery("#albumCreationLoading").hide(); - jQuery(".addAlbumOpen").colorbox.close(); - - var newAlbum = data.result.id, - newAlbum_name = ''; - - if (parent_id!=0) { - newAlbum_name = jQuery("#category_parent").find("option[value="+ parent_id +"]").text() +' / '; - } - newAlbum_name+= name; - - var new_option = jQuery("<option/>") - .attr("value", newAlbum) - .attr("selected", "selected") - .text(newAlbum_name); - - var $albumSelect = jQuery("#albumSelect"); - $albumSelect.find("option").removeAttr('selected'); - - if (parent_id==0) { - $albumSelect.prepend(new_option); - } - else { - $albumSelect.find("option[value="+ parent_id +"]").after(new_option); - } - - jQuery("#addAlbumForm form input[name=category_name]").val(''); - jQuery("#albumSelection").show(); - - return true; - }, - error: function(XMLHttpRequest, textStatus, errorThrows) { - jQuery("#albumCreationLoading").hide(); - jQuery("#categoryNameError").text(errorThrows).css("color", "red"); - } - }); +{combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} +{combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} - return false; - }); -}); -{/literal}{/footer_script} +{combine_script id='addAlbum.js' load='footer' require='jquery.colorbox' path='admin/themes/default/js/addAlbum.js'} <div style="display:none"> - <div id="addAlbumForm" style="text-align:left;padding:1em;"> + <div id="addAlbumForm"> <form> {'Parent album'|@translate}<br> - <select id="category_parent" name="category_parent"> - </select> + <select name="category_parent"></select> <br><br> {'Album name'|@translate}<br> |