1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Move project color editing to "Edit Details" from "Edit Icon"

Summary: Fixes T5482. This isn't perfect but seems less confusing/ugly on the balance.

Test Plan:
  - Edited color under "Edit Details".
  - Edited icon under "Edit Icon".
  - No weird submit button state issue.
  - No weird alignmnet issue.

Reviewers: chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T5482

Differential Revision: https://secure.phabricator.com/D9742
This commit is contained in:
epriestley 2014-06-26 08:50:01 -07:00
parent 41adc1b4c3
commit c6a58b85c5
2 changed files with 20 additions and 26 deletions

View file

@ -47,6 +47,7 @@ final class PhabricatorProjectEditDetailsController
$v_primary_slug = $project->getPrimarySlug();
unset($project_slugs[$v_primary_slug]);
$v_slugs = $project_slugs;
$v_color = $project->getColor();
$validation_exception = null;
@ -59,6 +60,7 @@ final class PhabricatorProjectEditDetailsController
$v_view = $request->getStr('can_view');
$v_edit = $request->getStr('can_edit');
$v_join = $request->getStr('can_join');
$v_color = $request->getStr('color');
$xactions = $field_list->buildFieldTransactionsFromRequest(
new PhabricatorProjectTransaction(),
@ -67,6 +69,7 @@ final class PhabricatorProjectEditDetailsController
$type_name = PhabricatorProjectTransaction::TYPE_NAME;
$type_slugs = PhabricatorProjectTransaction::TYPE_SLUGS;
$type_edit = PhabricatorTransactions::TYPE_EDIT_POLICY;
$type_color = PhabricatorProjectTransaction::TYPE_COLOR;
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType($type_name)
@ -88,6 +91,10 @@ final class PhabricatorProjectEditDetailsController
->setTransactionType(PhabricatorTransactions::TYPE_JOIN_POLICY)
->setNewValue($v_join);
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType($type_color)
->setNewValue($v_color);
$editor = id(new PhabricatorProjectTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
@ -130,7 +137,19 @@ final class PhabricatorProjectEditDetailsController
->setError($e_name));
$field_list->appendFieldsToForm($form);
$shades = PHUITagView::getShadeMap();
$shades = array_select_keys(
$shades,
array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
unset($shades[PHUITagView::COLOR_DISABLED]);
$form
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Color'))
->setName('color')
->setValue($v_color)
->setOptions($shades))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Primary Hashtag'))

View file

@ -33,18 +33,12 @@ final class PhabricatorProjectEditIconController
$xactions = array();
$v_icon = $request->getStr('icon');
$v_icon_color = $request->getStr('color');
$type_icon = PhabricatorProjectTransaction::TYPE_ICON;
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType($type_icon)
->setNewValue($v_icon);
$type_icon_color = PhabricatorProjectTransaction::TYPE_COLOR;
$xactions[] = id(new PhabricatorProjectTransaction())
->setTransactionType($type_icon_color)
->setNewValue($v_icon_color);
$editor = id(new PhabricatorProjectTransactionEditor())
->setActor($viewer)
->setContentSourceFromRequest($request)
@ -56,20 +50,6 @@ final class PhabricatorProjectEditIconController
return id(new AphrontReloadResponse())->setURI($edit_uri);
}
$shades = PHUITagView::getShadeMap();
$shades = array_select_keys(
$shades,
array(PhabricatorProject::DEFAULT_COLOR)) + $shades;
unset($shades[PHUITagView::COLOR_DISABLED]);
$color_form = id(new AphrontFormView())
->appendChild(
id(new AphrontFormSelectControl())
->setLabel(pht('Color'))
->setName('color')
->setValue($project->getColor())
->setOptions($shades));
require_celerity_resource('project-icon-css');
Javelin::initBehavior('phabricator-tooltips');
@ -121,14 +101,9 @@ final class PhabricatorProjectEditIconController
),
$buttons);
$color_form->appendChild(
id(new AphrontFormMarkupControl())
->setLabel(pht('Icon'))
->setValue($buttons));
return $this->newDialog()
->setTitle(pht('Choose Project Icon'))
->appendChild($color_form->buildLayoutView())
->appendChild($buttons)
->addCancelButton($edit_uri);
}
}