Skip to content

Commit

Permalink
Merge pull request #15 from klees/5_4_ks_filter3_roadmap
Browse files Browse the repository at this point in the history
UI: roadmap-entry for getUpdateOnLoadCode
  • Loading branch information
tfamula authored Apr 18, 2019
2 parents dd03e46 + 5ee18e8 commit 433544f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/UI/Implementation/Component/Input/Field/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,29 @@ final public function getContent() {
*/
public function getUpdateOnLoadCode(): \Closure
{
// TODO: Implement getUpdateOnLoadCode() method for each input if needed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
// TODO: This method will need to be removed.
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This exception will need to be removed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
return $this->withTriggeredSignal($signal, 'update');
}

Expand All @@ -496,6 +511,14 @@ public function withOnUpdate(Signal $signal)
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This exception will need to be removed.
throw new \Exception(
"This is not implemented yet. Every Input needs to implement ".
"this, but to be able to move on currently this is broken. ".
"If you see this message, please file a bug at mantis.ilias.de. ".
"Also have a look into the roadmap: \"Implement `Input::getUpdateOnLoadCode`, ".
"`Input::withOnUpdate` and `Input::appendOnUpdate` for every Input"
);
return $this->appendTriggeredSignal($signal, 'update');
}
}
19 changes: 19 additions & 0 deletions src/UI/Implementation/Component/Input/Field/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,23 @@ public function getUpdateOnLoadCode(): \Closure
};
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->withTriggeredSignal($signal, 'update');
}

/**
* @inheritdoc
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->appendTriggeredSignal($signal, 'update');
}
}
20 changes: 20 additions & 0 deletions src/UI/Implementation/Component/Input/Field/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,24 @@ public function getUpdateOnLoadCode(): \Closure
return $code;
};
}

/**
* @inheritdoc
*/
public function withOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->withTriggeredSignal($signal, 'update');
}

/**
* @inheritdoc
*/
public function appendOnUpdate(Signal $signal)
{
// TODO: This method will need to be removed.
// See ILIAS\UI\Implementation\Component\Input\Field\Input
return $this->appendTriggeredSignal($signal, 'update');
}
}
17 changes: 17 additions & 0 deletions src/UI/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ to construct a new Counter.
It would be handy to have a "withNumber"-mutator, or something like
"withIncrease/withDecrease"

### Implement `Input::getUpdateOnLoadCode`, `Input::withOnUpdate` and `Input::appendOnUpdate` for every Input (advanced, ~4h)

When introducing [UI Filters](https://github.com/ILIAS-eLearning/ILIAS/pull/1735)
some ends have been left open and need to be implemented properly. Currently
`withOnUpdate` and `appendOnUpdate` do not work on Inputs in the general case and
only work for `Select Field` and `Text Field` in the context of the filter. To
let the promise of `OnUpdate` come true, the following things will need to be done:

* Every Input needs to implement `Input::getUpdateOnLoadCode`.
* Once this is done, the method `Input::getUpdateOnLoadCode` on the base class
should be removed to force new inputs to implement this method properly.
* The usage of the method should be moved from the (specific) `Container\Filter\Renderer`
to the (general) `Field\Renderer` to make `OnUpdate` apply everywhere.
* `Input::withOnUpdate` and `Input::appendOnUpdate` can then be reinstated on the
base class and removed on `Field\Select` and `Field\Text`.

New inputs must already implement the methods.

## Long Term

Expand Down

0 comments on commit 433544f

Please sign in to comment.