From d3a7beb0ba2c2a93e5a3a6e6efa1ba0966113b50 Mon Sep 17 00:00:00 2001 From: kunw Date: Tue, 24 May 2016 10:53:52 +0800 Subject: [PATCH] updates for popup-details feature of UI. --- static/ng/resources/css/repository.css | 21 ++++++++++- .../details/retrieve-projects.directive.js | 8 ++++ .../repository/list-tag.directive.html | 2 +- .../repository/list-tag.directive.js | 7 ++++ .../repository/popup-details.directive.html | 6 +-- .../repository/popup-details.directive.js | 37 +++++++++++++------ 6 files changed, 65 insertions(+), 16 deletions(-) diff --git a/static/ng/resources/css/repository.css b/static/ng/resources/css/repository.css index 19e8c7022..d1646b616 100644 --- a/static/ng/resources/css/repository.css +++ b/static/ng/resources/css/repository.css @@ -108,4 +108,23 @@ .popover{ max-width: 500px; -} \ No newline at end of file +} + +.popover-header { + padding:8px 14px; + background-color:#f7f7f7; + border-bottom:1px solid #ebebeb; + -webkit-border-radius:5px 5px 0 0; + -moz-border-radius:5px 5px 0 0; + border-radius:5px 5px 0 0; +} + +.popover-title { + height: 2.5em; + padding: 8px 14px; + margin: 0; + font-size: 14px; + background-color: #f7f7f7; + border-bottom: 1px solid #ebebeb; + border-radius: 5px 5px 0 0; +} diff --git a/static/ng/resources/js/components/details/retrieve-projects.directive.js b/static/ng/resources/js/components/details/retrieve-projects.directive.js index 8d41385a6..6d437b4a5 100644 --- a/static/ng/resources/js/components/details/retrieve-projects.directive.js +++ b/static/ng/resources/js/components/details/retrieve-projects.directive.js @@ -125,6 +125,14 @@ $(document).on('click', clickHandler); function clickHandler(e) { + var target = $(e.target).parent(); + $('[data-toggle="popover"]').each(function () { + //the 'is' for buttons that trigger popups + //the 'has' for icons within a button that triggers a popup + if (!$(this).is(target) && $(this).has(target).length === 0 && $('.popover').has(target).length === 0) { + $(this).parent().popover('hide'); + } + }); var targetId = $(e.target).attr('id'); if(targetId === 'switchPane' || targetId === 'retrievePane' || diff --git a/static/ng/resources/js/components/repository/list-tag.directive.html b/static/ng/resources/js/components/repository/list-tag.directive.html index f74874a16..466e8c9b5 100644 --- a/static/ng/resources/js/components/repository/list-tag.directive.html +++ b/static/ng/resources/js/components/repository/list-tag.directive.html @@ -10,7 +10,7 @@ //tag// - + diff --git a/static/ng/resources/js/components/repository/list-tag.directive.js b/static/ng/resources/js/components/repository/list-tag.directive.js index 0ee834fab..63f9b759d 100644 --- a/static/ng/resources/js/components/repository/list-tag.directive.js +++ b/static/ng/resources/js/components/repository/list-tag.directive.js @@ -61,11 +61,18 @@ 'repoName': '=' }, 'replace': true, + 'link': link, 'controller': ListTagController, 'controllerAs': 'vm', 'bindToController': true }; return directive; + + function link(scope, element, attrs, ctrl) { + + } + + } })(); \ No newline at end of file diff --git a/static/ng/resources/js/components/repository/popup-details.directive.html b/static/ng/resources/js/components/repository/popup-details.directive.html index 7847270b2..ff8ee7593 100644 --- a/static/ng/resources/js/components/repository/popup-details.directive.html +++ b/static/ng/resources/js/components/repository/popup-details.directive.html @@ -1,4 +1,4 @@ - - + + - \ No newline at end of file + diff --git a/static/ng/resources/js/components/repository/popup-details.directive.js b/static/ng/resources/js/components/repository/popup-details.directive.js index 75766966a..6878b9338 100644 --- a/static/ng/resources/js/components/repository/popup-details.directive.js +++ b/static/ng/resources/js/components/repository/popup-details.directive.js @@ -10,8 +10,9 @@ function PopupDetailsController(ListManifestService, $filter, dateLFilter) { var vm = this; - + vm.retrieve = retrieve; + function retrieve() { ListManifestService(vm.repoName, vm.tag) .success(getManifestSuccess) @@ -35,7 +36,8 @@ 'templateUrl': '/static/ng/resources/js/components/repository/popup-details.directive.html', 'scope': { 'repoName': '@', - 'tag': '@' + 'tag': '@', + 'index': '@' }, 'link': link, 'controller': PopupDetailsController, @@ -46,21 +48,34 @@ function link(scope, element, attrs, ctrl) { ctrl.retrieve(); - scope.$watch('vm.manifest', function(current, origin) { + + scope.$watch('vm.manifest', function(current) { if(current) { - element.find('span').popover({ - 'content': generateContent, - 'html': true - }); + element + .popover({ + 'template': '', + 'title': '
', + 'content': generateContent, + 'html': true + }) + .on('shown.bs.popover', function(e){ + $('[type="text"]:input', element.parent()) + .select() + .end() + .on('click', function() { + $(this).select(); + }); + element.parent().find('.glyphicon.glyphicon-remove-circle').on('click', function() { + element.trigger('click'); + }); + }); } }); - function generateContent() { - var content = - '
' + + var content = '' + '
' + '' + - '

' + ctrl.manifest['Id'] + '

' + + '

' + '
' + '

' + ctrl.manifest['Parent'] + '

' + '
' +