Don't show Upload File icon unless it is in capabilities list [Storage Manager]. Fixes #1739

Issue:
When clicked on upload icon while saving a file prompt user to leave page. It is because the icon is a button and its type is set to submit which makes it to prompt, instead it should be 'button'

Storage Manager's menu items depends on capabilities list set by the module using it. If capabilities doesn't have 'upload' in it, It won't work. Upload button is bound to click event only when it is in capabilities.

Solution:
As upload button is being added only when it is in capabilities, so upload button html is removed from html file. It will not shown on UI untill it is in capabilities list.
This commit is contained in:
Surinder Kumar 2016-10-07 12:31:38 +01:00 committed by Dave Page
parent c931d715ac
commit 3963272523
2 changed files with 1 additions and 3 deletions

View File

@ -18,8 +18,6 @@
<input class="mode" name="mode" type="hidden" value="add"/>
<input class="currentpath" name="currentpath" type="hidden"/>
<button type="button" title="Refresh" class="btn fa fa-refresh refresh"></button>
<button type="submit" title="Upload File" value="Upload" class="btn fa fa-upload upload"><span></span>
</button>
<button type="button" title="Download File" class="btn fa fa-download download" disabled><span></span>
</button>
<button name="delete" type="button" title="Delete File/Folder" class="btn fa fa-trash delete" disabled>

View File

@ -1418,7 +1418,7 @@ if (has_capability(data, 'upload')) {
$('.upload').remove();
$( ".create" ).before( '<button value="Upload" type="button" title="Upload File" name="upload" id="upload" class="btn fa fa-upload upload"><span></span></button> ' );
$('.upload').unbind().click(function() {
$('#uploader .upload').unbind().click(function() {
// we create prompt
var msg = '<div id="dropzone-container">' +
'<button class="fa fa-times dz_cross_btn"></button>' +