task-manager 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/task-manager/extjs/app/controller/Plans.js +19 -0
 - data/app/assets/javascripts/task-manager/extjs/app/controller/Tasks.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/app/helper/ApplicationHelper.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/app/model/Task.js +3 -2
 - data/app/assets/javascripts/task-manager/extjs/app/store/Assignees.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/app/store/Months.js +2 -2
 - data/app/assets/javascripts/task-manager/extjs/app/view/assignee/TreeCombo.js +8 -6
 - data/app/assets/javascripts/task-manager/extjs/app/view/plan/Form.js +27 -4
 - data/app/assets/javascripts/task-manager/extjs/app/view/plan/Grid.js +3 -3
 - data/app/assets/javascripts/task-manager/extjs/app/view/plan/Index.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/app/view/plan/Search.js +2 -2
 - data/app/assets/javascripts/task-manager/extjs/app/view/task/Grid.js +2 -2
 - data/app/assets/javascripts/task-manager/extjs/app/view/task/Index.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/app/view/task/Search.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/lib/ux/CheckboxListCombo.js +1 -1
 - data/app/assets/javascripts/task-manager/extjs/lib/ux/TreeCombo.js +1 -0
 - data/app/controllers/task_manager/api/v1/plans_controller.rb +1 -1
 - data/app/controllers/task_manager/api/v1/tasks_controller.rb +2 -2
 - data/app/models/task_manager/plan.rb +3 -7
 - data/app/models/task_manager/task.rb +6 -1
 - data/db/migrate/20121105170602_create_task_manager_tasks.rb +1 -0
 - data/lib/task-manager.rb +4 -0
 - data/lib/task-manager/version.rb +1 -1
 - metadata +4 -4
 
| 
         @@ -22,6 +22,9 @@ Ext.define('TM.controller.Plans', { 
     | 
|
| 
       22 
22 
     | 
    
         
             
              }, {
         
     | 
| 
       23 
23 
     | 
    
         
             
                ref: 'planGrid',
         
     | 
| 
       24 
24 
     | 
    
         
             
                selector: 'plan_grid'
         
     | 
| 
      
 25 
     | 
    
         
            +
              }, {
         
     | 
| 
      
 26 
     | 
    
         
            +
                ref: 'callbackCheckboxCombo',
         
     | 
| 
      
 27 
     | 
    
         
            +
                selector: 'plan_form callback_checkboxcombo' 
         
     | 
| 
       25 
28 
     | 
    
         
             
              }],
         
     | 
| 
       26 
29 
     | 
    
         | 
| 
       27 
30 
     | 
    
         
             
              index: function() {
         
     | 
| 
         @@ -53,10 +56,22 @@ Ext.define('TM.controller.Plans', { 
     | 
|
| 
       53 
56 
     | 
    
         
             
                  },
         
     | 
| 
       54 
57 
     | 
    
         
             
                  'plan_form button[action="cancel"]': {
         
     | 
| 
       55 
58 
     | 
    
         
             
                    click: this.onCancelClick
         
     | 
| 
      
 59 
     | 
    
         
            +
                  },
         
     | 
| 
      
 60 
     | 
    
         
            +
                  'plan_form checkbox[name="autocompletable"]': {
         
     | 
| 
      
 61 
     | 
    
         
            +
                    change: this.onAutocompletableChange
         
     | 
| 
       56 
62 
     | 
    
         
             
                  }
         
     | 
| 
       57 
63 
     | 
    
         
             
                });
         
     | 
| 
       58 
64 
     | 
    
         
             
              },
         
     | 
| 
       59 
65 
     | 
    
         | 
| 
      
 66 
     | 
    
         
            +
              onAutocompletableChange: function () {
         
     | 
| 
      
 67 
     | 
    
         
            +
                record = this.getPlanForm().getValues().autocompletable;
         
     | 
| 
      
 68 
     | 
    
         
            +
                if(record == "on"){
         
     | 
| 
      
 69 
     | 
    
         
            +
                  this.getCallbackCheckboxCombo().hide();
         
     | 
| 
      
 70 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 71 
     | 
    
         
            +
                  this.getCallbackCheckboxCombo().show();;
         
     | 
| 
      
 72 
     | 
    
         
            +
                }
         
     | 
| 
      
 73 
     | 
    
         
            +
              },
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       60 
75 
     | 
    
         
             
              // @protected
         
     | 
| 
       61 
76 
     | 
    
         
             
              onAddClick: function() {
         
     | 
| 
       62 
77 
     | 
    
         
             
                Ext.create('TM.view.plan.FormWindow', { title: '添加计划' }).show();
         
     | 
| 
         @@ -107,6 +122,10 @@ Ext.define('TM.controller.Plans', { 
     | 
|
| 
       107 
122 
     | 
    
         
             
                var record = this.getPlanForm().getRecord() ||
         
     | 
| 
       108 
123 
     | 
    
         
             
                  Ext.create('TM.model.Plan');
         
     | 
| 
       109 
124 
     | 
    
         | 
| 
      
 125 
     | 
    
         
            +
                if(attrs.autocompletable == "on") {
         
     | 
| 
      
 126 
     | 
    
         
            +
                  delete attrs["callables_attributes"];
         
     | 
| 
      
 127 
     | 
    
         
            +
                }
         
     | 
| 
      
 128 
     | 
    
         
            +
                attrs.autocompletable = attrs.autocompletable ? true: false;
         
     | 
| 
       110 
129 
     | 
    
         
             
                record.set(attrs);
         
     | 
| 
       111 
130 
     | 
    
         
             
                record.save({
         
     | 
| 
       112 
131 
     | 
    
         
             
                  success: function() {
         
     | 
| 
         @@ -43,7 +43,7 @@ Ext.define('TM.controller.Tasks', { 
     | 
|
| 
       43 
43 
     | 
    
         
             
              // @protected
         
     | 
| 
       44 
44 
     | 
    
         
             
            	onDeleteClick: function(btn) {
         
     | 
| 
       45 
45 
     | 
    
         
             
            		var select = btn.up('task_grid').getSelectionModel().getSelection()[0];
         
     | 
| 
       46 
     | 
    
         
            -
                if(select  
     | 
| 
      
 46 
     | 
    
         
            +
                if(select === null) {
         
     | 
| 
       47 
47 
     | 
    
         
             
                  Ext.Msg.alert('提示','请选择要删除的计划任务');
         
     | 
| 
       48 
48 
     | 
    
         
             
                  return;
         
     | 
| 
       49 
49 
     | 
    
         
             
                }
         
     | 
| 
         @@ -7,6 +7,7 @@ Ext.define('TM.model.Task', { 
     | 
|
| 
       7 
7 
     | 
    
         
             
            		{ name: 'task_type'},
         
     | 
| 
       8 
8 
     | 
    
         
             
            		{ name: 'data', type: 'auto' },
         
     | 
| 
       9 
9 
     | 
    
         
             
            		{ name: 'status' },
         
     | 
| 
      
 10 
     | 
    
         
            +
                { name: 'assignee', type: 'auto', persist: false },
         
     | 
| 
       10 
11 
     | 
    
         
             
            		{ name: 'deadline', type: 'date'},
         
     | 
| 
       11 
12 
     | 
    
         
             
            		{ name: 'created_at', type: 'date' },
         
     | 
| 
       12 
13 
     | 
    
         
             
                { name: 'updated_at', type: 'date' }
         
     | 
| 
         @@ -19,5 +20,5 @@ Ext.define('TM.model.Task', { 
     | 
|
| 
       19 
20 
     | 
    
         
             
                  root: 'tasks',
         
     | 
| 
       20 
21 
     | 
    
         
             
                  totalProperty: 'total'
         
     | 
| 
       21 
22 
     | 
    
         
             
                }
         
     | 
| 
       22 
     | 
    
         
            -
              } 
     | 
| 
       23 
     | 
    
         
            -
            });
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -37,7 +37,7 @@ Ext.define('TM.store.Assignees', { 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  var parent = this.getNodeById(assignee.getParentId(true)) || this.getRootNode();
         
     | 
| 
       38 
38 
     | 
    
         
             
                  var node = parent.findChild('id', assignee.getId(true));
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                  if(!node) this.appendChildNode(parent, assignee);
         
     | 
| 
      
 40 
     | 
    
         
            +
                  if(!node) { this.appendChildNode(parent, assignee); }
         
     | 
| 
       41 
41 
     | 
    
         
             
                }, this);
         
     | 
| 
       42 
42 
     | 
    
         
             
              },
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
         @@ -18,18 +18,20 @@ Ext.define('TM.view.assignee.TreeCombo', { 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              getSubmitValue: function() {
         
     | 
| 
       20 
20 
     | 
    
         
             
                var value = [];
         
     | 
| 
       21 
     | 
    
         
            -
                if(!this.value) return value;
         
     | 
| 
      
 21 
     | 
    
         
            +
                if(!this.value) { return value; }
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                var objs = this.value.split(',');
         
     | 
| 
       24 
24 
     | 
    
         
             
                objs.forEach(function(i) {
         
     | 
| 
       25 
25 
     | 
    
         
             
                  var node = this.tree.getStore().getNodeById(i);
         
     | 
| 
       26 
26 
     | 
    
         
             
                  if(node) {
         
     | 
| 
       27 
27 
     | 
    
         
             
                    var assignee = node.raw.record;
         
     | 
| 
       28 
     | 
    
         
            -
                     
     | 
| 
       29 
     | 
    
         
            -
                       
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
                    if (assignee) {
         
     | 
| 
      
 29 
     | 
    
         
            +
                      var attrs = {
         
     | 
| 
      
 30 
     | 
    
         
            +
                        assignee_id: assignee.get('id'),
         
     | 
| 
      
 31 
     | 
    
         
            +
                        assignee_type: assignee.get('class_name')
         
     | 
| 
      
 32 
     | 
    
         
            +
                      };
         
     | 
| 
      
 33 
     | 
    
         
            +
                      value.push(attrs);
         
     | 
| 
      
 34 
     | 
    
         
            +
                    }
         
     | 
| 
       33 
35 
     | 
    
         
             
                  }
         
     | 
| 
       34 
36 
     | 
    
         
             
                }, this);
         
     | 
| 
       35 
37 
     | 
    
         | 
| 
         @@ -31,16 +31,17 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       31 
31 
     | 
    
         
             
                }, {
         
     | 
| 
       32 
32 
     | 
    
         
             
                  xtype: 'assignee_treecombo',
         
     | 
| 
       33 
33 
     | 
    
         
             
                  fieldLabel: '执行人',
         
     | 
| 
      
 34 
     | 
    
         
            +
                  allowBlank: false,
         
     | 
| 
       34 
35 
     | 
    
         
             
                  name: 'assignables_attributes',
         
     | 
| 
       35 
36 
     | 
    
         
             
                  store: Ext.getStore('TM.store.Assignees').toTreeStore()
         
     | 
| 
       36 
37 
     | 
    
         
             
                }, {
         
     | 
| 
       37 
     | 
    
         
            -
                  fieldLabel: ' 
     | 
| 
      
 38 
     | 
    
         
            +
                  fieldLabel: '周期',
         
     | 
| 
       38 
39 
     | 
    
         
             
                  name: 'plan_type',
         
     | 
| 
       39 
40 
     | 
    
         
             
                  store: 'TM.store.Types',
         
     | 
| 
       40 
41 
     | 
    
         
             
                  editable: false,
         
     | 
| 
       41 
42 
     | 
    
         
             
                  valueField: 'value',
         
     | 
| 
       42 
43 
     | 
    
         
             
                  xtype: 'combo',
         
     | 
| 
       43 
     | 
    
         
            -
                  blankText: ' 
     | 
| 
      
 44 
     | 
    
         
            +
                  blankText: '请选择周期',
         
     | 
| 
       44 
45 
     | 
    
         
             
                  allowBlank: false
         
     | 
| 
       45 
46 
     | 
    
         
             
                }, {
         
     | 
| 
       46 
47 
     | 
    
         
             
                  fieldLabel: '横向指标',
         
     | 
| 
         @@ -77,13 +78,13 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       77 
78 
     | 
    
         
             
              }, {
         
     | 
| 
       78 
79 
     | 
    
         
             
                xtype: 'fieldset',
         
     | 
| 
       79 
80 
     | 
    
         
             
                itemId: 'deadline',
         
     | 
| 
       80 
     | 
    
         
            -
                title: ' 
     | 
| 
      
 81 
     | 
    
         
            +
                title: '完成时限',
         
     | 
| 
       81 
82 
     | 
    
         
             
                layout: {
         
     | 
| 
       82 
83 
     | 
    
         
             
                  type: 'table',
         
     | 
| 
       83 
84 
     | 
    
         
             
                  columns: 2
         
     | 
| 
       84 
85 
     | 
    
         
             
                },
         
     | 
| 
       85 
86 
     | 
    
         
             
                defaults: {
         
     | 
| 
       86 
     | 
    
         
            -
                  labelAlign: 'right' 
     | 
| 
      
 87 
     | 
    
         
            +
                  labelAlign: 'right'
         
     | 
| 
       87 
88 
     | 
    
         
             
                },
         
     | 
| 
       88 
89 
     | 
    
         
             
                items: [{
         
     | 
| 
       89 
90 
     | 
    
         
             
                  fieldLabel: '月',
         
     | 
| 
         @@ -254,6 +255,7 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       254 
255 
     | 
    
         
             
                  bindStore(Ext.getStore('TM.store.Days'));
         
     | 
| 
       255 
256 
     | 
    
         | 
| 
       256 
257 
     | 
    
         
             
                this.showDeadlineCombos(["month", "day", "hour", "minute"]);
         
     | 
| 
      
 258 
     | 
    
         
            +
                this.requireDeadlineCombos(["month", "day", "hour", "minute"]);
         
     | 
| 
       257 
259 
     | 
    
         
             
              },
         
     | 
| 
       258 
260 
     | 
    
         | 
| 
       259 
261 
     | 
    
         
             
              // @private
         
     | 
| 
         @@ -264,6 +266,7 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       264 
266 
     | 
    
         
             
                  bindStore(Ext.getStore('TM.store.Days'));
         
     | 
| 
       265 
267 
     | 
    
         | 
| 
       266 
268 
     | 
    
         
             
                this.showDeadlineCombos(["month", "day", "hour", "minute"]);
         
     | 
| 
      
 269 
     | 
    
         
            +
                this.requireDeadlineCombos(["month", "day", "hour", "minute"]);
         
     | 
| 
       267 
270 
     | 
    
         
             
              },
         
     | 
| 
       268 
271 
     | 
    
         | 
| 
       269 
272 
     | 
    
         
             
              // @private
         
     | 
| 
         @@ -273,6 +276,8 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       273 
276 
     | 
    
         | 
| 
       274 
277 
     | 
    
         
             
                this.showDeadlineCombos(["day", "hour", "minute"]);
         
     | 
| 
       275 
278 
     | 
    
         
             
                this.hideDeadlineCombos(["month"]);
         
     | 
| 
      
 279 
     | 
    
         
            +
                this.requireDeadlineCombos(["day", "hour", "minute"]);
         
     | 
| 
      
 280 
     | 
    
         
            +
                this.allowBlankDeadlineCombos(["month"]);
         
     | 
| 
       276 
281 
     | 
    
         
             
              },
         
     | 
| 
       277 
282 
     | 
    
         | 
| 
       278 
283 
     | 
    
         
             
              // @private
         
     | 
| 
         @@ -282,12 +287,16 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       282 
287 
     | 
    
         | 
| 
       283 
288 
     | 
    
         
             
                this.showDeadlineCombos(["day", "hour", "minute"]);
         
     | 
| 
       284 
289 
     | 
    
         
             
                this.hideDeadlineCombos(["month"]);
         
     | 
| 
      
 290 
     | 
    
         
            +
                this.requireDeadlineCombos(["day", "hour", "minute"]);
         
     | 
| 
      
 291 
     | 
    
         
            +
                this.allowBlankDeadlineCombos(["month"]);
         
     | 
| 
       285 
292 
     | 
    
         
             
              },
         
     | 
| 
       286 
293 
     | 
    
         | 
| 
       287 
294 
     | 
    
         
             
              // @private
         
     | 
| 
       288 
295 
     | 
    
         
             
              showDailyDeadlineCombos: function() {
         
     | 
| 
       289 
296 
     | 
    
         
             
                this.showDeadlineCombos(["hour", "minute"]);
         
     | 
| 
       290 
297 
     | 
    
         
             
                this.hideDeadlineCombos(["month", "day"]);
         
     | 
| 
      
 298 
     | 
    
         
            +
                this.requireDeadlineCombos(["hour", "minute"]);
         
     | 
| 
      
 299 
     | 
    
         
            +
                this.allowBlankDeadlineCombos(["month","day"]);
         
     | 
| 
       291 
300 
     | 
    
         
             
              },
         
     | 
| 
       292 
301 
     | 
    
         | 
| 
       293 
302 
     | 
    
         
             
              // @private
         
     | 
| 
         @@ -309,6 +318,20 @@ Ext.define('TM.view.plan.Form', { 
     | 
|
| 
       309 
318 
     | 
    
         
             
                }, this);
         
     | 
| 
       310 
319 
     | 
    
         
             
              },
         
     | 
| 
       311 
320 
     | 
    
         | 
| 
      
 321 
     | 
    
         
            +
              // @private
         
     | 
| 
      
 322 
     | 
    
         
            +
              requireDeadlineCombos: function(combos) {
         
     | 
| 
      
 323 
     | 
    
         
            +
                combos.forEach(function(c) {
         
     | 
| 
      
 324 
     | 
    
         
            +
                  this.getDeadlineCombo('data.deadline_' + c).allowBlank = false;
         
     | 
| 
      
 325 
     | 
    
         
            +
                }, this);
         
     | 
| 
      
 326 
     | 
    
         
            +
              },
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
              // @private
         
     | 
| 
      
 329 
     | 
    
         
            +
              allowBlankDeadlineCombos: function(combos) {
         
     | 
| 
      
 330 
     | 
    
         
            +
                combos.forEach(function(c) {
         
     | 
| 
      
 331 
     | 
    
         
            +
                  this.getDeadlineCombo('data.deadline_' + c).allowBlank = true;
         
     | 
| 
      
 332 
     | 
    
         
            +
                }, this);
         
     | 
| 
      
 333 
     | 
    
         
            +
              },
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
       312 
335 
     | 
    
         
             
              // @private
         
     | 
| 
       313 
336 
     | 
    
         
             
              getAssigneesTreeCombo: function() {
         
     | 
| 
       314 
337 
     | 
    
         
             
                return this.query('assignee_treecombo')[0];
         
     | 
| 
         @@ -32,7 +32,7 @@ Ext.define('TM.view.plan.Grid', { 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  '<table class="data">',
         
     | 
| 
       33 
33 
     | 
    
         
             
                    '<tr>',
         
     | 
| 
       34 
34 
     | 
    
         
             
                      '<td rowspan="3" class="title">内容</td>',
         
     | 
| 
       35 
     | 
    
         
            -
                      '<td class="name" 
     | 
| 
      
 35 
     | 
    
         
            +
                      '<td class="name">完成时限:</td>',
         
     | 
| 
       36 
36 
     | 
    
         
             
                      '<td class="value">第{[values.data.deadline_month == null ? 0 : values.data.deadline_month]}',
         
     | 
| 
       37 
37 
     | 
    
         
             
                      '个月,第{[values.data.deadline_day == null ? 0 : values.data.deadline_day]}天,',
         
     | 
| 
       38 
38 
     | 
    
         
             
                      '{data.deadline_hour}时{data.deadline_minute}分</td>',
         
     | 
| 
         @@ -45,7 +45,7 @@ Ext.define('TM.view.plan.Grid', { 
     | 
|
| 
       45 
45 
     | 
    
         
             
                      '<td class="name">纵向指标:</td>',
         
     | 
| 
       46 
46 
     | 
    
         
             
                      '<td class="value">{[values.data.y == null ? "" : values.data.y]}</td>',
         
     | 
| 
       47 
47 
     | 
    
         
             
                    '</tr>',
         
     | 
| 
       48 
     | 
    
         
            -
                  '</table>' 
     | 
| 
      
 48 
     | 
    
         
            +
                  '</table>'
         
     | 
| 
       49 
49 
     | 
    
         
             
                 ]
         
     | 
| 
       50 
50 
     | 
    
         
             
              }],
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
         @@ -54,7 +54,7 @@ Ext.define('TM.view.plan.Grid', { 
     | 
|
| 
       54 
54 
     | 
    
         
             
                dataIndex: 'name',
         
     | 
| 
       55 
55 
     | 
    
         
             
                flex: 2
         
     | 
| 
       56 
56 
     | 
    
         
             
              }, {
         
     | 
| 
       57 
     | 
    
         
            -
                text: ' 
     | 
| 
      
 57 
     | 
    
         
            +
                text: '周期',
         
     | 
| 
       58 
58 
     | 
    
         
             
                dataIndex: 'plan_type',
         
     | 
| 
       59 
59 
     | 
    
         
             
                renderer: function(v, m, record) {
         
     | 
| 
       60 
60 
     | 
    
         
             
                  return this.translateType(v);
         
     | 
| 
         @@ -30,7 +30,7 @@ Ext.define('TM.view.plan.Search', { 
     | 
|
| 
       30 
30 
     | 
    
         
             
                      fieldLabel: '名称',
         
     | 
| 
       31 
31 
     | 
    
         
             
                      name: 'q[name_cont]'
         
     | 
| 
       32 
32 
     | 
    
         
             
                    }, {
         
     | 
| 
       33 
     | 
    
         
            -
                      fieldLabel: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                      fieldLabel: '周期',
         
     | 
| 
       34 
34 
     | 
    
         
             
                      editable: false,
         
     | 
| 
       35 
35 
     | 
    
         
             
                      xtype: 'combo',
         
     | 
| 
       36 
36 
     | 
    
         
             
                      store: 'TM.store.Types',
         
     | 
| 
         @@ -112,7 +112,7 @@ Ext.define('TM.view.plan.Search', { 
     | 
|
| 
       112 
112 
     | 
    
         
             
                        action: 'reset'
         
     | 
| 
       113 
113 
     | 
    
         
             
                      }]
         
     | 
| 
       114 
114 
     | 
    
         
             
                    }]
         
     | 
| 
       115 
     | 
    
         
            -
                  }] 
     | 
| 
      
 115 
     | 
    
         
            +
                  }]
         
     | 
| 
       116 
116 
     | 
    
         
             
                }]
         
     | 
| 
       117 
117 
     | 
    
         
             
              }],
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
         @@ -38,7 +38,7 @@ Ext.define('TM.view.task.Grid', { 
     | 
|
| 
       38 
38 
     | 
    
         
             
                dataIndex: 'name',
         
     | 
| 
       39 
39 
     | 
    
         
             
                flex: 2
         
     | 
| 
       40 
40 
     | 
    
         
             
              }, {
         
     | 
| 
       41 
     | 
    
         
            -
                text: ' 
     | 
| 
      
 41 
     | 
    
         
            +
                text: '周期',
         
     | 
| 
       42 
42 
     | 
    
         
             
                dataIndex: 'task_type',
         
     | 
| 
       43 
43 
     | 
    
         
             
                renderer: function(v, m, record) {
         
     | 
| 
       44 
44 
     | 
    
         
             
                  return this.translateType(v);
         
     | 
| 
         @@ -52,7 +52,7 @@ Ext.define('TM.view.task.Grid', { 
     | 
|
| 
       52 
52 
     | 
    
         
             
                },
         
     | 
| 
       53 
53 
     | 
    
         
             
                flex:2
         
     | 
| 
       54 
54 
     | 
    
         
             
              }, {
         
     | 
| 
       55 
     | 
    
         
            -
                text: ' 
     | 
| 
      
 55 
     | 
    
         
            +
                text: '完成时限',
         
     | 
| 
       56 
56 
     | 
    
         
             
                dataIndex: 'deadline',
         
     | 
| 
       57 
57 
     | 
    
         
             
                renderer: function(v, m, record) {
         
     | 
| 
       58 
58 
     | 
    
         
             
                  return Ext.Date.format(v, 'Y年m月j日 H:i:s');
         
     | 
| 
         @@ -53,11 +53,6 @@ module TaskManager 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  data.symbolize_keys!
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
                  reminding_at = default_deadline.ago(begin_to_remind * 60)
         
     | 
| 
       56 
     | 
    
         
            -
                  if autocompletable
         
     | 
| 
       57 
     | 
    
         
            -
                    status, finished_at = :finished, Time.now
         
     | 
| 
       58 
     | 
    
         
            -
                  else
         
     | 
| 
       59 
     | 
    
         
            -
                    status, finished_at = :new, nil
         
     | 
| 
       60 
     | 
    
         
            -
                  end
         
     | 
| 
       61 
56 
     | 
    
         | 
| 
       62 
57 
     | 
    
         
             
                  Task.create! do |t|
         
     | 
| 
       63 
58 
     | 
    
         
             
                    t.name = name
         
     | 
| 
         @@ -65,8 +60,9 @@ module TaskManager 
     | 
|
| 
       65 
60 
     | 
    
         
             
                    t.task_type = plan_type
         
     | 
| 
       66 
61 
     | 
    
         
             
                    t.deadline = calculate_deadline(plan_type, data)
         
     | 
| 
       67 
62 
     | 
    
         
             
                    t.reminding_at = reminding_at
         
     | 
| 
       68 
     | 
    
         
            -
                    t.status =  
     | 
| 
       69 
     | 
    
         
            -
                    t.finished_at =  
     | 
| 
      
 63 
     | 
    
         
            +
                    t.status = :new
         
     | 
| 
      
 64 
     | 
    
         
            +
                    t.finished_at = nil
         
     | 
| 
      
 65 
     | 
    
         
            +
                    t.autocompletable = autocompletable
         
     | 
| 
       70 
66 
     | 
    
         
             
                    t.create_assignable(
         
     | 
| 
       71 
67 
     | 
    
         
             
                      assignee_id: a.assignee_id,
         
     | 
| 
       72 
68 
     | 
    
         
             
                      assignee_type: a.assignee_type,
         
     | 
| 
         @@ -13,7 +13,8 @@ module TaskManager 
     | 
|
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                default_value_for :status, :new
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                attr_accessible :data, :deadline, :name, :reminding_at, :status, 
     | 
| 
      
 16 
     | 
    
         
            +
                attr_accessible :data, :deadline, :name, :reminding_at, :status,
         
     | 
| 
      
 17 
     | 
    
         
            +
                   :task_type, :finished_at, :autocompletable
         
     | 
| 
       17 
18 
     | 
    
         | 
| 
       18 
19 
     | 
    
         
             
                validates_presence_of :name, :task_type, :status, :assignable, :deadline
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
         @@ -76,6 +77,10 @@ module TaskManager 
     | 
|
| 
       76 
77 
     | 
    
         
             
                  def remindable
         
     | 
| 
       77 
78 
     | 
    
         
             
                    active.where("reminding_at <= ?", Time.now)
         
     | 
| 
       78 
79 
     | 
    
         
             
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  def autocompletable
         
     | 
| 
      
 82 
     | 
    
         
            +
                    where(autocompletable: true)
         
     | 
| 
      
 83 
     | 
    
         
            +
                  end
         
     | 
| 
       79 
84 
     | 
    
         
             
                end
         
     | 
| 
       80 
85 
     | 
    
         
             
              end
         
     | 
| 
       81 
86 
     | 
    
         
             
            end
         
     | 
    
        data/lib/task-manager.rb
    CHANGED
    
    
    
        data/lib/task-manager/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: task-manager
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.6
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-01-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -324,7 +324,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       324 
324 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       325 
325 
     | 
    
         
             
                  segments:
         
     | 
| 
       326 
326 
     | 
    
         
             
                  - 0
         
     | 
| 
       327 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 327 
     | 
    
         
            +
                  hash: 3025342267253612574
         
     | 
| 
       328 
328 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       329 
329 
     | 
    
         
             
              none: false
         
     | 
| 
       330 
330 
     | 
    
         
             
              requirements:
         
     | 
| 
         @@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       333 
333 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       334 
334 
     | 
    
         
             
                  segments:
         
     | 
| 
       335 
335 
     | 
    
         
             
                  - 0
         
     | 
| 
       336 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 336 
     | 
    
         
            +
                  hash: 3025342267253612574
         
     | 
| 
       337 
337 
     | 
    
         
             
            requirements: []
         
     | 
| 
       338 
338 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       339 
339 
     | 
    
         
             
            rubygems_version: 1.8.24
         
     |