]> git.mxchange.org Git - friendica.git/commitdiff
Bugfix: fbrowser did insert 2 Pictures instead of only 1
authorrabuzarus <>
Mon, 20 Mar 2017 21:45:24 +0000 (22:45 +0100)
committerrabuzarus <>
Mon, 20 Mar 2017 21:45:24 +0000 (22:45 +0100)
view/theme/frio/css/style.css
view/theme/frio/js/filebrowser.js
view/theme/frio/templates/filebrowser.tpl

index 47973ed448bd0156787d87a468af1ccf72d14140..e0a0b09b76c7bb276b4eed19f95c0469970f3248 100644 (file)
@@ -1272,6 +1272,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
 */
index 6856d12ba28737202e34f115621190fe8fc6f1cf..a66309865dc10e6a243bc2af97f33424e748bf3f 100644 (file)
@@ -88,23 +88,35 @@ var FileBrowser = {
 \r
                console.log("FileBrowser:", nickname, type,FileBrowser.event, FileBrowser.id );\r
 \r
+               // We need to add the AjaxUpload to the button\r
+               FileBrowser.uploadButtons();\r
+\r
                $(".error a.close").on("click", function(e) {\r
                        e.preventDefault();\r
                        $(".error").addClass("hidden");\r
                });\r
 \r
-               $(".folders a, .path a").on("click", function(e) {\r
+               // Click on album link\r
+               $(".fbrowser").on("click", ".folders a, .path a", function(e) {\r
                        e.preventDefault();\r
                        var url = baseurl + "/fbrowser/" + FileBrowser.type + "/" + this.dataset.folder + "?mode=none";\r
+                       $(".fbrowser-content").hide();\r
+                       $(".fbrowser .profile-rotator-wrapper").show();\r
 \r
                        // load new content to fbrowser window\r
-                       $(".fbrowser").load(url,function() {\r
-                               $(function() {FileBrowser.init(nickname, type, hash);});\r
+                       $(".fbrowser").load(url, function(responseText, textStatus){\r
+                               $(".profile-rotator-wrapper").hide();\r
+                               if (textStatus === 'success') {\r
+                                       $(".fbrowser_content").show();\r
+                                       // We need to add the AjaxUpload to the button\r
+                                       FileBrowser.uploadButtons();\r
+                               }\r
                        });\r
+                       \r
                });\r
 \r
                //embed on click\r
-               $(".photo-album-photo-link").on('click', function(e) {\r
+               $(".fbrowser").on('click', ".photo-album-photo-link", function(e) {\r
                        e.preventDefault();\r
 \r
                        var embed = "";\r
@@ -142,39 +154,52 @@ var FileBrowser = {
                        // update autosize for this textarea\r
                        autosize.update($(".text-autosize"));\r
                });\r
+       },\r
 \r
-               if ($("#upload-image").length)\r
+       uploadButtons: function() {\r
+               if ($("#upload-image").length) {\r
                        var image_uploader = new window.AjaxUpload(\r
                                'upload-image',\r
-                               { action: 'wall_upload/'+FileBrowser.nickname+'?response=json',\r
+                               {       action: 'wall_upload/'+FileBrowser.nickname+'?response=json',\r
                                        name: 'userfile',\r
                                        responseType: 'json',\r
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },\r
+                                       onSubmit: function(file,ext) {\r
+                                               $(".fbrowser-content").hide();\r
+                                               $(".fbrowser .profile-rotator-wrapper").show();\r
+                                               $(".error").addClass('hidden');\r
+                                       },\r
                                        onComplete: function(file,response) {\r
                                                if (response['error']!= undefined) {\r
                                                        $(".error span").html(response['error']);\r
                                                        $(".error").removeClass('hidden');\r
-                                                       $('#profile-rotator').hide();\r
+                                                       $(".fbrowser .profile-rotator-wrapper").hide();\r
                                                        return;\r
                                                }\r
+\r
+                                               $(".profile-rotator-wrapper").hide();\r
+                                               $(".fbrowser_content").show();\r
+\r
 //                                             location = baseurl + "/fbrowser/image/?mode=none"+location['hash'];\r
 //                                             location.reload(true);\r
 \r
                                                var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
                                                // load new content to fbrowser window\r
-                                               $(".fbrowser").load(url,function() {\r
-                                                       $(function() {FileBrowser.init(nickname, type, hash);});\r
-                                               });\r
+                                               $(".fbrowser").load(url);\r
                                        }\r
                                }\r
                        );\r
+               }\r
 \r
-               if ($("#upload-file").length)\r
+               if ($("#upload-file").length) {\r
                        var file_uploader = new window.AjaxUpload(\r
                                'upload-file',\r
-                               { action: 'wall_attach/'+FileBrowser.nickname+'?response=json',\r
+                               {       action: 'wall_attach/'+FileBrowser.nickname+'?response=json',\r
                                        name: 'userfile',\r
-                                       onSubmit: function(file,ext) { $('#profile-rotator').show(); $(".error").addClass('hidden'); },\r
+                                       onSubmit: function(file,ext) {\r
+                                               $(".fbrowser-content").hide();\r
+                                               $(".fbrowser .profile-rotator-wrapper").show();\r
+                                               $(".error").addClass('hidden');\r
+                                       },\r
                                        onComplete: function(file,response) {\r
                                                if (response['error']!= undefined) {\r
                                                        $(".error span").html(response['error']);\r
@@ -182,17 +207,19 @@ var FileBrowser = {
                                                        $('#profile-rotator').hide();\r
                                                        return;\r
                                                }\r
+\r
+                                               $(".profile-rotator-wrapper").hide();\r
+                                               $(".fbrowser_content").show();\r
+\r
 //                                             location = baseurl + "/fbrowser/file/?mode=none"+location['hash'];\r
 //                                             location.reload(true);\r
 \r
                                                var url = baseurl + "/fbrowser/" + FileBrowser.type + "?mode=none"\r
                                                // load new content to fbrowser window\r
-                                               $(".fbrowser").load(url,function() {\r
-                                                       $(function() {FileBrowser.init(nickname, type, hash);});\r
-                                               });\r
+                                               $(".fbrowser").load(url);\r
                                        }\r
                                }\r
-               );\r
-       },\r
+                       );\r
+               }\r
+       }\r
 };\r
-\r
index 55cecabb8fac1fb0b30bf0fcc2727f8c4f0926b1..1a1bd9a6759aedb6a016937f6d08b18981cdac5c 100644 (file)
@@ -8,43 +8,42 @@
 {{*<script type="text/javascript" src="view/theme/frio/js/filebrowser.js"></script>*}}
 
 <div class="fbrowser {{$type}}">
-       <input id="fb-nickname" type="hidden" name="type" value="{{$nickname}}" />
-       <input id="fb-type" type="hidden" name="type" value="{{$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}}" />
 
-       <div class="error hidden">
-               <span></span> <a href="#" class='close'>X</a>
-       </div>
+               <div class="error hidden">
+                       <span></span> <a href="#" class='close'>X</a>
+               </div>
 
-       <div class="path">
-               {{foreach $path as $p}}<a href="#" data-folder="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
-       </div>
+               <div class="path">
+                       {{foreach $path as $p}}<a href="#" data-folder="{{$p.0}}">{{$p.1}}</a>{{/foreach}}
+               </div>
 
-       {{if $folders }}
-       <div class="folders">
-               <ul>
-                       {{foreach $folders as $f}}<li><a href="#" data-folder="{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
-               </ul>
-       </div>
-       {{/if}}
+               {{if $folders }}
+               <div class="folders">
+                       <ul>
+                               {{foreach $folders as $f}}<li><a href="#" data-folder="{{$f.0}}">{{$f.1}}</a></li>{{/foreach}}
+                       </ul>
+               </div>
+               {{/if}}
+
+               <div class="list">
+                       {{foreach $files as $f}}
+                       <div class="photo-album-image-wrapper">
+                               <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
+                                       <img src="{{$f.2}}">
+                                       <p>{{$f.1}}</p>
+                               </a>
+                       </div>
+                       {{/foreach}}
+               </div>
 
-       <div class="list">
-               {{foreach $files as $f}}
-               <div class="photo-album-image-wrapper">
-                       <a href="#" class="photo-album-photo-link" data-link="{{$f.0}}" data-filename="{{$f.1}}" data-img="{{$f.2}}">
-                               <img src="{{$f.2}}">
-                               <p>{{$f.1}}</p>
-                       </a>
+               <div class="upload">
+                       <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>
-               {{/foreach}}
        </div>
-
-       <div class="upload">
-               <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 class="profile-rotator-wrapper" style="display: none;">
+               <i class="fa fa-circle-o-notch fa-spin"></i>
        </div>
 </div>
-
-<script>
-    $(document).ready(function(){
-
-       });
-</script>
\ No newline at end of file