@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+63 -7
+2
resources/celerity/map.php
··· 345 345 'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974', 346 346 'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761', 347 347 'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18', 348 + 'rsrc/js/application/calendar/event-all-day.js' => '712540b4', 348 349 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de', 349 350 'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '9e507b59', 350 351 'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a', ··· 583 584 'javelin-behavior-doorkeeper-tag' => 'e5822781', 584 585 'javelin-behavior-durable-column' => '657c2b50', 585 586 'javelin-behavior-error-log' => '6882e80a', 587 + 'javelin-behavior-event-all-day' => '712540b4', 586 588 'javelin-behavior-fancy-datepicker' => '5c0f680f', 587 589 'javelin-behavior-global-drag-and-drop' => 'c8e57404', 588 590 'javelin-behavior-herald-rule-editor' => '7ebaeed3',
+20 -5
src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
··· 179 179 } 180 180 } 181 181 182 + $all_day_id = celerity_generate_unique_node_id(); 183 + $start_date_id = celerity_generate_unique_node_id(); 184 + $end_date_id = celerity_generate_unique_node_id(); 185 + 186 + Javelin::initBehavior('event-all-day', array( 187 + 'allDayID' => $all_day_id, 188 + 'startDateID' => $start_date_id, 189 + 'endDateID' => $end_date_id, 190 + )); 191 + 182 192 $name = id(new AphrontFormTextControl()) 183 193 ->setLabel(pht('Name')) 184 194 ->setName('name') ··· 191 201 ->setValue($type) 192 202 ->setOptions($event->getStatusOptions()); 193 203 194 - $all_day_select = id(new AphrontFormCheckboxControl()) 204 + $all_day_checkbox = id(new AphrontFormCheckboxControl()) 195 205 ->addCheckbox( 196 206 'isAllDay', 197 207 1, 198 208 pht('All Day Event'), 199 - $is_all_day); 209 + $is_all_day, 210 + $all_day_id); 200 211 201 212 $start_control = id(new AphrontFormDateControl()) 202 213 ->setUser($user) 203 214 ->setName('start') 204 215 ->setLabel(pht('Start')) 205 216 ->setError($error_start_date) 206 - ->setValue($start_value); 217 + ->setValue($start_value) 218 + ->setID($start_date_id) 219 + ->setIsTimeDisabled($is_all_day); 207 220 208 221 $end_control = id(new AphrontFormDateControl()) 209 222 ->setUser($user) 210 223 ->setName('end') 211 224 ->setLabel(pht('End')) 212 225 ->setError($error_end_date) 213 - ->setValue($end_value); 226 + ->setValue($end_value) 227 + ->setID($end_date_id) 228 + ->setIsTimeDisabled($is_all_day); 214 229 215 230 $description = id(new AphrontFormTextAreaControl()) 216 231 ->setLabel(pht('Description')) ··· 248 263 ->setUser($user) 249 264 ->appendChild($name) 250 265 ->appendChild($status_select) 251 - ->appendChild($all_day_select) 266 + ->appendChild($all_day_checkbox) 252 267 ->appendChild($start_control) 253 268 ->appendChild($end_control) 254 269 ->appendControl($view_policies)
+11 -2
src/view/form/control/AphrontFormCheckboxControl.php
··· 4 4 5 5 private $boxes = array(); 6 6 7 - public function addCheckbox($name, $value, $label, $checked = false) { 7 + public function addCheckbox( 8 + $name, 9 + $value, 10 + $label, 11 + $checked = false, 12 + $id = null) { 8 13 $this->boxes[] = array( 9 14 'name' => $name, 10 15 'value' => $value, 11 16 'label' => $label, 12 17 'checked' => $checked, 18 + 'id' => $id, 13 19 ); 14 20 return $this; 15 21 } ··· 21 27 protected function renderInput() { 22 28 $rows = array(); 23 29 foreach ($this->boxes as $box) { 24 - $id = celerity_generate_unique_node_id(); 30 + $id = idx($box, 'id'); 31 + if ($id === null) { 32 + $id = celerity_generate_unique_node_id(); 33 + } 25 34 $checkbox = phutil_tag( 26 35 'input', 27 36 array(
+10
src/view/form/control/AphrontFormDateControl.php
··· 11 11 private $valueTime; 12 12 private $allowNull; 13 13 private $continueOnInvalidDate = false; 14 + private $isTimeDisabled; 14 15 private $isDisabled; 15 16 16 17 public function setAllowNull($allow_null) { 17 18 $this->allowNull = $allow_null; 19 + return $this; 20 + } 21 + 22 + public function setIsTimeDisabled($is_disabled) { 23 + $this->isTimeDisabled = $is_disabled; 18 24 return $this; 19 25 } 20 26 ··· 282 288 if ($disabled) { 283 289 $classes[] = 'datepicker-disabled'; 284 290 } 291 + if ($this->isTimeDisabled) { 292 + $classes[] = 'no-time'; 293 + } 285 294 286 295 return javelin_tag( 287 296 'div', ··· 291 300 'meta' => array( 292 301 'disabled' => (bool)$disabled, 293 302 ), 303 + 'id' => $this->getID(), 294 304 ), 295 305 array( 296 306 $checkbox,
+4
webroot/rsrc/css/phui/phui-form-view.css
··· 457 457 opacity: 0.5; 458 458 } 459 459 460 + .aphront-form-date-container.no-time .aphront-form-date-time-input{ 461 + display: none; 462 + } 463 + 460 464 461 465 .login-to-comment { 462 466 margin: 12px;
+16
webroot/rsrc/js/application/calendar/event-all-day.js
··· 1 + /** 2 + * @provides javelin-behavior-event-all-day 3 + */ 4 + 5 + 6 + JX.behavior('event-all-day', function(config) { 7 + var checkbox = JX.$(config.allDayID); 8 + JX.DOM.listen(checkbox, 'change', null, function() { 9 + var start = JX.$(config.startDateID); 10 + var end = JX.$(config.endDateID); 11 + 12 + JX.DOM.alterClass(start, 'no-time', checkbox.checked); 13 + JX.DOM.alterClass(end, 'no-time', checkbox.checked); 14 + }); 15 + 16 + });