Skip to content

Commit

Permalink
Merge pull request #24 from ajshort/date-time-cms-fields
Browse files Browse the repository at this point in the history
Date Time CMS Fields
  • Loading branch information
unclecheese committed Feb 24, 2013
2 parents 54ab09e + 91ace6f commit 320aa8f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 39 deletions.
22 changes: 13 additions & 9 deletions code/CalendarDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,22 @@ class CalendarDateTime extends DataObject


public function getCMSFields() {
DateField::set_default_config('showcalendar', true);
$f = new FieldList(
new DateField('StartDate',_t('CalendarDateTime.STARTDATE','Start date')),
new DateField('EndDate',_t('CalendarDateTime.ENDDATE','End date')),
new TimeField('StartTime', _t('CalendarDateTime.STARTTIME','Start time')),
new TimeField('EndTime', _t('CalendarDateTime.ENDTIME','End time')),
$fields = parent::getCMSFields();

$fields->removeByName('EventID');
$fields->addFieldsToTab('Root.Main', array(
$start = new DateField('StartDate',_t('CalendarDateTime.STARTDATE', 'Start date')),
$end = new DateField('EndDate',_t('CalendarDateTime.ENDDATE', 'End date')),
new TimePickerField('StartTime', _t('CalendarDateTime.STARTTIME', 'Start time')),
new TimePickerField('EndTime', _t('CalendarDateTime.ENDTIME', 'End time')),
new CheckboxField('AllDay', _t('CalendarDateTime.ALLDAY','This event lasts all day'))
);
));

$this->extend('updateCMSFields', $f);
$start->setConfig('showcalendar', true);
$end->setConfig('showcalendar', true);

return $f;
$this->extend('updateCMSFields', $fields);
return $fields;
}


Expand Down
21 changes: 0 additions & 21 deletions code/CalendarTimeField.php

This file was deleted.

17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
{
"name":"silverstripe/event-calendar",
"name":"silverstripe/event-calendar",
"type": "silverstripe-module",
"description": "Event Calendar for the SilverStripe CMS",
"keywords": ["silverstripe", "events"],
"license": "BSD-3-Clause",
"authors":[
"authors": [
{
"name": "Aaron Carlino",
"homepage": "http://leftandmain.com"
}
],
"require":
{
"require": {
"php": ">=5.3.2",
"silverstripe/framework": "3.*",
"silverstripe/cms": "3.*"
"silverstripe/cms": "3.*",
"silverstripe/timepickerfield": "dev-master"
},
"support": {
"issues": "https://github.com/unclecheese/EventCalendar/issues"
},
"extra": {
"extra": {
"installer-name": "event_calendar"
}

}
}
}

0 comments on commit 320aa8f

Please sign in to comment.