Sha256: 1ee0d2bf6f7cdd7ad40d64a541b2fe0833f6a8a27068874cf3761c867e84a6c0

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

<script type="text/ng-template" id="promethee/write/component/row">
  <div
    ng-controller="RowController"
    class="row promethee-editor__component promethee-editor__component--row"
    ng-click="edit($event);"
  >
    <div class="promethee-editor__component-selected" ng-class="{'promethee-editor__component-selected--visible': inspected.component === component}">
      <div class="promethee-editor__toolbar">
        Row
        <ng-include src="'promethee/write/toolbar'"></ng-include>
      </div>
      <ng-include src="'promethee/write/components'"></ng-include>
      <div class="clearfix"></div>
      <span class="btn btn-default btn-block" ng-click="addColumn()" style="margin: 0 6px 6px 6px;width: auto">Add column</span>
    </div>
  </div>
</script>

<script>
  angular.injector(['ng', 'Promethee']).get('definitions').push({
    name: 'Row',
    thumb: 'http://via.placeholder.com/300x200',
    data: {
      type: 'row',
      attributes: {},
      children: []
    }
  });

  promethee.controller('RowController', ['$scope', 'inspected', function($scope, inspected) {
    Object.defineProperty($scope, 'editing', {
      get: function() {
        return inspected.component == $scope.component;
      }
    });

    $scope.edit = function(event) {
      event.stopPropagation();
      inspected.component = $scope.component;
    };

    $scope.complete = function() {
      inspected.component = null;
    };

    $scope.toggleEdit = function() {
      $scope[$scope.editing ? 'complete' : 'edit']();
    };

    $scope.allowedTypes = ['column'];

    $scope.addColumn = function() {
      this.component.children.push({
        type: 'column',
        attributes: {
          size: 4,
          offset: 0
        },
        children: []
      })
    }
  }]);
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
promethee-1.0.20 app/views/promethee/edit/write/component/_row.html.erb