Fixing delete shelf button javascript problem. Now works well with and without javascript: No-js users will not get a warning, but they will get a form button rather than a link.
Signed-off-by: Chris Cormack <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
8efd4e595e
commit
532ce95798
1 changed files with 16 additions and 9 deletions
|
@ -5,7 +5,7 @@
|
|||
// prepare DOM for YUI Toolbar
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#deleteshelfc").empty();
|
||||
// $("#deleteshelfc").empty();
|
||||
yuiToolbar();
|
||||
});
|
||||
|
||||
|
@ -14,14 +14,15 @@
|
|||
function yuiToolbar() {
|
||||
newshelfButton = new YAHOO.widget.Button("newshelf");
|
||||
editshelfButton = new YAHOO.widget.Button("editshelf");
|
||||
deleteshelfButton = new YAHOO.widget.Button({
|
||||
id: "deleteshelf",
|
||||
type: "button",
|
||||
label: "Delete Shelf",
|
||||
container: "deleteshelfc",
|
||||
onclick: {fn:function(){confirmDelete("Are you sure you want to delete this shelf?")}}
|
||||
});
|
||||
deleteshelfButton = new YAHOO.widget.Button("deleteshelf", { value: "deleteshelfvalue" });
|
||||
YAHOO.util.Event.on("deleteshelf_f", "submit", confirmDelete);
|
||||
}
|
||||
function confirmDelete(p_oEvent) {
|
||||
var bSubmit = window.confirm("Are you sure you want to delete this shelf?");
|
||||
if(!bSubmit) {
|
||||
YAHOO.util.Event.preventDefault(p_oEvent);
|
||||
}
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
@ -29,5 +30,11 @@
|
|||
<ul class="toolbar">
|
||||
|
||||
<li><a id="newshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1">New Shelf</a></li>
|
||||
<!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" --><li><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR NAME="shelfnumber" -->">Edit Shelf</a></li><li id="deleteshelfc"><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1&DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete Shelf</a></li><!-- /TMPL_IF --><!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" --><li><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?op=modif&shelf=<!-- TMPL_VAR NAME="shelfnumber" -->">Edit Shelf</a></li><li id="deleteshelfc"><form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post" id="deleteshelf_f">
|
||||
<input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" />
|
||||
<input type="hidden" name="shelves" value="1" />
|
||||
<input type="submit" id="deleteshelf" value="Delete Shelf" onclick="return confirmDelete('Are you sure you want to delete this shelf?')" /></form>
|
||||
</li>
|
||||
|
||||
<!-- /TMPL_IF --><!-- /TMPL_IF -->
|
||||
</ul></div>
|
||||
|
|
Loading…
Reference in a new issue