Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced Bootstrap-tour by IntroJs in Vote activity #1106

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
344 changes: 205 additions & 139 deletions activities/Vote.activity/css/activity.css

Large diffs are not rendered by default.

26 changes: 0 additions & 26 deletions activities/Vote.activity/css/bootstrap-tour-standalone.min.css

This file was deleted.

2 changes: 2 additions & 0 deletions activities/Vote.activity/css/introjs.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions activities/Vote.activity/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<link rel="stylesheet" href="css/History.css">
<link rel="stylesheet" href="css/Settings.css">
<link rel="stylesheet" href="css/Export.css">
<link rel="stylesheet" href="css/bootstrap-tour-standalone.min.css">
<link rel="stylesheet" href="css/introjs.css">
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="lib/vue.min.js"></script>
<script src="lib/Sortable.min.js"></script>
Expand All @@ -28,8 +28,7 @@
<script src="lib/chartjs-plugin-datalabels.min.js"></script>
<script src="lib/wordcloud2.js"></script>
<script src="lib/jspdf.min.js"></script>
<script src="lib/jquery.min.js"></script>
<script src="lib/bootstrap-tour-standalone.min.js"></script>
<script src="lib/intro.js"></script>
<script>if (window.module) module = window.module;</script>
<script src="lib/require.js"></script>
<script type="text/javascript" src="../../cordova.js"></script>
Expand Down
109 changes: 53 additions & 56 deletions activities/Vote.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,168 +640,165 @@ var app = new Vue({
if(this.settings) {
steps = steps.concat([
{
element: ".poll-card#0",
placement: "right",
element: ".poll-card [id='#0']",
position: "right",
title: this.l10n.stringTutoSettingsPollCardTitle,
content: this.l10n.stringTutoSettingsPollCardContent
intro: this.l10n.stringTutoSettingsPollCardContent
},
{
element: "#edit-button",
placement: "right",
position: "right",
title: this.l10n.stringTutoSettingsEditButtonTitle,
content: this.l10n.stringTutoSettingsEditButtonContent
intro: this.l10n.stringTutoSettingsEditButtonContent
},
{
element: "#delete-button",
placement: "right",
position: "right",
title: this.l10n.stringTutoSettingsDeleteButtonTitle,
content: this.l10n.stringTutoSettingsDeleteButtonContent
intro: this.l10n.stringTutoSettingsDeleteButtonContent
},
{
element: "#settings-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsPlayButtonTitle,
content: this.l10n.stringTutoSettingsPlayButtonContent
intro: this.l10n.stringTutoSettingsPlayButtonContent
},
{
element: "#add-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsAddButtonTitle,
content: this.l10n.stringTutoSettingsAddButtonContent
intro: this.l10n.stringTutoSettingsAddButtonContent
},
{
element: "#image-edit-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsImageEditButtonTitle,
content: this.l10n.stringTutoSettingsImageEditButtonContent
intro: this.l10n.stringTutoSettingsImageEditButtonContent
},
{
element: "#question",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsQuestionTitle,
content: this.l10n.stringTutoSettingsQuestionContent
intro: this.l10n.stringTutoSettingsQuestionContent
},
{
element: "#type",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsTypeTitle,
content: this.l10n.stringTutoSettingsTypeContent
intro: this.l10n.stringTutoSettingsTypeContent
},
{
element: ".add-option-button",
placement: "top",
position: "top",
title: this.l10n.stringTutoSettingsAddOptionButtonTitle,
content: this.l10n.stringTutoSettingsAddOptionButtonContent
intro: this.l10n.stringTutoSettingsAddOptionButtonContent
},
{
element: ".option#0",
placement: "top",
element: ".option [id='#0']",
position: "top",
title: this.l10n.stringTutoSettingsOptionTitle,
content: this.l10n.stringTutoSettingsOptionContent
intro: this.l10n.stringTutoSettingsOptionContent
},
]);
} else {
switch(this.currentView) {
case 'polls-grid':
steps = steps.concat([
{
element: "",
orphan: true,
placement: "bottom",
title: this.l10n.stringTutoExplainTitle,
content: this.l10n.stringTutoExplainContent
intro: this.l10n.stringTutoExplainContent
},
{
element: ".poll-card#0",
placement: "right",
element: ".poll-card [id='#0']",
position: "right",
title: this.l10n.stringTutoPollCardTitle,
content: this.l10n.stringTutoPollCardContent
intro: this.l10n.stringTutoPollCardContent
},
{
element: ".search-input",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoPollSearchTitle,
content: this.l10n.stringTutoPollSearchContent
intro: this.l10n.stringTutoPollSearchContent
},
{
element: "#settings-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoSettingsButtonTitle,
content: this.l10n.stringTutoSettingsButtonContent
intro: this.l10n.stringTutoSettingsButtonContent
},
{
element: "#history-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoHistoryButtonTitle,
content: this.l10n.stringTutoHistoryButtonContent
intro: this.l10n.stringTutoHistoryButtonContent
},
{
element: "#network-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoNetworkButtonTitle,
content: this.l10n.stringTutoNetworkButtonContent
intro: this.l10n.stringTutoNetworkButtonContent
},
]);
break;
case 'history':
steps = steps.concat([
{
element: ".history-item#0",
placement: "bottom",
element: ".history-item [id='#0']",
position: "bottom",
title: this.l10n.stringTutoHistoryItemTitle,
content: this.l10n.stringTutoHistoryItemContent
intro: this.l10n.stringTutoHistoryItemContent
},
{
element: "#home-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoHomeButtonTitle,
content: this.l10n.stringTutoHomeButtonContent
intro: this.l10n.stringTutoHomeButtonContent
},
{
element: "#export-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoExportButtonTitle,
content: this.l10n.stringTutoExportButtonContent
intro: this.l10n.stringTutoExportButtonContent
},
{
element: "#delete-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoDeleteButtonTitle,
content: this.l10n.stringTutoDeleteButtonContent
intro: this.l10n.stringTutoDeleteButtonContent
},
]);
break;
case 'poll-stats':
steps = steps.concat([
{
element: "#stats",
placement: "right",
position: "right",
title: this.l10n.stringTutoPollStatsTitle,
content: this.l10n.stringTutoPollStatsContent
intro: this.l10n.stringTutoPollStatsContent
},
{
element: ".poll-footer",
placement: "top",
position: "top",
title: this.l10n.stringTutoPollFooterTitle,
content: this.l10n.stringTutoPollFooterContent
intro: this.l10n.stringTutoPollFooterContent
},
{
element: "#stop-poll",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoStopPollTitle,
content: this.l10n.stringTutoStopPollContent
intro: this.l10n.stringTutoStopPollContent
},
{
element: "#real-time-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoRealTimeButtonTitle,
content: this.l10n.stringTutoRealTimeButtonContent
intro: this.l10n.stringTutoRealTimeButtonContent
},
{
element: "#auto-stop-button",
placement: "bottom",
position: "bottom",
title: this.l10n.stringTutoAutoStopButtonTitle,
content: this.l10n.stringTutoAutoStopButtonContent
intro: this.l10n.stringTutoAutoStopButtonContent
},
]);
break;
Expand Down
103 changes: 42 additions & 61 deletions activities/Vote.activity/js/components/SugarTutorial.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,43 @@
// Tutorial component based on bootstrap tour
Vue.component('sugar-tutorial', {
data: function () {
return {
l10n: {
stringTutoPrev: 'Prev',
stringTutoNext: 'Next',
stringTutoEnd: 'End',
}
}
},
mounted() {
let vm = this;
if (this.$root.$refs.SugarL10n) {
this.$root.$refs.SugarL10n.$on('localized', function () {
vm.$root.$refs.SugarL10n.localize(vm.l10n);
});
}
},
methods: {
show: function (steps) {
var vm = this;
var tour = new Tour({
template: `
<div class='popover tour'>
<div class='arrow'></div>
<h3 class='popover-title tutorial-title'></h3>
<div class='popover-content'></div>
<div class='popover-navigation' style='display: flex; flex-wrap:wrap; justify-content: center; align-items: center'>
<div class='tutorial-prev-icon tutorial-icon-button' data-role='prev'>
<div class='tutorial-prev-icon1 web-activity'></div>
<div class='tutorial-icon-text'>${this.l10n.stringTutoPrev}</div>
</div>
<span data-role='separator' style='margin: 4px'>|</span>
<div class='tutorial-next-icon tutorial-icon-button' data-role='next'>
<div class='tutorial-next-icon1 web-activity'></div>
<div class='tutorial-icon-text'>${this.l10n.stringTutoNext}</div>
</div>
<div class='tutorial-end-icon tutorial-icon-button' data-role='end'>
<div class='tutorial-end-icon1 web-activity'></div>
<div class='tutorial-icon-text'>${this.l10n.stringTutoEnd}</div>
</div>
</div>
</div>`,
storage: false,
backdrop: true,
steps: steps,
onStart: function (tour) {
vm.$emit('start', tour);
},
onShow: function (tour) {
vm.$emit('show', tour);
},
onEnd: function (tour) {
vm.$emit('end', tour);
},
});
tour.init();
tour.start(true);
}
}
// Tutorial component based on introJs tour
Vue.component("sugar-tutorial", {
data: function () {
return {
l10n: {
stringTutoPrev: "Prev",
stringTutoNext: "Next",
stringTutoEnd: "End",
},
};
},
mounted() {
let vm = this;
if (this.$root.$refs.SugarL10n) {
this.$root.$refs.SugarL10n.$on("localized", function () {
vm.$root.$refs.SugarL10n.localize(vm.l10n);
});
}
},
methods: {
show: function (steps) {
steps = steps.filter(function (obj) {
return (
!("element" in obj) ||
(obj.element.length &&
document.querySelector(obj.element) &&
document.querySelector(obj.element).style.display != "none")
);
});
introJs()
.setOptions({
tooltipClass: "customTooltip",
steps: steps,
prevLabel: this.l10n.stringTutoPrev,
nextLabel: this.l10n.stringTutoNext,
exitOnOverlayClick: false,
nextToDone: false,
showBullets: false,
})
.start();
},
},
});
Loading