Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Commit

Permalink
Code cleanup, button colors
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Oct 11, 2018
1 parent a16d21e commit ed9875f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions crm-tutorials/contact-summary.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"url": "civicrm/contact/view",
"title": ts("Introduction to Contacts"),
"auto_run": true,
"steps": [
{
"target": "#contactname-block",
Expand Down
4 changes: 2 additions & 2 deletions css/tutorial-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ body.civitutorial-admin-open .hopscotch-nav-button {
color: white;
cursor: pointer;
}
button#civitutorial-admin-close {
background: #aaa334;
form:not(.tutorial-saved) #civitutorial-admin-close {
background: #d2c600;
}
button#civitutorial-admin-delete {
background: #aa323b;
Expand Down
2 changes: 2 additions & 0 deletions js/tutorial-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@
if (!tutorial.steps.length) {
addStep();
}
setSaved(tutorial.saved);
}

function setSaved(val) {
tutorial.saved = val;
$('#civitutorial-admin-save').prop('disabled', val);
$('#civitutorial-admin').toggleClass('tutorial-saved', val);
}

function addStep() {
Expand Down
20 changes: 10 additions & 10 deletions js/tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
if (autoStartTutorial) {
poll = setInterval(function() {
if ($(autoStartTutorial.steps[0].target).length) {
startTour(autoStartTutorial.id);
startTutorial(autoStartTutorial.id);
clearInterval(poll);
poll = null;
}
Expand All @@ -95,10 +95,10 @@

function clickStart(e) {
e.preventDefault();
startTour($(this).data('tutorial'));
startTutorial($(this).data('tutorial'));
}

function startTour(id) {
function startTutorial(id) {
hopscotch.endTour();

var defaults = {
Expand All @@ -108,33 +108,33 @@
prevBtn: ts('Back')
}
};
defaults.onClose = defaults.onEnd = endTour;
defaults.onClose = defaults.onEnd = endTutorial;

CRM.vars.tutorial.items[id].viewed = true;
var tour = _.extend(defaults, _.cloneDeep(CRM.vars.tutorial.items[id]));
var tutorial = _.extend(defaults, _.cloneDeep(CRM.vars.tutorial.items[id]));

// Place icons in the step number circle if provided
tour.i18n.stepNums = _.map(tour.steps, function(step, i) {
tutorial.i18n.stepNums = _.map(tutorial.steps, function(step, i) {
return step.icon ? '<i class="crm-i ' + step.icon + '"></i>' : i + 1;
});

hopscotch.startTour(tour);
hopscotch.startTour(tutorial);

CRM.api3('Tutorial', 'mark', {id: id});
}

function endTour() {
function endTutorial() {
var supportMenu = $('.menumain a[href$="#tutorial-start"]').closest('.menumain');
if (supportMenu.length) {
window.setTimeout(function() {
hopscotch.startTour({
id: 'tour-closed',
id: 'tutorial-closed',
steps: [
{
target: $(supportMenu)[0],
placement: 'bottom',
nextOnTargetClick: true,
content: ts('To see this tour again, or for more ways to learn and get help, open the Support menu.')
content: ts('To see this tutorial again, or for more ways to learn and get help, open the Support menu.')
}
],
i18n: {
Expand Down

0 comments on commit ed9875f

Please sign in to comment.