From ee46807842f27df3a62f812ef5251b1d41af6657 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 1 Oct 2014 15:21:48 +0000 Subject: [PATCH] * Filemanager: New styling and access to list of uploading files in progress --- etemplate/js/et2_widget_file.js | 51 ++++++++++++++++++++-- etemplate/templates/default/etemplate2.css | 23 ++++++++++ filemanager/templates/default/index.xet | 2 +- 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/etemplate/js/et2_widget_file.js b/etemplate/js/et2_widget_file.js index 0ea297aa36..b33884a2eb 100644 --- a/etemplate/js/et2_widget_file.js +++ b/etemplate/js/et2_widget_file.js @@ -78,7 +78,13 @@ var et2_file = et2_inputWidget.extend( "type": "string", "default": "Choose file...", "description": "String caption to be displayed on file upload span" - } + }, + progress_dropdownlist: { + "name": "List on files in progress like dropdown", + "type": "boolean", + "default": false, + "description": "Style list of files in uploading progress like dropdown list with a total upload progress indicator" + }, }, asyncOptions: {}, @@ -419,7 +425,13 @@ var et2_file = et2_inputWidget.extend( .css('cursor', 'default'); event.data = this; - + + //Add dropdown_progress + if (this.options.progress_dropdownlist) + { + this._build_progressDropDownList(); + } + // Callback if(this.options.onStart) return et2_call(this.options.onStart, event, file_count); return true; @@ -457,8 +469,41 @@ var et2_file = et2_inputWidget.extend( // Fire legacy change action when done this.change(this.input); } + + //Remove progress_dropDown_fileList class and unbind the click handler from body + if (this.options.progress_dropdownlist) + { + this.progress.removeClass("progress_dropDown_fileList"); + jQuery(this.node).find('span').removeClass('totalProgress_loader'); + jQuery('body').off('click'); + } + }, + + /** + * Build up dropdown progress with total count indicator + * + * @todo Implement totalProgress bar instead of ajax-loader, in order to show how much percent of uploading is completed + */ + _build_progressDropDownList: function () + { + this.progress.addClass("progress_dropDown_fileList"); + + //Add uploading indicator and bind hover handler on it + jQuery(this.node).find('span') + .addClass('totalProgress_loader') + .hover(function(){ + jQuery('.progress_dropDown_fileList').show(); + }); + + //Bind click handler to dismiss the dropdown while uploading + jQuery('body').on('click', function(event){ + if (event.target.className != 'remove') + { + jQuery('.progress_dropDown_fileList').hide(); + } + }); + }, - /** * Creates the elements used for displaying the file, and it's upload status, and diff --git a/etemplate/templates/default/etemplate2.css b/etemplate/templates/default/etemplate2.css index f7fac5cc6e..63b93b43b8 100644 --- a/etemplate/templates/default/etemplate2.css +++ b/etemplate/templates/default/etemplate2.css @@ -480,6 +480,28 @@ div.et2_file { margin-left: 8px; margin-top: 0; } +.et2_file .progress_dropDown_fileList { + background: white; + position: absolute; + border: 1px solid gray; + border-top: 0; + margin-top: 6px !important; + margin-left: 0 !important; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + max-height: 300px; + width: 181px !important; + z-index: 201 !important; + box-shadow: 6px 6px 9px gray; +} +.et2_file .progress_dropDown_fileList > li { + border-bottom: 1px solid lightgray; +} +.et2_file .totalProgress_loader { + background-repeat: no-repeat; + background-image: url('images/ajax-loader.gif'); +} + .et2_file .progress { width: 300px; max-height: 6em; @@ -515,6 +537,7 @@ div.et2_file { background-color: green; height: 5px; margin: 0px; + width: 0px; } /* Hide progress bar when completed */ .et2_file .progress li.success > span.progressBar { diff --git a/filemanager/templates/default/index.xet b/filemanager/templates/default/index.xet index 673e38760f..863f225d9d 100644 --- a/filemanager/templates/default/index.xet +++ b/filemanager/templates/default/index.xet @@ -58,7 +58,7 @@