Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Disable completed checkbox in UI when appropriate.
Bug: 12308
  • Loading branch information
mrubinsk committed Jan 30, 2016
1 parent 741a6af commit 0ea8bee
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 15 additions & 2 deletions nag/lib/Form/Task.php
Expand Up @@ -20,6 +20,12 @@ class Nag_Form_Task extends Horde_Form
const SECTION_RECUR = 2;
const SECTION_DESC = 3;

/**
*
* @var Nag_Task
*/
protected $_task;

/**
* Const'r
*
Expand Down Expand Up @@ -144,8 +150,7 @@ public function __construct($vars, $title = '')
$v->setDefault(3);
$this->addVariable(_("Estimated Time"), 'estimate', 'number', false);
$this->addVariable(_("Actual Time"), 'actual', 'number', false);
$this->addVariable(_("Completed?"), 'completed', 'boolean', false);

$this->_completedVar = $this->addVariable(_("Completed?"), 'completed', 'boolean', false);
$this->setSection(self::SECTION_RECUR, _("Recurrence"));
$this->addVariable(_("Recurrence"), 'recurrence', 'Nag:NagRecurrence', false);
}
Expand Down Expand Up @@ -187,4 +192,12 @@ public function renderActive()
);
}

public function setTask(Nag_Task $task)
{
$this->_task = $task;
if (!$this->_task->childrenCompleted()) {
$this->_completedVar->disable();
}
}

}
4 changes: 4 additions & 0 deletions nag/task.php
Expand Up @@ -120,6 +120,10 @@ function _delete($task_id, $tasklist_id)
}

$form = new Nag_Form_Task($vars, sprintf(_("Edit: %s"), $task->name));
if (!$task->completed) {
$task->loadChildren();
$form->setTask($task);
}
break;
}
}
Expand Down

0 comments on commit 0ea8bee

Please sign in to comment.