Skip to content

Commit

Permalink
add editor and associate editor feature tours
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-jones committed Jul 28, 2023
1 parent 285b64f commit 1ee4430
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 47 deletions.
13 changes: 13 additions & 0 deletions cms/tours/dashboard_ed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
steps:
- selector: '#group-tab'
title: Your group activity
content: An interactive progress bar for your group(s) allows you, at a glance, to see which Associates need
more applications and how fast each group is working.

- selector: '#group-tab ul.progress-bar'
title: Progress bar
content: Clicking each status will take you to those applications

- selector: "#feature_tour_nav"
title: Want to see the tour again?
content: You can re-take this tour again at any point by selecting it from the Feature Tours menu
51 changes: 31 additions & 20 deletions cms/tours/dashboard_ed_assed.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
steps:
- selector: header h1
title: Welcome to your dashboard!
content: You will now come to <strong>this page</strong> after you log in. This is where you can see all the applications you have to process, and the activity of your groups.
content: You will now come to this page after you log in. This is where you can see all the applications you have to process, and the activity of your groups.

- selector: nav.vertical-nav
title: Navigation,
content: The old Admin navigation has moved from the top to the left-hand side
title: Navigation
content: The old Admin navigation has moved from the top to the left-hand side.

- selector: "#primary-nav ul li:first-of-type"
- selector: nav dl
title: Your groups
content: The groups that you are a member of are shown at the top right of your dashboard.

- selector: "#notifications_nav"
title: Notifications
content: there is a new notifications button in the top nav
content: There is a new notifications button in the top nav.

- selector: "main section:first-of-type"
title: Cards
content: Each application is a card on your dashboard, and the cards are arranged in priority order, from left to right. Clicking a card will open up the application in a new tab
- selector: "header h1"
title: Your priority list
content: Each application is a card on your dashboard, and the cards are arranged in priority order, from left to
right. Clicking a card will open up the application in a new tab.

- selector: "main section:first-of-type"
- selector: "header h1"
title: Card components
content: 'each card has six components:
<ul>
<li>date of submission</li>
<li>status</li>
<li>what action needs to be taken</li>
<li>Information about the group and who the application is assigned to</li>
</ul>'

- selector: "main a svc.feather-log-out"
content: 'Each card has six components:
<ol>
<li>The date of submission</li>
<li>The status of the application</li>
<li>What action needs to be taken</li>
<li>The title of the application</li>
<li>The review group</li>
<li>Who the application is assigned to</li>
</ol>'

- selector: "#logout"
title: Log out
content: "Logout has moved to the bottom of the dashboard"

- selector: "#primary-nav svg.feather-home"
- selector: "#doaj_home"
title: "DOAJ Home"
content: "to get back to the main DOAJ website, click 'DOAJ HOME' in the top right corner"
content: "To get back to the main DOAJ website, click 'DOAJ HOME' in the top right corner"

- selector: "#feature_tour_nav"
title: Want to see the tour again?
content: You can re-take this tour again at any point by selecting it from the Feature Tours menu
1 change: 1 addition & 0 deletions portality/bll/services/tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def activeTours(self, path, user):
for r in tour.get("roles"):
if user.has_role(r):
active_tours.append(tour)
break
else:
active_tours.append(tour)
return active_tours
Expand Down
18 changes: 10 additions & 8 deletions portality/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,16 +1393,18 @@
TOUR_COOKIE_MAX_AGE = 31536000

TOURS = {
"/dashboard/": [
"/editor/": [
{
"roles": ["admin"],
"roles": ["editor", "associate_editor"],
"content_id": "dashboard_ed_assed",
"name": "Welcome to the dashboard",
"name": "Welcome to your dashboard!",
"description": "The new dashboard gives you a way to see all your priority work, take a look at what's new.",
} # ,
# {
# "roles": ["admin"],
# "content_id": "dashboard_ed"
# }
},
{
"roles": ["editor"],
"content_id": "dashboard_ed",
"name": "Your group activity",
"description": "Your dashboard shows you who is working on what, and the status of your group's applications"
}
]
}
43 changes: 32 additions & 11 deletions portality/static/js/tourist.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
if (!doaj.hasOwnProperty("tourist")) { doaj.tourist = {}}

doaj.tourist.cookiePrefix = "";
doaj.tourist.allTours = [];
doaj.tourist.currentTour = null;
doaj.tourist.contentId = null;

doaj.tourist.init = function(params) {
let tours = params.tours || [];
let cookiePrefix = params.cookie_prefix;
doaj.tourist.allTours = params.tours || [];
doaj.tourist.cookiePrefix = params.cookie_prefix;

$(".trigger_tour").on("click", doaj.tourist.triggerTour);

let first = doaj.tourist.findNextTour();
if (first) {
doaj.tourist.start(first);
}
}

doaj.tourist.findNextTour = function() {
let cookies = document.cookie.split("; ");

let first = false;
for (let tour of tours) {
let cookieName = cookiePrefix + tour.content_id + "=" + tour.content_id;
for (let tour of doaj.tourist.allTours) {
let cookieName = doaj.tourist.cookiePrefix + tour.content_id + "=" + tour.content_id;
let cookie = cookies.find(c => c === cookieName);
if (!cookie) {
first = tour;
break;
}
}

$(".trigger_tour").on("click", doaj.tourist.triggerTour);

if (first) {
doaj.tourist.start(first);
}
return first;
}

doaj.tourist.start = function (tour) {
doaj.tourist.contentId = tour.content_id;
doaj.tourist.currentTour = new Tourguide({
src: `/tours/${tour.content_id}`,
onStart: doaj.tourist.startCallback,
keyboardControls: true
onComplete: doaj.tourist.completeCallback
});
doaj.tourist.currentTour.start()
}
Expand All @@ -39,6 +46,20 @@ doaj.tourist.startCallback = function(options) {
doaj.tourist.seen({tour: doaj.tourist.contentId});
}

doaj.tourist.completeCallback = function(options) {
doaj.tourist.currentTour = null;
doaj.tourist.contentId = null;

let next = doaj.tourist.findNextTour();
if (next) {
doaj.tourist.start(next);
} else {
$([document.documentElement, document.body]).animate({
scrollTop: 0
}, 500);
}
}

doaj.tourist.seen = function(params) {
$.ajax({
type: "GET",
Expand Down
10 changes: 5 additions & 5 deletions portality/templates/includes/_tourist_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

{% if tours|length > 0 %}
<li class="dropdown flex-center">
<a href="/dashboard/notifications" class="dropdown__trigger label" role="button" aria-haspopup="true" aria-expanded="false">
<a href="/dashboard/notifications" id="feature_tour_nav" class="dropdown__trigger label" role="button" aria-haspopup="true" aria-expanded="false">
<span><span data-feather="navigation" aria-hidden="true"></span> Feature Tours</span>
</a>
<ul class="dropdown__menu notifications" id="feature_tours">
{% for tour in tours %}
{% set seen_class = namespace(val="notifications_unseen") %}
{% set seen = namespace(val="[new] ") %}
{% if request.cookies.get(app.config.get("TOUR_COOKIE_PREFIX") + tour.content_id) %}
{% set seen_class.val = "notifications_seen" %}
{% set seen.val = "" %}
{% endif %}

<li class="notifications__item">
<a href="#" class="dropdown__link {{ seen_class.val }} trigger_tour" data-tour-id="{{ tour.content_id }}">
<strong>{{ tour.name }}</strong><br>
<a href="#" class="dropdown__link trigger_tour" data-tour-id="{{ tour.content_id }}">
<strong>{{ seen.val }}{{ tour.name }}</strong><br>
{{ tour.description }}
</a>
</li>
Expand Down
6 changes: 3 additions & 3 deletions portality/templates/layouts/dashboard_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h2 class="sr-only">DOAJ Dashboard</h2>
<ul class="unstyled-list flex-center">
{% include "includes/_tourist_nav.html" %}
{# ~~->Notifications:Feature~~ #}
<li class="dropdown flex-center">
<li class="dropdown flex-center" id="notifications_nav">
<a href="/dashboard/notifications" class="dropdown__trigger label" role="button" aria-haspopup="true" aria-expanded="false">
<span><span data-feather="bell" aria-hidden="true"></span> Notifications <span class="js-notifications-count"></span></span>
</a>
Expand All @@ -46,7 +46,7 @@ <h2 class="sr-only">DOAJ Dashboard</h2>
</a>
</li>
{% endif %}
<li class="flex-center">
<li class="flex-center" id="doaj_home">
<a href="/" class="label">
<span><span data-feather="home" aria-hidden="true"></span> DOAJ home</span>
</a>
Expand Down Expand Up @@ -161,7 +161,7 @@ <h1>

<p>
<small>
<a href="{{ url_for('account.logout') }}" class="tag">
<a href="{{ url_for('account.logout') }}" class="tag" id="logout">
<span data-feather="log-out" aria-hidden="true"></span>
Log out
</a>
Expand Down

0 comments on commit 1ee4430

Please sign in to comment.