Sha256: c187e33a7bd77099015c4a001094ddd0207dbb2e35a1e503aff8172df31a3189

Contents?: true

Size: 1.82 KB

Versions: 27

Compression:

Stored size: 1.82 KB

Contents

var FLASH, Flash;

/* set asset version */

FLASH = {
  VERSION: "<%= @hash %>",
  MESSAGE: "<%= @message %>",
  DEPLOYED: <%= Time.now.to_i %>,
  DEPLOYED_STRING: "<%= Time.now.to_s %>"
};

   
/* FLASH MESSAGE HANDLERS */

YAHOO.namespace("flash");

Flash = {};

Flash.timeout = 8;
Flash.duration = 0.25;

Flash.write = function(type, message) {
	type = type || "notice";
  if (message) {
    $('flash_message').update(message);
    Flash.setFlashClass('flash', type);

    // blindDown if the flash is currently hidden
    if ($('flash').getStyle("display") === "none") {
      $('flash').blindDown({queue: "end", duration: Flash.duration});
    }
    YAHOO.oib.setTimeoutInSeconds(Flash.close, Flash.timeout);
	}
};

Flash.close = function() {
  Try.these(function() {
    $('flash').blindUp({queue: "end", duration: Flash.duration});
  });
};

Flash.setFlashClass = function(flash_id, type) {
  if (type === "error") {
    Try.these(function() {
      $(flash_id).removeClassName('notice');
    });
  }
  if (type === "notice") {
    Try.these(function() {
      $(flash_id).removeClassName('error');
    });
  }
  Try.these(function() {
    $(flash_id).addClassName(type);
  });
};


Flash.error = function(message) {
  YAHOO.logger.error(message);
  Flash.write("error", message, true);
};

Flash.notice = function(message) {
	Flash.write("notice", message, true);
};

Flash.success = Flash.notice;

Flash.t = {};
Flash.t.notice = function(key, args) {
  var m;
  
  m = I18n.t(key, args);
  Flash.notice(m);
};
Flash.t.success = Flash.t.notice;

Flash.t.error = function(key, args) {
  var m;
  
  m = I18n.t(key, args);
  Flash.error(m);
};


Flash.settingsChanged = function() {
  Flash.t.success("SETTINGS_CHANGED");
};
Flash.problemSubmitting = function() {
  Flash.t.error("PROBLEM_SUBMITTING");
};

YAHOO.flash = Flash;

/* ----------------------- */

Version data entries

27 entries across 22 versions & 1 rubygems

Version Path
ymdp-0.1.10 spec/data/app/javascripts/flash.js
ymdp-0.1.9 spec/data/app/javascripts/flash.js
ymdp-0.1.8.1 spec/data/app/javascripts/flash.js
ymdp-0.1.8 spec/data/app/javascripts/flash.js
ymdp-0.1.7 spec/data/app/javascripts/flash.js
ymdp-0.1.6 spec/data/app/javascripts/flash.js
ymdp-0.1.4 spec/data/app/javascripts/flash.js
ymdp-0.1.4 lib/new_application/app/javascripts/flash.js
ymdp-0.1.3.2 lib/new_application/app/javascripts/flash.js
ymdp-0.1.3.2 spec/data/app/javascripts/flash.js
ymdp-0.1.3.1 spec/data/app/javascripts/flash.js
ymdp-0.1.3.1 lib/new_application/app/javascripts/flash.js
ymdp-0.1.3 lib/new_application/app/javascripts/flash.js
ymdp-0.1.3 spec/data/app/javascripts/flash.js
ymdp-0.1.1 spec/data/app/javascripts/flash.js
ymdp-0.1.1 lib/new_application/app/javascripts/flash.js
ymdp-0.1.0 lib/new_application/app/javascripts/flash.js
ymdp-0.0.17 lib/new_application/app/javascripts/flash.js
ymdp-0.0.16 lib/new_application/app/javascripts/flash.js
ymdp-0.0.15 lib/new_application/app/javascripts/flash.js