Sha256: 6ee8e78e8a62125f840af676f0871c9d5a0c1702005959553365d9b04b27daa1

Contents?: true

Size: 851 Bytes

Versions: 34

Compression:

Stored size: 851 Bytes

Contents

class Quby.Views.QuestionView extends Backbone.View
  initialize: ->
    @model.on "decideVisibility", @decideVisibility, @
    if @model.get("defaultInvisible")
      @decideVisibility()

  decideVisibility: ->
    if @isVisible()
      @$el.addClass "show"
      if @$el.is(".select")
        @$el.find('option').removeAttr("disabled")
      @$el.removeClass "hide"
    else
      @$el.addClass "hide"
      # Chrome counts visible select options as always hidden,
      # so we need to also disable them to signify they are truly hidden
      if @$el.is(".select")
        @$el.find('option').attr("disabled", "disabled")
      @$el.removeClass "show"

  isVisible: ->
    @shown() || (!@hidden() && !@model.get("defaultInvisible"))

  shown: ->
    !@model.get("shownByOptions").isEmpty()
  hidden: ->
    !@model.get("hiddenByOptions").isEmpty()

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
quby-5.0.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-4.0.4 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.0.pre4 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.0.pre3 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.0.pre2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.0.pre1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-4.0.3 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-4.0.2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-4.0.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-4.0.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-3.2.2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-3.2.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-3.2.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-3.2.0.pre.pre1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee