Sha256: 6c34c974dc55aab89588c1e202d9eb1db285219e80a272cdfab68e2c451c303d

Contents?: true

Size: 1.2 KB

Versions: 39

Compression:

Stored size: 1.2 KB

Contents

SirTrevor.BlockControls.prototype.initialize = function() {
  var groups = {};
  for(var block_type in this.available_types) {
    if (SirTrevor.Blocks.hasOwnProperty(block_type)) {
      var block_control = new SirTrevor.BlockControl(block_type, this.instance_scope);
      if (block_control.can_be_rendered) {
        var blockGroup;

        if ($.isFunction(SirTrevor.Blocks[block_type].prototype.blockGroup)) {
          blockGroup = SirTrevor.Blocks[block_type].prototype.blockGroup();
        } else {
          blockGroup = SirTrevor.Blocks[block_type].prototype.blockGroup;
        }
        
        groups[blockGroup] = groups[blockGroup] || [];
        groups[blockGroup].push(block_control.render().$el);
      }
    }
  }
  for(groupKey in groups) {
    var group   = groups[groupKey];
    if(groupKey == 'undefined' || groupKey === undefined) {
      groupKey = i18n.t("blocks:group:undefined");
    }
    var groupEl = $("<div class='st-controls-group'><div class='st-group-control-label'>" + groupKey + "</div></div>");
    $.each(group, function(){
      groupEl.append($(this));
    });
    this.$el.append(groupEl);
  }

  this.$el.delegate('.st-block-control', 'click', this.handleControlButtonClick);
};

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
blacklight-spotlight-0.24.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.23.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.22.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.21.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.20.3 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.20.2 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.20.1 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.20.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.19.2 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.19.1 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.19.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.18.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.17.1 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.17.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.16.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.15.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.14.2 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.14.1 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.14.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js
blacklight-spotlight-0.13.0 app/assets/javascripts/spotlight/sir-trevor/grouped_block_controls.js