← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/launchpad/add-help-initseries into lp:launchpad

 

Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/add-help-initseries into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #747384 in Launchpad itself: "+initseries page needs pop-up help"
  https://bugs.launchpad.net/launchpad/+bug/747384

For more details, see:
https://code.launchpad.net/~rvb/launchpad/add-help-initseries/+merge/58641

This branch adds 2 help pop-ups to the +initseries page.  It also adds ':' at the end of a few widget titles (drive by fix).

= Test =
(modified js test)
lib/lp/registry/javascript/tests/test_distroseries.html

= QA =
Make sure the page +initseries (e.g. https://launchpad.dev/deribuntu/deriwarty/+initseries) features the two pop-up help buttons.
-- 
https://code.launchpad.net/~rvb/launchpad/add-help-initseries/+merge/58641
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/add-help-initseries into lp:launchpad.
=== added file 'lib/lp/registry/help/init-series-packageset-help.html'
--- lib/lp/registry/help/init-series-packageset-help.html	1970-01-01 00:00:00 +0000
+++ lib/lp/registry/help/init-series-packageset-help.html	2011-04-21 09:08:32 +0000
@@ -0,0 +1,20 @@
+<html>
+  <head>
+    <title>Packagesets</title>
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssreset/reset.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssfonts/fonts.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssbase/base.css" />
+  </head>
+  <body>
+    <h1>Packagesets</h1>
+    <p>
+      Packages in a distribution are typically organized into groups of packages
+      that are termed "packagesets". Examples of these are those packages that form
+      the set required for a server installation, a desktop installation, or a
+      custom installation such as mythbuntu.
+    </p>
+  </body>
+</html>

=== added file 'lib/lp/registry/help/init-series-title-help.html'
--- lib/lp/registry/help/init-series-title-help.html	1970-01-01 00:00:00 +0000
+++ lib/lp/registry/help/init-series-title-help.html	2011-04-21 09:08:32 +0000
@@ -0,0 +1,23 @@
+<html>
+  <head>
+    <title>Series initialization</title>
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssreset/reset.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssfonts/fonts.css" />
+    <link rel="stylesheet" type="text/css"
+          href="/+icing/yui/cssbase/base.css" />
+  </head>
+  <body>
+    <h1>There are two ways to initialize a new series:</h1>
+    <ul>
+      <li>A continuation of a distribution with existing series. For example,
+      after the previous series was released you might want to open a new
+      development series by copying the previous one.
+      </li>
+      <li>A derived distribution series. This is where you have a new
+      distribution and you want to copy the packages form a series in a
+      different distribution.
+      </li>
+  </body>
+</html>

=== modified file 'lib/lp/registry/javascript/distroseries.js'
--- lib/lp/registry/javascript/distroseries.js	2011-03-29 20:13:28 +0000
+++ lib/lp/registry/javascript/distroseries.js	2011-04-21 09:08:32 +0000
@@ -58,6 +58,26 @@
         },
 
         /**
+         * A dictionary {link:link, text:text} to populate
+         * the pop-up help for the field.
+         *
+         * @property help
+         */
+        help: {
+            getter: function() {
+                return {link:this.helpNode.get("href"),
+                        text:this.helpNode
+                            .one('.invisible-link')
+                            .get("text")};
+            },
+            setter: function(value, name) {
+                this.helpNode.set("href", value.link);
+                this.helpNode.one('.invisible-link')
+                    .set("text", value.text);
+             }
+        },
+
+        /**
          * A description shown near the field.
          *
          * @label description
@@ -82,6 +102,9 @@
 
     initializer: function(config) {
         this.labelNode = Y.Node.create("<label />");
+        this.helpNode = Y.Node.create(('<a href=""' +
+            'target="help" class="sprite maybe">&nbsp;' +
+            '<span class="invisible-link"></span></a>'));
         this.fieldNode = Y.Node.create("<div></div>");
         this.descriptionNode = Y.Node.create('<p class="formHelp" />');
         this.spinnerNode = Y.Node.create(
@@ -89,10 +112,13 @@
     },
 
     renderUI: function() {
-        this.get("contentBox")
+        var node = this.get("contentBox")
             .append(this.labelNode)
             .append(this.fieldNode)
             .append(this.descriptionNode);
+        if (this.get('help').text != "") {
+            node.one('label').append(this.helpNode);
+        }
     },
 
     /**
@@ -743,7 +769,7 @@
     var architecture_choice =
         new ArchitecturesChoiceListWidget()
             .set("name", "field.architectures")
-            .set("label", "Architectures")
+            .set("label", "Architectures:")
             .set("description", (
                      "Choose the architectures you want to " +
                      "use from the parent series."))
@@ -752,8 +778,10 @@
         new PackagesetPickerWidget()
             .set("name", "field.packagesets")
             .set("size", 5)
+            .set("help", {link: '/+help/init-series-packageset-help.html',
+                          text: 'Packagesets help'})
             .set("multiple", true)
-            .set("label", "Package sets to copy from parent")
+            .set("label", "Package sets to copy from parent:")
             .set("description", (
                      "The package sets that will be imported " +
                      "into the derived distroseries."))
@@ -762,7 +790,7 @@
         new ChoiceListWidget()
             .set("name", "field.package_copy_options")
             .set("type", "radio")
-            .set("label", "Copy options")
+            .set("label", "Copy options:")
             .set("description", (
                      "Choose whether to rebuild all the sources you copy " +
                      "from the parent, or to copy their binaries too."))

=== modified file 'lib/lp/registry/javascript/tests/test_distroseries.js'
--- lib/lp/registry/javascript/tests/test_distroseries.js	2011-04-05 03:15:54 +0000
+++ lib/lp/registry/javascript/tests/test_distroseries.js	2011-04-21 09:08:32 +0000
@@ -99,7 +99,36 @@
                 this.container.one("p.formHelp").get("text"));
         },
 
-        testSpinner: function() {
+        testRenderHelp: function() {
+            this.widget.set("help",
+                {link: "http://test.com/test.html";, text: "Help text"});
+            this.widget.render(this.container);
+            Assert.areEqual(
+                "Help text",
+                this.container.one("a")
+                   .one('span.invisible-link').get("text"));
+            Assert.areEqual(
+                "http://test.com/test.html";,
+                this.container.one("a").get('href'));
+         },
+
+         testChangeHelp: function() {
+            this.widget.set("help",
+                {link: "http://test.com/test.html";, text: "Help text"});
+            this.widget.render(this.container);
+            this.widget.set(
+                "help",
+                {link: "http://test.com/test2.html";, text: "Help text2"});
+            Assert.areEqual(
+                "Help text2",
+                this.container.one("a")
+                    .one('span.invisible-link').get("text"));
+            Assert.areEqual(
+                "http://test.com/test2.html";,
+                this.container.one("a").get('href'));
+         },
+
+         testSpinner: function() {
             Assert.isFalse(
                 this.widget.fieldNode.contains(this.widget.spinnerNode));
             this.widget.showSpinner();

=== modified file 'lib/lp/registry/templates/distroseries-initialize.pt'
--- lib/lp/registry/templates/distroseries-initialize.pt	2011-03-29 19:05:34 +0000
+++ lib/lp/registry/templates/distroseries-initialize.pt	2011-04-21 09:08:32 +0000
@@ -15,6 +15,10 @@
       <tal:enabled condition="view/is_derived_series_feature_enabled">
       <div class="top-portlet">
         This page allows you to initialize a distribution series.
+        <a href="/+help/init-series-title-help.html"
+           target="help" class="sprite maybe">&nbsp;
+          <span class="invisible-link">Initialization help</span></a>
+
       </div>
       <p class="error message javascript-disabled">
         Javascript is required to use this page. Please enable