Add Orderable to subdef Controller

This commit is contained in:
Benoît Burnichon
2016-02-10 17:06:08 +01:00
parent 20178f76cd
commit 721edc33c6
3 changed files with 10 additions and 2 deletions

View File

@@ -80,6 +80,7 @@ class SubdefsController extends Controller
$class = $request->request->get($post_sub . '_class'); $class = $request->request->get($post_sub . '_class');
$downloadable = $request->request->get($post_sub . '_downloadable'); $downloadable = $request->request->get($post_sub . '_downloadable');
$orderable = $request->request->get($post_sub . '_orderable');
$defaults = ['path', 'meta', 'mediatype']; $defaults = ['path', 'meta', 'mediatype'];
@@ -107,7 +108,7 @@ class SubdefsController extends Controller
$labels = $request->request->get($post_sub . '_label', []); $labels = $request->request->get($post_sub . '_label', []);
$subdefs->set_subdef($group, $name, $class, $downloadable, $options, $labels); $subdefs->set_subdef($group, $name, $class, $downloadable, $options, $labels, $orderable);
} }
} }

View File

@@ -223,10 +223,11 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
* @param boolean $downloadable * @param boolean $downloadable
* @param array $options * @param array $options
* @param array $labels * @param array $labels
* @param bool $orderable
* @return databox_subdefsStructure * @return databox_subdefsStructure
* @throws Exception * @throws Exception
*/ */
public function set_subdef($group, $name, $class, $downloadable, $options, $labels) public function set_subdef($group, $name, $class, $downloadable, $options, $labels, $orderable = true)
{ {
$dom_struct = $this->databox->get_dom_structure(); $dom_struct = $this->databox->get_dom_structure();
@@ -234,6 +235,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
$subdef->setAttribute('class', $class); $subdef->setAttribute('class', $class);
$subdef->setAttribute('name', mb_strtolower($name)); $subdef->setAttribute('name', mb_strtolower($name));
$subdef->setAttribute('downloadable', ($downloadable ? 'true' : 'false')); $subdef->setAttribute('downloadable', ($downloadable ? 'true' : 'false'));
$subdef->setAttribute('orderable', ($orderable ? 'true' : 'false'));
foreach ($labels as $code => $label) { foreach ($labels as $code => $label) {
$child = $dom_struct->createElement('label'); $child = $dom_struct->createElement('label');

View File

@@ -230,6 +230,11 @@
<td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_downloadable" {% if subdef.isDownloadable() %}checked="checked"{% endif %} value="1" /></td> <td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_downloadable" {% if subdef.isDownloadable() %}checked="checked"{% endif %} value="1" /></td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>{{ 'subdef.orderable' | trans }}</td>
<td><input type="checkbox" name="{{subdefgroup}}_{{subdefname}}_orderable" {% if subdef.isOrderable() %}checked="checked"{% endif %} value="1" /></td>
<td></td>
</tr>
<tr> <tr>
<td> <td>
{{ 'classe' | trans }} {{ 'classe' | trans }}