diff options
Diffstat (limited to 'app')
-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); |