Sha256: eeef02c12837356745d35d341cb9437c4fa37f4e5839e83b40ad8a8d2de9a5e5
Contents?: true
Size: 1.17 KB
Versions: 33
Compression:
Stored size: 1.17 KB
Contents
class Quby.Models.Panel extends Backbone.Model defaults: -> questions: new Quby.Collections.Questions view: new Quby.Views.PanelView(model: @) panelId: null initedShowsHidesCalled: false initialize: -> panelId = @get('panelId') viewSelector = "##{panelId}" if panelId @get("view").setElement $(viewSelector)[0] hidePanelTrigger = -> @trigger "hidePanelCheck" @get("questions").on "hide", hidePanelTrigger, @ @get("questions").on "unhide", hidePanelTrigger, @ @get("questions").on "show", hidePanelTrigger, @ @get("questions").on "unshow", hidePanelTrigger, @ @on "hidePanelCheck", @hidePanelCheck, @ @trigger "hidePanelCheck" initShowsHides: (allQuestions) -> unless @get 'initedShowsHidesCalled' @set('initedShowsHidesCalled', true) @get("questions").each (question) -> options = question.get("options") options.each (option) -> option.initShowsHides allQuestions hidePanelCheck: -> if @hidden() if !@get("questions").noneVisible() @trigger "unhide" else if @get("questions").noneVisible() @trigger "hide" hidden: -> @get("view").hidden()
Version data entries
33 entries across 33 versions & 1 rubygems