mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-16 16:58:38 +01:00
Move "Macros" to a first-class application
Summary: This is mostly to unblock D3547. - Move "Macros" to a first-class application called "Macros". - After D3547, this application will also house "Memes" (macros with text on them). - This will also make them easier to find; the top navigational query I field is "where are image macros?" nowadays, since it's not intuitive they're part of files. - This makes some of the UI mobile-aware but doesn't set the `device` flag yet, since there are still some missing pieces. - I'll separate storage out and continue modernizing the UI as we unblock and integrate D3547. Test Plan: Created, edited and deleted macros. Viewed files. Reviewers: btrahan, vrana, teisenbe Reviewed By: vrana CC: aran Maniphest Tasks: T175 Differential Revision: https://secure.phabricator.com/D3572
This commit is contained in:
parent
a6b6a9766b
commit
92ff9c092b
13 changed files with 155 additions and 73 deletions
|
@ -149,6 +149,7 @@ $app_map = array(
|
|||
'diviner' => array(1, 35),
|
||||
'repositories' => array(8, 13),
|
||||
'phame' => array(8, 4),
|
||||
'macro' => array(0, 31),
|
||||
);
|
||||
|
||||
$xadj = -1;
|
||||
|
|
|
@ -51,8 +51,8 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'/rsrc/image/autosprite.png' =>
|
||||
array(
|
||||
'hash' => '72184117972407fe930910bee886fd21',
|
||||
'uri' => '/res/72184117/rsrc/image/autosprite.png',
|
||||
'hash' => '10b50d4636be52a6f36fb28b3a05f90e',
|
||||
'uri' => '/res/10b50d46/rsrc/image/autosprite.png',
|
||||
'disk' => '/rsrc/image/autosprite.png',
|
||||
'type' => 'png',
|
||||
),
|
||||
|
@ -657,7 +657,7 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'autosprite-css' =>
|
||||
array(
|
||||
'uri' => '/res/17eb3f9b/rsrc/css/autosprite.css',
|
||||
'uri' => '/res/5de6fe77/rsrc/css/autosprite.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
|
|
|
@ -565,6 +565,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationFlags' => 'applications/flag/application/PhabricatorApplicationFlags.php',
|
||||
'PhabricatorApplicationHerald' => 'applications/herald/application/PhabricatorApplicationHerald.php',
|
||||
'PhabricatorApplicationLaunchView' => 'applications/meta/view/PhabricatorApplicationLaunchView.php',
|
||||
'PhabricatorApplicationMacro' => 'applications/macro/application/PhabricatorApplicationMacro.php',
|
||||
'PhabricatorApplicationMailingLists' => 'applications/mailinglists/application/PhabricatorApplicationMailingLists.php',
|
||||
'PhabricatorApplicationManiphest' => 'applications/maniphest/application/PhabricatorApplicationManiphest.php',
|
||||
'PhabricatorApplicationMetaMTA' => 'applications/metamta/application/PhabricatorApplicationMetaMTA.php',
|
||||
|
@ -728,12 +729,9 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFileDataController' => 'applications/files/controller/PhabricatorFileDataController.php',
|
||||
'PhabricatorFileDeleteController' => 'applications/files/controller/PhabricatorFileDeleteController.php',
|
||||
'PhabricatorFileDropUploadController' => 'applications/files/controller/PhabricatorFileDropUploadController.php',
|
||||
'PhabricatorFileImageMacro' => 'applications/files/storage/PhabricatorFileImageMacro.php',
|
||||
'PhabricatorFileImageMacro' => 'applications/macro/storage/PhabricatorFileImageMacro.php',
|
||||
'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php',
|
||||
'PhabricatorFileListController' => 'applications/files/controller/PhabricatorFileListController.php',
|
||||
'PhabricatorFileMacroDeleteController' => 'applications/files/controller/PhabricatorFileMacroDeleteController.php',
|
||||
'PhabricatorFileMacroEditController' => 'applications/files/controller/PhabricatorFileMacroEditController.php',
|
||||
'PhabricatorFileMacroListController' => 'applications/files/controller/PhabricatorFileMacroListController.php',
|
||||
'PhabricatorFileProxyController' => 'applications/files/controller/PhabricatorFileProxyController.php',
|
||||
'PhabricatorFileProxyImage' => 'applications/files/storage/PhabricatorFileProxyImage.php',
|
||||
'PhabricatorFileShortcutController' => 'applications/files/controller/PhabricatorFileShortcutController.php',
|
||||
|
@ -796,6 +794,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorLoginController' => 'applications/auth/controller/PhabricatorLoginController.php',
|
||||
'PhabricatorLoginValidateController' => 'applications/auth/controller/PhabricatorLoginValidateController.php',
|
||||
'PhabricatorLogoutController' => 'applications/auth/controller/PhabricatorLogoutController.php',
|
||||
'PhabricatorMacroController' => 'applications/macro/controller/PhabricatorMacroController.php',
|
||||
'PhabricatorMacroDeleteController' => 'applications/macro/controller/PhabricatorMacroDeleteController.php',
|
||||
'PhabricatorMacroEditController' => 'applications/macro/controller/PhabricatorMacroEditController.php',
|
||||
'PhabricatorMacroListController' => 'applications/macro/controller/PhabricatorMacroListController.php',
|
||||
'PhabricatorMailImplementationAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAdapter.php',
|
||||
'PhabricatorMailImplementationAmazonSESAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php',
|
||||
'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationPHPMailerLiteAdapter.php',
|
||||
|
@ -1727,6 +1729,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationFlags' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationHerald' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationLaunchView' => 'AphrontView',
|
||||
'PhabricatorApplicationMacro' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationMailingLists' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationManiphest' => 'PhabricatorApplication',
|
||||
'PhabricatorApplicationMetaMTA' => 'PhabricatorApplication',
|
||||
|
@ -1881,9 +1884,6 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFileImageMacro' => 'PhabricatorFileDAO',
|
||||
'PhabricatorFileInfoController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileListController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileMacroDeleteController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileMacroEditController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileMacroListController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileProxyController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileProxyImage' => 'PhabricatorFileDAO',
|
||||
'PhabricatorFileShortcutController' => 'PhabricatorFileController',
|
||||
|
@ -1933,6 +1933,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorLoginController' => 'PhabricatorAuthController',
|
||||
'PhabricatorLoginValidateController' => 'PhabricatorAuthController',
|
||||
'PhabricatorLogoutController' => 'PhabricatorAuthController',
|
||||
'PhabricatorMacroController' => 'PhabricatorController',
|
||||
'PhabricatorMacroDeleteController' => 'PhabricatorMacroController',
|
||||
'PhabricatorMacroEditController' => 'PhabricatorMacroController',
|
||||
'PhabricatorMacroListController' => 'PhabricatorMacroController',
|
||||
'PhabricatorMailImplementationAmazonSESAdapter' => 'PhabricatorMailImplementationPHPMailerLiteAdapter',
|
||||
'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'PhabricatorMailImplementationAdapter',
|
||||
'PhabricatorMailImplementationSendGridAdapter' => 'PhabricatorMailImplementationAdapter',
|
||||
|
|
|
@ -55,11 +55,6 @@ class AphrontDefaultApplicationConfiguration
|
|||
'alt/(?P<key>[^/]+)/(?P<phid>[^/]+)/'
|
||||
=> 'PhabricatorFileDataController',
|
||||
|
||||
'macro/' => array(
|
||||
'' => 'PhabricatorFileMacroListController',
|
||||
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorFileMacroEditController',
|
||||
'delete/(?P<id>\d+)/' => 'PhabricatorFileMacroDeleteController',
|
||||
),
|
||||
'proxy/' => 'PhabricatorFileProxyController',
|
||||
'xform/(?P<transform>[^/]+)/(?P<phid>[^/]+)/'
|
||||
=> 'PhabricatorFileTransformController',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -47,16 +47,12 @@ final class PhabricatorFileSideNavView extends AphrontView {
|
|||
'name' => 'All Files',
|
||||
'href' => '/file/filter/all/'
|
||||
),
|
||||
'<hr />' => array(),
|
||||
'Image Macros' => array(),
|
||||
'create_macro' => array(
|
||||
'name' => 'Create Image Macro',
|
||||
'href' => '/file/macro/edit/'
|
||||
),
|
||||
'all_macros' => array(
|
||||
'name' => 'All Image Macros',
|
||||
'href' => '/file/macro/'
|
||||
),
|
||||
// TODO: Remove this fairly soon.
|
||||
'<br />' => null,
|
||||
'<div style="font-weight: normal; font-size: smaller; '.
|
||||
'white-space: normal;">NOTE: Macros have moved to a separate '.
|
||||
'application. Use the "Search" field to jump to it or choose '.
|
||||
'More Stuff » Macros from the home page.</span>' => null,
|
||||
);
|
||||
|
||||
$side_nav = new AphrontSideNavView();
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorApplicationMacro extends PhabricatorApplication {
|
||||
|
||||
public function getBaseURI() {
|
||||
return '/macro/';
|
||||
}
|
||||
|
||||
public function getShortDescription() {
|
||||
return 'Image Macros and Memes';
|
||||
}
|
||||
|
||||
public function getAutospriteName() {
|
||||
return 'macro';
|
||||
}
|
||||
|
||||
public function getTitleGlyph() {
|
||||
return "\xE2\x9A\x98";
|
||||
}
|
||||
|
||||
public function getRoutes() {
|
||||
return array(
|
||||
'/macro/' => array(
|
||||
'' => 'PhabricatorMacroListController',
|
||||
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorMacroEditController',
|
||||
'delete/(?P<id>\d+)/' => 'PhabricatorMacroDeleteController',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
abstract class PhabricatorMacroController
|
||||
extends PhabricatorController {
|
||||
|
||||
protected function buildSideNavView(PhabricatorFileImageMacro $macro = null) {
|
||||
$nav = new AphrontSideNavFilterView();
|
||||
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
|
||||
|
||||
$nav->addLabel('Create');
|
||||
$nav->addFilter('edit', 'Create Macro');
|
||||
|
||||
$nav->addSpacer();
|
||||
|
||||
$nav->addLabel('Macros');
|
||||
$nav->addFilter('', 'All Macros');
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,8 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorFileMacroDeleteController
|
||||
extends PhabricatorFileController {
|
||||
final class PhabricatorMacroDeleteController
|
||||
extends PhabricatorMacroController {
|
||||
|
||||
private $id;
|
||||
|
||||
|
@ -36,7 +36,8 @@ final class PhabricatorFileMacroDeleteController
|
|||
|
||||
if ($request->isDialogFormPost()) {
|
||||
$macro->delete();
|
||||
return id(new AphrontRedirectResponse())->setURI('/file/macro/');
|
||||
return id(new AphrontRedirectResponse())->setURI(
|
||||
$this->getApplicationURI());
|
||||
}
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
|
@ -47,9 +48,9 @@ final class PhabricatorFileMacroDeleteController
|
|||
'<p>Really delete the much-beloved image macro "'.
|
||||
phutil_escape_html($macro->getName()).'"? It will be sorely missed.'.
|
||||
'</p>')
|
||||
->setSubmitURI('/file/macro/delete/'.$this->id.'/')
|
||||
->setSubmitURI($this->getApplicationURI('/delete/'.$this->id.'/'))
|
||||
->addSubmitButton('Delete')
|
||||
->addCancelButton('/file/macro/');
|
||||
->addCancelButton($this->getApplicationURI());
|
||||
|
||||
|
||||
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
@ -16,8 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorFileMacroEditController
|
||||
extends PhabricatorFileController {
|
||||
final class PhabricatorMacroEditController
|
||||
extends PhabricatorMacroController {
|
||||
|
||||
private $id;
|
||||
|
||||
|
@ -68,7 +68,8 @@ final class PhabricatorFileMacroEditController
|
|||
|
||||
try {
|
||||
$macro->save();
|
||||
return id(new AphrontRedirectResponse())->setURI('/file/macro/');
|
||||
return id(new AphrontRedirectResponse())->setURI(
|
||||
$this->getApplicationURI());
|
||||
} catch (AphrontQueryDuplicateKeyException $ex) {
|
||||
$errors[] = 'Macro name is not unique!';
|
||||
$e_name = 'Duplicate';
|
||||
|
@ -85,7 +86,7 @@ final class PhabricatorFileMacroEditController
|
|||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form->setAction('/file/macro/edit/');
|
||||
$form->setAction($this->getApplicationURI('/edit/'));
|
||||
$form->setUser($request->getUser());
|
||||
|
||||
$form
|
||||
|
@ -105,7 +106,7 @@ final class PhabricatorFileMacroEditController
|
|||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Save Image Macro')
|
||||
->addCancelButton('/file/macro/'));
|
||||
->addCancelButton($this->getApplicationURI()));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
if ($macro->getID()) {
|
||||
|
@ -117,13 +118,13 @@ final class PhabricatorFileMacroEditController
|
|||
$panel->appendChild($form);
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
|
||||
|
||||
$side_nav = new PhabricatorFileSideNavView();
|
||||
$side_nav->setSelectedFilter('create_macro');
|
||||
$side_nav->appendChild($error_view);
|
||||
$side_nav->appendChild($panel);
|
||||
$nav = $this->buildSideNavView($macro);
|
||||
$nav->selectFilter('#', 'edit');
|
||||
$nav->appendChild($error_view);
|
||||
$nav->appendChild($panel);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$side_nav,
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => $title,
|
||||
));
|
|
@ -16,8 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
final class PhabricatorFileMacroListController
|
||||
extends PhabricatorFileController {
|
||||
final class PhabricatorMacroListController
|
||||
extends PhabricatorMacroController {
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
|
@ -74,7 +74,7 @@ final class PhabricatorFileMacroListController
|
|||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/file/macro/edit/'.$macro->getID().'/',
|
||||
'href' => $this->getApplicationURI('/edit/'.$macro->getID().'/'),
|
||||
),
|
||||
phutil_escape_html($macro->getName())),
|
||||
|
||||
|
@ -93,7 +93,7 @@ final class PhabricatorFileMacroListController
|
|||
javelin_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/file/macro/delete/'.$macro->getID().'/',
|
||||
'href' => $this->getApplicationURI('/delete/'.$macro->getID().'/'),
|
||||
'sigil' => 'workflow',
|
||||
'class' => 'grey small button',
|
||||
),
|
||||
|
@ -119,7 +119,6 @@ final class PhabricatorFileMacroListController
|
|||
|
||||
$filter_form = id(new AphrontFormView())
|
||||
->setMethod('GET')
|
||||
->setAction('/file/macro/')
|
||||
->setUser($request->getUser())
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
|
@ -132,14 +131,6 @@ final class PhabricatorFileMacroListController
|
|||
|
||||
$filter_view = new AphrontListFilterView();
|
||||
$filter_view->appendChild($filter_form);
|
||||
$filter_view->addButton(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/file/macro/edit/',
|
||||
'class' => 'green button',
|
||||
),
|
||||
'New Image Macro'));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->appendChild($table);
|
||||
|
@ -148,13 +139,14 @@ final class PhabricatorFileMacroListController
|
|||
$panel->appendChild($pager);
|
||||
}
|
||||
|
||||
$side_nav = new PhabricatorFileSideNavView();
|
||||
$side_nav->setSelectedFilter('all_macros');
|
||||
$side_nav->appendChild($filter_view);
|
||||
$side_nav->appendChild($panel);
|
||||
$nav = $this->buildSideNavView();
|
||||
$nav->selectFilter('/');
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$side_nav,
|
||||
$nav->appendChild($filter_view);
|
||||
$nav->appendChild($panel);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Image Macros',
|
||||
));
|
|
@ -308,50 +308,58 @@
|
|||
background-position: 0px -3134px;
|
||||
}
|
||||
|
||||
.action-file {
|
||||
.app-macro-full {
|
||||
background-position: 0px -3165px;
|
||||
}
|
||||
|
||||
.app-macro {
|
||||
background-position: 0px -3226px;
|
||||
}
|
||||
|
||||
.action-file {
|
||||
background-position: 0px -3257px;
|
||||
}
|
||||
|
||||
.action-fork {
|
||||
background-position: 0px -3182px;
|
||||
background-position: 0px -3274px;
|
||||
}
|
||||
|
||||
.action-edit {
|
||||
background-position: 0px -3199px;
|
||||
background-position: 0px -3291px;
|
||||
}
|
||||
|
||||
.action-flag-0 {
|
||||
background-position: 0px -3216px;
|
||||
background-position: 0px -3308px;
|
||||
}
|
||||
|
||||
.action-flag-1 {
|
||||
background-position: 0px -3233px;
|
||||
background-position: 0px -3325px;
|
||||
}
|
||||
|
||||
.action-flag-2 {
|
||||
background-position: 0px -3250px;
|
||||
background-position: 0px -3342px;
|
||||
}
|
||||
|
||||
.action-flag-3 {
|
||||
background-position: 0px -3267px;
|
||||
background-position: 0px -3359px;
|
||||
}
|
||||
|
||||
.action-flag-4 {
|
||||
background-position: 0px -3284px;
|
||||
background-position: 0px -3376px;
|
||||
}
|
||||
|
||||
.action-flag-5 {
|
||||
background-position: 0px -3301px;
|
||||
background-position: 0px -3393px;
|
||||
}
|
||||
|
||||
.action-flag-6 {
|
||||
background-position: 0px -3318px;
|
||||
background-position: 0px -3410px;
|
||||
}
|
||||
|
||||
.action-flag-7 {
|
||||
background-position: 0px -3335px;
|
||||
background-position: 0px -3427px;
|
||||
}
|
||||
|
||||
.action-flag-ghost {
|
||||
background-position: 0px -3352px;
|
||||
background-position: 0px -3444px;
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 113 KiB |
Loading…
Add table
Reference in a new issue