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

Modernize Herald

Summary: Convert to responsive layout, pht, etc.

Test Plan: Test Herald on desktop and mobile.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5976
This commit is contained in:
Chad Little 2013-05-20 08:24:07 -07:00
parent 092020a7a6
commit c5e7222f9e
21 changed files with 299 additions and 281 deletions

View file

@ -204,7 +204,7 @@ final class HeraldCommitAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Great success at doing nothing.'); pht('Great success at doing nothing.'));
break; break;
case HeraldActionConfig::ACTION_EMAIL: case HeraldActionConfig::ACTION_EMAIL:
foreach ($effect->getTarget() as $phid) { foreach ($effect->getTarget() as $phid) {
@ -213,7 +213,7 @@ final class HeraldCommitAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Added address to email targets.'); pht('Added address to email targets.'));
break; break;
case HeraldActionConfig::ACTION_AUDIT: case HeraldActionConfig::ACTION_AUDIT:
foreach ($effect->getTarget() as $phid) { foreach ($effect->getTarget() as $phid) {
@ -225,7 +225,7 @@ final class HeraldCommitAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Triggered an audit.'); pht('Triggered an audit.'));
break; break;
case HeraldActionConfig::ACTION_FLAG: case HeraldActionConfig::ACTION_FLAG:
$result[] = parent::applyFlagEffect( $result[] = parent::applyFlagEffect(

View file

@ -217,12 +217,12 @@ final class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
$effect->setAction(HeraldActionConfig::ACTION_ADD_CC); $effect->setAction(HeraldActionConfig::ACTION_ADD_CC);
$effect->setTarget(array_keys($this->explicitCCs)); $effect->setTarget(array_keys($this->explicitCCs));
$effect->setReason( $effect->setReason(
'CCs provided explicitly by revision author or carried over from a '. pht('CCs provided explicitly by revision author or carried over '.
'previous version of the revision.'); 'from a previous version of the revision.'));
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Added addresses to CC list.'); pht('Added addresses to CC list.'));
} }
$forbidden_ccs = array_fill_keys( $forbidden_ccs = array_fill_keys(
@ -236,7 +236,7 @@ final class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'OK, did nothing.'); pht('OK, did nothing.'));
break; break;
case HeraldActionConfig::ACTION_FLAG: case HeraldActionConfig::ACTION_FLAG:
$result[] = parent::applyFlagEffect( $result[] = parent::applyFlagEffect(
@ -269,18 +269,18 @@ final class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Added these addresses to '.$op.' list. '. pht('Added these addresses to %s list. '.
'Others could not be added.'); 'Others could not be added.', $op));
} }
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$failed, $failed,
false, false,
$op.' forbidden, these addresses have unsubscribed.'); pht('%s forbidden, these addresses have unsubscribed.', $op));
} else { } else {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Added addresses to '.$op.' list.'); pht('Added addresses to %s list.', $op));
} }
break; break;
case HeraldActionConfig::ACTION_REMOVE_CC: case HeraldActionConfig::ACTION_REMOVE_CC:
@ -290,7 +290,7 @@ final class HeraldDifferentialRevisionAdapter extends HeraldObjectAdapter {
$result[] = new HeraldApplyTranscript( $result[] = new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Removed addresses from CC list.'); pht('Removed addresses from CC list.'));
break; break;
default: default:
throw new Exception("No rules to handle action '{$action}'."); throw new Exception("No rules to handle action '{$action}'.");

View file

@ -25,7 +25,7 @@ final class HeraldDryRunAdapter extends HeraldObjectAdapter {
$results[] = new HeraldApplyTranscript( $results[] = new HeraldApplyTranscript(
$effect, $effect,
false, false,
'This was a dry run, so no actions were actually taken.'); pht('This was a dry run, so no actions were actually taken.'));
} }
return $results; return $results;
} }

View file

@ -22,7 +22,7 @@ abstract class HeraldObjectAdapter {
return new HeraldApplyTranscript( return new HeraldApplyTranscript(
$effect, $effect,
false, false,
'Object already flagged.'); pht('Object already flagged.'));
} }
$handle = PhabricatorObjectHandleData::loadOneHandle( $handle = PhabricatorObjectHandleData::loadOneHandle(
@ -38,13 +38,14 @@ abstract class HeraldObjectAdapter {
$flag->setReasonPHID($user->getPHID()); $flag->setReasonPHID($user->getPHID());
$flag->setColor($color); $flag->setColor($color);
$flag->setNote('Flagged by Herald Rule "'.$rule->getName().'".'); $flag->setNote(
pht('Flagged by Herald Rule "%s".', $rule->getName()));
$flag->save(); $flag->save();
return new HeraldApplyTranscript( return new HeraldApplyTranscript(
$effect, $effect,
true, true,
'Added flag.'); pht('Added flag.'));
} }
} }

View file

@ -11,7 +11,7 @@ final class PhabricatorApplicationHerald extends PhabricatorApplication {
} }
public function getShortDescription() { public function getShortDescription() {
return 'Create Notification Rules'; return pht('Create Notification Rules');
} }
public function getTitleGlyph() { public function getTitleGlyph() {

View file

@ -11,26 +11,26 @@ final class HeraldActionConfig {
public static function getActionMessageMapForRuleType($rule_type) { public static function getActionMessageMapForRuleType($rule_type) {
$generic_mappings = array( $generic_mappings = array(
self::ACTION_NOTHING => 'Do nothing', self::ACTION_NOTHING => pht('Do nothing'),
self::ACTION_ADD_CC => 'Add emails to CC', self::ACTION_ADD_CC => pht('Add emails to CC'),
self::ACTION_REMOVE_CC => 'Remove emails from CC', self::ACTION_REMOVE_CC => pht('Remove emails from CC'),
self::ACTION_EMAIL => 'Send an email to', self::ACTION_EMAIL => pht('Send an email to'),
self::ACTION_AUDIT => 'Trigger an Audit', self::ACTION_AUDIT => pht('Trigger an Audit'),
self::ACTION_FLAG => 'Mark with flag', self::ACTION_FLAG => pht('Mark with flag'),
); );
switch ($rule_type) { switch ($rule_type) {
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
$specific_mappings = array( $specific_mappings = array(
self::ACTION_AUDIT => 'Trigger an Audit for project', self::ACTION_AUDIT => pht('Trigger an Audit for project'),
); );
break; break;
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
$specific_mappings = array( $specific_mappings = array(
self::ACTION_ADD_CC => 'CC me', self::ACTION_ADD_CC => pht('CC me'),
self::ACTION_REMOVE_CC => 'Remove me from CC', self::ACTION_REMOVE_CC => pht('Remove me from CC'),
self::ACTION_EMAIL => 'Email me', self::ACTION_EMAIL => pht('Email me'),
self::ACTION_AUDIT => 'Trigger an Audit by me', self::ACTION_AUDIT => pht('Trigger an Audit by me'),
); );
break; break;
case null: case null:

View file

@ -21,24 +21,24 @@ final class HeraldConditionConfig {
const CONDITION_REGEXP_PAIR = 'regexp-pair'; const CONDITION_REGEXP_PAIR = 'regexp-pair';
public static function getConditionMap() { public static function getConditionMap() {
static $map = array( $map = array(
self::CONDITION_CONTAINS => 'contains', self::CONDITION_CONTAINS => pht('contains'),
self::CONDITION_NOT_CONTAINS => 'does not contain', self::CONDITION_NOT_CONTAINS => pht('does not contain'),
self::CONDITION_IS => 'is', self::CONDITION_IS => pht('is'),
self::CONDITION_IS_NOT => 'is not', self::CONDITION_IS_NOT => pht('is not'),
self::CONDITION_IS_ANY => 'is any of', self::CONDITION_IS_ANY => pht('is any of'),
self::CONDITION_IS_NOT_ANY => 'is not any of', self::CONDITION_IS_NOT_ANY => pht('is not any of'),
self::CONDITION_INCLUDE_ALL => 'include all of', self::CONDITION_INCLUDE_ALL => pht('include all of'),
self::CONDITION_INCLUDE_ANY => 'include any of', self::CONDITION_INCLUDE_ANY => pht('include any of'),
self::CONDITION_INCLUDE_NONE => 'include none of', self::CONDITION_INCLUDE_NONE => pht('include none of'),
self::CONDITION_IS_ME => 'is myself', self::CONDITION_IS_ME => pht('is myself'),
self::CONDITION_IS_NOT_ME => 'is not myself', self::CONDITION_IS_NOT_ME => pht('is not myself'),
self::CONDITION_REGEXP => 'matches regexp', self::CONDITION_REGEXP => pht('matches regexp'),
self::CONDITION_RULE => 'matches:', self::CONDITION_RULE => pht('matches:'),
self::CONDITION_NOT_RULE => 'does not match:', self::CONDITION_NOT_RULE => pht('does not match:'),
self::CONDITION_EXISTS => 'exists', self::CONDITION_EXISTS => pht('exists'),
self::CONDITION_NOT_EXISTS => 'does not exist', self::CONDITION_NOT_EXISTS => pht('does not exist'),
self::CONDITION_REGEXP_PAIR => 'matches regexp pair', self::CONDITION_REGEXP_PAIR => pht('matches regexp pair'),
); );
return $map; return $map;

View file

@ -8,9 +8,9 @@ final class HeraldContentTypeConfig {
const CONTENT_TYPE_OWNERS = 'owners'; const CONTENT_TYPE_OWNERS = 'owners';
public static function getContentTypeMap() { public static function getContentTypeMap() {
static $map = array( $map = array(
self::CONTENT_TYPE_DIFFERENTIAL => 'Differential Revisions', self::CONTENT_TYPE_DIFFERENTIAL => pht('Differential Revisions'),
self::CONTENT_TYPE_COMMIT => 'Commits', self::CONTENT_TYPE_COMMIT => pht('Commits'),
/* TODO: Deal with this /* TODO: Deal with this
self::CONTENT_TYPE_MERGE => 'Merge Requests', self::CONTENT_TYPE_MERGE => 'Merge Requests',
self::CONTENT_TYPE_OWNERS => 'Owners Changes', self::CONTENT_TYPE_OWNERS => 'Owners Changes',

View file

@ -22,26 +22,27 @@ final class HeraldFieldConfig {
const FIELD_MERGE_REQUESTER = 'merge-requester'; const FIELD_MERGE_REQUESTER = 'merge-requester';
public static function getFieldMap() { public static function getFieldMap() {
static $map = array( $map = array(
self::FIELD_TITLE => 'Title', self::FIELD_TITLE => pht('Title'),
self::FIELD_BODY => 'Body', self::FIELD_BODY => pht('Body'),
self::FIELD_AUTHOR => 'Author', self::FIELD_AUTHOR => pht('Author'),
self::FIELD_REVIEWER => 'Reviewer', self::FIELD_REVIEWER => pht('Reviewer'),
self::FIELD_REVIEWERS => 'Reviewers', self::FIELD_REVIEWERS => pht('Reviewers'),
self::FIELD_CC => 'CCs', self::FIELD_CC => pht('CCs'),
self::FIELD_TAGS => 'Tags', self::FIELD_TAGS => pht('Tags'),
self::FIELD_DIFF_FILE => 'Any changed filename', self::FIELD_DIFF_FILE => pht('Any changed filename'),
self::FIELD_DIFF_CONTENT => 'Any changed file content', self::FIELD_DIFF_CONTENT => pht('Any changed file content'),
self::FIELD_REPOSITORY => 'Repository', self::FIELD_REPOSITORY => pht('Repository'),
self::FIELD_RULE => 'Another Herald rule', self::FIELD_RULE => pht('Another Herald rule'),
self::FIELD_AFFECTED_PACKAGE => 'Any affected package', self::FIELD_AFFECTED_PACKAGE => pht('Any affected package'),
self::FIELD_AFFECTED_PACKAGE_OWNER => "Any affected package's owner", self::FIELD_AFFECTED_PACKAGE_OWNER =>
pht("Any affected package's owner"),
self::FIELD_NEED_AUDIT_FOR_PACKAGE => self::FIELD_NEED_AUDIT_FOR_PACKAGE =>
'Affected packages that need audit', pht('Affected packages that need audit'),
self::FIELD_DIFFERENTIAL_REVISION => 'Differential revision', self::FIELD_DIFFERENTIAL_REVISION => pht('Differential revision'),
self::FIELD_DIFFERENTIAL_REVIEWERS => 'Differential reviewers', self::FIELD_DIFFERENTIAL_REVIEWERS => pht('Differential reviewers'),
self::FIELD_DIFFERENTIAL_CCS => 'Differential CCs', self::FIELD_DIFFERENTIAL_CCS => pht('Differential CCs'),
self::FIELD_MERGE_REQUESTER => 'Merge requester' self::FIELD_MERGE_REQUESTER => pht('Merge requester')
); );
return $map; return $map;

View file

@ -6,9 +6,9 @@ final class HeraldRuleTypeConfig {
const RULE_TYPE_PERSONAL = 'personal'; const RULE_TYPE_PERSONAL = 'personal';
public static function getRuleTypeMap() { public static function getRuleTypeMap() {
static $map = array( $map = array(
self::RULE_TYPE_GLOBAL => 'Global', self::RULE_TYPE_GLOBAL => pht('Global'),
self::RULE_TYPE_PERSONAL => 'Personal', self::RULE_TYPE_PERSONAL => pht('Personal'),
); );
return $map; return $map;
} }

View file

@ -5,7 +5,7 @@ abstract class HeraldController extends PhabricatorController {
public function buildStandardPageResponse($view, array $data) { public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView(); $page = $this->buildStandardPageView();
$page->setApplicationName('Herald'); $page->setApplicationName(pht('Herald'));
$page->setBaseURI('/herald/'); $page->setBaseURI('/herald/');
$page->setTitle(idx($data, 'title')); $page->setTitle(idx($data, 'title'));
$page->setGlyph("\xE2\x98\xBF"); $page->setGlyph("\xE2\x98\xBF");
@ -16,31 +16,47 @@ abstract class HeraldController extends PhabricatorController {
return $response->setContent($page->render()); return $response->setContent($page->render());
} }
public function buildApplicationMenu() {
return $this->renderNav()->getMenu();
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addAction(
id(new PhabricatorMenuItemView())
->setName(pht('Create Herald Rule'))
->setHref($this->getApplicationURI('new/'))
->setIcon('create'));
return $crumbs;
}
protected function renderNav() { protected function renderNav() {
$nav = id(new AphrontSideNavFilterView()) $nav = id(new AphrontSideNavFilterView())
->setBaseURI(new PhutilURI('/herald/')) ->setBaseURI(new PhutilURI('/herald/'))
->addLabel('My Rules') ->addLabel(pht('My Rules'))
->addFilter('new', 'Create Rule'); ->addFilter('new', pht('Create Rule'));
$rules_map = HeraldContentTypeConfig::getContentTypeMap(); $rules_map = HeraldContentTypeConfig::getContentTypeMap();
foreach ($rules_map as $key => $value) { foreach ($rules_map as $key => $value) {
$nav->addFilter("view/{$key}/personal", $value); $nav->addFilter("view/{$key}/personal", $value);
} }
$nav->addLabel('Global Rules'); $nav->addLabel(pht('Global Rules'));
foreach ($rules_map as $key => $value) { foreach ($rules_map as $key => $value) {
$nav->addFilter("view/{$key}/global", $value); $nav->addFilter("view/{$key}/global", $value);
} }
$nav $nav
->addLabel('Utilities') ->addLabel(pht('Utilities'))
->addFilter('test', 'Test Console') ->addFilter('test', pht('Test Console'))
->addFilter('transcript', 'Transcripts') ->addFilter('transcript', pht('Transcripts'))
->addFilter('history', 'Edit Log'); ->addFilter('history', pht('Edit Log'));
if ($this->getRequest()->getUser()->getIsAdmin()) { if ($this->getRequest()->getUser()->getIsAdmin()) {
$nav->addLabel('Admin'); $nav->addLabel(pht('Admin'));
foreach ($rules_map as $key => $value) { foreach ($rules_map as $key => $value) {
$nav->addFilter("view/{$key}/all", $value); $nav->addFilter("view/{$key}/all", $value);
} }

View file

@ -42,11 +42,12 @@ final class HeraldDeleteController extends HeraldController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($request->getUser()); $dialog->setUser($request->getUser());
$dialog->setTitle('Really delete this rule?'); $dialog->setTitle(pht('Really delete this rule?'));
$dialog->appendChild(hsprintf( $dialog->setHeaderColor(PhabricatorActionHeaderView::HEADER_RED);
"Are you sure you want to delete the rule '<strong>%s</strong>'?", $dialog->appendChild(pht(
"Are you sure you want to delete the rule: %s?",
$rule->getName())); $rule->getName()));
$dialog->addSubmitButton('Delete'); $dialog->addSubmitButton(pht('Delete'));
$dialog->addCancelButton('/herald/'); $dialog->addCancelButton('/herald/');
$dialog->setSubmitURI($request->getPath()); $dialog->setSubmitURI($request->getPath());

View file

@ -36,10 +36,8 @@ final class HeraldHomeController extends HeraldController {
$query->withContentTypes(array($this->contentType)); $query->withContentTypes(array($this->contentType));
$is_admin_page = false;
$show_author = false; $show_author = false;
$show_rule_type = false; $show_rule_type = false;
$can_create = false;
$has_author_filter = false; $has_author_filter = false;
$author_filter_phid = null; $author_filter_phid = null;
@ -48,7 +46,6 @@ final class HeraldHomeController extends HeraldController {
if (!$user->getIsAdmin()) { if (!$user->getIsAdmin()) {
return new Aphront400Response(); return new Aphront400Response();
} }
$is_admin_page = true;
$show_rule_type = true; $show_rule_type = true;
$show_author = true; $show_author = true;
$has_author_filter = true; $has_author_filter = true;
@ -56,20 +53,18 @@ final class HeraldHomeController extends HeraldController {
if ($author_filter_phid) { if ($author_filter_phid) {
$query->withAuthorPHIDs(array($author_filter_phid)); $query->withAuthorPHIDs(array($author_filter_phid));
} }
$rule_desc = 'All'; $rule_desc = pht('All');
break; break;
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL: case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
$query->withRuleTypes(array(HeraldRuleTypeConfig::RULE_TYPE_GLOBAL)); $query->withRuleTypes(array(HeraldRuleTypeConfig::RULE_TYPE_GLOBAL));
$can_create = true; $rule_desc = pht('Global');
$rule_desc = 'Global';
break; break;
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL: case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
default: default:
$this->ruleType = HeraldRuleTypeConfig::RULE_TYPE_PERSONAL; $this->ruleType = HeraldRuleTypeConfig::RULE_TYPE_PERSONAL;
$query->withRuleTypes(array(HeraldRuleTypeConfig::RULE_TYPE_PERSONAL)); $query->withRuleTypes(array(HeraldRuleTypeConfig::RULE_TYPE_PERSONAL));
$query->withAuthorPHIDs(array($user->getPHID())); $query->withAuthorPHIDs(array($user->getPHID()));
$can_create = true; $rule_desc = pht('Personal');
$rule_desc = 'Personal';
break; break;
} }
@ -94,19 +89,16 @@ final class HeraldHomeController extends HeraldController {
$panel->appendChild($pager); $panel->appendChild($pager);
$panel->setNoBackground(); $panel->setNoBackground();
$panel->setHeader("Herald: {$rule_desc} Rules for {$content_desc}"); $panel->setHeader(
pht("Herald: %s Rules for %s", $rule_desc, $content_desc));
if ($can_create) {
$panel->addButton(
phutil_tag(
'a',
array(
'href' => '/herald/new/'.$this->contentType.'/'.$this->ruleType.'/',
'class' => 'green button',
),
'Create New Herald Rule'));
}
$crumbs = $this
->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Herald Rules'))
->setHref($this->getApplicationURI(
'view/'.$this->contentType.'/'.$this->ruleType)));
$nav = $this->renderNav(); $nav = $this->renderNav();
$nav->selectFilter('view/'.$this->contentType.'/'.$this->ruleType); $nav->selectFilter('view/'.$this->contentType.'/'.$this->ruleType);
@ -116,12 +108,14 @@ final class HeraldHomeController extends HeraldController {
} }
$nav->appendChild($panel); $nav->appendChild($panel);
$nav->setCrumbs($crumbs);
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$nav, $nav,
array( array(
'title' => 'Herald', 'title' => pht('Herald'),
'admin' => $is_admin_page, 'dust' => true,
'device' => true,
)); ));
} }
@ -140,16 +134,17 @@ final class HeraldHomeController extends HeraldController {
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
->setNoShading(true)
->appendChild( ->appendChild(
id(new AphrontFormTokenizerControl()) id(new AphrontFormTokenizerControl())
->setName('set_phid') ->setName('set_phid')
->setValue($tokens) ->setValue($tokens)
->setLimit(1) ->setLimit(1)
->setLabel('Filter Author') ->setLabel(pht('Filter Author'))
->setDataSource('/typeahead/common/accounts/')) ->setDataSource('/typeahead/common/accounts/'))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Apply Filter')); ->setValue(pht('Apply Filter')));
$filter = new AphrontListFilterView(); $filter = new AphrontListFilterView();
$filter->appendChild($form); $filter->appendChild($form);

View file

@ -34,16 +34,16 @@ final class HeraldNewController extends HeraldController {
$captions = array( $captions = array(
HeraldRuleTypeConfig::RULE_TYPE_PERSONAL => HeraldRuleTypeConfig::RULE_TYPE_PERSONAL =>
'Personal rules notify you about events. You own them, but they can '. pht('Personal rules notify you about events. You own them, but '.
'only affect you.', 'they can only affect you.'),
HeraldRuleTypeConfig::RULE_TYPE_GLOBAL => HeraldRuleTypeConfig::RULE_TYPE_GLOBAL =>
'Global rules notify anyone about events. No one owns them, and '. pht('Global rules notify anyone about events. No one owns them, and '.
'anyone can edit them. Usually, Global rules are used to notify '. 'anyone can edit them. Usually, Global rules are used to notify '.
'mailing lists.', 'mailing lists.'),
); );
$radio = id(new AphrontFormRadioButtonControl()) $radio = id(new AphrontFormRadioButtonControl())
->setLabel('Type') ->setLabel(pht('Type'))
->setName('rule_type') ->setName('rule_type')
->setValue($this->ruleType); ->setValue($this->ruleType);
@ -70,13 +70,18 @@ final class HeraldNewController extends HeraldController {
->setValue(pht('Create Rule')) ->setValue(pht('Create Rule'))
->addCancelButton('/herald/view/'.$this->contentType.'/')); ->addCancelButton('/herald/view/'.$this->contentType.'/'));
$header = new PhabricatorHeaderView(); $crumbs = $this
$header->setHeader(pht('Create New Herald Rule')); ->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Create Herald Rule'))
->setHref($this->getApplicationURI(
'view/'.$this->contentType.'/'.$this->ruleType)));
$nav = $this->renderNav(); $nav = $this->renderNav();
$nav->selectFilter('new'); $nav->selectFilter('new');
$nav->appendChild($header);
$nav->appendChild($form); $nav->appendChild($form);
$nav->setCrumbs($crumbs);
return $this->buildApplicationPage( return $this->buildApplicationPage(
$nav, $nav,

View file

@ -75,7 +75,7 @@ final class HeraldRuleController extends HeraldController {
if ($errors) { if ($errors) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors'); $error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors); $error_view->setErrors($errors);
} else { } else {
$error_view = null; $error_view = null;
@ -109,7 +109,7 @@ final class HeraldRuleController extends HeraldController {
))) )))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Rule Name') ->setLabel(pht('Rule Name'))
->setName('name') ->setName('name')
->setError($e_name) ->setError($e_name)
->setValue($rule->getName())); ->setValue($rule->getName()));
@ -117,13 +117,13 @@ final class HeraldRuleController extends HeraldController {
$form $form
->appendChild( ->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setValue(hsprintf( ->setValue(pht(
"This <strong>%s</strong> rule triggers for <strong>%s</strong>.", "This %s rule triggers for %s.",
$rule_type_name, phutil_tag('strong', array(), $rule_type_name),
$content_type_name))) phutil_tag('strong', array(), $content_type_name))))
->appendChild( ->appendChild(
id(new AphrontFormInsetView()) id(new AphrontFormInsetView())
->setTitle('Conditions') ->setTitle(pht('Conditions'))
->setRightButton(javelin_tag( ->setRightButton(javelin_tag(
'a', 'a',
array( array(
@ -132,9 +132,9 @@ final class HeraldRuleController extends HeraldController {
'sigil' => 'create-condition', 'sigil' => 'create-condition',
'mustcapture' => true 'mustcapture' => true
), ),
'Create New Condition')) pht('New Condition')))
->setDescription( ->setDescription(
hsprintf('When %s these conditions are met:', $must_match_selector)) pht('When %s these conditions are met:', $must_match_selector))
->setContent(javelin_tag( ->setContent(javelin_tag(
'table', 'table',
array( array(
@ -144,7 +144,7 @@ final class HeraldRuleController extends HeraldController {
''))) '')))
->appendChild( ->appendChild(
id(new AphrontFormInsetView()) id(new AphrontFormInsetView())
->setTitle('Action') ->setTitle(pht('Action'))
->setRightButton(javelin_tag( ->setRightButton(javelin_tag(
'a', 'a',
array( array(
@ -153,8 +153,8 @@ final class HeraldRuleController extends HeraldController {
'sigil' => 'create-action', 'sigil' => 'create-action',
'mustcapture' => true, 'mustcapture' => true,
), ),
'Create New Action')) pht('New Action')))
->setDescription(hsprintf( ->setDescription(pht(
'Take these actions %s this rule matches:', 'Take these actions %s this rule matches:',
$repetition_selector)) $repetition_selector))
->setContent(javelin_tag( ->setContent(javelin_tag(
@ -166,24 +166,29 @@ final class HeraldRuleController extends HeraldController {
''))) '')))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save Rule') ->setValue(pht('Save Rule'))
->addCancelButton('/herald/view/'.$rule->getContentType().'/')); ->addCancelButton('/herald/view/'.$rule->getContentType().'/'));
$this->setupEditorBehavior($rule, $handles); $this->setupEditorBehavior($rule, $handles);
$header = new PhabricatorHeaderView(); $title = $rule->getID()
$header->setHeader(
$rule->getID()
? pht('Edit Herald Rule') ? pht('Edit Herald Rule')
: pht('Create Herald Rule')); : pht('Create Herald Rule');
$crumbs = $this
->buildApplicationCrumbs()
->addCrumb(
id(new PhabricatorCrumbView())
->setName($title)
->setHref('#'));
$nav = $this->renderNav(); $nav = $this->renderNav();
$nav->setCrumbs($crumbs);
$nav->selectFilter( $nav->selectFilter(
'view/'.$rule->getContentType().'/'.$rule->getRuleType()); 'view/'.$rule->getContentType().'/'.$rule->getRuleType());
$nav->appendChild( $nav->appendChild(
array( array(
$error_view, $error_view,
$header,
$form, $form,
)); ));
@ -191,6 +196,8 @@ final class HeraldRuleController extends HeraldController {
$nav, $nav,
array( array(
'title' => pht('Edit Rule'), 'title' => pht('Edit Rule'),
'dust' => true,
'device' => true,
)); ));
} }
@ -213,8 +220,8 @@ final class HeraldRuleController extends HeraldController {
$errors = array(); $errors = array();
if (!strlen($rule->getName())) { if (!strlen($rule->getName())) {
$e_name = "Required"; $e_name = pht("Required");
$errors[] = "Rule must have a name."; $errors[] = pht("Rule must have a name.");
} }
$data = json_decode($request->getStr('rule'), true); $data = json_decode($request->getStr('rule'), true);
@ -247,10 +254,10 @@ final class HeraldRuleController extends HeraldController {
if ($cond_type == HeraldConditionConfig::CONDITION_REGEXP) { if ($cond_type == HeraldConditionConfig::CONDITION_REGEXP) {
if (@preg_match($obj->getValue(), '') === false) { if (@preg_match($obj->getValue(), '') === false) {
$errors[] = $errors[] =
'The regular expression "'.$obj->getValue().'" is not valid. '. pht('The regular expression "%s" is not valid. '.
'Regular expressions must have enclosing characters (e.g. '. 'Regular expressions must have enclosing characters (e.g. '.
'"@/path/to/file@", not "/path/to/file") and be syntactically '. '"@/path/to/file@", not "/path/to/file") and be syntactically '.
'correct.'; 'correct.', $obj->getValue());
} }
} }
@ -258,26 +265,27 @@ final class HeraldRuleController extends HeraldController {
$json = json_decode($obj->getValue(), true); $json = json_decode($obj->getValue(), true);
if (!is_array($json)) { if (!is_array($json)) {
$errors[] = $errors[] =
'The regular expression pair "'.$obj->getValue().'" is not '. pht('The regular expression pair "%s" is not '.
'valid JSON. Enter a valid JSON array with two elements.'; 'valid JSON. Enter a valid JSON array with two elements.',
$obj->getValue());
} else { } else {
if (count($json) != 2) { if (count($json) != 2) {
$errors[] = $errors[] =
'The regular expression pair "'.$obj->getValue().'" must have '. pht('The regular expression pair "%s" must have '.
'exactly two elements.'; 'exactly two elements.', $obj->getValue());
} else { } else {
$key_regexp = array_shift($json); $key_regexp = array_shift($json);
$val_regexp = array_shift($json); $val_regexp = array_shift($json);
if (@preg_match($key_regexp, '') === false) { if (@preg_match($key_regexp, '') === false) {
$errors[] = $errors[] =
'The first regexp, "'.$key_regexp.'" in the regexp pair '. pht('The first regexp, "%s" in the regexp pair '.
'is not a valid regexp.'; 'is not a valid regexp.', $key_regexp);
} }
if (@preg_match($val_regexp, '') === false) { if (@preg_match($val_regexp, '') === false) {
$errors[] = $errors[] =
'The second regexp, "'.$val_regexp.'" in the regexp pair '. pht('The second regexp, "%s" in the regexp pair '.
'is not a valid regexp.'; 'is not a valid regexp.', $val_regexp);
} }
} }
} }
@ -320,8 +328,8 @@ final class HeraldRuleController extends HeraldController {
$rule->saveTransaction(); $rule->saveTransaction();
} catch (AphrontQueryDuplicateKeyException $ex) { } catch (AphrontQueryDuplicateKeyException $ex) {
$e_name = "Not Unique"; $e_name = pht("Not Unique");
$errors[] = "Rule name is not unique. Choose a unique name."; $errors[] = pht("Rule name is not unique. Choose a unique name.");
} }
} }
@ -469,8 +477,8 @@ final class HeraldRuleController extends HeraldController {
return AphrontFormSelectControl::renderSelectTag( return AphrontFormSelectControl::renderSelectTag(
$rule->getMustMatchAll() ? 'all' : 'any', $rule->getMustMatchAll() ? 'all' : 'any',
array( array(
'all' => 'all of', 'all' => pht('all of'),
'any' => 'any of', 'any' => pht('any of'),
), ),
array( array(
'name' => 'must_match', 'name' => 'must_match',

View file

@ -35,14 +35,24 @@ final class HeraldRuleEditHistoryController extends HeraldController {
$panel->appendChild($list_view); $panel->appendChild($list_view);
$panel->setNoBackground(); $panel->setNoBackground();
$crumbs = $this
->buildApplicationCrumbs($can_create = false)
->addCrumb(
id(new PhabricatorCrumbView())
->setName(pht('Edit History'))
->setHref($this->getApplicationURI('herald/history')));
$nav = $this->renderNav(); $nav = $this->renderNav();
$nav->selectFilter('history'); $nav->selectFilter('history');
$nav->appendChild($panel); $nav->appendChild($panel);
$nav->setCrumbs($crumbs);
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$nav, $nav,
array( array(
'title' => 'Rule Edit History', 'title' => pht('Rule Edit History'),
'device' => true,
'dust' => true,
)); ));
} }

View file

@ -15,8 +15,8 @@ final class HeraldTestConsoleController extends HeraldController {
$errors = array(); $errors = array();
if ($request->isFormPost()) { if ($request->isFormPost()) {
if (!$object_name) { if (!$object_name) {
$e_name = 'Required'; $e_name = pht('Required');
$errors[] = 'An object name is required.'; $errors[] = pht('An object name is required.');
} }
if (!$errors) { if (!$errors) {
@ -25,30 +25,30 @@ final class HeraldTestConsoleController extends HeraldController {
if (preg_match('/^D(\d+)$/', $object_name, $matches)) { if (preg_match('/^D(\d+)$/', $object_name, $matches)) {
$object = id(new DifferentialRevision())->load($matches[1]); $object = id(new DifferentialRevision())->load($matches[1]);
if (!$object) { if (!$object) {
$e_name = 'Invalid'; $e_name = pht('Invalid');
$errors[] = 'No Differential Revision with that ID exists.'; $errors[] = pht('No Differential Revision with that ID exists.');
} }
} else if (preg_match('/^r([A-Z]+)(\w+)$/', $object_name, $matches)) { } else if (preg_match('/^r([A-Z]+)(\w+)$/', $object_name, $matches)) {
$repo = id(new PhabricatorRepository())->loadOneWhere( $repo = id(new PhabricatorRepository())->loadOneWhere(
'callsign = %s', 'callsign = %s',
$matches[1]); $matches[1]);
if (!$repo) { if (!$repo) {
$e_name = 'Invalid'; $e_name = pht('Invalid');
$errors[] = 'There is no repository with the callsign '. $errors[] = pht('There is no repository with the callsign: %s.',
$matches[1].'.'; $matches[1]);
} }
$commit = id(new PhabricatorRepositoryCommit())->loadOneWhere( $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
'repositoryID = %d AND commitIdentifier = %s', 'repositoryID = %d AND commitIdentifier = %s',
$repo->getID(), $repo->getID(),
$matches[2]); $matches[2]);
if (!$commit) { if (!$commit) {
$e_name = 'Invalid'; $e_name = pht('Invalid');
$errors[] = 'There is no commit with that identifier.'; $errors[] = pht('There is no commit with that identifier.');
} }
$object = $commit; $object = $commit;
} else { } else {
$e_name = 'Invalid'; $e_name = pht('Invalid');
$errors[] = 'This object name is not recognized.'; $errors[] = pht('This object name is not recognized.');
} }
if (!$errors) { if (!$errors) {
@ -88,19 +88,21 @@ final class HeraldTestConsoleController extends HeraldController {
if ($errors) { if ($errors) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors'); $error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors); $error_view->setErrors($errors);
} else { } else {
$error_view = null; $error_view = null;
} }
$text = pht('Enter an object to test rules '.
'for, like a Diffusion commit (e.g., rX123) or a '.
'Differential revision (e.g., D123). You will be shown the '.
'results of a dry run on the object.');
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">Enter an object to test rules '. '<p class="aphront-form-instructions">%s</p>', $text))
'for, like a Diffusion commit (e.g., <tt>rX123</tt>) or a '.
'Differential revision (e.g., <tt>D123</tt>). You will be shown the '.
'results of a dry run on the object.</p>'))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel(pht('Object Name')) ->setLabel(pht('Object Name'))

View file

@ -34,11 +34,11 @@ final class HeraldTranscriptController extends HeraldController {
if (!$object_xscript) { if (!$object_xscript) {
$notice = id(new AphrontErrorView()) $notice = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle('Old Transcript') ->setTitle(pht('Old Transcript'))
->appendChild(phutil_tag( ->appendChild(phutil_tag(
'p', 'p',
array(), array(),
'Details of this transcript have been garbage collected.')); pht('Details of this transcript have been garbage collected.')));
$nav->appendChild($notice); $nav->appendChild($notice);
} else { } else {
$filter = $this->getFilterPHIDs(); $filter = $this->getFilterPHIDs();
@ -53,9 +53,9 @@ final class HeraldTranscriptController extends HeraldController {
if ($xscript->getDryRun()) { if ($xscript->getDryRun()) {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Dry Run'); $notice->setTitle(pht('Dry Run'));
$notice->appendChild( $notice->appendChild(pht('This was a dry run to test Herald '.
'This was a dry run to test Herald rules, no actions were executed.'); 'rules, no actions were executed.'));
$nav->appendChild($notice); $nav->appendChild($notice);
} }
@ -82,10 +82,12 @@ final class HeraldTranscriptController extends HeraldController {
->setName($xscript->getID())); ->setName($xscript->getID()));
$nav->setCrumbs($crumbs); $nav->setCrumbs($crumbs);
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$nav, $nav,
array( array(
'title' => 'Transcript', 'title' => pht('Transcript'),
'device' => true,
'dust' => true,
)); ));
} }
@ -127,9 +129,9 @@ final class HeraldTranscriptController extends HeraldController {
protected function getFilterMap() { protected function getFilterMap() {
return array( return array(
self::FILTER_AFFECTED => 'Rules that Affected Me', self::FILTER_AFFECTED => pht('Rules that Affected Me'),
self::FILTER_OWNED => 'Rules I Own', self::FILTER_OWNED => pht('Rules I Own'),
self::FILTER_ALL => 'All Rules', self::FILTER_ALL => pht('All Rules'),
); );
} }
@ -295,9 +297,13 @@ final class HeraldTranscriptController extends HeraldController {
} }
if ($apply_xscript->getApplied()) { if ($apply_xscript->getApplied()) {
$outcome = hsprintf('<span class="outcome-success">SUCCESS</span>'); $success = pht('SUCCESS');
$outcome =
hsprintf('<span class="outcome-success">%s</span>', $success);
} else { } else {
$outcome = hsprintf('<span class="outcome-failure">FAILURE</span>'); $failure = pht('FAILURE');
$outcome =
hsprintf('<span class="outcome-failure">%s</span>', $failure);
} }
$rows[] = array( $rows[] = array(
@ -313,12 +319,12 @@ final class HeraldTranscriptController extends HeraldController {
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setNoDataString('No actions were taken.'); $table->setNoDataString(pht('No actions were taken.'));
$table->setHeaders( $table->setHeaders(
array( array(
'Action', pht('Action'),
'Target', pht('Target'),
'Details', pht('Details'),
)); ));
$table->setColumnClasses( $table->setColumnClasses(
array( array(
@ -370,7 +376,7 @@ final class HeraldTranscriptController extends HeraldController {
$cond_markup[] = phutil_tag( $cond_markup[] = phutil_tag(
'li', 'li',
array(), array(),
hsprintf( pht(
'%s Condition: %s %s %s%s', '%s Condition: %s %s %s%s',
$result, $result,
$field_names[$cond->getFieldName()], $field_names[$cond->getFieldName()],
@ -380,12 +386,14 @@ final class HeraldTranscriptController extends HeraldController {
} }
if ($rule->getResult()) { if ($rule->getResult()) {
$pass = pht('PASS');
$result = hsprintf( $result = hsprintf(
'<span class="herald-outcome rule-pass">PASS</span>'); '<span class="herald-outcome rule-pass">%s</span>', $pass);
$class = 'herald-rule-pass'; $class = 'herald-rule-pass';
} else { } else {
$fail = pht('FAIL');
$result = hsprintf( $result = hsprintf(
'<span class="herald-outcome rule-fail">FAIL</span>'); '<span class="herald-outcome rule-fail">%s</span>', $fail);
$class = 'herald-rule-fail'; $class = 'herald-rule-fail';
} }
@ -435,13 +443,16 @@ final class HeraldTranscriptController extends HeraldController {
phutil_tag('ul', array(), $cond_markup))); phutil_tag('ul', array(), $cond_markup)));
} }
$panel = '';
if ($rule_markup) {
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Rule Details'); $panel->setHeader(pht('Rule Details'));
$panel->setNoBackground();
$panel->appendChild(phutil_tag( $panel->appendChild(phutil_tag(
'ul', 'ul',
array('class' => 'herald-explain-list'), array('class' => 'herald-explain-list'),
$rule_markup)); $rule_markup));
}
return $panel; return $panel;
} }
@ -457,10 +468,10 @@ final class HeraldTranscriptController extends HeraldController {
$handles = $this->loadViewerHandles(array($phid)); $handles = $this->loadViewerHandles(array($phid));
$data += array( $data += array(
'Object Name' => $object_xscript->getName(), pht('Object Name') => $object_xscript->getName(),
'Object Type' => $object_xscript->getType(), pht('Object Type') => $object_xscript->getType(),
'Object PHID' => $phid, pht('Object PHID') => $phid,
'Object Link' => $handles[$phid]->renderLink(), pht('Object Link') => $handles[$phid]->renderLink(),
); );
} }
@ -501,7 +512,8 @@ final class HeraldTranscriptController extends HeraldController {
)); ));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Object Transcript'); $panel->setHeader(pht('Object Transcript'));
$panel->setNoBackground();
$panel->appendChild($table); $panel->appendChild($table);
return $panel; return $panel;

View file

@ -64,19 +64,19 @@ final class HeraldTranscriptListController extends HeraldController {
'href' => '/herald/transcript/'.$xscript['id'].'/', 'href' => '/herald/transcript/'.$xscript['id'].'/',
'class' => 'button small grey', 'class' => 'button small grey',
), ),
'View Transcript'), pht('View Transcript')),
); );
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Date', pht('Date'),
'Time', pht('Time'),
'Object', pht('Object'),
'Dry Run', pht('Dry Run'),
'Duration', pht('Duration'),
'View', pht('View'),
)); ));
$table->setColumnClasses( $table->setColumnClasses(
array( array(
@ -105,10 +105,12 @@ final class HeraldTranscriptListController extends HeraldController {
->setName(pht('Transcripts'))); ->setName(pht('Transcripts')));
$nav->setCrumbs($crumbs); $nav->setCrumbs($crumbs);
return $this->buildStandardPageResponse( return $this->buildApplicationPage(
$nav, $nav,
array( array(
'title' => 'Herald Transcripts', 'title' => pht('Herald Transcripts'),
'device' => true,
'dust' => true,
)); ));
} }

View file

@ -21,7 +21,9 @@ final class HeraldRuleEditHistoryView extends AphrontView {
} }
public function render() { public function render() {
$rows = array(); $list = new PhabricatorObjectItemListView();
$list->setFlush(true);
$list->setCards(true);
foreach ($this->edits as $edit) { foreach ($this->edits as $edit) {
$name = nonempty($edit->getRuleName(), 'Unknown Rule'); $name = nonempty($edit->getRuleName(), 'Unknown Rule');
@ -43,31 +45,20 @@ final class HeraldRuleEditHistoryView extends AphrontView {
break; break;
} }
$rows[] = array( $editor = $this->handles[$edit->getEditorPHID()]->renderLink();
$edit->getRuleID(), $date = phabricator_datetime($edit->getDateCreated(), $this->user);
$this->handles[$edit->getEditorPHID()]->renderLink(),
$details, $item = id(new PhabricatorObjectItemView())
phabricator_datetime($edit->getDateCreated(), $this->user), ->setObjectName(pht('Rule %d', $edit->getRuleID()))
); ->setSubHead($details)
->addIcon('none', $date)
->addByLine(pht('Editor: %s', $editor));
$list->addItem($item);
} }
$table = new AphrontTableView($rows); $list->setNoDataString(pht('No edits for rule.'));
$table->setNoDataString("No edits for rule.");
$table->setHeaders(
array(
'Rule ID',
'Editor',
'Details',
'Edit Date',
));
$table->setColumnClasses(
array(
'',
'',
'wide',
'',
));
return $table->render(); return $list;
} }
} }

View file

@ -34,76 +34,50 @@ final class HeraldRuleListView extends AphrontView {
$type_map = HeraldRuleTypeConfig::getRuleTypeMap(); $type_map = HeraldRuleTypeConfig::getRuleTypeMap();
$rows = array(); $list = new PhabricatorObjectItemListView();
$list->setFlush(true);
$list->setCards(true);
foreach ($this->rules as $rule) { foreach ($this->rules as $rule) {
if ($rule->getRuleType() == HeraldRuleTypeConfig::RULE_TYPE_GLOBAL) { if ($rule->getRuleType() == HeraldRuleTypeConfig::RULE_TYPE_GLOBAL) {
$author = null; $author = pht('Global Rule');
} else { } else {
$author = $this->handles[$rule->getAuthorPHID()]->renderLink(); $author = $this->handles[$rule->getAuthorPHID()]->renderLink();
$author = pht('Editor: %s', $author);
} }
$name = phutil_tag(
'a',
array(
'href' => '/herald/rule/'.$rule->getID().'/',
),
$rule->getName());
$edit_log = phutil_tag( $edit_log = phutil_tag(
'a', 'a',
array( array(
'href' => '/herald/history/'.$rule->getID().'/', 'href' => '/herald/history/'.$rule->getID().'/',
), ),
'View Edit Log'); pht('View Edit Log'));
$delete = javelin_tag( $delete = javelin_tag(
'a', 'a',
array( array(
'href' => '/herald/delete/'.$rule->getID().'/', 'href' => '/herald/delete/'.$rule->getID().'/',
'sigil' => 'workflow', 'sigil' => 'workflow',
'class' => 'button small grey',
), ),
'Delete'); pht('Delete'));
$rows[] = array( $item = id(new PhabricatorObjectItemView())
$type_map[$rule->getRuleType()], ->setObjectName($type_map[$rule->getRuleType()])
$author, ->setHeader($rule->getName())
$name, ->setHref('/herald/rule/'.$rule->getID().'/')
$edit_log, ->addAttribute($edit_log)
$delete, ->addIcon('none', $author)
); ->addAction(
id(new PhabricatorMenuItemView())
->setHref('/herald/delete/'.$rule->getID().'/')
->setIcon('delete')
->setWorkflow(true));
$list->addItem($item);
} }
$table = new AphrontTableView($rows); $list->setNoDataString(pht("No matching rules."));
$table->setNoDataString("No matching rules.");
$table->setHeaders( return $list;
array(
'Rule Type',
'Author',
'Rule Name',
'Edit Log',
'',
));
$table->setColumnClasses(
array(
'',
'',
'wide pri',
'',
'action'
));
$table->setColumnVisibility(
array(
$this->showRuleType,
$this->showAuthor,
true,
true,
true,
));
return $table->render();
} }
} }