Skip to content

Commit

Permalink
make default calendar color change with theming app
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehrke committed Sep 12, 2016
1 parent e5b314c commit e211d0b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion controller/viewcontroller.php
Expand Up @@ -83,14 +83,16 @@ public function index() {
$defaultView = $this->config->getUserValue($userId, $this->appName, 'currentView', 'month');
$skipPopover = $this->config->getUserValue($userId, $this->appName, 'skipPopover', 'no');
$weekNumbers = $this->config->getUserValue($userId, $this->appName, 'showWeekNr', 'no');
$defaultColor = $this->config->getAppValue('theming', 'color', '#0082C9');

return new TemplateResponse('calendar', 'main', [
'appVersion' => $appVersion,
'defaultView' => $defaultView,
'emailAddress' => $emailAddress,
'skipPopover' => $skipPopover,
'weekNumbers' => $weekNumbers,
'supportsClass' => $supportsClass
'supportsClass' => $supportsClass,
'defaultColor' => $defaultColor,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion js/app/service/calendarservice.js
Expand Up @@ -483,7 +483,7 @@ app.service('CalendarService', ['DavClient', 'Calendar', function(DavClient, Cal
simple.color = simple.color.substr(0,7);
}
} else {
simple.color = '#1d2d44';
simple.color = angular.element('#fullcalendar').attr('data-defaultColor');
}

simple.writableProperties = (oc_current_user === simple.owner) && simple.writable;
Expand Down
1 change: 1 addition & 0 deletions templates/part.fullcalendar.php
Expand Up @@ -25,6 +25,7 @@
<div
class="calendar"
data-appVersion="<?php p($_['appVersion']); ?>"
data-defaultColor="<?php p($_['defaultColor']); ?>"
data-defaultView="<?php p($_['defaultView']); ?>"
data-emailAddress="<?php p($_['emailAddress']); ?>"
data-skipPopover="<?php p($_['skipPopover']); ?>"
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/controller/viewcontrollerTest.php
Expand Up @@ -136,6 +136,11 @@ public function testIndex($isAssetPipelineEnabled, $showAssetPipelineError, $ser
->with('user123', $this->appName, 'showWeekNr', 'no')
->will($this->returnValue('someShowWeekNrValue'));

$this->config->expects($this->at(6))
->method('getAppValue')
->with('theming', 'color', '#0082C9')
->will($this->returnValue('#ff00ff'));

$actual = $this->controller->index();

$this->assertInstanceOf('OCP\AppFramework\Http\TemplateResponse', $actual);
Expand All @@ -145,7 +150,8 @@ public function testIndex($isAssetPipelineEnabled, $showAssetPipelineError, $ser
'emailAddress' => 'test@bla.com',
'skipPopover' => 'someSkipPopoverValue',
'weekNumbers' => 'someShowWeekNrValue',
'supportsClass' => $expectsSupportsClass
'supportsClass' => $expectsSupportsClass,
'defaultColor' => '#ff00ff',
], $actual->getParams());
$this->assertEquals('main', $actual->getTemplateName());
}
Expand Down

0 comments on commit e211d0b

Please sign in to comment.