diff --git a/public/images/loading-overlay.gif b/public/images/loading-overlay.gif new file mode 100644 index 0000000..e71258e Binary files /dev/null and b/public/images/loading-overlay.gif differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3206d8d..0270a84 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -21,6 +21,7 @@ * noosfero libraries *= require_self *= require modal.js +*= require loading-overlay.js * views speficics *= require add-and-join.js *= require report-abuse.js diff --git a/public/javascripts/loading-overlay.js b/public/javascripts/loading-overlay.js new file mode 100644 index 0000000..0d90f7e --- /dev/null +++ b/public/javascripts/loading-overlay.js @@ -0,0 +1,36 @@ +if (typeof loading_overlay === 'undefined') { + +// block user actions while making a post. Also indicate the network transaction +loading_overlay = { + + show: function (selector) { + var element = jQuery(selector); + if (element.length > 0) { + var overlay = jQuery('
', { + class: 'loading-overlay', + css: { + width: element.outerWidth(), + height: element.outerHeight(), + left: element.position().left, + top: element.position().top, + marginLeft: parseFloat(element.css('margin-left')), + marginTop: parseFloat(element.css('margin-top')), + marginRight: parseFloat(element.css('margin-right')), + marginBottom: parseFloat(element.css('margin-bottom')), + }, + }).appendTo(element).get(0); + + overlay.dest = element; + element.loading_overlay = overlay; + } + }, + + hide: function (selector) { + var element = jQuery(selector); + var overlay = element.find('.loading-overlay'); + overlay.remove(); + }, + +}; + +} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 89d9a67..9f5205c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -11,6 +11,7 @@ * noosfero libraries *= require_self *= require iepngfix/iepngfix + *= require loading-overlay * views specifics *= require chat *= require search diff --git a/public/stylesheets/loading-overlay.scss b/public/stylesheets/loading-overlay.scss new file mode 100644 index 0000000..b7f93ad --- /dev/null +++ b/public/stylesheets/loading-overlay.scss @@ -0,0 +1,8 @@ + +.loading-overlay { + position: absolute; + background-color: #eee; /* while the image don't load */ + background-image: url(/images/loading-overlay.gif); + opacity: 0.40; + z-index: 10; +} -- libgit2 0.21.2