Commit 7391983adb35bbbeb3118ef4d156a981078cd0dd

Authored by Braulio Bhavamitra
1 parent 682ee5be

Add loading overlay js/css

public/images/loading-overlay.gif 0 → 100644

3.4 KB

public/javascripts/application.js
... ... @@ -21,6 +21,7 @@
21 21 * noosfero libraries
22 22 *= require_self
23 23 *= require modal.js
  24 +*= require loading-overlay.js
24 25 * views speficics
25 26 *= require add-and-join.js
26 27 *= require report-abuse.js
... ...
public/javascripts/loading-overlay.js 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +if (typeof loading_overlay === 'undefined') {
  2 +
  3 +// block user actions while making a post. Also indicate the network transaction
  4 +loading_overlay = {
  5 +
  6 + show: function (selector) {
  7 + var element = jQuery(selector);
  8 + if (element.length > 0) {
  9 + var overlay = jQuery('<div>', {
  10 + class: 'loading-overlay',
  11 + css: {
  12 + width: element.outerWidth(),
  13 + height: element.outerHeight(),
  14 + left: element.position().left,
  15 + top: element.position().top,
  16 + marginLeft: parseFloat(element.css('margin-left')),
  17 + marginTop: parseFloat(element.css('margin-top')),
  18 + marginRight: parseFloat(element.css('margin-right')),
  19 + marginBottom: parseFloat(element.css('margin-bottom')),
  20 + },
  21 + }).appendTo(element).get(0);
  22 +
  23 + overlay.dest = element;
  24 + element.loading_overlay = overlay;
  25 + }
  26 + },
  27 +
  28 + hide: function (selector) {
  29 + var element = jQuery(selector);
  30 + var overlay = element.find('.loading-overlay');
  31 + overlay.remove();
  32 + },
  33 +
  34 +};
  35 +
  36 +}
... ...
public/stylesheets/application.css
... ... @@ -11,6 +11,7 @@
11 11 * noosfero libraries
12 12 *= require_self
13 13 *= require iepngfix/iepngfix
  14 + *= require loading-overlay
14 15 * views specifics
15 16 *= require chat
16 17 *= require search
... ...
public/stylesheets/loading-overlay.scss 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +
  2 +.loading-overlay {
  3 + position: absolute;
  4 + background-color: #eee; /* while the image don't load */
  5 + background-image: url(/images/loading-overlay.gif);
  6 + opacity: 0.40;
  7 + z-index: 10;
  8 +}
... ...