Bayard 'kit' Randel has proposed merging lp:~blr/launchpad/ui-setbranch-git into lp:launchpad.
Commit message: Add tabview macro for both git and bzr push instructions. Requested reviews: William Grant (wgrant) Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~blr/launchpad/ui-setbranch-git/+merge/258146 * Add a new metal macro using the yui3 tabview for both git and bzr push instructions. * Add git scm logo sprites. * Cleanup lintiness in productseries-setbranch.js Screenshots =========== http://i.imgur.com/xJ70Z0K.png http://i.imgur.com/wQpcQXj.png -- Your team Launchpad code reviewers is requested to review the proposed merge of lp:~blr/launchpad/ui-setbranch-git into lp:launchpad.
=== added file 'lib/canonical/launchpad/icing/css/components/yui_tabview.css' --- lib/canonical/launchpad/icing/css/components/yui_tabview.css 1970-01-01 00:00:00 +0000 +++ lib/canonical/launchpad/icing/css/components/yui_tabview.css 2015-05-04 05:21:44 +0000 @@ -0,0 +1,112 @@ +/* +YUI 3.10.3 (build 2fb5187) +Copyright 2013 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +http://yuilibrary.com/license/ +*/ + +.yui3-tab-panel { + display: none; + } + +.yui3-tab-panel-selected { + display: block; + } + +.yui3-tabview-list, +.yui3-tab { + margin: 0; + padding: 0; + list-style: none; + } + +.yui3-tabview { + position: relative; + } + +.yui3-tabview, +.yui3-tabview-list, +.yui3-tabview-panel, +.yui3-tab, +.yui3-tab-panel { + zoom: 1; + } + +.yui3-tab { + display: inline-block; + *display: inline; + vertical-align: bottom; + cursor: pointer; + } + +.yui3-tab-label { + display: block; + display: inline-block; + padding: 6px 10px; + position: relative; + text-decoration: none; + vertical-align: bottom; + } + +.yui3-skin-sam .yui3-tabview-list { + zoom: 1; + } + +.yui3-skin-sam .yui3-tab { + margin: 0 .2em 0 0; + padding: 1px 0 0; + zoom: 1; + } + +.yui3-skin-sam .yui3-tab-selected { + margin-bottom: -1px; + } + +.yui3-skin-sam .yui3-tab-label { + background: #d8d8d8 url(../../../../assets/skins/sam/sprite.png) repeat-x; + border: solid #a3a3a3; + border-width: 1px 1px 0 1px; + color: #000; + cursor: pointer; + font-size: 85%; + padding: .3em .75em; + text-decoration: none; + border-radius: 5px 5px 0 0; + } + +.yui3-skin-sam .yui3-tab-label:hover, +.yui3-skin-sam .yui3-tab-label:focus { + background: #bfdaff url(../../../../assets/skins/sam/sprite.png) repeat-x left -1300px; + outline: 0; + } + +.yui3-skin-sam .yui3-tab-selected .yui3-tab-label, +.yui3-skin-sam .yui3-tab-selected .yui3-tab-label:focus, +.yui3-skin-sam .yui3-tab-selected .yui3-tab-label:hover { + background: #fbfbfb url(../../../../assets/skins/sam/sprite.png) repeat-x left -1400px; + color: #333; + font-weight: bold; + } + +.yui3-skin-sam .yui3-tab-selected .yui3-tab-label { + padding: .4em .75em; + } + +.yui3-skin-sam .yui3-tab-selected .yui3-tab-label { + border-color: #808080; + } + +.yui3-skin-sam .yui3-tabview-panel { + background: #fbfbfb; + border-radius: 0px 3px 3px 3px; + } + +.yui3-skin-sam .yui3-tabview-panel { + border: 1px solid #808080; + border-top-color: #243356; + padding: 1em .5em; + } + +#yui3-css-stamp.skin-sam-tabview { + display: none; + } === modified file 'lib/canonical/launchpad/icing/inline-sprites-1.css.in' --- lib/canonical/launchpad/icing/inline-sprites-1.css.in 2015-03-24 13:36:23 +0000 +++ lib/canonical/launchpad/icing/inline-sprites-1.css.in 2015-05-04 05:21:44 +0000 @@ -85,6 +85,10 @@ background-image: url(/@@/branch.png); /* sprite-ref: icon-sprites */ background-repeat: no-repeat; } +.gitbranch { + background-image: url(/@@/gitbranch.png); /* sprite-ref: icon-sprites */ + background-repeat: no-repeat; + } .distribution { background-image: url(/@@/distribution.png); /* sprite-ref: icon-sprites */ background-repeat: no-repeat; === modified file 'lib/canonical/launchpad/icing/style.css' --- lib/canonical/launchpad/icing/style.css 2015-04-07 23:43:43 +0000 +++ lib/canonical/launchpad/icing/style.css 2015-05-04 05:21:44 +0000 @@ -538,16 +538,50 @@ /* --- Code --- */ +code.command { + background-color: #FFF; + border: 1px solid #ddd; + border-radius: 3px; + box-sizing: border-box; + color: #626262; + padding: 4px; + font-family: "DejaVu Sans Mono", "Courier New", monospace; + font-size: 1.05em; +} + +code.command-block { + display: block; + margin-bottom: 1em; + padding: 6px; +} + +div.scm-tip { + margin-bottom: 1em; + box-sizing: border-box; + overflow: hidden; + padding: 5px; +} + +div.scm-tip:after { + clear: left; +} + +div#push-instructions-tab { + width: 750px; +} + table.code { - margin-bottom: 1em; - } + margin-bottom: 1em; +} + table.code th { - text-align: left; - font-weight: bold; - } + text-align: left; + font-weight: bold; +} + table.code th, table.code td { - padding-right: 3em; - } + padding-right: 3em; +} .branch-no-dev-focus { background: #FFF59C; === added file 'lib/canonical/launchpad/images/gitbranch-large.png' Binary files lib/canonical/launchpad/images/gitbranch-large.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/gitbranch-large.png 2015-05-04 05:21:44 +0000 differ === added file 'lib/canonical/launchpad/images/gitbranch.png' Binary files lib/canonical/launchpad/images/gitbranch.png 1970-01-01 00:00:00 +0000 and lib/canonical/launchpad/images/gitbranch.png 2015-05-04 05:21:44 +0000 differ === modified file 'lib/lp/code/javascript/productseries-setbranch.js' --- lib/lp/code/javascript/productseries-setbranch.js 2012-07-02 12:50:33 +0000 +++ lib/lp/code/javascript/productseries-setbranch.js 2015-05-04 05:21:44 +0000 @@ -12,77 +12,92 @@ var module = Y.namespace('lp.code.productseries_setbranch'); module._get_selected_rcs = function() { - var rcs_types = module._rcs_types(); - var selected = 'None'; - for (var i = 0; i < rcs_types.length; i++) { - if (rcs_types[i].checked) { - selected = rcs_types[i].value; - break; - } - } - return selected; + var rcs_types = module._rcs_types(); + var selected = 'None'; + var i; + for (i = 0; i < rcs_types.length; i++) { + if (rcs_types[i].checked) { + selected = rcs_types[i].value; + break; + } + } + return selected; }; module.__rcs_types = null; module._rcs_types = function() { - if (module.__rcs_types === null) { - module.__rcs_types = document.getElementsByName('field.rcs_type'); - } - return module.__rcs_types; + if (module.__rcs_types === null) { + module.__rcs_types = document.getElementsByName('field.rcs_type'); + } + return module.__rcs_types; }; module.set_enabled = function(field_id, is_enabled) { - var field = Y.DOM.byId(field_id); - field.disabled = !is_enabled; + var field = Y.DOM.byId(field_id); + field.disabled = !is_enabled; }; module.onclick_rcs_type = function(e) { - /* Which rcs type radio button has been selected? */ - // CVS - var rcs_types = module._rcs_types(); - var selectedRCS = module._get_selected_rcs(); - module.set_enabled('field.cvs_module', selectedRCS == 'CVS'); + /* Which rcs type radio button has been selected? */ + // CVS + var rcs_types = module._rcs_types(); + var selectedRCS = module._get_selected_rcs(); + module.set_enabled('field.cvs_module', selectedRCS === 'CVS'); }; module.onclick_branch_type = function(e) { - /* Which branch type radio button was selected? */ - var selectedRCS = module._get_selected_rcs(); - var types = document.getElementsByName('field.branch_type'); - var type = 'None'; - for (var i = 0; i < types.length; i++) { - if (types[i].checked) { - type = types[i].value; - break; - } - } - // Linked - module.set_enabled('field.branch_location', type == 'link-lp-bzr'); - module.set_enabled('field.branch_name', type != 'link-lp-bzr'); - module.set_enabled('field.branch_owner', type != 'link-lp-bzr'); - // New, empty branch. - // Import - var is_external = (type == 'import-external'); - module.set_enabled('field.repo_url', is_external); - module.set_enabled('field.cvs_module', - (is_external & selectedRCS == 'CVS')); - var rcs_types = module._rcs_types(); - for (var j = 0; j < rcs_types.length; j++) { - rcs_types[j].disabled = !is_external; - } + /* Which branch type radio button was selected? */ + var selectedRCS = module._get_selected_rcs(); + var types = document.getElementsByName('field.branch_type'); + var type = 'None'; + var i; + for (i = 0; i < types.length; i++) { + if (types[i].checked) { + type = types[i].value; + break; + } + } + // Linked + module.set_enabled('field.branch_location', type === 'link-lp-bzr'); + module.set_enabled('field.branch_name', type !== 'link-lp-bzr'); + module.set_enabled('field.branch_owner', type !== 'link-lp-bzr'); + // New, empty branch. + // Import + var is_external = (type === 'import-external'); + module.set_enabled('field.repo_url', is_external); + module.set_enabled('field.cvs_module', + (is_external & selectedRCS === 'CVS')); + var rcs_types = module._rcs_types(); + var j; + for (j = 0; j < rcs_types.length; j++) { + rcs_types[j].disabled = !is_external; + } + }; + + module.renderTabs = function() { + console.log('rendering tabs'); + console.log(Y); + var tabview = new Y.TabView({ + srcNode: '#push-instructions-tab' + }); + console.log(tabview); + tabview.render(); }; module.setup = function() { - Y.all('input[name="field.rcs_type"]').on( - 'click', module.onclick_rcs_type); - Y.all('input[name="field.branch_type"]').on( - 'click', module.onclick_branch_type); - - // Set the initial state. - module.onclick_rcs_type(); - module.onclick_branch_type(); + Y.all('input[name="field.rcs_type"]').on( + 'click', module.onclick_rcs_type); + Y.all('input[name="field.branch_type"]').on( + 'click', module.onclick_branch_type); + + // Set the initial state. + module.onclick_rcs_type(); + module.onclick_branch_type(); + + module.renderTabs(); }; - }, "0.1", {"requires": ["node", "DOM"]} -); +}, "0.1", {"requires": ["node", "DOM", "tabview"]} + ); === modified file 'lib/lp/code/templates/product-branch-summary.pt' --- lib/lp/code/templates/product-branch-summary.pt 2012-10-08 02:02:19 +0000 +++ lib/lp/code/templates/product-branch-summary.pt 2015-05-04 05:21:44 +0000 @@ -97,19 +97,9 @@ </tal:has-branches> <tal:has-user condition="view/user"> - <p id="push-instructions" - tal:condition="not: context/codehosting_usage/enumvalue:UNKNOWN"> - You can push the branch directly to Launchpad with the command:<br /> - <tt class="command"> - bzr push lp:~<tal:user replace="view/user/name"/>/<tal:project replace="context/name"/>/<tal:series replace="context/name"/> - </tt> - <tal:no-keys condition="not:view/user/sshkeys"> - <br/>To authenticate with the Launchpad branch upload service, - you need to - <a tal:attributes="href string:${view/user/fmt:url}/+editsshkeys"> - register a SSH key</a>. - </tal:no-keys> - </p> + <div tal:condition="not: context/codehosting_usage/enumvalue:UNKNOWN"> + <div metal:use-macro="context/@@+productseries-macros/push-instructions"></div> + </div> </tal:has-user> <div tal:condition="context/codehosting_usage/enumvalue:UNKNOWN"> === modified file 'lib/lp/registry/browser/configure.zcml' --- lib/lp/registry/browser/configure.zcml 2015-02-27 01:11:06 +0000 +++ lib/lp/registry/browser/configure.zcml 2015-05-04 05:21:44 +0000 @@ -1722,6 +1722,13 @@ template="../templates/productseries-setbranch.pt" permission="launchpad.Edit"/> <browser:page + name="+productseries-macros" + for="*" + class="lp.app.browser.launchpad.Macro" + permission="zope.Public" + template="../templates/productseries-macros.pt" + /> + <browser:page name="+review" for="lp.registry.interfaces.productseries.IProductSeries" class="lp.registry.browser.productseries.ProductSeriesReviewView" === added file 'lib/lp/registry/templates/productseries-macros.pt' --- lib/lp/registry/templates/productseries-macros.pt 1970-01-01 00:00:00 +0000 +++ lib/lp/registry/templates/productseries-macros.pt 2015-05-04 05:21:44 +0000 @@ -0,0 +1,42 @@ +<tal:root + xmlns:tal="http://xml.zope.org/namespaces/tal" + xmlns:metal="http://xml.zope.org/namespaces/metal" + xmlns:i18n="http://xml.zope.org/namespaces/i18n" + omit-tag=""> + + <div metal:define-macro="push-instructions" id="push-instructions" class="yui3-skin-sam"> + <div id="push-instructions-tab" class="yui3-tabview"> + <ul> + <li><a href="#push-instructions-git"><i class="sprite gitbranch"></i>git</a></li> + <li><a href="#push-instructions-bzr"><i class="sprite branch"></i>bzr</a></li> + </ul> + <div> + <div id="push-instructions-git" class="scm-tip"> + <p>You can add a remote for your git branch with the command:</p> + <code class="command command-block"> + git remote add origin git+ssh://<tal:user replace="view/user/name"/>@git.launchpad.net/~<tal:user replace="view/user/name"/>/<tal:project replace="context/product/name"/>/master<br /> + </code> + <p>… and push the git branch to Launchpad with:</p> + <code class="command command-block"> + git push origin master + </code> + </div> + <div id="#push-instructions-bzr" class="scm-tip"> + <p>You can push a Bazaar branch directly to Launchpad with the command:</p> + <p> + <code class="command command-block"> + bzr push lp:~<tal:user replace="view/user/name"/>/<tal:project replace="context/product/name"/>/<tal:series replace="context/name"/> + </code> + </p> + </div> + </div> + + <tal:no-keys condition="not:view/user/sshkeys"> + <p>To authenticate with the Launchpad branch upload service, + you need to + <a tal:attributes="href string:${view/user/fmt:url}/+editsshkeys"> + register a SSH key</a>.</p> + </tal:no-keys> + </div> + </div> +</tal:root> === modified file 'lib/lp/registry/templates/productseries-setbranch.pt' --- lib/lp/registry/templates/productseries-setbranch.pt 2012-10-09 01:07:52 +0000 +++ lib/lp/registry/templates/productseries-setbranch.pt 2015-05-04 05:21:44 +0000 @@ -17,20 +17,11 @@ </metal:block> <div metal:fill-slot="main"> - - <p id="push-instructions"> - You can push the branch directly to Launchpad with the command:<br /> - <tt class="command"> - bzr push lp:~<tal:user replace="view/user/name"/>/<tal:project replace="context/product/name"/>/<tal:series replace="context/name"/> - </tt> - <tal:no-keys condition="not:view/user/sshkeys"> - <br/>To authenticate with the Launchpad branch upload service, - you need to - <a tal:attributes="href string:${view/user/fmt:url}/+editsshkeys"> - register a SSH key</a>. - </tal:no-keys> - </p> - + + <h3>Push Instructions</h3> + <div metal:use-macro="context/@@+productseries-macros/push-instructions"></div> + + <h3>Branch Settings</h3> <div metal:use-macro="context/@@launchpad_form/form"> <metal:formbody fill-slot="widgets">
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp

