From c466bca32d79dcea6c013f1dd65dc459541402d1 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 27 Sep 2013 16:12:51 -0400 Subject: [PATCH] Add clipboard copy support for the pull command --- static/css/quay.css | 20 +++++++++++++++++--- static/js/ZeroClipboard.min.js | 8 ++++++++ static/js/ZeroClipboard.swf | Bin 0 -> 1635 bytes static/js/app.js | 2 +- static/js/controllers.js | 2 ++ static/partials/view-repo.html | 12 +++++++++++- templates/index.html | 2 ++ 7 files changed, 41 insertions(+), 5 deletions(-) create mode 100755 static/js/ZeroClipboard.min.js create mode 100755 static/js/ZeroClipboard.swf diff --git a/static/css/quay.css b/static/css/quay.css index 153351ffe..409ebad1c 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -11,6 +11,10 @@ display: none; } +p.editable { + display: inline-block; +} + p.editable .content:empty:after { display: inline-block; content: "(Click to add)"; @@ -67,19 +71,29 @@ p.editable:hover i { .repo .pull-command { float: right; display: inline-block; -} - -.repo .pull-command { font-size: 1.2em; } +.repo .pull-command .pull-container { + display: inline-block; + width: 300px; + margin-right: 10px; + vertical-align: middle; +} + .repo .pull-command input { + cursor: default; + background: white; color: #666; padding: 4px; border: 1px solid #ddd; width: 300px; } +.repo #copyClipboard { + cursor: pointer; +} + .repo .settings-cog { margin-left: 20px; } diff --git a/static/js/ZeroClipboard.min.js b/static/js/ZeroClipboard.min.js new file mode 100755 index 000000000..32535fddf --- /dev/null +++ b/static/js/ZeroClipboard.min.js @@ -0,0 +1,8 @@ +/*! + * zeroclipboard + * The Zero Clipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie, and a JavaScript interface. + * Copyright 2012 Jon Rohan, James M. Greene, . + * Released under the MIT license + * http://jonrohan.github.com/ZeroClipboard/ + * v1.1.7 + */(function(){"use strict";var a=function(a,b){var c=a.style[b];a.currentStyle?c=a.currentStyle[b]:window.getComputedStyle&&(c=document.defaultView.getComputedStyle(a,null).getPropertyValue(b));if(c=="auto"&&b=="cursor"){var d=["a"];for(var e=0;e=0?"&":"?")+"nocache="+(new Date).getTime()},i=function(a){var b=[];return a.trustedDomains&&(typeof a.trustedDomains=="string"?b.push("trustedDomain="+a.trustedDomains):b.push("trustedDomain="+a.trustedDomains.join(","))),b.join("&")},j=function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c ';b=document.createElement("div"),b.id="global-zeroclipboard-html-bridge",b.setAttribute("class","global-zeroclipboard-container"),b.setAttribute("data-clipboard-ready",!1),b.style.position="absolute",b.style.left="-9999px",b.style.top="-9999px",b.style.width="15px",b.style.height="15px",b.style.zIndex="9999",b.innerHTML=c,document.body.appendChild(b)}a.htmlBridge=b,a.flashBridge=document["global-zeroclipboard-flash-bridge"]||b.children[0].lastElementChild};l.prototype.resetBridge=function(){this.htmlBridge.style.left="-9999px",this.htmlBridge.style.top="-9999px",this.htmlBridge.removeAttribute("title"),this.htmlBridge.removeAttribute("data-clipboard-text"),f(m,this.options.activeClass),m=null,this.options.text=null},l.prototype.ready=function(){var a=this.htmlBridge.getAttribute("data-clipboard-ready");return a==="true"||a===!0},l.prototype.reposition=function(){if(!m)return!1;var a=g(m);this.htmlBridge.style.top=a.top+"px",this.htmlBridge.style.left=a.left+"px",this.htmlBridge.style.width=a.width+"px",this.htmlBridge.style.height=a.height+"px",this.htmlBridge.style.zIndex=a.zIndex+1,this.setSize(a.width,a.height)},l.dispatch=function(a,b){l.prototype._singleton.receiveEvent(a,b)},l.prototype.on=function(a,b){var c=a.toString().split(/\s/g);for(var d=0;d<|i+I>}9Z`;@rK0}c_ByHJ}?I?+JQ#Rf>o5+@IXOp$p(Z-Ri zjT772`m$RD392LV(Bg(7Rg&_hFAWOxAN0NGOaDNhi~fKD1)ZSidmk2k>@TQ0hg5vo zE=owlnQtyU^UY8?B=SEA8Tlh2SAf*>R|z4%9{(#4vK(0U(pJ4uJnXt&xP;b|=}r{& zmdfRWgM-h(sVY9a1 zkDg3V52{+`Y0+LkaFddjS>`V9axV(YbF*_;$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! zv=^4gKlNo5}D1^E12w0geG*f|H4sc!7VmEvzrxwO`LWIx`8cbR`2 zi(z~?w!dJDD3{omD3{rjDPk(`e`Bh-aYFRA+E#92+K0CMzAf8TR-IRs{0}E5nyM)u zp5yLF_)v&NUi0)~{)jnM({70UPQDZ)b%ZqJ>#!bvMrX{}UR&nm52 hrB$!AH2nOW+(@nt#n7>F@%Mf4Z~ZAE{{=lE$MA>_KQRCR literal 0 HcmV?d00001 diff --git a/static/js/app.js b/static/js/app.js index 6b3679f55..195c47a6c 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -45,4 +45,4 @@ quayApp.run(['$location', '$rootScope', function($location, $rootScope) { $rootScope.title = current.$$route.title; } }); -}]); \ No newline at end of file +}]); diff --git a/static/js/controllers.js b/static/js/controllers.js index 2b6d73aef..f99c4fb9c 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -43,6 +43,8 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope) { $rootScope.title = namespace + '/' + name; $scope.repo = repo; $scope.currentTag = repo.tags[tag] || repo.tags['latest']; + + var clip = new ZeroClipboard($('#copyClipboard'), { 'moviePath': 'static/js/ZeroClipboard.swf' }); }, function() { $scope.repo = null; $rootScope.title = 'Unknown Repository'; diff --git a/static/partials/view-repo.html b/static/partials/view-repo.html index e9c5c2eb2..4b4932bd5 100644 --- a/static/partials/view-repo.html +++ b/static/partials/view-repo.html @@ -17,10 +17,20 @@
- Get this repository: + Get this repository: + +
+
+ + + + +
+
+

{{repo.description}}

diff --git a/templates/index.html b/templates/index.html index 9c489601e..17b84f58a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,6 +21,8 @@ + +