зеркало из https://github.com/mozilla/treeherder.git
Bug 1231774 - Makes the repo dropdown code generic
This makes it possible to use a checkbox dropdown in another location. Like in the Tier drop-down in the next commit.
This commit is contained in:
Родитель
bc15ddb0dd
Коммит
00cf5421a3
|
@ -111,11 +111,11 @@ treeherder.directive('thWatchedRepoInfoDropDown', [
|
|||
}]);
|
||||
|
||||
|
||||
treeherder.directive('thRepoDropdownContainer', [
|
||||
treeherder.directive('thCheckboxDropdownContainer', [
|
||||
'ThLog', '$rootScope', 'thEvents',
|
||||
function (ThLog, $rootScope, thEvents) {
|
||||
|
||||
var $log = new ThLog("thRepoDropdownContainer");
|
||||
var $log = new ThLog("thCheckboxDropdownContainer");
|
||||
|
||||
return {
|
||||
restrict: "A",
|
||||
|
@ -131,16 +131,12 @@ treeherder.directive('thRepoDropdownContainer', [
|
|||
}
|
||||
});
|
||||
|
||||
$('.repo-dropdown-menu').on({
|
||||
$('.checkbox-dropdown-menu').on({
|
||||
"click": function(ev) {
|
||||
if ($(ev.target).hasClass(".repo-link") || $(ev.target).hasClass(".repo-checkbox")) {
|
||||
if ($(ev.target).hasClass("dropdown-link")) {
|
||||
scope.closeable = false;
|
||||
}
|
||||
$log.debug("repo menu dropdown", "click", scope.closeable, ev.target.className);
|
||||
},
|
||||
"mouseup": function(ev) {
|
||||
scope.closeable = false;
|
||||
$log.debug("repo menu dropdown", "mouseup", scope.closeable, ev.target.className);
|
||||
$log.debug("menu dropdown", "click", scope.closeable, ev.target.className);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -159,9 +155,9 @@ treeherder.directive('thRepoMenuItem', [
|
|||
replace: true,
|
||||
link: function(scope, element, attrs) {
|
||||
var elem = $(element);
|
||||
elem.find('.repo-link').prop('href', scope.urlBasePath + "?repo=" + scope.repo.name);
|
||||
elem.find('.dropdown-link').prop('href', scope.urlBasePath + "?repo=" + scope.repo.name);
|
||||
if (scope.repo.name === scope.repoName) {
|
||||
elem.find('.repo-checkbox').prop('disabled', 'disabled');
|
||||
elem.find('.dropdown-checkbox').prop('disabled', 'disabled');
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
<td ng-if="property.label == 'Revision'" class="break-word">
|
||||
<a href="{{::property.value | getRevisionUrl:repoName}}"
|
||||
title="Open resultset"
|
||||
class="repo-link"
|
||||
ng-cloak>{{property.value}}</a>
|
||||
</td>
|
||||
<td ng-if="property.label != 'Revision'"
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
<!-- Repos Menu -->
|
||||
<span ng-controller="RepositoryMenuCtrl" >
|
||||
<span th-repo-dropdown-container class="dropdown">
|
||||
<span th-checkbox-dropdown-container class="dropdown">
|
||||
<button id="repoLabel" title="Watch a repo" role="button"
|
||||
href="#" data-toggle="dropdown" data-target="#"
|
||||
class="btn btn-view-nav btn-right-navbar nav-menu-btn">Repos
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<li>
|
||||
<input type="checkbox"
|
||||
class="repo-checkbox"
|
||||
class="dropdown-checkbox"
|
||||
ng-checked="repoModel.watchedRepos[repo.name]"
|
||||
ng-click="repoModel.toggleWatched(repo.name)"
|
||||
title="toggle watching this repo">
|
||||
<a title="Open repo" class="repo-link">{{::repo.name}}</a>
|
||||
<a title="Open repo" class="dropdown-link">{{::repo.name}}</a>
|
||||
</li>
|
||||
|
|
Загрузка…
Ссылка в новой задаче