Christopher Johnson (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/207415
Change subject: adds SprintUIObjectBox and CSS to enable horizontal scrolling ...................................................................... adds SprintUIObjectBox and CSS to enable horizontal scrolling Bug: T94203 Change-Id: I0e05acc938ba581720de7f2277459a0b7490eae4 --- M rsrc/behavior-c3-chart.js A rsrc/sprintui-object-box.css M src/__phutil_library_map__.php M src/celerity/CeleritySprintResources.php M src/celerity/map.php A src/view/SprintUIObjectBoxView.php M src/view/burndown/BoardDataPieView.php M src/view/burndown/BurndownChartView.php M src/view/reports/OpenTasksView.php M src/view/reports/UserOpenTasksView.php 10 files changed, 403 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint refs/changes/15/207415/1 diff --git a/rsrc/behavior-c3-chart.js b/rsrc/behavior-c3-chart.js index a1daaee..0e6db1e 100644 --- a/rsrc/behavior-c3-chart.js +++ b/rsrc/behavior-c3-chart.js @@ -36,4 +36,3 @@ } }); }); - diff --git a/rsrc/sprintui-object-box.css b/rsrc/sprintui-object-box.css new file mode 100644 index 0000000..56cfd89 --- /dev/null +++ b/rsrc/sprintui-object-box.css @@ -0,0 +1,74 @@ +/** + * @provides sprintui-object-box-css + */ + +.sprintui-object-box { + position: relative; + overflow-x: scroll; + overflow-y:hidden; +} + +div.phui-object-box.phui-object-box-flush { + margin-top: 0; +} + +.phui-object-box .phui-header-shell { + padding: 4px 5px 4px 12px; +border-bottom: 1px solid {$lightblueborder}; +border-top: none; +} + +.phui-object-box .phui-header-image { + margin: 1px 8px -7px -7px; +} + +.phui-object-box .phui-header-shell h1 { + text-shadow: 0 1px #fff; + padding: 8px 0; +} + +.phui-object-box .phui-header-shell + .phui-info-view { + margin: 0; + border-width: 0; +border-bottom: 1px solid {$lightblueborder}; +} + +.device-phone .phui-object-box { + margin: 8px 8px 0 8px; +} + +.phui-box-border.phui-object-box-lightgreen { +border: 1px solid {$lightgreenborder}; +border-bottom: 1px solid {$greenborder}; +} + +.phui-box-border.phui-object-box-lightgreen .phui-action-header { +border-bottom: 1px solid {$lightgreenborder}; +} + +.phui-box-border.phui-object-box-lightblue { +border: 1px solid {$lightblueborder}; +border-bottom: 1px solid {$blueborder}; +} + +.phui-box-border.phui-object-box-lightblue .phui-action-header { +border-bottom: 1px solid {$lightblueborder}; +} + +.phui-box-border.phui-object-box-lightred { +border: 1px solid {$lightredborder}; +border-bottom: 1px solid {$redborder}; +} + +.phui-box-border.phui-object-box-lightred .phui-action-header { +border-bottom: 1px solid {$lightredborder}; +} + +.phui-box-border.phui-object-box-lightviolet { +border: 1px solid {$lightvioletborder}; +border-bottom: 1px solid {$violetborder}; +} + +.phui-box-border.phui-object-box-lightviolet .phui-action-header { +border-bottom: 1px solid {$lightvioletborder}; +} diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 0fd9367..aa783ce 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -68,6 +68,7 @@ 'SprintTableView' => 'view/SprintTableView.php', 'SprintTaskStoryPointsField' => 'customfield/SprintTaskStoryPointsField.php', 'SprintTestCase' => 'tests/SprintTestCase.php', + 'SprintUIObjectBoxView' => 'view/SprintUIObjectBoxView.php', 'SprintValidator' => 'util/SprintValidator.php', 'SprintView' => 'view/SprintView.php', 'TaskTableDataProvider' => 'storage/TaskTableDataProvider.php', @@ -125,6 +126,7 @@ 'PhabricatorStandardCustomFieldInterface', ), 'SprintTestCase' => 'PHPUnit_Framework_TestCase', + 'SprintUIObjectBoxView' => 'AphrontView', 'SprintView' => 'AphrontView', 'UserOpenTasksView' => 'OpenTasksView', ), diff --git a/src/celerity/CeleritySprintResources.php b/src/celerity/CeleritySprintResources.php index b448183..c885e42 100644 --- a/src/celerity/CeleritySprintResources.php +++ b/src/celerity/CeleritySprintResources.php @@ -25,4 +25,3 @@ } } - diff --git a/src/celerity/map.php b/src/celerity/map.php index ad3c084..5a4123a 100644 --- a/src/celerity/map.php +++ b/src/celerity/map.php @@ -14,19 +14,20 @@ 'behavior-events-table.js' => 'f202fb99', 'behavior-priority-pie.js' => 'f72c0144', 'behavior-sprint-boards.js' => 'b2754b95', - 'behavior-sprint-table.js' => '01ed4a30', + 'behavior-sprint-table.js' => '7fb99402', 'behavior-tasks-table.js' => '60d7b7fb', - 'c3.css' => 'cc484ff6', + 'c3.css' => '93642428', 'c3.js' => '1997878e', 'd3.min.js' => '97b28f9e', - 'dataTables.css' => '1239d5f5', + 'dataTables.css' => 'b74437b2', 'dataTables.tableTools.css' => '380aa862', 'dataTables.tableTools.js' => '69919d95', 'images/Screenshot-1.png' => '500c0ca0', 'jquery-1.11.2.js' => '75fa3fcc', 'jquery.dataTables.js' => 'faddf310', - 'phui-workboard-view.css' => '24307748', + 'phui-workboard-view.css' => '4f0fb320', 'sprint-report.css' => 'f6959ade', + 'sprintui-object-box.css' => '287505a8', 'webroot-static/copy_csv_xls.swf' => 'fcbb02cb', 'webroot-static/sort_asc.png' => '68adbacc', 'webroot-static/sort_both.png' => '9c425f1b', @@ -34,10 +35,10 @@ ), 'symbols' => array( 'c3' => '1997878e', - 'c3-css' => 'cc484ff6', + 'c3-css' => '93642428', 'd3' => '97b28f9e', 'dataTables' => 'faddf310', - 'dataTables-css' => '1239d5f5', + 'dataTables-css' => 'b74437b2', 'dataTables.tableTools' => '69919d95', 'javelin-behavior-burndown-report-chart' => '631b0017', 'javelin-behavior-c3-board-data-pie' => 'a1302bf1', @@ -46,11 +47,12 @@ 'javelin-behavior-events-table' => 'f202fb99', 'javelin-behavior-priority-pie' => 'f72c0144', 'javelin-behavior-sprint-boards' => 'b2754b95', - 'javelin-behavior-sprint-table' => '01ed4a30', + 'javelin-behavior-sprint-table' => '7fb99402', 'javelin-behavior-tasks-table' => '60d7b7fb', 'jquery' => '75fa3fcc', - 'phui-workboard-view-css' => '24307748', + 'phui-workboard-view-css' => '4f0fb320', 'sprint-report-css' => 'f6959ade', + 'sprintui-object-box-css' => '287505a8', 'tableTools-css' => '380aa862', ), 'requires' => array( diff --git a/src/view/SprintUIObjectBoxView.php b/src/view/SprintUIObjectBoxView.php new file mode 100644 index 0000000..824b185 --- /dev/null +++ b/src/view/SprintUIObjectBoxView.php @@ -0,0 +1,314 @@ +<?php + +final class SprintUIObjectBoxView extends AphrontView { + + private $headerText; + private $headerColor; + private $formErrors = null; + private $formSaved = false; + private $infoView; + private $form; + private $validationException; + private $header; + private $flush; + private $id; + private $sigils = array(); + private $metadata; + private $actionListID; + + private $tabs = array(); + private $propertyLists = array(); + + public function addSigil($sigil) { + $this->sigils[] = $sigil; + return $this; + } + + public function setMetadata(array $metadata) { + $this->metadata = $metadata; + return $this; + } + + public function addPropertyList( + PHUIPropertyListView $property_list, + $tab = null) { + + if (!($tab instanceof PHUIListItemView) && + ($tab !== null)) { + assert_stringlike($tab); + $tab = id(new PHUIListItemView())->setName($tab); + } + + if ($tab) { + if ($tab->getKey()) { + $key = $tab->getKey(); + } else { + $key = 'tab.default.'.spl_object_hash($tab); + $tab->setKey($key); + } + } else { + $key = 'tab.default'; + } + + if ($tab) { + if (empty($this->tabs[$key])) { + $tab->addSigil('phui-object-box-tab'); + $tab->setMetadata( + array( + 'tabKey' => $key, + )); + + if (!$tab->getHref()) { + $tab->setHref('#'); + } + + if (!$tab->getType()) { + $tab->setType(PHUIListItemView::TYPE_LINK); + } + + $this->tabs[$key] = $tab; + } + } + + $this->propertyLists[$key][] = $property_list; + + $action_list = $property_list->getActionList(); + if ($action_list) { + $this->actionListID = celerity_generate_unique_node_id(); + $action_list->setId($this->actionListID); + } + + return $this; + } + + public function setHeaderText($text) { + $this->headerText = $text; + return $this; + } + + public function setHeaderColor($color) { + $this->headerColor = $color; + return $this; + } + + public function setFormErrors(array $errors, $title = null) { + if ($errors) { + $this->formErrors = id(new PHUIInfoView()) + ->setTitle($title) + ->setErrors($errors); + } + return $this; + } + + public function setFormSaved($saved, $text = null) { + if (!$text) { + $text = pht('Changes saved.'); + } + if ($saved) { + $save = id(new PHUIInfoView()) + ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) + ->appendChild($text); + $this->formSaved = $save; + } + return $this; + } + + public function setInfoView(PHUIInfoView $view) { + $this->infoView = $view; + return $this; + } + + public function setForm($form) { + $this->form = $form; + return $this; + } + + public function setID($id) { + $this->id = $id; + return $this; + } + + public function setHeader($header) { + $this->header = $header; + return $this; + } + + public function setFlush($flush) { + $this->flush = $flush; + return $this; + } + + public function setValidationException( + PhabricatorApplicationTransactionValidationException $ex = null) { + $this->validationException = $ex; + return $this; + } + + public function render() { + + require_celerity_resource('sprintui-object-box-css', 'sprint'); + + if ($this->headerColor) { + $header_color = $this->headerColor; + } else { + $header_color = PHUIActionHeaderView::HEADER_LIGHTBLUE; + } + + if ($this->header) { + $header = $this->header; + $header->setHeaderColor($header_color); + } else { + $header = id(new PHUIHeaderView()) + ->setHeader($this->headerText) + ->setHeaderColor($header_color); + } + + if ($this->actionListID) { + $icon_id = celerity_generate_unique_node_id(); + $icon = id(new PHUIIconView()) + ->setIconFont('fa-bars'); + $meta = array( + 'map' => array( + $this->actionListID => 'phabricator-action-list-toggle', + $icon_id => 'phuix-dropdown-open', + ), + ); + $mobile_menu = id(new PHUIButtonView()) + ->setTag('a') + ->setText(pht('Actions')) + ->setHref('#') + ->setIcon($icon) + ->addClass('phui-mobile-menu') + ->setID($icon_id) + ->addSigil('jx-toggle-class') + ->setMetadata($meta); + $header->addActionLink($mobile_menu); + } + + $ex = $this->validationException; + $exception_errors = null; + if ($ex) { + $messages = array(); + foreach ($ex->getErrors() as $error) { + $messages[] = $error->getMessage(); + } + if ($messages) { + $exception_errors = id(new PHUIInfoView()) + ->setErrors($messages); + } + } + + $tab_lists = array(); + $property_lists = array(); + $tab_map = array(); + + $default_key = 'tab.default'; + + // Find the selected tab, or select the first tab if none are selected. + if ($this->tabs) { + $selected_tab = null; + foreach ($this->tabs as $key => $tab) { + if ($tab->getSelected()) { + $selected_tab = $key; + break; + } + } + if ($selected_tab === null) { + head($this->tabs)->setSelected(true); + $selected_tab = head_key($this->tabs); + } + } + + foreach ($this->propertyLists as $key => $list) { + $group = new PHUIPropertyGroupView(); + $i = 0; + foreach ($list as $item) { + $group->addPropertyList($item); + if ($i > 0) { + $item->addClass('phui-property-list-section-noninitial'); + } + $i++; + } + + if ($this->tabs && $key != $default_key) { + $tab_id = celerity_generate_unique_node_id(); + $tab_map[$key] = $tab_id; + + if ($key === $selected_tab) { + $style = null; + } else { + $style = 'display: none'; + } + + $tab_lists[] = phutil_tag( + 'div', + array( + 'style' => $style, + 'id' => $tab_id, + ), + $group); + } else { + if ($this->tabs) { + $group->addClass('phui-property-group-noninitial'); + } + $property_lists[] = $group; + } + } + + $tabs = null; + if ($this->tabs) { + $tabs = id(new PHUIListView()) + ->setType(PHUIListView::NAVBAR_LIST); + foreach ($this->tabs as $tab) { + $tabs->addMenuItem($tab); + } + + Javelin::initBehavior('phui-object-box-tabs'); + } + + $content = id(new PHUIBoxView()) + ->appendChild( + array( + $header, + $this->infoView, + $this->formErrors, + $this->formSaved, + $exception_errors, + $this->form, + $tabs, + $tab_lists, + $property_lists, + $this->renderChildren(), + )) + ->setBorder(true) + ->setID($this->id) + ->addMargin(PHUI::MARGIN_LARGE_TOP) + ->addMargin(PHUI::MARGIN_LARGE_LEFT) + ->addMargin(PHUI::MARGIN_LARGE_RIGHT) + ->addClass('sprintui-object-box'); + + if ($this->tabs) { + $content->addSigil('sprintui-object-box'); + $content->setMetadata( + array( + 'tabMap' => $tab_map, + )); + } + + if ($this->flush) { + $content->addClass('phui-object-box-flush'); + } + + $content->addClass('sprintui-object-box-'.$header_color); + + foreach ($this->sigils as $sigil) { + $content->addSigil($sigil); + } + + if ($this->metadata !== null) { + $content->setMetadata($this->metadata); + } + + return $content; + } +} diff --git a/src/view/burndown/BoardDataPieView.php b/src/view/burndown/BoardDataPieView.php index 3674893..ca1653a 100644 --- a/src/view/burndown/BoardDataPieView.php +++ b/src/view/burndown/BoardDataPieView.php @@ -33,7 +33,7 @@ margin-left: 900px;', ), pht('Task Priority')); - $box = id(new PHUIObjectBoxView()) + $box = id(new SprintUIObjectBoxView()) ->setHeaderText(pht('Points Allocation Report for '. $project_name)) ->appendChild($boardpie) diff --git a/src/view/burndown/BurndownChartView.php b/src/view/burndown/BurndownChartView.php index 149cf29..b6643b2 100644 --- a/src/view/burndown/BurndownChartView.php +++ b/src/view/burndown/BurndownChartView.php @@ -31,12 +31,11 @@ 'pointstoday' => $pointstoday, ), 'sprint'); - $chart = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Burndown for '.$project_name)) + $chart = id(new SprintUIObjectBoxView())->setHeaderText(pht('Burndown for '.$project_name)) ->appendChild(phutil_tag('div', array( 'id' => 'chart', - 'style' => 'width: 100%; height:450px', + 'style' => 'width: 100%; height:450px;', ), '')); return $chart; diff --git a/src/view/reports/OpenTasksView.php b/src/view/reports/OpenTasksView.php index e5d3f80..648566e 100644 --- a/src/view/reports/OpenTasksView.php +++ b/src/view/reports/OpenTasksView.php @@ -5,4 +5,3 @@ abstract public function execute($tasks, $recently_closed, $date); } - diff --git a/src/view/reports/UserOpenTasksView.php b/src/view/reports/UserOpenTasksView.php index 39017e1..b065d5c 100644 --- a/src/view/reports/UserOpenTasksView.php +++ b/src/view/reports/UserOpenTasksView.php @@ -20,4 +20,3 @@ return array ( $leftover, $leftover_closed, $base_link, $leftover_name, $col_header, $header, $result_closed, $result ); } } - -- To view, visit https://gerrit.wikimedia.org/r/207415 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0e05acc938ba581720de7f2277459a0b7490eae4 Gerrit-PatchSet: 1 Gerrit-Project: phabricator/extensions/Sprint Gerrit-Branch: master Gerrit-Owner: Christopher Johnson (WMDE) <christopher.john...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits