bsw@1045: local slides = param.get( "slides", "table" ) bsw@1045: bsw@1045: local show_slides = {} bsw@1045: bsw@1045: for i, slide in ipairs( slides ) do bsw@1045: bsw@1045: if slide.initiative then bsw@1045: show_slides[ #show_slides + 1 ] = slide bsw@1045: end bsw@1045: bsw@1045: end bsw@1045: bsw@1045: slot.select( "slideshow", function () bsw@1045: bsw@1045: ui.container { attr = { class = "slideshow" }, content = function () bsw@1045: bsw@1045: for i, slide in ipairs( show_slides ) do bsw@1045: bsw@1045: if slide.initiative.issue.closed then bsw@1045: view = "finished" bsw@1045: elseif slide.initiative.issue.fully_frozen then bsw@1045: view = "voting" bsw@1045: elseif slide.initiative.issue.half_frozen then bsw@1045: view = "verification" bsw@1045: elseif slide.initiative.issue.admitted then bsw@1045: view = "discussion" bsw@1045: else bsw@1045: view = "admission" bsw@1045: end bsw@1045: bsw@1045: ui.container { attr = { class = "slide slide-" .. i }, content = function () bsw@1045: bsw@1045: if slide.initiative.issue.closed then bsw@1045: util.initiative_pie(slide.initiative, 150) bsw@1045: end bsw@1045: bsw@1045: ui.container { bsw@1045: attr = { class = "slideshowTitle" }, bsw@1045: content = slide.title bsw@1045: } bsw@1045: bsw@1045: execute.view { bsw@1045: module = "initiative", view = "_list_element", params = { bsw@1045: initiative = slide.initiative bsw@1045: } bsw@1045: } bsw@1045: bsw@1045: end } bsw@1045: bsw@1045: end bsw@1045: bsw@1045: bsw@1045: end } bsw@1045: bsw@1045: end ) bsw@1045: bsw@1045: ui.script{ script = [[ bsw@1045: bsw@1045: var slideshowCurrent = 0; bsw@1045: var slideshowCount = ]] .. #show_slides .. [[ ; bsw@1045: function slideshowShowSlide(i) { bsw@1045: $(".slideshow .slide").slideUp(); bsw@1045: $(".slideshow .slide-" + i).slideDown(); bsw@1045: slideshowCurrent = i; bsw@1045: } bsw@1045: bsw@1045: function slideshowShowNext() { bsw@1045: var next = slideshowCurrent + 1; bsw@1045: if (next > slideshowCount) { bsw@1045: next = 1; bsw@1045: } bsw@1045: slideshowShowSlide(next); bsw@1045: window.setTimeout(slideshowShowNext, 7500); bsw@1045: } bsw@1045: bsw@1045: slideshowShowNext(); bsw@1045: bsw@1045: bsw@1045: ]]}