Merge lp:~deadlight/canonical-identity-provider/core-vanilla-templates into lp:~deadlight/canonical-identity-provider/vanilla

Proposed by Karl Williams
Status: Merged
Approved by: Karl Williams
Approved revision: 1689
Merge reported by: Karl Williams
Merged at revision: not available
Proposed branch: lp:~deadlight/canonical-identity-provider/core-vanilla-templates
Merge into: lp:~deadlight/canonical-identity-provider/vanilla
Prerequisite: lp:~deadlight/canonical-identity-provider/add-vanilla-and-sass
Diff against target: 396 lines (+298/-51)
6 files modified
src/identityprovider/static_src/scss/styles.scss (+8/-0)
src/webui/templates/static/ubuntuone-account.html (+33/-51)
src/webui/templates/vanilla/_footer.html (+28/-0)
src/webui/templates/vanilla/_header.html (+32/-0)
src/webui/templates/vanilla/base.html (+179/-0)
src/webui/templates/vanilla/widgets/header-me-menu.html (+18/-0)
To merge this branch: bzr merge lp:~deadlight/canonical-identity-provider/core-vanilla-templates
Reviewer Review Type Date Requested Status
Anthony Dillon (community) Approve
Review via email: mp+370201@code.launchpad.net

Description of the change

Added a base template with vanilla styling and converted the "Your Ubuntu One account" page as a test.

NOTE: the site header/navigation is not yet complete

----

QA:

- ./node_modules/gulp/bin/gulp.js sass
- make start-db run
- Go to [HOSTNAME]:8000/+ubuntuone-account

To post a comment you must log in.
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Looking good, few questions in the code.

review: Needs Information
Revision history for this message
Karl Williams (deadlight) wrote :

I've left a few classes in that Vanilla doesn't use mostly because I'm not sure if any of them are used by JS in other places. BUT, since we're doing this page-by-page, I guess I can remove them and then wait and see if pages get an error as they come up.

1689. By Karl Williams

Remove old classes. Use vanilla notification patter for notifications and messages.

Revision history for this message
Karl Williams (deadlight) wrote :

Ant: I've cleaned out all of the unused classes. Some might be required later but I can revert/add new features when we get to those pages.

Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

Thanks +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/identityprovider/static_src/scss/styles.scss'
2--- src/identityprovider/static_src/scss/styles.scss 2019-07-16 13:03:58 +0000
3+++ src/identityprovider/static_src/scss/styles.scss 2019-07-17 13:42:18 +0000
4@@ -4,6 +4,14 @@
5
6 @import 'vanilla-framework/scss/build';
7
8+.p-navigation .row {
9+ justify-content: space-between;
10+}
11+
12+.p-navigation__nav {
13+ width: auto;
14+}
15+
16 .p-cip-hero {
17 background-image: linear-gradient(212deg, #E95420 0%, #C44631 6%, #A33940 12%, #8B304A 18%, #7C2B51 24%, #772953 29%, #55163B 51%, #370626 75%, #2C001E 100%);
18 }
19
20=== modified file 'src/webui/templates/static/ubuntuone-account.html'
21--- src/webui/templates/static/ubuntuone-account.html 2014-07-30 16:35:52 +0000
22+++ src/webui/templates/static/ubuntuone-account.html 2019-07-17 13:42:18 +0000
23@@ -1,4 +1,4 @@
24-{% extends "base.html" %}
25+{% extends "vanilla/base.html" %}
26 {% load i18n %}
27 {% load static_url %}
28
29@@ -13,56 +13,38 @@
30
31 {% block menu %}{% endblock %}
32
33-{% block text_title %}<h1 class="u1-h-main">{% trans "Your Ubuntu One account" %}</h1>{% endblock %}
34+{% block text_title %}<h1>{% trans "Your Ubuntu One account" %}</h1>{% endblock %}
35
36 {% block content %}
37-<div class="yui3-g-r">
38-
39- <div class="yui3-u-1-2 account-information">
40-
41- <h3>{% trans "One account to log in to everything on Ubuntu" %}</h3>
42-
43- <p>
44- {% blocktrans %}Ubuntu One is the single account you use to log in to
45- all services and sites related to Ubuntu.{% endblocktrans %}
46- </p>
47-
48- <h3>{% trans "Already have an SSO account?" %}</h3>
49-
50- <p>
51- {% blocktrans %}You can use your existing Ubuntu single sign on or
52- Launchpad credentials to log in. Your Ubuntu single sign on account is
53- now called your Ubuntu One account.{% endblocktrans %}
54- </p>
55- </div>
56-
57- <div class="yui3-u-1-3 account-faq">
58-
59- <div class="box">
60- <div class="title">
61- <h3>Account FAQ</h3>
62- </div>
63-
64- <div class="body">
65- <ul class="questions">
66- <li><a href="{% url 'faq' %}#what-is-an-ubuntu-one-account">{% trans "What is an Ubuntu One account?" %}</a></li>
67- <li><a href="{% url 'faq' %}#how-can-i-update-my-ubuntu-one-email-address">{% trans "How can I update my Ubuntu One e-mail address?" %}</a></li>
68- <li><a href="{% url 'faq' %}#i-never-received-my-ubuntu-one-verification-code-now-what">{% trans "I never received my Ubuntu One verification code. Now what?" %}</a></li>
69- <li><a href="{% url 'faq' %}#how-do-i-recover-or-change-my-ubuntu-one-password">{% trans "How do I recover or change my Ubuntu One password?" %}</a></li>
70- <li><a href="{% url 'faq' %}#can-i-delete-my-ubuntu-one-account">{% trans "Can I delete my Ubuntu One account?" %}</a></li>
71- </ul>
72-
73- <p class="more-help">
74- {% url 'faq' as faq_url %}
75- {% blocktrans with email='isd-support@canonical.com' %}
76- <a href="{{ faq_url }}">View all FAQs</a> or email support at <a href="mailto:{{ email }}">{{ email }}</a>
77- {% endblocktrans %}
78- </div>
79-
80- </div>
81-
82- </div>
83-
84-</div>
85-
86+<section class="p-strip">
87+ <div class="row">
88+ <div class="col-8">
89+ <h3>{% trans "One account to log in to everything on Ubuntu" %}</h3>
90+ <p>{% blocktrans %}Ubuntu One is the single account you use to log in to
91+ all services and sites related to Ubuntu.{% endblocktrans %}</p>
92+ <h3>{% trans "Already have an SSO account?" %}</h3>
93+ <p>{% blocktrans %}You can use your existing Ubuntu single sign on or
94+ Launchpad credentials to log in. Your Ubuntu single sign on account is
95+ now called your Ubuntu One account.{% endblocktrans %}</p>
96+ </div>
97+ <div class="col-4">
98+ <div class="p-card">
99+ <h3>Account FAQ</h3>
100+ <ul class="p-list--divided">
101+ <li class="p-list__item"><a href="{% url 'faq' %}#what-is-an-ubuntu-one-account">{% trans "What is an Ubuntu One account?" %}</a></li>
102+ <li class="p-list__item"><a href="{% url 'faq' %}#how-can-i-update-my-ubuntu-one-email-address">{% trans "How can I update my Ubuntu One e-mail address?" %}</a></li>
103+ <li class="p-list__item"><a href="{% url 'faq' %}#i-never-received-my-ubuntu-one-verification-code-now-what">{% trans "I never received my Ubuntu One verification code. Now what?" %}</a></li>
104+ <li class="p-list__item"><a href="{% url 'faq' %}#how-do-i-recover-or-change-my-ubuntu-one-password">{% trans "How do I recover or change my Ubuntu One password?" %}</a></li>
105+ <li class="p-list__item"><a href="{% url 'faq' %}#can-i-delete-my-ubuntu-one-account">{% trans "Can I delete my Ubuntu One account?" %}</a></li>
106+ </ul>
107+ <p>
108+ {% url 'faq' as faq_url %}
109+ {% blocktrans with email='isd-support@canonical.com' %}
110+ <a href="{{ faq_url }}">View all FAQs</a> or email support at <a href="mailto:{{ email }}">{{ email }}</a>
111+ {% endblocktrans %}
112+ </p>
113+ </div>
114+ </div>
115+ </div>
116+</section>
117 {% endblock %}
118
119=== added directory 'src/webui/templates/vanilla'
120=== added file 'src/webui/templates/vanilla/_footer.html'
121--- src/webui/templates/vanilla/_footer.html 1970-01-01 00:00:00 +0000
122+++ src/webui/templates/vanilla/_footer.html 2019-07-17 13:42:18 +0000
123@@ -0,0 +1,28 @@
124+{% load i18n static_url %}
125+
126+{% comment %}
127+Copyright 2010 Canonical Ltd. This software is licensed under the
128+GNU Affero General Public License version 3 (see the file LICENSE).
129+{% endcomment %}
130+
131+<footer class="p-strip" data-qa-id="ubuntuone_footer">
132+ <hr>
133+ <div class="row">
134+ <p>{% trans "Ubuntu One. One place to log in to everything on Ubuntu." %}</p>
135+ {% spaceless %}
136+ <ul class="p-inline-list--middot">
137+ <li class="p-inline-list__item"><a href="{{ 'terms_of_service'|static_url }}">{% trans "Terms" %}</a></li>
138+ <li class="p-inline-list__item"><a href="{{ 'privacy_policy'|static_url }}">{% trans "Canonical privacy notice" %}</a></li>
139+ <li class="p-inline-list__item"><a href="{{ 'privacy_notice'|static_url }}">{% trans "SSO privacy notice" %}</a></li>
140+ <li class="p-inline-list__item"><a href="{{ 'support_form'|static_url }}">{% trans "Support" %}</a></li>
141+ <li class="p-inline-list__item"><a href="{{ 'dp_bugs'|static_url }}">{% trans "Report a bug on this site" %}</a></li>
142+ {% block language_footer %}
143+ {% if not embedded %}
144+ <li class="p-inline-list__item"><a href="{% url 'set_language' %}">{% trans "Switch language" %}</a></li>
145+ {% endif %}
146+ {% endblock %}
147+ </ul>
148+ {% endspaceless %}
149+ <p>{% blocktrans with current_date|date:"Y" as current_year %}&copy; Copyright {{ current_year }} Canonical Ltd. &lsquo;Ubuntu One&rsquo; and &lsquo;Canonical&rsquo; are registered trademarks of Canonical Ltd.{% endblocktrans %}</p>
150+ </div>
151+</footer>
152
153=== added file 'src/webui/templates/vanilla/_header.html'
154--- src/webui/templates/vanilla/_header.html 1970-01-01 00:00:00 +0000
155+++ src/webui/templates/vanilla/_header.html 2019-07-17 13:42:18 +0000
156@@ -0,0 +1,32 @@
157+{% load i18n %}
158+
159+{% comment %}
160+Copyright 2010 Canonical Ltd. This software is licensed under the
161+GNU Affero General Public License version 3 (see the file LICENSE).
162+{% endcomment %}
163+
164+<header id="navigation" class="p-navigation">
165+ <div class="row">
166+ <div class="p-navigation__banner">
167+ <div class="p-navigation__logo">
168+ {% if not embedded %}
169+ <a href="/" id="u1-logo" class="p-navigation__link">
170+ <img src="https://assets.ubuntu.com/v1/d738f754-Ubuntu_One_Mono_Logo.svg" alt="{% blocktrans %}Ubuntu One{% endblocktrans %}" width="90">
171+ </a>
172+ {% endif %}
173+ </div>
174+ <a href="#navigation" class="p-navigation__toggle--open" title="menu">Menu</a>
175+ <a href="#navigation-closed" class="p-navigation__toggle--close" title="close menu">Close menu</a>
176+ </div>
177+ <nav class="p-navigation__nav">
178+ <span class="u-off-screen">
179+ <a href="#main-content">Jump to main content</a>
180+ </span>
181+ {% block me-menu %}
182+ {% include "vanilla/widgets/header-me-menu.html" %}
183+ {% endblock %}
184+
185+ {% block navigation %}{% endblock %}
186+ </nav>
187+ </div>
188+</header>
189
190=== added file 'src/webui/templates/vanilla/base.html'
191--- src/webui/templates/vanilla/base.html 1970-01-01 00:00:00 +0000
192+++ src/webui/templates/vanilla/base.html 2019-07-17 13:42:18 +0000
193@@ -0,0 +1,179 @@
194+{% load i18n static_url combo staticfiles %}
195+<!DOCTYPE html>
196+
197+<!--[if IE 7 ]><html class="ie7" lang="en" dir="ltr"><![endif]-->
198+<!--[if IE 8 ]><html class="ie8" lang="en" dir="ltr"><![endif]-->
199+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en" dir="ltr" class="no-js" {% block html_extra %}{% endblock %}><!--<![endif]-->
200+{% comment %}Copyright 2013 Canonical Ltd. This software is licensed under the GNU Affero General Public License version 3 (see the file LICENSE).{% endcomment %}
201+ <head>
202+ <meta charset="utf-8">
203+ <meta name="viewport" content="width=device-width">
204+ {% block extra_meta %}{% endblock %}
205+
206+ {% block extra_header %}{% endblock %}
207+
208+ <title>{% block title %}{% trans "Log in" %}{% endblock %}</title>
209+ <link rel="icon" type="image/vnd.microsoft.icon"
210+ href="{% static 'identityprovider/img/favicon.ico' %}">
211+
212+ {% block corecss %}
213+ <link href="{% static 'vanilla-css/styles.css' %}" rel="stylesheet">
214+ {% endblock %}
215+ {% block extra_css %}{% endblock %}
216+
217+ <!--[if lt IE 9]>
218+ <script type="text/javascript" src="{% static 'identityprovider/js/ie/html5shiv.js' %}"></script>
219+ <![endif]-->
220+ <script>
221+ document.documentElement.className=document.documentElement.className.replace(/\bno-js\b/,'') + ' js';
222+ </script>
223+ </head>
224+ <body data-qa-id="{% block qaid %}{% endblock %}" {% if embedded %}onload="blank_targets()"{% endif %}
225+ class="{% block bodyclass %}{% if user.is_authenticated %}with-menu{% endif %}{% endblock %}{% if readonly %} readonly{% endif %}">
226+ {% get_current_language as LANGUAGE_CODE %}
227+ <!-- Current language: {{ LANGUAGE_CODE }} -->
228+
229+ {% if google_tag_manager_id %}
230+ <!-- Google Tag Manager (noscript) -->
231+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ google_tag_manager_id }}"
232+ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
233+ <!-- End Google Tag Manager (noscript) -->
234+ {% endif %}
235+
236+ <div id="cont" role="main">
237+ {% include "vanilla/_header.html" %}
238+
239+ {% block menu %}
240+ {% if user.is_authenticated %}
241+ {% include "widgets/personal-menu.html" %}
242+ {% endif %}
243+ {% endblock %}
244+
245+ <div id="content">
246+
247+ {% block readonly %}
248+ {% if readonly %}
249+ <div class="p-notification--caution">
250+ <p class="p-notification__response">
251+ {% blocktrans %}We are currently in read-only mode. That means that at the moment you can't create new accounts, update your personal information, or request password reminders.{% endblocktrans %}
252+ </p>
253+ </div>
254+ {% endif %}
255+ {% endblock %}
256+
257+ {% block messages %}
258+ {% if messages %}
259+ {% for message in messages %}
260+ <div class="p-notification">
261+ <p class="p-notification__response">
262+ {{ message }}
263+ </p>
264+ </div>
265+ {% endfor %}
266+ {% endif %}
267+ {% endblock %}
268+
269+ <section class="p-strip--dark p-cip-hero">
270+ <div class="row">
271+ <div class="col-7">
272+ {% block text_title %}{% endblock %}
273+ </div>
274+ </div>
275+ </section>
276+
277+ <div id="{% block content_id %}box{% endblock %}">
278+ {% block content %}{% endblock %}
279+ </div>
280+
281+ </div><!-- close #content -->
282+
283+ {% include "vanilla/_footer.html" %}
284+
285+ </div><!-- close #cont -->
286+
287+ {% block general_js %}
288+ <script type="text/javascript">
289+ YUI_config = {
290+ maxURLLength: 2000,
291+ combine: {{ combine|lower }},
292+ comboBase: '{{ combo_url }}?',
293+ base: '{% static "yui/3.15.0/" %}',
294+ root: 'yui/3.15.0/'
295+ }
296+ </script>
297+ {# use combo to load yui, to provide far future caching, as whitenoise doesn't for non-hashed urls #}
298+ {# notexist disables optimisation in template tag that avoids combo if only one file #}
299+ {% combo 'yui/3.15.0/yui/yui-min.js' 'notexist' %}
300+
301+ <script type="text/javascript">
302+ YUI().use('node', 'transition', function (Y) {
303+ Y.all('.message.temporary').transition({
304+ easing: 'ease-out',
305+ duration: 0.1,
306+ delay: 5,
307+ height: 0,
308+ opacity: 0,
309+ marginTop: 0,
310+ marginBottom: 0,
311+ paddingTop: 0,
312+ paddingBottom: 0,
313+ on: {
314+ start: function () {
315+ this.setStyle('overflow', 'hidden');
316+ }
317+ }
318+ });
319+ });
320+ </script>
321+
322+ {% endblock %}
323+
324+ {% block test_js %}{% endblock %}
325+ {% block extra_js %}{% endblock %}
326+
327+ {% block disable_submit_buttons_js %}
328+ <script type="text/javascript">
329+ (function(){
330+ // disable all submit buttons after initial form submission
331+ // to prevent double-clicks
332+ var formEls = document.querySelectorAll('form');
333+
334+ if (formEls && formEls.length) {
335+ for (var i = formEls.length; i--;) {
336+ formEls[i].addEventListener('submit', disableAfterSubmit);
337+ }
338+ }
339+
340+ function disableAfterSubmit(e) {
341+ var formEl = e.currentTarget;
342+ var submitEl = formEl.querySelector('input[type=submit],button[type=submit]');
343+
344+ if (!submitEl.classList.contains('disabled')) {
345+ disableSubmitEl(submitEl);
346+ } else {
347+ e.preventDefault();
348+ }
349+ }
350+
351+ function disableSubmitEl(el) {
352+ el.classList.add('disabled');
353+ }
354+
355+ })();
356+ </script>
357+ {% endblock %}
358+
359+ {% block analytics %}
360+ {% if google_tag_manager_id %}
361+ <!-- Google Tag Manager -->
362+ <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
363+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
364+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
365+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
366+ })(window,document,'script','dataLayer','{{ google_tag_manager_id }}');</script>
367+ <!-- End Google Tag Manager -->
368+ {% endif %}
369+ {% endblock %}
370+
371+ </body>
372+</html>
373
374=== added directory 'src/webui/templates/vanilla/widgets'
375=== added file 'src/webui/templates/vanilla/widgets/header-me-menu.html'
376--- src/webui/templates/vanilla/widgets/header-me-menu.html 1970-01-01 00:00:00 +0000
377+++ src/webui/templates/vanilla/widgets/header-me-menu.html 2019-07-17 13:42:18 +0000
378@@ -0,0 +1,18 @@
379+{% load i18n %}
380+{% load menu_item %}
381+{% load url_with_token %}
382+
383+<ul class="p-navigation__links" role="menu" id="ac-status">
384+ {% if user.is_authenticated %}
385+ <li id="account" data-qa-id="account" class="p-navigation__link" role="menuitem">
386+ <span data-qa-id="user_name" class="user-name">{{user.displayname}}</span>
387+ <a href="{% url_with_token 'account-index' %}" id="account-link" data-qa-id="account_link">{% trans "My account" %}</a> <span class="sep">|</span>
388+ <a href="{% url_with_token 'logout' %}" id="logout-link" data-qa-id="logout_link">{% trans "Log out" %}</a>
389+ </li>
390+{% else %}
391+ <li class="p-navigation__link" role="menuitem">
392+ {% url_with_token 'login' as login_url %}
393+ {% menu_item "login" _("Log in or Create account") login_url %}
394+ </li>
395+{% endif %}
396+</ul>

Subscribers

People subscribed via source and target branches

to all changes: