Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14059532
D16327.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D16327.diff
View Options
diff --git a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
--- a/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
+++ b/src/applications/calendar/editor/PhabricatorCalendarEventEditEngine.php
@@ -212,4 +212,45 @@
return $fields;
}
+ protected function willBuildEditForm($object, array $fields) {
+ $all_day_field = idx($fields, 'isAllDay');
+ $start_field = idx($fields, 'start');
+ $end_field = idx($fields, 'end');
+
+ if ($all_day_field) {
+ $is_all_day = $all_day_field->getValueForTransaction();
+
+ $control_ids = array();
+ if ($start_field) {
+ $control_ids[] = $start_field->getControlID();
+ }
+ if ($end_field) {
+ $control_ids[] = $end_field->getControlID();
+ }
+
+ Javelin::initBehavior(
+ 'event-all-day',
+ array(
+ 'allDayID' => $all_day_field->getControlID(),
+ 'controlIDs' => $control_ids,
+ ));
+
+ } else {
+ $is_all_day = $object->getIsAllDay();
+ }
+
+ if ($is_all_day) {
+ if ($start_field) {
+ $start_field->setHideTime(true);
+ }
+
+ if ($end_field) {
+ $end_field->setHideTime(true);
+ }
+ }
+
+
+
+ return $fields;
+ }
}
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -1176,6 +1176,8 @@
$controller = $this->getController();
$request = $controller->getRequest();
+ $fields = $this->willBuildEditForm($object, $fields);
+
$form = id(new AphrontFormView())
->setUser($viewer)
->addHiddenInput('editEngine', 'true');
@@ -1210,6 +1212,10 @@
return $form;
}
+ protected function willBuildEditForm($object, array $fields) {
+ return $fields;
+ }
+
private function buildEditFormActionButton($object) {
if (!$this->isEngineConfigurable()) {
return null;
diff --git a/src/applications/transactions/editfield/PhabricatorEpochEditField.php b/src/applications/transactions/editfield/PhabricatorEpochEditField.php
--- a/src/applications/transactions/editfield/PhabricatorEpochEditField.php
+++ b/src/applications/transactions/editfield/PhabricatorEpochEditField.php
@@ -4,6 +4,7 @@
extends PhabricatorEditField {
private $allowNull;
+ private $hideTime;
public function setAllowNull($allow_null) {
$this->allowNull = $allow_null;
@@ -14,9 +15,19 @@
return $this->allowNull;
}
+ public function setHideTime($hide_time) {
+ $this->hideTime = $hide_time;
+ return $this;
+ }
+
+ public function getHideTime() {
+ return $this->hideTime;
+ }
+
protected function newControl() {
return id(new AphrontFormDateControl())
->setAllowNull($this->getAllowNull())
+ ->setIsTimeDisabled($this->getHideTime())
->setViewer($this->getViewer());
}
@@ -26,9 +37,7 @@
}
protected function newConduitParameterType() {
- // TODO: This isn't correct, but we don't have any methods which use this
- // yet.
- return new ConduitIntParameterType();
+ return new ConduitEpochParameterType();
}
}
diff --git a/webroot/rsrc/js/application/calendar/behavior-event-all-day.js b/webroot/rsrc/js/application/calendar/behavior-event-all-day.js
--- a/webroot/rsrc/js/application/calendar/behavior-event-all-day.js
+++ b/webroot/rsrc/js/application/calendar/behavior-event-all-day.js
@@ -2,15 +2,16 @@
* @provides javelin-behavior-event-all-day
*/
-
JX.behavior('event-all-day', function(config) {
- var checkbox = JX.$(config.allDayID);
- JX.DOM.listen(checkbox, 'change', null, function() {
- var start = JX.$(config.startDateID);
- var end = JX.$(config.endDateID);
+ var all_day = JX.$(config.allDayID);
+
+ JX.DOM.listen(all_day, 'change', null, function() {
+ var is_all_day = !!parseInt(all_day.value, 10);
- JX.DOM.alterClass(start, 'no-time', checkbox.checked);
- JX.DOM.alterClass(end, 'no-time', checkbox.checked);
+ for (var ii = 0; ii < config.controlIDs.length; ii++) {
+ var control = JX.$(config.controlIDs[ii]);
+ JX.DOM.alterClass(control, 'no-time', is_all_day);
+ }
});
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 8:07 PM (16 h, 10 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6761625
Default Alt Text
D16327.diff (4 KB)
Attached To
Mode
D16327: Hide time controls when editing all-day Calendar events
Attached
Detach File
Event Timeline
Log In to Comment