Skip to content

Commit 485cfc5

Browse files
committed
Add enable/disable toogle for tiles
1 parent a3f46fb commit 485cfc5

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

Admin/Controller/Tile.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public function actionSave(ParameterBag $params)
5959
return $this->redirect($this->buildLink('if-gs-list') . $this->buildLinkHash($tile->tile_id));
6060
}
6161

62+
public function actionToggle()
63+
{
64+
$plugin = $this->plugin('XF:Toggle');
65+
return $plugin->actionToggle('Inforge\GridShow:Tile');
66+
}
67+
6268
protected function tileSaveProcess(\Inforge\GridShow\Entity\Tile $tile)
6369
{
6470
$form = $this->formAction();

Entity/Tile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function getStructure(Structure $structure)
4242
],
4343
'active' => [
4444
'type' => self::BOOL,
45-
'default' => false
45+
'default' => true
4646
]
4747
];
4848

Setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function installStep1()
2424
$table->addColumn('link', 'varchar', 200);
2525
$table->addColumn('image_url', 'varchar', 200);
2626
$table->addColumn('display_order', 'int')->setDefault(0);
27-
$table->addColumn('active', 'tinyint')->setDefault(0);
27+
$table->addColumn('active', 'tinyint')->setDefault(1);
2828
$table->addPrimaryKey('tile_id');
2929
});
3030
}

_output/templates/_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"admin/if_gs_tile_list.html": {
88
"version_id": 1000070,
99
"version_string": "1.0.0",
10-
"hash": "934a70d39dbee97dc146057dc82c8d49"
10+
"hash": "9217193fc2acd618a42f772cd3bb0e98"
1111
},
1212
"public/if_gs_gridshow_widget.html": {
1313
"version_id": 1000070,

_output/templates/admin/if_gs_tile_list.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</xf:pageaction>
66

77
<xf:if is="$tiles is not empty">
8-
<div class="block">
8+
<xf:form action="{{ link('if-gs-list/toggle') }}" class="block" ajax="true">
99
<div class="block-outer">
1010
<xf:macro template="filter_macros" name="quick_filter" arg-key="contents" arg-class="block-outer-opposite" />
1111
</div>
@@ -17,15 +17,19 @@
1717
label="{$tile.title}"
1818
hint="{{ phrase('category:') }} {$tile.category}"
1919
href="{{ link('if-gs-list/edit', $tile) }}"
20-
delete="{{ link('if-gs-list/delete', $tile) }}" />
20+
delete="{{ link('if-gs-list/delete', $tile) }}">
21+
<xf:toggle name="active[{$tile.tile_id}]" selected="$tile.active"
22+
class="dataList-cell--separated" submit="true"
23+
tooltip="{{ phrase('enable_disable_x', {'title': $tile.title}) }}" />
24+
</xf:datarow>
2125
</xf:foreach>
2226
</xf:datalist>
2327
</div>
2428
<div class="block-footer">
2529
<span class="block-footer-counter">{{ display_totals($tiles) }}</span>
2630
</div>
2731
</div>
28-
</div>
32+
</xf:form>
2933
<xf:else />
3034
<div class="blockMessage">{{ phrase('no_items_to_display') }}</div>
3135
</xf:if>

0 commit comments

Comments
 (0)