Sha256: 6fea4301be9590a135465edcc97e6798fb15258d6b86de39b08ac843789697c6

Contents?: true

Size: 1.54 KB

Versions: 7

Compression:

Stored size: 1.54 KB

Contents

module Netzke
  #
  # An invisible component that provides feedback service for all Netzke widgets
  #
  class FeedbackGhost < Base
    def self.js_base_class
      "Ext.Component" # yes, invisible
    end

    def self.js_extend_properties
      {
        :show_feedback => <<-END_OF_JAVASCRIPT.l,
          function(msg){
            var createBox = function(s, l){
                return ['<div class="msg">',
                        '<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
                        '<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">', s, '</div></div></div>',
                        '<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
                        '</div>'].join('');
            }

            var showBox = function(msg, lvl){
              if (!lvl) {lvl = 'notice'};
              var msgCt = Ext.DomHelper.insertFirst(document.body, {'class':'netzke-feedback'}, true);
              var m = Ext.DomHelper.append(msgCt, {html:createBox(msg,lvl)}, true);
              m.slideIn('t').pause(2).ghost("b", {remove:true});
            }

            if (typeof msg != 'string') {
              var compoundMsg = "";
              Ext.each(msg, function(m){
                compoundMsg += m.msg + '<br>';
              });
              if (compoundMsg != "") showBox(compoundMsg, null); // the second parameter will be level
            } else {
              showBox(msg);
            }
        	}
        END_OF_JAVASCRIPT
      }
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
skozlov-netzke-core-0.4.1 lib/netzke/feedback_ghost.rb
skozlov-netzke-core-0.4.2 lib/netzke/feedback_ghost.rb
skozlov-netzke-core-0.4.3 lib/netzke/feedback_ghost.rb
netzke-core-0.4.5 lib/netzke/feedback_ghost.rb
netzke-core-0.4.4 lib/netzke/feedback_ghost.rb
netzke-core-0.4.2 lib/netzke/feedback_ghost.rb
netzke-core-0.4.3 lib/netzke/feedback_ghost.rb