Commit 35b96eb9 authored by Robert Knight's avatar Robert Knight

Add a custom build of Angular UI bootstrap for dropdown component

h/static/scripts/vendor/angular-bootstrap.js contains
a legacy version of the dropdown component

ui-bootstrap contains the current version with additional features
including the ability to open and close the dropdown via an
'is-open' attribute, keyboard navigation support and the ability
to use it via attribute directives.

This build has been lightly edited for Angular 1.2.x compatibility
(the original build requires a couple of features from Angular 1.3)

Card 89
parent 9f7ff156
......@@ -122,6 +122,7 @@ module.exports = angular.module('h', [
'ngTagsInput'
'ngWebSocket'
'toastr'
require('./vendor/ui-bootstrap-custom-0.13.4')
])
.controller('AppController', require('./app-controller'))
......
......@@ -8,53 +8,6 @@
var directive = {};
directive.dropdownToggle =
['$document', '$location', '$window',
function ($document, $location, $window) {
var openElement = null, close;
return {
restrict: 'C',
link: function(scope, element, attrs) {
scope.$watch(function dropdownTogglePathWatch(){return $location.path();}, function dropdownTogglePathWatchAction() {
close && close();
});
element.parent().bind('click', function(event) {
close && close();
});
element.bind('click', function(event) {
event.preventDefault();
event.stopPropagation();
var iWasOpen = false;
if (openElement) {
iWasOpen = openElement === element;
close();
}
if (!iWasOpen){
element.parent().addClass('open');
openElement = element;
close = function (event) {
event && event.preventDefault();
event && event.stopPropagation();
$document.unbind('click', close);
element.parent().removeClass('open');
close = null;
openElement = null;
}
$document.bind('click', close);
}
});
}
};
}];
directive.tabbable = function() {
return {
restrict: 'C',
......
This diff is collapsed.
<div class="pull-right dropdown">
<div class="pull-right" dropdown>
<span class="dropdown-toggle"
dropdown-toggle
data-toggle="dropdown"
role="button"
ng-switch on="groups.focused().public"
......
......@@ -18,10 +18,10 @@
'other': 'Showing {} selected annotations.'}"></span>
<a href="" ng-click="clearSelection()">Clear selection</a>.</li>
<li ng-show="isStream">
<span class="ng-cloak dropdown">
<span class="ng-cloak" dropdown>
<span role="button"
class="dropdown-toggle"
data-toggle="dropdown">
data-toggle="dropdown"
dropdown-toggle>
Sorted by {{sort.name | lowercase}}
<i class="h-icon-arrow-drop-down"></i>
</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment