Sha256: 78e39a65fa8f5c16b3998d524b2b516eec4642878ec75e1a3b739add75a47136

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
//            Portions ©2008-2011 Apple Inc. All rights reserved.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================


SC.BaseTheme.imageButtonRenderDelegate = SC.RenderDelegate.create({
  name: 'image-button',

  render: function(dataSource, context) {
    var image = dataSource.get('image'),
        toolTip = dataSource.get('toolTip');

    // render controlSize
    this.addSizeClassName(dataSource, context);

    context.addClass('no-min-width');

    if (toolTip) {
      context.attr('title', toolTip);
      context.attr('alt', toolTip);
    }

    if (image) {
      context.push("<div class='img "+image+"'></div>");
    } else {
      context.push("<div class='img'></div>");
    }
  },

  update: function(dataSource, $) {
    var image, toolTip;

    this.updateSizeClassName(dataSource, $);

    if (dataSource.didChangeFor('imageButtonRenderDelegate', 'toolTip')) {
      toolTip = dataSource.get('toolTip');

      $.attr('title', toolTip);
      $.attr('alt', toolTip);
    }

    if (dataSource.didChangeFor('imageButtonRenderDelegate', 'image')) {
      image = dataSource.get('image');

      $.children()[0].className = 'img '+image;
    }
  }
});

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sproutcore-1.6.0.rc.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.rc.2 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.rc.2-java lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.rc.1-x86-mingw32 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.rc.1 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.rc.1-java lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.3-x86-mingw32 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.3-java lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.3 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.2-x86-mingw32 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.2-java lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.2 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.6.0.beta.1 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.5.0-java lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js
sproutcore-1.5.0 lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js