Allow pastes to be flagged

Summary:
This does a few things:

  - Allows you to flag pastes. This is straightforward.
  - Allows Applications to register event listeners.
  - Makes object action lists emit a 'didrenderactions' event, so other applications can add more actions. The Flags application injects its action in this way. This should generally make it much easier to add actions to objects when we add new applications, with less code duplication and better modularity. We have a really hacky version of this in Differential that I want to get rid of in lieu of this more general approach. I'm going to make object lists do the same thing, so any application can jump in and add stuff.

Test Plan: Flagged and unflagged pastes. Viewed home page, differential, flags list.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D3377
This commit is contained in:
epriestley
2012-08-24 13:19:47 -07:00
parent 36e71a0601
commit 85bf88e400
21 changed files with 209 additions and 18 deletions

View File

@@ -159,9 +159,18 @@ $action_template = id(new PhutilSprite())
->setSourceSize(16, 16);
$action_map = array(
'file' => 'icon/page_white_text.png',
'fork' => 'icon/arrow_branch.png',
'edit' => 'icon/page_white_edit.png',
'file' => 'icon/page_white_text.png',
'fork' => 'icon/arrow_branch.png',
'edit' => 'icon/page_white_edit.png',
'flag-0' => 'icon/flag-0.png',
'flag-1' => 'icon/flag-1.png',
'flag-2' => 'icon/flag-2.png',
'flag-3' => 'icon/flag-3.png',
'flag-4' => 'icon/flag-4.png',
'flag-5' => 'icon/flag-5.png',
'flag-6' => 'icon/flag-6.png',
'flag-7' => 'icon/flag-7.png',
'flag-ghost' => 'icon/flag-ghost.png',
);
foreach ($action_map as $icon => $source) {