Sha256: 129bd5345a5db6cc3c0812d217d67a2fd8afcf31bfd7d89221c89c5219dd1ce9

Contents?: true

Size: 1.08 KB

Versions: 71

Compression:

Stored size: 1.08 KB

Contents

INTERESTING_PROPERTIES = ['class', 'accessibilityLabel', 'tag', 'alpha', 'isHidden']
IRREGULAR_PROPERTIES = INTERESTING_PROPERTIES.concat( 'parent', 'subviews', 'children' )

renderListItem = ( propertyName, propertyValue, cssClass )->
  propertyValue ?= 'null'

  if _.isObject( propertyValue )
    propertyValue = JSON.stringify(propertyValue)

  $("<li>").addClass(cssClass)
    .append( 
      $('<div/>').addClass('key').text(propertyName),
      $('<div/>').addClass('value').text(propertyValue)
    )

define ->
  DetailsView = Backbone.View.extend
    el: $('#dom-detail')

    updateModel: (model)->
      @model = model
      @refresh()

    refresh: ->
      $ul  = $('<ul>')

      for prop in INTERESTING_PROPERTIES
        if @model.has(prop)
          val = @model.get(prop)
          $ul.append( renderListItem( prop, val, 'interesting' ) )

      for prop in _.keys(@model.attributes).sort()
        continue if _.contains( IRREGULAR_PROPERTIES, prop )

        val = @model.get(prop)
        $ul.append( renderListItem( prop, val ) )

      @$el.empty().append($ul)



  DetailsView

Version data entries

71 entries across 54 versions & 5 rubygems

Version Path
sc-frank-ios-1.2.3 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-cucumber-1.2.5 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-cucumber-1.2.4.pre1 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.3.0.pre.2 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.bba52d7.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.e1e3ccb.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.1a856ca.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.3.0.pre.1 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.2.4 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.2.3.pre.2 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.2.3.pre.1 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-pivotal-1.2.3 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.b7791c5.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
frank-cucumber-1.2.3 frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/bundle/bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.3256dc1.debug frank-skeleton/frank_static_resources.bundle/bundle/js/details_view.coffee
sc-frank-cucumber-1.2.1.9c95c03.debug frank-skeleton/frank_static_resources.bundle/js/details_view.coffee