Permalink
Comparing changes
Open a pull request
- 6 commits
- 13 files changed
- 0 commit comments
- 3 contributors
Unified
Split
Showing
with
462 additions
and 202 deletions.
- +107 −33 docs/hacking/install.rst
- +12 −6 h/static/scripts/app-controller.coffee
- +1 −0 h/static/scripts/app.coffee
- +1 −1 h/static/scripts/test/app-controller-test.coffee
- +21 −0 h/static/styles/common.scss
- +3 −3 h/static/styles/help-page.scss
- +2 −3 h/static/styles/simple-search.scss
- +1 −1 h/static/styles/topbar.scss
- BIN h/static/styles/vendor/fonts/h.eot
- +263 −143 h/static/styles/vendor/fonts/selection.json
- +18 −2 h/static/styles/vendor/icomoon.css
- +20 −5 h/templates/app.html
- +13 −5 h/templates/help.html
| @@ -38,23 +38,22 @@ Installing the system dependencies | ||
| Installing h's system dependencies is different on different operating systems. | ||
| Follow either the | ||
| `Installing the system dependencies on Debian or Ubuntu`_ or the | ||
| `Installing the system dependencies on Ubuntu 14.04`_ or the | ||
| `Installing the system dependencies on OS X`_ section below. | ||
| Installing the system dependencies on Debian or Ubuntu | ||
| `````````````````````````````````````````````````````` | ||
| Installing the system dependencies on Ubuntu 14.04 | ||
| `````````````````````````````````````````````````` | ||
| This section describes how to install h's system dependencies on Debian and | ||
| Debian-like GNU/Linux distributions (such as Ubuntu). | ||
| This section describes how to install h's system dependencies on Ubuntu 14.04. | ||
| These steps will also probably work with little or no changes on other versions | ||
| of Ubuntu, Debian, or other Debian-based GNU/Linux distributions. | ||
| Not all required packages are necessarily part of the ``stable`` distribution; | ||
| you may need to fetch some stuff from ``unstable``. (On Ubuntu, you may need to | ||
| add the ``universe`` package repositories.) | ||
| Install the following packages: | ||
| Install the following packages:: | ||
| .. code-block:: bash | ||
| $ apt-get install -y --no-install-recommends \ | ||
| sudo apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| git \ | ||
| libevent-dev \ | ||
| @@ -69,14 +68,25 @@ Install the following packages:: | ||
| ruby \ | ||
| ruby-dev | ||
| Upgrade pip and npm:: | ||
| Add a ``node`` symlink. This is needed because the node binary from Ubuntu is | ||
| called ``nodejs`` but many packages will try to run it as ``node``: | ||
| $ pip install -U pip virtualenv | ||
| $ npm install -g npm | ||
| .. code-block:: bash | ||
| Install compass:: | ||
| sudo ln -s /usr/bin/nodejs /usr/bin/node | ||
| $ gem install compass | ||
| Upgrade pip and npm: | ||
| .. code-block:: bash | ||
| sudo pip install -U pip virtualenv | ||
| sudo npm install -g npm | ||
| Install compass: | ||
| .. code-block:: bash | ||
| sudo gem install compass | ||
| Installing the system dependencies on OS X | ||
| @@ -88,18 +98,22 @@ The instructions that follow assume you have previously installed Homebrew_. | ||
| .. _Homebrew: http://brew.sh/ | ||
| Install the following packages:: | ||
| Install the following packages: | ||
| .. code-block:: bash | ||
| $ brew install \ | ||
| brew install \ | ||
| libevent \ | ||
| libffi \ | ||
| libyaml \ | ||
| node \ | ||
| python | ||
| Install compass:: | ||
| Install compass: | ||
| $ gem install compass | ||
| .. code-block:: bash | ||
| gem install compass | ||
| Installing ElasticSearch | ||
| @@ -137,38 +151,92 @@ with h in a development environment. | ||
| .. _instructions on installing NSQ: http://nsq.io/deployment/installing.html | ||
| Get the h source code from GitHub | ||
| --------------------------------- | ||
| Use ``git`` to download the h source code: | ||
| .. code-block:: bash | ||
| git clone https://github.com/hypothesis/h.git | ||
| This will download the code into an ``h`` directory in your current working | ||
| directory. | ||
| Install h into a Python virtualenv | ||
| ---------------------------------- | ||
| Although it is strictly optional, we highly recommend that you install h inside | ||
| a Python "virtualenv". First, follow the instructions for your platform on | ||
| installing virtualenvwrapper_. Then, at a shell, you can create a virtualenv for | ||
| the h application with:: | ||
| the h application with: | ||
| .. code-block:: bash | ||
| $ mkvirtualenv h | ||
| mkvirtualenv h | ||
| You will notice that the your shell prompt changes to include a (h) symbol. That | ||
| means that you now have your virtual environment activated. This is required for | ||
| running the code. | ||
| At any later time, you can activate your virtualenv by running:: | ||
| At any later time, you can activate your virtualenv by running: | ||
| .. code-block:: bash | ||
| workon h | ||
| $ workon h | ||
| Install h's Python dependencies into the virtual environment, and its Node | ||
| dependencies into the ``h/node_modules`` directory: | ||
| Once platform dependencies are installed:: | ||
| .. code-block:: bash | ||
| $ make deps | ||
| cd h | ||
| make deps | ||
| .. note:: | ||
| If ``make deps`` fails for any reason re-running it may not install all the | ||
| dependencies because it sees the ``h.egg_info`` and ``node_modules`` | ||
| directories that it created before it failed and assumes that because they | ||
| exist its work is done. You may see ``make: Nothing to be done for `deps'`` | ||
| or you may get no output, or you may see it doing some work (e.g. installing | ||
| Python dependencies) but it may not do *all* the work (e.g. not installing | ||
| missing Node dependencies). | ||
| So to reinstall all the dependencies after a failure or crash do:: | ||
| rm -rf h.egg_info node_modules | ||
| make deps | ||
| .. _virtualenvwrapper: https://virtualenvwrapper.readthedocs.org/en/latest/install.html | ||
| Add Node modules to your PATH | ||
| ----------------------------- | ||
| If you don't have your ``h/node_modules/.bin`` directory on your ``PATH`` then | ||
| you'll get errors because the Node modules you've installed can't be found | ||
| (for example: ``Program file not found: uglifyjs``). | ||
| To add the Node modules to your ``PATH``: | ||
| .. code-block:: bash | ||
| export PATH=./node_modules/.bin:$PATH | ||
| If you add the above line to your ``~/.bashrc`` file then you won't have to | ||
| enter it every time you start a new terminal. | ||
| Running h | ||
| --------- | ||
| Now that you've installed h and all of its dependencies, you should be able to | ||
| run h in your development environment with this command:: | ||
| run h in your development environment with this command: | ||
| .. code-block:: bash | ||
| $ make dev | ||
| make dev | ||
| This will start the server on port 5000 (http://localhost:5000), reload the | ||
| application whenever changes are made to the source code, and restart it should | ||
| @@ -186,17 +254,23 @@ Running the tests | ||
| There are test suites for both the frontend and backend code. | ||
| To run the Python suite, invoke the tests in the standard fashion:: | ||
| To run the Python suite, invoke the tests in the standard fashion: | ||
| .. code-block:: bash | ||
| python setup.py test | ||
| To run the JavaScript suite, run: | ||
| $ python setup.py test | ||
| .. code-block:: bash | ||
| To run the JavaScript suite, run:: | ||
| $(npm bin)/karma start h/static/scripts/karma.config.js --single-run | ||
| $ $(npm bin)/karma start h/static/scripts/karma.config.js --single-run | ||
| As a convenience, there is a make target which will do all of the above: | ||
| As a convenience, there is a make target which will do all of the above:: | ||
| .. code-block:: bash | ||
| $ make test | ||
| make test | ||
| Debugging h | ||
| @@ -43,8 +43,16 @@ module.exports = class AppController | ||
| applyUpdates(action, payload) | ||
| $scope.$digest() | ||
| # App dialogs | ||
| $scope.accountDialog = visible: false | ||
| $scope.shareDialog = visible: false | ||
| oncancel = -> | ||
| $scope.dialog.visible = false | ||
| $scope.accountDialog.visible = false | ||
| # Check to see if we are on the stream page. | ||
| if $window.top is $window | ||
| $scope.isStream = true | ||
| cleanupAnnotations = -> | ||
| # Clean up any annotations that need to be unloaded. | ||
| @@ -68,7 +76,7 @@ module.exports = class AppController | ||
| if isFirstRun and not (newVal or oldVal) | ||
| $scope.login() | ||
| else | ||
| $scope.dialog.visible = false | ||
| $scope.accountDialog.visible = false | ||
| # Update any edits in progress. | ||
| for draft in drafts.all() | ||
| @@ -85,12 +93,12 @@ module.exports = class AppController | ||
| $route.reload() | ||
| $scope.login = -> | ||
| $scope.dialog.visible = true | ||
| $scope.accountDialog.visible = true | ||
| identity.request {oncancel} | ||
| $scope.logout = -> | ||
| return unless drafts.discard() | ||
| $scope.dialog.visible = false | ||
| $scope.accountDialog.visible = false | ||
| identity.logout() | ||
| $scope.loadMore = (number) -> | ||
| @@ -100,8 +108,6 @@ module.exports = class AppController | ||
| $scope.search.query = '' | ||
| annotationUI.clearSelectedAnnotations() | ||
| $scope.dialog = visible: false | ||
| $scope.search = | ||
| query: $location.search()['q'] | ||
| @@ -111,6 +111,7 @@ module.exports = angular.module('h', [ | ||
| .directive('spinner', require('./directive/spinner')) | ||
| .directive('tabbable', require('./directive/tabbable')) | ||
| .directive('tabReveal', require('./directive/tab-reveal')) | ||
| .directive('shareDialog', require('./directive/share-dialog')) | ||
| .filter('converter', require('./filter/converter')) | ||
| .filter('moment', require('./filter/moment')) | ||
| @@ -117,7 +117,7 @@ describe 'AppController', -> | ||
| it 'does not show login form for logged in users', -> | ||
| createController() | ||
| assert.isFalse($scope.dialog.visible) | ||
| assert.isFalse($scope.accountDialog.visible) | ||
| describe 'applyUpdate', -> | ||
| @@ -112,6 +112,27 @@ html { | ||
| } | ||
| // Share this view ///////////////////// | ||
| .share-dialog-toggle { | ||
| top: 1px; | ||
| left: 8px; | ||
| position: relative; | ||
| cursor: pointer; | ||
| color: $gray-light; | ||
| float: left; | ||
| margin-right: 15px; | ||
| &:hover { | ||
| color: $gray-dark; | ||
| } | ||
| } | ||
| .share-links { | ||
| a { | ||
| font-size: 1.5em; | ||
| padding: .3em; | ||
| } | ||
| } | ||
| //FORM RELATED//////////////////////////////// | ||
| .form-horizontal { | ||
| @@ -12,7 +12,7 @@ | ||
| .masthead { | ||
| margin-bottom: 2.5em; | ||
| margin-left: -1em; | ||
| margin-left: -2em; | ||
| } | ||
| } | ||
| @@ -86,7 +86,7 @@ | ||
| @include icons { | ||
| @include help-icon; | ||
| font-size: 14px; | ||
| font-size: 10px; | ||
| } | ||
| } | ||
| @@ -96,7 +96,7 @@ | ||
| height: 45px; | ||
| position: absolute; | ||
| top: -10px; | ||
| right: -10px; | ||
| right: 0px; | ||
| } | ||
| .numbered-list { | ||
| @@ -9,7 +9,7 @@ | ||
| @include clearfix; | ||
| position: relative; | ||
| padding: 0 1.5385em; | ||
| color: $gray; | ||
| color: $gray-darker; | ||
| } | ||
| .simple-search-form * { | ||
| @@ -23,14 +23,13 @@ | ||
| } | ||
| :not(:focus) ~ .simple-search-icon { | ||
| color: $gray-lighter; | ||
| color: $gray-light; | ||
| } | ||
| input.simple-search-input { | ||
| float: left; | ||
| outline: none; | ||
| color: $text-color; | ||
| width: 100%; | ||
| border: none; | ||
| padding: 0; | ||
| @@ -57,7 +57,7 @@ body { | ||
| & > *:first-child, & > *:last-child { | ||
| line-height: 28px; | ||
| margin: 0 .72em; | ||
| margin-right: .72em; | ||
| } | ||
| } | ||
| } | ||
Binary file not shown.
Oops, something went wrong.