fc77ee76d6
The primary license of the project is changing to: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later The Additional Permission is designed to permit publicly distributed Javascript code to be relicensed under LGPL-3.0-or-later, but not server-side Javascript code. As such, we've relicensed here static Javscript files under LGPL-3.0-or-later, and those that run as part of build and/or server side under AGPL-3.0-or-later. Note that in future, Javascript files may be updated to be stronger copyleft license with the Additional Permission, particularly if they adapted to run on server side and/or turned into templates. Of course, we'd seek public discussion with the contributor community about such changes. This commit is one of the many steps to relicense the entire codebase. Documentation granting permission for this relicensing (from all past contributors who hold copyrights) is on file with Software Freedom Conservancy, Inc.
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
// License: LGPL-3.0-or-later
|
|
// Functionality for a wizard UI (eg. our donate button)
|
|
|
|
appl.def('wizard', {
|
|
|
|
set_step: function(wiz_name, step_name, el) {
|
|
appl.push({name: step_name, el: appl.prev_elem(el)}, wiz_name + '.steps')
|
|
},
|
|
|
|
show_step: function(wiz_name, index) {
|
|
var steps = appl[wiz_name].steps
|
|
steps.forEach(function(step) { step.el.style.display = 'none' })
|
|
appl[wiz_name].steps[index].el.style.display = 'table-cell'
|
|
},
|
|
|
|
init: function(wiz_name, node) {
|
|
appl.def(wiz_name + '.current_step', 0)
|
|
appl[wiz_name].steps[0].is_accessible = true
|
|
appl.trigger_update(wiz_name + '.steps')
|
|
this.show_step(wiz_name, 0)
|
|
appl.prev_elem(node).style.display = 'table'
|
|
return appl
|
|
},
|
|
|
|
reset: function(wiz_name) {
|
|
var wiz = appl[wiz_name]
|
|
wiz.steps = wiz.steps.map(function(step) {
|
|
$(step.el).find('form').each(function() { this.reset() })
|
|
step.is_accessible = false
|
|
return step
|
|
})
|
|
wiz.steps[0].is_accessible = true
|
|
appl.trigger_update(wiz_name + '.steps')
|
|
appl.def(wiz_name + '.current_step', 0)
|
|
appl.wizard.show_step(wiz_name, 0)
|
|
return appl
|
|
},
|
|
|
|
jump: function(wiz_name, index) {
|
|
var wiz = appl[wiz_name]
|
|
if(!wiz.steps[index].is_accessible) return
|
|
appl.def(wiz_name + '.current_step', index)
|
|
this.show_step(wiz_name, index)
|
|
return appl
|
|
},
|
|
|
|
advance: function(wiz_name) {
|
|
var wiz = appl[wiz_name]
|
|
if(wiz.current_step + 1 >= wiz.steps.length)
|
|
wiz.on_complete()
|
|
appl.incr(wiz_name + '.current_step')
|
|
wiz.steps[wiz.current_step].is_accessible = true
|
|
appl.trigger_update(wiz_name + '.steps')
|
|
appl.wizard.show_step(wiz_name, wiz.current_step)
|
|
return appl
|
|
}
|
|
|
|
})
|
|
|