diff options
author | emkael <emkael@tlen.pl> | 2016-05-06 17:47:43 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-05-09 12:35:55 +0200 |
commit | e2094c00b4691dcc78b4db8e94a020acdabb1057 (patch) | |
tree | 0e8aeaebee7fa6b456cf7c1170fcee2343eefc3c /app/php/controls | |
parent | 4682a28147505362441f29a7af159d8f0fcdfd23 (diff) |
* quick default status edit in calendar scaffold
Diffstat (limited to 'app/php/controls')
-rw-r--r-- | app/php/controls/CalendarScaffold.php | 9 | ||||
-rw-r--r-- | app/php/controls/CalendarScaffold.tpl | 19 | ||||
-rw-r--r-- | app/php/controls/scripts/CalendarScaffold.js | 2 |
3 files changed, 26 insertions, 4 deletions
diff --git a/app/php/controls/CalendarScaffold.php b/app/php/controls/CalendarScaffold.php index b12f6aa..1a25cce 100644 --- a/app/php/controls/CalendarScaffold.php +++ b/app/php/controls/CalendarScaffold.php @@ -96,6 +96,15 @@ class CalendarScaffold extends FacadeTemplateControl { $this->_rebindData(); } + public function toggleDefaultState($sender, $param) { + $calendar = $this->getFacade()->get($sender->CustomData); + if ($calendar) { + $calendar[0]->Visible = $sender->Checked; + $calendar[0]->save(); + $this->_rebindData(TRUE); + } + } + public function uploadRowFile($sender, $param) { $fileType = $sender->getFileType(); if (preg_match('/^image\//', $fileType)) { diff --git a/app/php/controls/CalendarScaffold.tpl b/app/php/controls/CalendarScaffold.tpl index a92c3e6..5e15b92 100644 --- a/app/php/controls/CalendarScaffold.tpl +++ b/app/php/controls/CalendarScaffold.tpl @@ -26,9 +26,22 @@ DataValueField="CategoryID" ListValueField="ID" ListTextField="Name" /> - <com:TActiveCheckBoxColumn ID="Visible" - HeaderText="Default" - DataField="Visible" /> + <com:TActiveTemplateColumn ID="Visible" + HeaderText="Default"> + <prop:ItemTemplate> + <com:TActiveCheckBox + OnCheckedChanged="SourceTemplateControl.toggleDefaultState" + CssClass="visibilityToggle"> + <prop:Checked><%# $this->Parent->Data->Visible %></prop:Checked> + <prop:CustomData><%# $this->Parent->Data->UID %></prop:CustomData> + </com:TActiveCheckBox> + </prop:ItemTemplate> + <prop:EditItemTemplate> + <com:TCheckBox ID="CheckBox"> + <prop:Checked><%# $this->Parent->Data->Visible %></prop:Checked> + </com:TCheckBox> + </prop:EditItemTemplate> + </com:TActiveTemplateColumn> <com:TActiveBoundColumn ID="CustomName" HeaderText="Custom name" DataField="CustomName" /> diff --git a/app/php/controls/scripts/CalendarScaffold.js b/app/php/controls/scripts/CalendarScaffold.js index 815a3da..d4b8ec5 100644 --- a/app/php/controls/scripts/CalendarScaffold.js +++ b/app/php/controls/scripts/CalendarScaffold.js @@ -1,6 +1,6 @@ $('body').on( 'click', - 'main .calendarScaffold tbody a[href^="javascript:;//"]', + 'main .calendarScaffold tbody a[href^="javascript:;//"], main .calendarScaffold tbody input.visibilityToggle', function(e) { var loader = $('<div>').addClass('calendarScaffoldLoader'); $('main .calendarScaffold div[id$="_Container"]').append(loader); |