mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-20 02:38:39 +01:00
All day events should disable time editing in edit view
Summary: Closes T8021, All day events should disable time editing in edit view Test Plan: Edit all day event, time text fields should be disabled. Unchecking all-day should show time fields. Reviewers: chad, #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T8021 Differential Revision: https://secure.phabricator.com/D12774
This commit is contained in:
parent
da52a27b42
commit
d249456a04
6 changed files with 63 additions and 7 deletions
|
@ -345,6 +345,7 @@ return array(
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
|
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
|
||||||
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
|
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
|
||||||
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
|
||||||
|
'rsrc/js/application/calendar/event-all-day.js' => '712540b4',
|
||||||
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
|
||||||
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
|
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59',
|
||||||
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
|
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
|
||||||
|
@ -583,6 +584,7 @@ return array(
|
||||||
'javelin-behavior-doorkeeper-tag' => 'e5822781',
|
'javelin-behavior-doorkeeper-tag' => 'e5822781',
|
||||||
'javelin-behavior-durable-column' => '657c2b50',
|
'javelin-behavior-durable-column' => '657c2b50',
|
||||||
'javelin-behavior-error-log' => '6882e80a',
|
'javelin-behavior-error-log' => '6882e80a',
|
||||||
|
'javelin-behavior-event-all-day' => '712540b4',
|
||||||
'javelin-behavior-fancy-datepicker' => '5c0f680f',
|
'javelin-behavior-fancy-datepicker' => '5c0f680f',
|
||||||
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
|
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
|
||||||
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
|
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
|
||||||
|
|
|
@ -179,6 +179,16 @@ final class PhabricatorCalendarEventEditController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$all_day_id = celerity_generate_unique_node_id();
|
||||||
|
$start_date_id = celerity_generate_unique_node_id();
|
||||||
|
$end_date_id = celerity_generate_unique_node_id();
|
||||||
|
|
||||||
|
Javelin::initBehavior('event-all-day', array(
|
||||||
|
'allDayID' => $all_day_id,
|
||||||
|
'startDateID' => $start_date_id,
|
||||||
|
'endDateID' => $end_date_id,
|
||||||
|
));
|
||||||
|
|
||||||
$name = id(new AphrontFormTextControl())
|
$name = id(new AphrontFormTextControl())
|
||||||
->setLabel(pht('Name'))
|
->setLabel(pht('Name'))
|
||||||
->setName('name')
|
->setName('name')
|
||||||
|
@ -191,26 +201,31 @@ final class PhabricatorCalendarEventEditController
|
||||||
->setValue($type)
|
->setValue($type)
|
||||||
->setOptions($event->getStatusOptions());
|
->setOptions($event->getStatusOptions());
|
||||||
|
|
||||||
$all_day_select = id(new AphrontFormCheckboxControl())
|
$all_day_checkbox = id(new AphrontFormCheckboxControl())
|
||||||
->addCheckbox(
|
->addCheckbox(
|
||||||
'isAllDay',
|
'isAllDay',
|
||||||
1,
|
1,
|
||||||
pht('All Day Event'),
|
pht('All Day Event'),
|
||||||
$is_all_day);
|
$is_all_day,
|
||||||
|
$all_day_id);
|
||||||
|
|
||||||
$start_control = id(new AphrontFormDateControl())
|
$start_control = id(new AphrontFormDateControl())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setName('start')
|
->setName('start')
|
||||||
->setLabel(pht('Start'))
|
->setLabel(pht('Start'))
|
||||||
->setError($error_start_date)
|
->setError($error_start_date)
|
||||||
->setValue($start_value);
|
->setValue($start_value)
|
||||||
|
->setID($start_date_id)
|
||||||
|
->setIsTimeDisabled($is_all_day);
|
||||||
|
|
||||||
$end_control = id(new AphrontFormDateControl())
|
$end_control = id(new AphrontFormDateControl())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setName('end')
|
->setName('end')
|
||||||
->setLabel(pht('End'))
|
->setLabel(pht('End'))
|
||||||
->setError($error_end_date)
|
->setError($error_end_date)
|
||||||
->setValue($end_value);
|
->setValue($end_value)
|
||||||
|
->setID($end_date_id)
|
||||||
|
->setIsTimeDisabled($is_all_day);
|
||||||
|
|
||||||
$description = id(new AphrontFormTextAreaControl())
|
$description = id(new AphrontFormTextAreaControl())
|
||||||
->setLabel(pht('Description'))
|
->setLabel(pht('Description'))
|
||||||
|
@ -248,7 +263,7 @@ final class PhabricatorCalendarEventEditController
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->appendChild($name)
|
->appendChild($name)
|
||||||
->appendChild($status_select)
|
->appendChild($status_select)
|
||||||
->appendChild($all_day_select)
|
->appendChild($all_day_checkbox)
|
||||||
->appendChild($start_control)
|
->appendChild($start_control)
|
||||||
->appendChild($end_control)
|
->appendChild($end_control)
|
||||||
->appendControl($view_policies)
|
->appendControl($view_policies)
|
||||||
|
|
|
@ -4,12 +4,18 @@ final class AphrontFormCheckboxControl extends AphrontFormControl {
|
||||||
|
|
||||||
private $boxes = array();
|
private $boxes = array();
|
||||||
|
|
||||||
public function addCheckbox($name, $value, $label, $checked = false) {
|
public function addCheckbox(
|
||||||
|
$name,
|
||||||
|
$value,
|
||||||
|
$label,
|
||||||
|
$checked = false,
|
||||||
|
$id = null) {
|
||||||
$this->boxes[] = array(
|
$this->boxes[] = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'value' => $value,
|
'value' => $value,
|
||||||
'label' => $label,
|
'label' => $label,
|
||||||
'checked' => $checked,
|
'checked' => $checked,
|
||||||
|
'id' => $id,
|
||||||
);
|
);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +27,10 @@ final class AphrontFormCheckboxControl extends AphrontFormControl {
|
||||||
protected function renderInput() {
|
protected function renderInput() {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($this->boxes as $box) {
|
foreach ($this->boxes as $box) {
|
||||||
$id = celerity_generate_unique_node_id();
|
$id = idx($box, 'id');
|
||||||
|
if ($id === null) {
|
||||||
|
$id = celerity_generate_unique_node_id();
|
||||||
|
}
|
||||||
$checkbox = phutil_tag(
|
$checkbox = phutil_tag(
|
||||||
'input',
|
'input',
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -11,6 +11,7 @@ final class AphrontFormDateControl extends AphrontFormControl {
|
||||||
private $valueTime;
|
private $valueTime;
|
||||||
private $allowNull;
|
private $allowNull;
|
||||||
private $continueOnInvalidDate = false;
|
private $continueOnInvalidDate = false;
|
||||||
|
private $isTimeDisabled;
|
||||||
private $isDisabled;
|
private $isDisabled;
|
||||||
|
|
||||||
public function setAllowNull($allow_null) {
|
public function setAllowNull($allow_null) {
|
||||||
|
@ -18,6 +19,11 @@ final class AphrontFormDateControl extends AphrontFormControl {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setIsTimeDisabled($is_disabled) {
|
||||||
|
$this->isTimeDisabled = $is_disabled;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
const TIME_START_OF_DAY = 'start-of-day';
|
const TIME_START_OF_DAY = 'start-of-day';
|
||||||
const TIME_END_OF_DAY = 'end-of-day';
|
const TIME_END_OF_DAY = 'end-of-day';
|
||||||
const TIME_START_OF_BUSINESS = 'start-of-business';
|
const TIME_START_OF_BUSINESS = 'start-of-business';
|
||||||
|
@ -282,6 +288,9 @@ final class AphrontFormDateControl extends AphrontFormControl {
|
||||||
if ($disabled) {
|
if ($disabled) {
|
||||||
$classes[] = 'datepicker-disabled';
|
$classes[] = 'datepicker-disabled';
|
||||||
}
|
}
|
||||||
|
if ($this->isTimeDisabled) {
|
||||||
|
$classes[] = 'no-time';
|
||||||
|
}
|
||||||
|
|
||||||
return javelin_tag(
|
return javelin_tag(
|
||||||
'div',
|
'div',
|
||||||
|
@ -291,6 +300,7 @@ final class AphrontFormDateControl extends AphrontFormControl {
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'disabled' => (bool)$disabled,
|
'disabled' => (bool)$disabled,
|
||||||
),
|
),
|
||||||
|
'id' => $this->getID(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$checkbox,
|
$checkbox,
|
||||||
|
|
|
@ -457,6 +457,10 @@ properly, and submit values. */
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-form-date-container.no-time .aphront-form-date-time-input{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.login-to-comment {
|
.login-to-comment {
|
||||||
margin: 12px;
|
margin: 12px;
|
||||||
|
|
16
webroot/rsrc/js/application/calendar/event-all-day.js
Normal file
16
webroot/rsrc/js/application/calendar/event-all-day.js
Normal file
|
@ -0,0 +1,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);
|
||||||
|
|
||||||
|
JX.DOM.alterClass(start, 'no-time', checkbox.checked);
|
||||||
|
JX.DOM.alterClass(end, 'no-time', checkbox.checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue