launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #33025
[Merge] ~finnrg/launchpad:feat/bazaar-banner into launchpad:master
Finn Gärtner has proposed merging ~finnrg/launchpad:feat/bazaar-banner into launchpad:master.
Commit message:
feat: Create a bazaar warning banner
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~finnrg/launchpad/+git/launchpad/+merge/493355
Creates a bazaar warning banner for bazaar project pages and the "All branches" page.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~finnrg/launchpad:feat/bazaar-banner into launchpad:master.
diff --git a/lib/lp/app/javascript/ui/assets/skins/sam/banner-skin.css b/lib/lp/app/javascript/ui/assets/skins/sam/banner-skin.css
index 97fdffc..aa44d39 100644
--- a/lib/lp/app/javascript/ui/assets/skins/sam/banner-skin.css
+++ b/lib/lp/app/javascript/ui/assets/skins/sam/banner-skin.css
@@ -1,13 +1,5 @@
/* JS Banner styling */
.yui3-banner {
- /* Default to not visible so we can fade in */
- opacity: 1;
-
- /* Animations for fade-in/out */
- -webkit-transition: opacity 0.3s ease-in;
- -moz-transition: opacity 0.3s ease-in;
- transition: opacity 0.3s ease-in;
-
width: 100%;
}
@@ -18,7 +10,7 @@
/* Nasty hack to get the bar moved since it's absolutely positioned
* This also needs to be updated
*/
-body.beta #locationbar, body.private #locationbar {
+body.beta #locationbar, body.private #locationbar, body.bazaar #locationbar {
padding-top: 47px;
}
@@ -26,6 +18,15 @@ body.beta #locationbar, body.private #locationbar {
body.beta.private #locationbar {
padding-top: 94px;
}
+body.beta.bazaar #locationbar {
+ padding-top: 94px;
+}
+body.private.bazaar #locationbar {
+ padding-top: 94px;
+}
+body.beta.private.bazaar #locationbar {
+ padding-top: 141px;
+}
/* Similarly, the banner content needs to be positioned appropriately. */
body.beta .yui3-banner-content.beta, body.private .yui3-banner-content.private {
@@ -39,8 +40,8 @@ body.beta.private .yui3-banner-content.private {
/* If the container exists make sure we start out with the rest of the page
* bumped down the starting distance to reduce flash effect
*/
-.beta_banner_container, .private_banner_container {
- min-height: 45px;
+.beta_banner_container, .private_banner_container, .bazaar_banner_container {
+ min-height: 37px;
}
.yui3-banner-content {
@@ -65,8 +66,8 @@ body.beta.private .yui3-banner-content.private {
height: 21px;
margin-right: 10px;
padding: 0;
- vertical-align: middle;
- width: 20px;
+ vertical-align: top;
+ width: 21px;
}
.yui3-banner-content .banner-content {}
@@ -119,3 +120,9 @@ body.beta.private .yui3-banner-content.private {
background: url(/@@/notification-private.png);
background-repeat: no-repeat;
}
+
+.yui3-banner-content.bazaar .badge {
+ background: url(/@@/info-large.png);
+ background-repeat: no-repeat;
+ background-size: 21px 21px;
+}
\ No newline at end of file
diff --git a/lib/lp/app/javascript/ui/banner.js b/lib/lp/app/javascript/ui/banner.js
index c5e5c9c..e4c65d8 100644
--- a/lib/lp/app/javascript/ui/banner.js
+++ b/lib/lp/app/javascript/ui/banner.js
@@ -15,6 +15,7 @@ YUI.add('lp.ui.banner', function (Y) {
// GLOBALS
ns.PRIVATE = 'private';
ns.BETA = 'beta';
+ ns.BAZAAR = 'bazaar';
/**
* Banner widget base class
@@ -316,6 +317,47 @@ YUI.add('lp.ui.banner', function (Y) {
}
});
+
+ /**
+ * Bazaar Banner widget
+ *
+ * This is the Private feature banner which is pretty basic.
+ *
+ * Note that this doesn't automatically follow the information type code.
+ * Nor does it listen to the choice widgets and try to update. It's purely
+ * meant to function as told to do so. Most of the work around making sure
+ * the banner shows and works properly is in the View code in global.js.
+ *
+ * @class PrivateBanner
+ * @extends Banner
+ *
+ */
+ ns.BazaarBanner = Y.Base.create('banner', ns.Banner, [], {
+
+ }, {
+ ATTRS: {
+ badge_text: {
+ value: ''
+ },
+
+ content: {
+ value: 'Launchpad will phase out support for Bazaar soon. Active projects should be migrated to Git.'
+ },
+
+ /**
+ * Manually force the banner type so users don't need to set it.
+ * This is a private banner class.
+ *
+ * @attribute banner_type
+ * @default PRIVATE
+ * @type {String}
+ */
+ banner_type: {
+ value: ns.BAZAAR
+ }
+ }
+ });
+
}, '0.1', {
requires: ['base', 'node', 'anim', 'widget', 'lp.mustache', 'yui-log']
});
diff --git a/lib/lp/app/javascript/views/global.js b/lib/lp/app/javascript/views/global.js
index be3eea9..677fe84 100644
--- a/lib/lp/app/javascript/views/global.js
+++ b/lib/lp/app/javascript/views/global.js
@@ -120,6 +120,17 @@ YUI.add('lp.views.global', function (Y) {
that._private_banner.show();
});
}
+
+ var is_bazaar = Y.one('.bazaar_banner_container');
+ if (is_bazaar) {
+ that._bazaar_banner = new ui.banner.BazaarBanner();
+ that._bazaar_banner.render(is_bazaar);
+ // We delay the show until the page is ready so we get our
+ // pretty css3 animation that distracts the user a bit.
+ Y.on('load', function (ev) {
+ that._bazaar_banner.show();
+ });
+ }
},
initialize: function (cfg) {},
diff --git a/lib/lp/app/templates/base-layout.pt b/lib/lp/app/templates/base-layout.pt
index 4ddb539..c4a163e 100644
--- a/lib/lp/app/templates/base-layout.pt
+++ b/lib/lp/app/templates/base-layout.pt
@@ -102,6 +102,11 @@
<noscript><strong>The information on this page is private.</strong></noscript>
</div>
</tal:private-banner>
+ <tal:bazaar-banner condition="view/is_bazaar">
+ <div class="bazaar_banner_container">
+ <noscript><strong>The information on this page is private.</strong></noscript>
+ </div>
+ </tal:bazaar-banner>
<div class="yui-d0">
<div id="locationbar" class="login-logout">
<tal:login replace="structure context/@@login_status" />
diff --git a/lib/lp/code/browser/branch.py b/lib/lp/code/browser/branch.py
index 7d8d870..2969261 100644
--- a/lib/lp/code/browser/branch.py
+++ b/lib/lp/code/browser/branch.py
@@ -394,6 +394,7 @@ class BranchView(
def initialize(self):
super().initialize()
+ self._is_bazaar = True
self.branch = self.context
self.notices = []
# Cache permission so private team owner can be rendered.
diff --git a/lib/lp/code/browser/branchlisting.py b/lib/lp/code/browser/branchlisting.py
index d532057..9b59b28 100644
--- a/lib/lp/code/browser/branchlisting.py
+++ b/lib/lp/code/browser/branchlisting.py
@@ -500,6 +500,10 @@ class BranchListingView(LaunchpadFormView, FeedsMixin):
# that they should link to.
can_have_git_link = False
+ def initialize(self):
+ self._is_bazaar = True
+ return super().initialize()
+
@property
def show_git_link(self):
if not self.can_have_git_link:
diff --git a/lib/lp/services/webapp/publisher.py b/lib/lp/services/webapp/publisher.py
index 18aca49..e6ec36a 100644
--- a/lib/lp/services/webapp/publisher.py
+++ b/lib/lp/services/webapp/publisher.py
@@ -268,7 +268,6 @@ class LaunchpadView(UserAttributeCache):
@property
def private(self):
- """A view is private if its context is."""
privacy = IPrivacy(self.context, None)
if privacy is not None:
return privacy.private
@@ -276,6 +275,11 @@ class LaunchpadView(UserAttributeCache):
return False
@property
+ def is_bazaar(self):
+ """A view is private if its context is."""
+ return getattr(self, "_is_bazaar", False)
+
+ @property
def information_type(self):
"""A view has the information_type of its context."""
information_typed = IInformationType(self.context, None)
Follow ups