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.6.6 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.6.5 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.6.3 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.6.2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.6.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.6.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.5.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.4.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.3.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.3.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.2.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.1.3 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.1.2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.1.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.1.0 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.5 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.4 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.3 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.2 app/assets/javascripts/quby/backbone/views/question_view.js.coffee
quby-5.0.1 app/assets/javascripts/quby/backbone/views/question_view.js.coffee