Sha256: 9c09c35c466b65bcfe450ec10e3205cf5dc3a986e0ed828d578e6329835fd973

Contents?: true

Size: 2 KB

Versions: 518

Compression:

Stored size: 2 KB

Contents

BoundControl = Class.extend({
    
  el: false,        // The DOM element to which the object is bound  
  model: false,     // The model to which the control is bound
  attribute: false, // The attribute of the model
  binder: false,    // The model binder
  
  init: function(params) {},  // Constructor  
  view: function() {},        // Sets the control in a view state
  edit: function() {},        // Sets the control in an edit state
  save: function() {},        // Sends the value in the control to the model to be saved
  cancel: function() {},      // Cancels the edit
  error: function(str) {},     // Shows an error

  show_loader: function() {
    var w = $('#'+this.el).outerWidth();
    var h = 40; //$('#'+this.el).outerHeight();
    var this2 = this;
    
    if (!$('#'+this.el+'_check').length)
    {      
      $('#'+this.el+'_container').prepend($('<div/>')
        .attr('id', this.el + '_check')
        .addClass('mb_bound_input_check')
        .css('position', 'absolute')
        .css('top', 0)
        .css('left', w-h-1)
        .css('width', h+2)
        .css('overflow', 'hidden')
        .append($('<a/>')
          .addClass('loading')
          .html('&#10003;')
          .css('width', h)
          .css('margin-left', h)
          .attr('href', '#')
          .click(function(event) { event.preventDefault(); })
        )
      );
    }    
    $('#'+this.el+'_check a')
      .addClass('mb_loading')
      .css('margin-left', h);
    $('#'+this.el+'_check a').animate({ 'margin-left': 0 }, 300); 
  },
  
  hide_loader: function() {
    this.hide_check();
  },
  
  show_check: function(duration) {
    $('#'+this.el+'_check a').removeClass('loading');
    if (duration)
    {
      var this2 = this;
      setTimeout(function() { this2.hide_check(); }, duration);
    }
  },
  
  hide_check: function() {
    var h = $('#'+this.el).outerHeight();
    var this2 = this;
    $('#'+this.el+'_check a').animate({ 'margin-left': h }, 300, function() { 
      $('#'+this2.check).remove(); 
    });
  }
  
});

Version data entries

518 entries across 518 versions & 1 rubygems

Version Path
caboose-cms-0.7.59 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.58 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.57 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.55 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.54 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.53 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.52 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.51 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.50 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.49 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.48 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.47 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.46 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.45 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.44 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.43 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.42 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.41 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.40 app/assets/javascripts/caboose/model/bound_control.js
caboose-cms-0.7.39 app/assets/javascripts/caboose/model/bound_control.js