Sha256: c45161957bb9975ae9c2dd9cdc6e639dea503423907282c55179784c9a56c313

Contents?: true

Size: 1.46 KB

Versions: 4

Compression:

Stored size: 1.46 KB

Contents

Ext.define('TM.model.Plan', {
  extend: 'Ext.data.Model',

  fields: [
    { name: 'id', type: 'int', persist: false },

    { name: 'name' },
    { name: 'plan_type' },
    { name: 'data', type: 'auto' },
    { name: 'autocompletable', type: 'boolean' },

    { name: 'begin_to_remind', type: 'int' },

    { name: 'enabled_at', type: 'date' },
    { name: 'last_task_created_at', type: 'date' },


    { name: 'created_at', type: 'date', persist: false },
    { name: 'updated_at', type: 'date', persist: false },

    { name: 'assignees', type: 'auto', persist: false, defaultValue: [] },
    { name: 'callbacks', type: 'auto', persist: false, defaultValue: [] },
    { name: 'assignables_attributes', type: 'auto', defaultValue: [] },
    { name: 'callables_attributes', type: 'auto', defaultValue: [] }
  ],

  proxy: {
    type: 'rest',
    url: '/task-manager/api/plans',
    reader: {
      root: 'plans',
      totalProperty: 'total'
    }
  },

  save: function(opts) {
    var self = this;
    opts = opts || {};
    var success = opts.success;
    opts.success = function(record, operation) {
      self.set(Ext.JSON.decode(operation.response.responseText).plan);
      self.commit();
      if (operation.action === 'create') {
        Ext.getStore('TM.store.Plans').insert(0, self);
      }
      if(success) success.call(self);
    };

    this.callParent([opts]);
  },

  destroy: function() {
    this.callParent(arguments);

    if(this.store) this.store.remove(this);
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
task-manager-0.1.7 app/assets/javascripts/task-manager/extjs/app/model/Plan.js
task-manager-0.1.6 app/assets/javascripts/task-manager/extjs/app/model/Plan.js
task-manager-0.1.5 app/assets/javascripts/task-manager/extjs/app/model/Plan.js
task-manager-0.1.4 app/assets/javascripts/task-manager/extjs/app/model/Plan.js