Merge branch 'develop' into improvement/frio-action-links-to-buttons

# Conflicts:
#	view/theme/frio/js/filebrowser.js
#	view/theme/frio/templates/filebrowser.tpl
This commit is contained in:
Hypolite Petovan 2017-03-25 20:27:26 -04:00
commit d7f80bf7e7
4 changed files with 93 additions and 48 deletions

View file

@ -1316,6 +1316,18 @@ section #jotOpen {
color: #fff;
}
/* Filebrowser */
.fbrowser .profile-rotator-wrapper {
min-height: 200px;
}
.fbrowser .fa-spin {
position: absolute;
left: 45%;
top: 40%;
font-size: 48px;
margin:0px auto;
}
/*
/* Stream
*/

View file

@ -88,23 +88,34 @@ var FileBrowser = {
console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );
// We need to add the AjaxUpload to the button
FileBrowser.uploadButtons();
$(".error .close").on("click", function(e) {
e.preventDefault();
$(".error").addClass("hidden");
});
$(".folders a, .path a, .folders button, .path button").on("click", function(e) {
// Click on album link
$(".fbrowser").on("click", ".folders a, .path a, .folders button, .path button", function(e) {
e.preventDefault();
var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none";
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
// load new content to fbrowser window
$(".fbrowser").load(url,function() {
$(function() {FileBrowser.init(nickname, type, hash);});
$(".fbrowser").load(url, function(responseText, textStatus){
$(".profile-rotator-wrapper").hide();
if (textStatus === 'success') {
$(".fbrowser_content").show();
// We need to add the AjaxUpload to the button
FileBrowser.uploadButtons();
}
});
});
//embed on click
$(".photo-album-photo-link").on('click', function(e) {
$(".fbrowser").on('click', ".photo-album-photo-link", function(e) {
e.preventDefault();
var embed = "";
@ -142,39 +153,52 @@ var FileBrowser = {
// update autosize for this textarea
autosize.update($(".text-autosize"));
});
},
if ($("#upload-image").length)
uploadButtons: function() {
if ($("#upload-image").length) {
var image_uploader = new window.AjaxUpload(
'upload-image',
{ action: 'wall_upload/'+FileBrowser.nickname+'?response=json',
name: 'userfile',
responseType: 'json',
onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },
onSubmit: function(file,ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass('hidden');
},
onComplete: function(file,response) {
if (response['error']!= undefined) {
$(".error span").html(response['error']);
$(".error").removeClass('hidden');
$('#profile-rotator').hide();
$(".fbrowser .profile-rotator-wrapper").hide();
return;
}
$(".profile-rotator-wrapper").hide();
$(".fbrowser_content").show();
// location = baseurl + "/fbrowser/image/?mode=none"+location['hash'];
// location.reload(true);
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"
// load new content to fbrowser window
$(".fbrowser").load(url,function() {
$(function() {FileBrowser.init(nickname, type, hash);});
});
$(".fbrowser").load(url);
}
}
);
}
if ($("#upload-file").length)
if ($("#upload-file").length) {
var file_uploader = new window.AjaxUpload(
'upload-file',
{ action: 'wall_attach/'+FileBrowser.nickname+'?response=json',
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },
onSubmit: function(file,ext) {
$(".fbrowser-content").hide();
$(".fbrowser .profile-rotator-wrapper").show();
$(".error").addClass('hidden');
},
onComplete: function(file,response) {
if (response['error']!= undefined) {
$(".error span").html(response['error']);
@ -182,17 +206,19 @@ var FileBrowser = {
$('#profile-rotator').hide();
return;
}
$(".profile-rotator-wrapper").hide();
$(".fbrowser_content").show();
// location = baseurl + "/fbrowser/file/?mode=none"+location['hash'];
// location.reload(true);
var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"
// load new content to fbrowser window
$(".fbrowser").load(url,function() {
$(function() {FileBrowser.init(nickname, type, hash);});
});
$(".fbrowser").load(url);
}
}
);
},
}
}
};

View file

@ -8,9 +8,11 @@ $(document).ready(function(){
$(this).removeData('bs.modal');
$("#modal-title").empty();
$('#modal-body').empty();
// remove the file browser from jot (else we would have problems
// with ajaxupload
// Remove the file browser from jot (else we would have problems
// with AjaxUpload
$(".fbrowser").remove();
// Remove the AjaxUpload element
$("[name=userfile]").parent().remove();
});
// Clear bs modal on close

View file

@ -8,6 +8,7 @@
{{*<script type="text/javascript" src="view/theme/frio/js/filebrowser.js"></script>*}}
<div class="fbrowser {{$type}}">
<div class="fbrowser-content">
<input id="fb-nickname" type="hidden" name="type" value="{{$nickname}}" />
<input id="fb-type" type="hidden" name="type" value="{{$type}}" />
@ -42,3 +43,7 @@
<button id="upload-{{$type}}"><img id="profile-rotator" src="images/rotator.gif" alt="{{$wait}}" title="{{$wait|escape:'html'}}" style="display: none;" /> {{"Upload"|t}}</button>
</div>
</div>
<div class="profile-rotator-wrapper" style="display: none;">
<i class="fa fa-circle-o-notch fa-spin"></i>
</div>
</div>