Sha256: 4a2da859a008c5c48bc48eb93054504eb0fd3f4de967391e41992ddb2436a4c1
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
ELA.Views ?= {} class ELA.Views.Viewport extends Backbone.Poised.View tagName: 'article' className: 'viewport' initialize: (options = {}) -> @views = for view in options.views view.options = _.omit(view, 'view') view.options.name = view.name or Math.random().toString(36).slice(-8) view.View = view.view?.toFunction() or ELA.Views.GraphView view @subviews = {} @layouts = options.layouts or [ layout: _.map(@views, (view, idx) -> String.fromCharCode(97 + idx) ).join(' ') ] @listenTo(@model, 'change:layout', @render) areaLayout: -> '"' + @layouts[@model.get('layout')].layout.join('" "') + '"' _style: -> "grid-template-areas: #{@areaLayout()};" + 'grid-auto-columns: 1fr;' + 'grid-auto-rows: 1fr;' render: -> for view in @views @subviews[view.options.name]?.remove() @$el.empty().attr('style', @_style()) for view, idx in @views area = String.fromCharCode(97 + idx) if @areaLayout().indexOf(area) > -1 options = _.extend model: @model parentView: this localePrefix: @localePrefix attributes: style: "grid-area: #{area}" , view.options view = @subviews[view.options.name] = new view.View(options) @$el.append(view.render().el) this
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ela-3.4.2 | app/js/lib/views/viewport.coffee |
ela-3.4.0 | app/js/lib/views/viewport.coffee |
ela-3.3.1 | app/js/lib/views/viewport.coffee |
ela-3.3.0 | app/js/lib/views/viewport.coffee |