Add a basic notification UI element

Summary: This is //extremely// basic but dead simple and should cover us for v1, I think. Let me know what features you need.

Test Plan: Used UI example page.

Reviewers: allenjohnashton, ddfisher, keebuhm

Reviewed By: ddfisher

CC: aran, ender

Maniphest Tasks: T944

Differential Revision: https://secure.phabricator.com/D2732
This commit is contained in:
epriestley
2012-06-13 15:00:24 -07:00
parent 0cdc4e008d
commit d119b051e8
7 changed files with 243 additions and 0 deletions

View File

@@ -1332,6 +1332,18 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/js/application/core/behavior-keyboard-shortcuts.js',
),
'javelin-behavior-phabricator-notification-example' =>
array(
'uri' => '/res/0b8fadf5/rsrc/js/application/uiexample/notification-example.js',
'type' => 'js',
'requires' =>
array(
0 => 'phabricator-notification',
1 => 'javelin-stratcom',
2 => 'javelin-behavior',
),
'disk' => '/rsrc/js/application/uiexample/notification-example.js',
),
'javelin-behavior-phabricator-object-selector' =>
array(
'uri' => '/res/0c4b0d82/rsrc/js/application/core/behavior-object-selector.js',
@@ -2146,6 +2158,27 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/js/application/core/DropdownMenuItem.js',
),
'phabricator-notification' =>
array(
'uri' => '/res/8497d4b2/rsrc/js/application/core/Notification.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-install',
1 => 'javelin-dom',
2 => 'javelin-stratcom',
),
'disk' => '/rsrc/js/application/core/Notification.js',
),
'phabricator-notification-css' =>
array(
'uri' => '/res/423a14d1/rsrc/css/aphront/notification.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/notification.css',
),
'phabricator-object-selector-css' =>
array(
'uri' => '/res/7eb4c705/rsrc/css/application/objectselector/object-selector.css',

View File

@@ -966,6 +966,7 @@ phutil_register_library_map(array(
'PhabricatorUIExampleController' => 'applications/uiexample/controller/PhabricatorUIExampleController.php',
'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php',
'PhabricatorUIListFilterExample' => 'applications/uiexample/examples/PhabricatorUIListFilterExample.php',
'PhabricatorUINotificationExample' => 'applications/uiexample/examples/PhabricatorUINotificationExample.php',
'PhabricatorUIPagerExample' => 'applications/uiexample/examples/PhabricatorUIPagerExample.php',
'PhabricatorUITooltipExample' => 'applications/uiexample/examples/PhabricatorUITooltipExample.php',
'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php',
@@ -1900,6 +1901,7 @@ phutil_register_library_map(array(
'PhabricatorUIExampleController' => 'PhabricatorController',
'PhabricatorUIExampleRenderController' => 'PhabricatorUIExampleController',
'PhabricatorUIListFilterExample' => 'PhabricatorUIExample',
'PhabricatorUINotificationExample' => 'PhabricatorUIExample',
'PhabricatorUIPagerExample' => 'PhabricatorUIExample',
'PhabricatorUITooltipExample' => 'PhabricatorUIExample',
'PhabricatorUnitsTestCase' => 'PhabricatorTestCase',

View File

@@ -0,0 +1,46 @@
<?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 PhabricatorUINotificationExample extends PhabricatorUIExample {
public function getName() {
return 'Notifications';
}
public function getDescription() {
return 'Use <tt>JX.Notification</tt> to create notifications.';
}
public function renderExample() {
require_celerity_resource('phabricator-notification-css');
Javelin::initBehavior('phabricator-notification-example');
$content = javelin_render_tag(
'a',
array(
'sigil' => 'notification-example',
'class' => 'button green',
),
'Show Notification');
$content = '<div style="padding: 1em 3em;">'.$content.'</content>';
return $content;
}
}

View File

@@ -31,6 +31,9 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
public function willLintPaths(array $paths) {
$root = dirname(phutil_get_library_root('phabricator'));
require_once $root.'/scripts/__init_script__.php';
if ($this->haveSymbolsBinary === null) {
$binary = $this->getSymbolsBinaryPath();
$this->haveSymbolsBinary = Filesystem::pathExists($binary);