ember-magic-table 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in ember-magic-table.gemspec
4
+ gemspec
File without changes
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "ember-magic-table/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ember-magic-table"
7
+ s.version = Ember::Magic::Table::VERSION
8
+ s.authors = ["Chris Nelson"]
9
+ s.email = ["chris@gaslightsoftware.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{An ember component that produces an editable table given an Ember Data Model}
12
+ s.description = %q{Uses ember-table. Makes all the properties editable. Is awesome(ish)}
13
+
14
+ s.rubyforge_project = "ember-magic-table"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,38 @@
1
+ Magic.EditableTableController = Ember.Table.TableController.extend Ember.Evented,
2
+ hasHeader: yes
3
+ hasFooter: no
4
+ # numFixedColumns: 0
5
+ numRows: 5
6
+ rowHeight: 30
7
+
8
+ columns: Ember.computed ->
9
+ columns= []
10
+ return unless @get("content")
11
+ for attrName, meta of @get("contentType").metaData()
12
+ do (attrName) ->
13
+ columns.push Ember.Table.ColumnDefinition.create
14
+ headerCellName: attrName.capitalize()
15
+ contentPath: attrName
16
+ tableCellViewClass: 'Magic.EditableTableCell'
17
+ setCellContent: (row, value) -> row.set(attrName, value)
18
+ columns
19
+ .property("content")
20
+
21
+ contentType: Ember.computed ->
22
+ @get("actualContent.type")
23
+ .property("actualContent")
24
+
25
+ actualContent: Ember.computed ->
26
+ content = @get("content")
27
+ while Ember.ArrayProxy.detectInstance(content) and !DS.RecordArray.detectInstance(content)
28
+ content = content.get "content"
29
+ content
30
+ .property("content")
31
+
32
+ add: ->
33
+ model = @get("contentType").createRecord()
34
+ @get("actualContent").addReference(model.get("_reference"))
35
+ Ember.run.schedule "afterRender", => @trigger("edit", model)
36
+
37
+ finishedEditing: ->
38
+ DS.get("defaultStore").commit()
@@ -0,0 +1,6 @@
1
+ #= require_self
2
+ #= require ember-table
3
+ #= require ./controller
4
+ #= require ./views
5
+
6
+ window.Magic = Ember.Namespace.create()
@@ -0,0 +1,54 @@
1
+ Magic.EditableTableCell = Ember.Table.TableCell.extend
2
+ classNames: 'editable-table-cell'
3
+ templateName: 'editable_table_cell'
4
+ isEditing: no
5
+ type: 'text'
6
+
7
+ startEditing: (model) ->
8
+ @set 'isEditing', yes if model == @get("rowContent")
9
+
10
+ didInsertElement: ->
11
+ @get("controller").on "edit", @, @startEditing
12
+
13
+ willDestroyElement: ->
14
+ @get("controller").off "edit", @, @startEditing
15
+
16
+ innerTextField: Ember.TextField.extend
17
+ typeBinding: 'parentView.type'
18
+ valueBinding: 'parentView.cellContent'
19
+ didInsertElement: -> @$().focus()
20
+ focusOut: (event) ->
21
+ @set 'parentView.isEditing', no
22
+
23
+ onRowContentDidChange: Ember.observer ->
24
+ @set 'isEditing', no
25
+ , 'rowContent'
26
+
27
+ click: (event) ->
28
+ @set 'isEditing', yes
29
+ event.stopPropagation()
30
+
31
+ keyDown: (event) ->
32
+ if event.keyCode == 13
33
+ @set 'isEditing', no
34
+ @get("controller").finishedEditing()
35
+
36
+
37
+ Magic.EditableTableContainer = Ember.Table.TablesContainer.extend Ember.Table.RowSelectionMixin,
38
+ selectionBinding: 'controller.selection'
39
+
40
+ Magic.EditableTable = Ember.View.extend
41
+ classNames: "presentation-container"
42
+ template: Ember.Handlebars.compile ( '{{view Magic.EditableTableContainer}}\n<button class="button" {{action add}}>Add</button>')
43
+
44
+ Ember.Handlebars.registerHelper 'magic_editable_table', (path, options) ->
45
+ unless options
46
+ options = path
47
+ path = "controller"
48
+ content = Ember.Handlebars.get(@, path, options)
49
+ if Magic.EditableTableController.detectInstance content
50
+ controller = content
51
+ else
52
+ controller = Magic.EditableTableController.create content: content
53
+ options.hash.controller = controller
54
+ Ember.Handlebars.helpers.view.call(@, Magic.EditableTable, options)
@@ -0,0 +1,10 @@
1
+ require "ember-magic-table/version"
2
+
3
+ module Ember
4
+ module Magic
5
+ module Table
6
+ class MagicTableEngine < Rails::Engine
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Ember
2
+ module Magic
3
+ module Table
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ eval("(function() {\n\nEmber.TEMPLATES[\"body-container\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n data.buffer.push(\"<div class='table-scrollable-wrapper'>\\n \");\n hashTypes = {'classNames': \"STRING\",'contentBinding': \"STRING\",'columnsBinding': \"STRING\",'widthBinding': \"STRING\",'numItemsShowingBinding': \"STRING\",'scrollTopBinding': \"STRING\",'startIndexBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.LazyTableBlock\", {hash:{\n 'classNames': (\"left-table-block\"),\n 'contentBinding': (\"controller.bodyContent\"),\n 'columnsBinding': (\"controller.fixedColumns\"),\n 'widthBinding': (\"controller._fixedBlockWidth\"),\n 'numItemsShowingBinding': (\"controller._numItemsShowing\"),\n 'scrollTopBinding': (\"controller._scrollTop\"),\n 'startIndexBinding': (\"controller._startIndex\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n \");\n hashTypes = {'classNames': \"STRING\",'contentBinding': \"STRING\",'columnsBinding': \"STRING\",'scrollLeftBinding': \"STRING\",'widthBinding': \"STRING\",'numItemsShowingBinding': \"STRING\",'scrollTopBinding': \"STRING\",'startIndexBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.LazyTableBlock\", {hash:{\n 'classNames': (\"right-table-block\"),\n 'contentBinding': (\"controller.bodyContent\"),\n 'columnsBinding': (\"controller.tableColumns\"),\n 'scrollLeftBinding': (\"controller._tableScrollLeft\"),\n 'widthBinding': (\"controller._tableBlockWidth\"),\n 'numItemsShowingBinding': (\"controller._numItemsShowing\"),\n 'scrollTopBinding': (\"controller._scrollTop\"),\n 'startIndexBinding': (\"controller._startIndex\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n</div>\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"footer-container\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n data.buffer.push(\"<div class='table-fixed-wrapper'>\\n \");\n hashTypes = {'classNames': \"STRING\",'contentBinding': \"STRING\",'columnsBinding': \"STRING\",'widthBinding': \"STRING\",'heightBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.TableBlock\", {hash:{\n 'classNames': (\"left-table-block\"),\n 'contentBinding': (\"controller.footerContent\"),\n 'columnsBinding': (\"controller.fixedColumns\"),\n 'widthBinding': (\"controller._fixedBlockWidth\"),\n 'heightBinding': (\"controller.footerHeight\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n \");\n hashTypes = {'classNames': \"STRING\",'contentBinding': \"STRING\",'columnsBinding': \"STRING\",'scrollLeftBinding': \"STRING\",'widthBinding': \"STRING\",'heightBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.TableBlock\", {hash:{\n 'classNames': (\"right-table-block\"),\n 'contentBinding': (\"controller.footerContent\"),\n 'columnsBinding': (\"controller.tableColumns\"),\n 'scrollLeftBinding': (\"controller._tableScrollLeft\"),\n 'widthBinding': (\"controller._tableBlockWidth\"),\n 'heightBinding': (\"controller.footerHeight\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n</div>\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"header-cell\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n data.buffer.push(\"<span \");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers.action.call(depth0, \"sortByColumn\", \"view.content\", {hash:{},contexts:[depth0,depth0],types:[\"ID\",\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\">\\n \");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers._triageMustache.call(depth0, \"view.content.headerCellName\", {hash:{},contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n</span>\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"header-container\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n data.buffer.push(\"<div class='table-fixed-wrapper'>\\n \");\n hashTypes = {'classNames': \"STRING\",'columnsBinding': \"STRING\",'widthBinding': \"STRING\",'heightBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.HeaderBlock\", {hash:{\n 'classNames': (\"left-table-block\"),\n 'columnsBinding': (\"controller.fixedColumns\"),\n 'widthBinding': (\"controller._fixedBlockWidth\"),\n 'heightBinding': (\"controller.headerHeight\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n \");\n hashTypes = {'classNames': \"STRING\",'columnsBinding': \"STRING\",'scrollLeftBinding': \"STRING\",'widthBinding': \"STRING\",'heightBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.HeaderBlock\", {hash:{\n 'classNames': (\"right-table-block\"),\n 'columnsBinding': (\"controller.tableColumns\"),\n 'scrollLeftBinding': (\"controller._tableScrollLeft\"),\n 'widthBinding': (\"controller._tableBlockWidth\"),\n 'heightBinding': (\"controller.headerHeight\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n</div>\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"header-row\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n hashTypes = {'contentBinding': \"STRING\",'itemViewClassField': \"STRING\",'widthBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.MultiItemViewCollectionView\", {hash:{\n 'contentBinding': (\"view.content\"),\n 'itemViewClassField': (\"headerCellViewClass\"),\n 'widthBinding': (\"controller._tableColumnsWidth\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"table-row\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', hashTypes, escapeExpression=this.escapeExpression;\n\n\n hashTypes = {'rowBinding': \"STRING\",'contentBinding': \"STRING\",'itemViewClassField': \"STRING\",'widthBinding': \"STRING\"};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.MultiItemViewCollectionView\", {hash:{\n 'rowBinding': (\"view.row\"),\n 'contentBinding': (\"view.columns\"),\n 'itemViewClassField': (\"tableCellViewClass\"),\n 'widthBinding': (\"controller._tableColumnsWidth\")\n },contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n return buffer;\n \n});\n\nEmber.TEMPLATES[\"tables-container\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nthis.compilerInfo = [2,'>= 1.0.0-rc.3'];\nhelpers = helpers || Ember.Handlebars.helpers; data = data || {};\n var buffer = '', stack1, hashTypes, escapeExpression=this.escapeExpression, self=this;\n\nfunction program1(depth0,data) {\n \n var buffer = '', hashTypes;\n data.buffer.push(\"\\n \");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.HeaderTableContainer\", {hash:{},contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n return buffer;\n }\n\nfunction program3(depth0,data) {\n \n var buffer = '', hashTypes;\n data.buffer.push(\"\\n \");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.FooterTableContainer\", {hash:{},contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n return buffer;\n }\n\n hashTypes = {};\n stack1 = helpers['if'].call(depth0, \"controller.hasHeader\", {hash:{},inverse:self.noop,fn:self.program(1, program1, data),contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data});\n if(stack1 || stack1 === 0) { data.buffer.push(stack1); }\n data.buffer.push(\"\\n\");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.BodyTableContainer\", {hash:{},contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n hashTypes = {};\n stack1 = helpers['if'].call(depth0, \"controller.hasFooter\", {hash:{},inverse:self.noop,fn:self.program(3, program3, data),contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data});\n if(stack1 || stack1 === 0) { data.buffer.push(stack1); }\n data.buffer.push(\"\\n\");\n hashTypes = {};\n data.buffer.push(escapeExpression(helpers.view.call(depth0, \"Ember.Table.ScrollContainer\", {hash:{},contexts:[depth0],types:[\"ID\"],hashTypes:hashTypes,data:data})));\n data.buffer.push(\"\\n\");\n return buffer;\n \n});\n\n})();//@ sourceURL=build/templates/templates.js")
2
+
3
+ eval("(function() {\n\n/*\njQuery.browser shim that makes HT working with jQuery 1.8+\n*/\n\nif (!jQuery.browser) {\n (function() {\n var browser, matched;\n matched = void 0;\n browser = void 0;\n jQuery.uaMatch = function(ua) {\n var match;\n ua = ua.toLowerCase();\n match = /(chrome)[ \\/]([\\w.]+)/.exec(ua) || /(webkit)[ \\/]([\\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \\/]([\\w.]+)/.exec(ua) || /(msie) ([\\w.]+)/.exec(ua) || ua.indexOf(\"compatible\") < 0 && /(mozilla)(?:.*? rv:([\\w.]+)|)/.exec(ua) || [];\n return {\n browser: match[1] || \"\",\n version: match[2] || \"0\"\n };\n };\n matched = jQuery.uaMatch(navigator.userAgent);\n browser = {};\n if (matched.browser) {\n browser[matched.browser] = true;\n browser.version = matched.version;\n }\n if (browser.chrome) {\n browser.webkit = true;\n } else {\n if (browser.webkit) {\n browser.safari = true;\n }\n }\n return jQuery.browser = browser;\n })();\n}\n\n\n})();//@ sourceURL=build/src/utils/jquery_fix.js")
4
+
5
+ eval("(function() {\n\n\n(function($) {\n return $.getScrollbarWidth = function() {\n var $div, $textarea1, $textarea2, scrollbarWidth;\n scrollbarWidth = 0;\n if (!scrollbarWidth) {\n if ($.browser.msie) {\n $textarea1 = $(\"<textarea cols=\\\"10\\\" rows=\\\"2\\\"></textarea>\").css({\n position: \"absolute\",\n top: -1000,\n left: -1000\n }).appendTo(\"body\");\n $textarea2 = $(\"<textarea cols=\\\"10\\\" rows=\\\"2\\\" style=\\\"overflow: hidden;\\\"></textarea>\").css({\n position: \"absolute\",\n top: -1000,\n left: -1000\n }).appendTo(\"body\");\n scrollbarWidth = $textarea1.width() - $textarea2.width();\n $textarea1.add($textarea2).remove();\n } else {\n $div = $(\"<div />\").css({\n width: 100,\n height: 100,\n overflow: \"auto\",\n position: \"absolute\",\n top: -1000,\n left: -1000\n }).prependTo(\"body\").append(\"<div />\").find(\"div\").css({\n width: \"100%\",\n height: 200\n });\n scrollbarWidth = 100 - $div.width();\n $div.parent().remove();\n }\n }\n return scrollbarWidth;\n };\n})(jQuery);\n\n\n})();//@ sourceURL=build/src/utils/scrollbar_width_helper.js")
6
+
7
+ eval("(function() {\n\nvar debounce;\n\nEmber.ResizeHandler = Ember.Mixin.create({\n resizeEndDelay: 200,\n resizing: false,\n onResizeStart: Ember.K,\n onResizeEnd: Ember.K,\n onResize: Ember.K,\n debounceResizeEnd: Ember.computed(function() {\n var _this = this;\n return debounce(function(event) {\n if (_this.isDestroyed) {\n return;\n }\n _this.set('resizing', false);\n return typeof _this.onResizeEnd === \"function\" ? _this.onResizeEnd(event) : void 0;\n }, this.get('resizeEndDelay'));\n }).property('resizeEndDelay'),\n resizeHandler: Ember.computed(function() {\n return jQuery.proxy(this.handleWindowResize, this);\n }).property(),\n handleWindowResize: function(event) {\n if (!this.get('resizing')) {\n this.set('resizing', true);\n if (typeof this.onResizeStart === \"function\") {\n this.onResizeStart(event);\n }\n }\n if (typeof this.onResize === \"function\") {\n this.onResize(event);\n }\n return this.get('debounceResizeEnd')(event);\n },\n didInsertElement: function() {\n this._super();\n return $(window).bind('resize', this.get(\"resizeHandler\"));\n },\n willDestroy: function() {\n $(window).unbind('resize', this.get(\"resizeHandler\"));\n return this._super();\n }\n});\n\ndebounce = function(func, wait, immediate) {\n var result, timeout;\n timeout = result = null;\n return function() {\n var args, callNow, context, later;\n context = this;\n args = arguments;\n later = function() {\n timeout = null;\n if (!immediate) {\n return result = func.apply(context, args);\n }\n };\n callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n }\n return result;\n };\n};\n\n\n})();//@ sourceURL=build/src/utils/resize_handler.js")
8
+
9
+ eval("(function() {\n\n\nEmber.StyleBindingsMixin = Ember.Mixin.create({\n concatenatedProperties: ['styleBindings'],\n attributeBindings: ['style'],\n unitType: 'px',\n createStyleString: function(styleName, property) {\n var value;\n value = this.get(property);\n if (value === void 0) {\n return;\n }\n if (Ember.typeOf(value) === 'number') {\n value = value + this.get('unitType');\n }\n return \"\" + styleName + \":\" + value + \";\";\n },\n applyStyleBindings: function() {\n var lookup, properties, styleBindings, styleComputed, styles,\n _this = this;\n styleBindings = this.styleBindings;\n if (!styleBindings) {\n return;\n }\n lookup = {};\n styleBindings.forEach(function(binding) {\n var property, style, _ref;\n _ref = binding.split(':'), property = _ref[0], style = _ref[1];\n return lookup[style || property] = property;\n });\n styles = Ember.keys(lookup);\n properties = styles.map(function(style) {\n return lookup[style];\n });\n styleComputed = Ember.computed(function() {\n var styleString, styleTokens;\n styleTokens = styles.map(function(style) {\n return _this.createStyleString(style, lookup[style]);\n });\n styleString = styleTokens.join('');\n if (styleString.length !== 0) {\n return styleString;\n }\n });\n styleComputed.property.apply(styleComputed, properties);\n return Ember.defineProperty(this, 'style', styleComputed);\n },\n init: function() {\n this.applyStyleBindings();\n return this._super();\n }\n});\n\n\n})();//@ sourceURL=build/src/utils/style_bindings.js")
10
+
11
+ eval("(function() {\n\n\nEmber.LazyContainerView = Ember.ContainerView.extend(Ember.StyleBindingsMixin, {\n classNames: 'lazy-list-container',\n styleBindings: ['height'],\n content: null,\n itemViewClass: null,\n rowHeight: null,\n scrollTop: null,\n startIndex: null,\n init: function() {\n this._super();\n return this.onNumChildViewsDidChange();\n },\n height: Ember.computed(function() {\n return this.get('content.length') * this.get('rowHeight');\n }).property('content.length', 'rowHeight'),\n numChildViews: Ember.computed(function() {\n return this.get('numItemsShowing') + 2;\n }).property('numItemsShowing'),\n onNumChildViewsDidChange: Ember.observer(function() {\n var itemViewClass, newNumViews, numViewsToInsert, oldNumViews, view, viewsToAdd, viewsToRemove, _i, _results;\n view = this;\n itemViewClass = Ember.get(this.get('itemViewClass'));\n newNumViews = this.get('numChildViews');\n if (!(itemViewClass && newNumViews)) {\n return;\n }\n oldNumViews = this.get('length');\n numViewsToInsert = newNumViews - oldNumViews;\n if (numViewsToInsert < 0) {\n viewsToRemove = this.slice(newNumViews, oldNumViews);\n return this.removeObjects(viewsToRemove);\n } else if (numViewsToInsert > 0) {\n viewsToAdd = (function() {\n _results = [];\n for (var _i = 0; 0 <= numViewsToInsert ? _i < numViewsToInsert : _i > numViewsToInsert; 0 <= numViewsToInsert ? _i++ : _i--){ _results.push(_i); }\n return _results;\n }).apply(this).map(function() {\n return view.createChildView(itemViewClass);\n });\n return this.pushObjects(viewsToAdd);\n }\n }, 'numChildViews', 'itemViewClass'),\n viewportDidChange: Ember.observer(function() {\n var clength, content, numShownViews, startIndex;\n content = this.get('content') || [];\n clength = content.get('length');\n numShownViews = Math.min(this.get('length'), clength);\n startIndex = this.get('startIndex');\n if (startIndex + numShownViews >= clength) {\n startIndex = clength - numShownViews;\n }\n if (startIndex < 0) {\n 0;\n\n } else {\n startIndex;\n\n }\n return this.forEach(function(childView, i) {\n var item, itemIndex;\n if (i >= numShownViews) {\n childView = this.objectAt(i);\n childView.set('content', null);\n return;\n }\n itemIndex = startIndex + i;\n childView = this.objectAt(itemIndex % numShownViews);\n item = content.objectAt(itemIndex);\n if (item !== childView.get('content')) {\n childView.teardownContent();\n childView.set('itemIndex', itemIndex);\n childView.set('content', item);\n return childView.prepareContent();\n }\n }, this);\n }, 'content.length', 'length', 'startIndex')\n});\n\nEmber.LazyItemView = Ember.View.extend(Ember.StyleBindingsMixin, {\n itemIndex: null,\n prepareContent: Ember.K,\n teardownContent: Ember.K,\n rowHeightBinding: 'parentView.rowHeight',\n styleBindings: ['width', 'top', 'display'],\n top: Ember.computed(function() {\n return this.get('itemIndex') * this.get('rowHeight');\n }).property('itemIndex', 'rowHeight'),\n display: Ember.computed(function() {\n if (!this.get('content')) {\n return 'none';\n }\n }).property('content')\n});\n\n\n})();//@ sourceURL=build/src/utils/lazy_container_view.js")
12
+
13
+ eval("(function() {\n\n\nEmber.MultiItemViewCollectionView = Ember.CollectionView.extend({\n itemViewClassField: null,\n createChildView: function(view, attrs) {\n var itemViewClass, itemViewClassField;\n itemViewClassField = this.get('itemViewClassField');\n itemViewClass = attrs.content.get(itemViewClassField);\n if (typeof itemViewClass === 'string') {\n itemViewClass = Ember.get(Ember.lookup, itemViewClass);\n }\n return this._super(itemViewClass, attrs);\n }\n});\n\nEmber.MouseWheelHandlerMixin = Ember.Mixin.create({\n onMouseWheel: Ember.K,\n didInsertElement: function() {\n var _this = this;\n this._super();\n return this.$().bind('mousewheel', function(event, delta, deltaX, deltaY) {\n return Ember.run(_this, _this.onMouseWheel, event, delta, deltaX, deltaY);\n });\n },\n willDestroy: function() {\n var _ref;\n if ((_ref = this.$()) != null) {\n _ref.unbind('mousewheel');\n }\n return this._super();\n }\n});\n\nEmber.ScrollHandlerMixin = Ember.Mixin.create({\n onScroll: Ember.K,\n didInsertElement: function() {\n var _this = this;\n this._super();\n return this.$().bind('scroll', function(event) {\n return Ember.run(_this, _this.onScroll, event);\n });\n },\n willDestroy: function() {\n var _ref;\n if ((_ref = this.$()) != null) {\n _ref.unbind('scroll');\n }\n return this._super();\n }\n});\n\n\n})();//@ sourceURL=build/src/utils/utils.js")
14
+
15
+ eval("(function() {\n\n\nEmber.Table = Ember.Namespace.create();\n\nEmber.Table.ColumnDefinition = Ember.Object.extend({\n headerCellName: null,\n resize: function(pxWidth, tableWidth) {\n var diff, newMaxWidth, newWidth, nextCol, oldWidth, percent;\n newMaxWidth = null;\n tableWidth = tableWidth || this.get(\"controller._tableContainerWidth\");\n if (!this.get(\"controller.fluidTable\")) {\n if (pxWidth) {\n this.set(\"columnWidth\", pxWidth);\n }\n return null;\n }\n if (!tableWidth) {\n return;\n }\n percent = function(val) {\n if (\"string\" === typeof val) {\n return +(val.replace(\"%\", \"\"));\n } else {\n return val * 100 / tableWidth;\n }\n };\n oldWidth = percent(this.get(\"columnWidth\"));\n newWidth = 'number' === typeof pxWidth ? percent(pxWidth) : oldWidth;\n nextCol = this.get(\"_nextColumn\");\n if (nextCol) {\n diff = oldWidth - newWidth + percent(nextCol.get(\"columnWidth\"));\n nextCol.set(\"columnWidth\", diff / 100 * tableWidth);\n newMaxWidth = (newWidth + diff) / 100 * tableWidth - 100;\n }\n this.set(\"columnWidth\", newWidth / 100 * tableWidth);\n this.notifyPropertyChange(\"columnWidth\");\n return newMaxWidth;\n },\n _convertColumnToWidth: Ember.beforeObserver(function() {\n var tableWidth;\n if (!this.get(\"controller.fluidTable\")) {\n return;\n }\n tableWidth = this.get(\"controller._tableContainerWidth\");\n if (tableWidth) {\n return this.set(\"columnWidth\", this.get(\"columnWidth\") / tableWidth * 100 + \"%\");\n }\n }, \"controller._tableContainerWidth\"),\n _resizeToTable: Ember.observer(function() {\n return this.resize();\n }, \"controller._tableContainerWidth\"),\n columnWidth: 150,\n headerCellViewClass: 'Ember.Table.HeaderCell',\n tableCellViewClass: 'Ember.Table.TableCell',\n getCellContent: function(row) {\n var path;\n path = this.get('contentPath');\n Ember.assert(\"You must either provide a contentPath or override \" + \"getCellContent in your column definition\", path != null);\n return Ember.get(row, path);\n },\n setCellContent: Ember.K\n});\n\nEmber.Table.Row = Ember.ObjectProxy.extend({\n content: null,\n isHovering: false,\n isSelected: false,\n isShowing: true,\n isActive: false\n});\n\nEmber.Table.RowArrayProxy = Ember.ArrayProxy.extend({\n tableRowClass: null,\n content: null,\n rowContent: Ember.computed(function() {\n return [];\n }).property(),\n objectAt: function(idx) {\n var item, row, tableRowClass;\n row = this.get('rowContent')[idx];\n if (row) {\n return row;\n }\n tableRowClass = this.get('tableRowClass');\n item = this.get('content').objectAt(idx);\n row = tableRowClass.create({\n content: item\n });\n this.get('rowContent')[idx] = row;\n return row;\n }\n});\n\nEmber.Table.TableController = Ember.Controller.extend({\n columns: null,\n numFixedColumns: 0,\n numFooterRow: 0,\n rowHeight: 30,\n headerHeight: 50,\n footerHeight: 30,\n hasHeader: true,\n hasFooter: true,\n tableRowViewClass: 'Ember.Table.TableRow',\n fluidTable: false,\n bodyContent: Ember.computed(function() {\n return Ember.Table.RowArrayProxy.create({\n tableRowClass: Ember.Table.Row,\n content: this.get('content')\n });\n }).property('content'),\n footerContent: Ember.computed(function(key, value) {\n if (value) {\n return value;\n } else {\n return Ember.A();\n }\n }).property(),\n fixedColumns: Ember.computed(function() {\n var columns, numFixedColumns;\n columns = this.get('columns');\n if (!columns) {\n return Ember.A();\n }\n numFixedColumns = this.get('numFixedColumns') || 0;\n return columns.slice(0, numFixedColumns);\n }).property('columns.@each', 'numFixedColumns'),\n tableColumns: Ember.computed(function() {\n var columns, numFixedColumns;\n columns = this.get('columns');\n if (!columns) {\n return Ember.A();\n }\n numFixedColumns = this.get('numFixedColumns') || 0;\n columns = columns.slice(numFixedColumns, columns.get('length'));\n this.prepareTableColumns(columns);\n return columns;\n }).property('columns.@each', 'numFixedColumns'),\n prepareTableColumns: Ember.observer(function(tableColumns) {\n var col, columns, i, _i, _len, _results;\n columns = Ember.isArray(tableColumns) ? tableColumns : this.get(\"tableColumns\");\n _results = [];\n for (i = _i = 0, _len = columns.length; _i < _len; i = ++_i) {\n col = columns[i];\n col.set(\"_nextColumn\", columns.objectAt(i + 1));\n _results.push(col.set(\"controller\", this));\n }\n return _results;\n }, \"tableColumns.@each\", \"tableColumns\"),\n sortByColumn: Ember.K,\n _tableScrollTop: 0,\n _tableScrollLeft: 0,\n _width: null,\n _height: null,\n _scrollbarSize: null,\n _fixedColumnsWidth: Ember.computed(function() {\n return this._getTotalWidth(this.get('fixedColumns'));\n }).property('fixedColumns.@each.columnWidth'),\n _tableColumnsWidth: Ember.computed(function() {\n if (this.get(\"fluidTable\")) {\n return \"100%\";\n }\n return this._getTotalWidth(this.get('tableColumns'));\n }).property('tableColumns.@each.columnWidth', \"fluidTable\"),\n _rowWidth: Ember.computed(function() {\n var columnsWidth, nonFixedTableWidth;\n columnsWidth = this.get('_tableColumnsWidth');\n nonFixedTableWidth = this.get('_tableContainerWidth') - this.get('_fixedColumnsWidth');\n if (columnsWidth < nonFixedTableWidth) {\n return nonFixedTableWidth;\n }\n return columnsWidth;\n }).property('_fixedColumnsWidth', '_tableColumnsWidth', '_tableContainerWidth'),\n _bodyHeight: Ember.computed(function() {\n var bodyHeight, footerHeight, headerHeight, scrollbarSize;\n bodyHeight = this.get('_height');\n headerHeight = this.get('headerHeight');\n footerHeight = this.get('footerHeight');\n scrollbarSize = this.get('_scrollbarSize');\n if (this.get('_tableColumnsWidth') > this.get('_width') - this.get('_fixedColumnsWidth')) {\n bodyHeight -= scrollbarSize;\n }\n if (this.get('hasHeader')) {\n bodyHeight -= headerHeight;\n }\n if (this.get('hasFooter')) {\n bodyHeight -= footerHeight;\n }\n return bodyHeight;\n }).property('_height', 'headerHeight', 'footerHeight', '_scrollbarSize', 'hasHeader', 'hasFooter', '_tableColumnsWidth', '_width', '_fixedColumnsWidth'),\n _tableBlockWidth: Ember.computed(function() {\n return this.get('_width') - this.get('_fixedColumnsWidth') - this.get('_scrollbarSize');\n }).property('_width', '_fixedColumnsWidth', '_scrollbarSize'),\n _fixedBlockWidthBinding: '_fixedColumnsWidth',\n _tableContentHeight: Ember.computed(function() {\n return this.get('rowHeight') * this.get('bodyContent.length');\n }).property('rowHeight', 'bodyContent.length'),\n _tableContainerWidth: Ember.computed(function() {\n return this.get('_width') - this.get('_scrollbarSize');\n }).property('_width', '_scrollbarSize'),\n _scrollContainerWidth: Ember.computed(function() {\n return this.get('_width') - this.get('_fixedColumnsWidth') - this.get('_scrollbarSize');\n }).property('_width', '_fixedColumnsWidth', '_scrollbarSize'),\n _scrollContainerHeight: Ember.computed(function() {\n var containerHeight;\n return containerHeight = this.get('_height') - this.get('headerHeight');\n }).property('_height', 'headerHeight'),\n _numItemsShowing: Ember.computed(function() {\n return Math.floor(this.get('_bodyHeight') / this.get('rowHeight'));\n }).property('_bodyHeight', 'rowHeight'),\n _startIndex: Ember.computed(function() {\n var index, numContent, numViews, rowHeight, scrollTop;\n numContent = this.get('bodyContent.length');\n numViews = this.get('_numItemsShowing');\n rowHeight = this.get('rowHeight');\n scrollTop = this.get('_tableScrollTop');\n index = Math.floor(scrollTop / rowHeight);\n if (index + numViews >= numContent) {\n index = numContent - numViews;\n }\n if (index < 0) {\n return 0;\n } else {\n return index;\n }\n }).property('bodyContent.length', '_numItemsShowing', 'rowHeight', '_tableScrollTop'),\n _getTotalWidth: function(columns) {\n var widths;\n if (!columns) {\n return 0;\n }\n widths = columns.getEach('columnWidth') || [];\n return widths.reduce((function(total, w) {\n return total + w;\n }), 0);\n }\n});\n\n\n})();//@ sourceURL=build/src/controllers.js")
16
+
17
+ eval("(function() {\n\nvar indexesOf;\n\nindexesOf = Ember.EnumerableUtils.indexesOf;\n\nEmber.Table.RowSelectionMixin = Ember.Mixin.create({\n attributeBindings: 'tabindex',\n content: Ember.computed.alias('controller.bodyContent'),\n rowHeight: Ember.computed.alias('controller.rowHeight'),\n numItemsShowing: Ember.computed.alias('controller._numItemsShowing'),\n startIndex: Ember.computed.alias('controller._startIndex'),\n scrollTop: Ember.computed.alias('controller._tableScrollTop'),\n tabindex: -1,\n KEY_EVENTS: {\n 37: 'leftArrowPressed',\n 38: 'upArrowPressed',\n 39: 'rightArrowPressed',\n 40: 'downArrowPressed'\n },\n _calculateSelectionIndices: function(value) {\n var content, indices, rows, selection;\n selection = this.get('selectionIndices');\n selection.clear();\n rows = this.get('content');\n if (rows) {\n content = rows.mapProperty('content');\n indices = indexesOf(content, value);\n return selection.addObjects(indices);\n }\n },\n contentDidChange: Ember.observer(function() {\n return this._calculateSelectionIndices(this.get('selection'));\n }, 'content.@each.content'),\n selection: Ember.computed(function(key, value) {\n var rows, selection;\n rows = this.get('content') || [];\n selection = this.get('selectionIndices');\n value = value || [];\n if (arguments.length === 1) {\n value = selection.map(function(index) {\n return rows.objectAt(index).get('content');\n });\n } else {\n this._calculateSelectionIndices(value);\n }\n return value;\n }).property('selectionIndices.[]'),\n selectionIndices: Ember.computed(function() {\n var set;\n set = new Ember.Set();\n set.addEnumerableObserver(this);\n return set;\n }).property(),\n enumerableDidChange: Ember.K,\n enumerableWillChange: function(set, removing, adding) {\n var content;\n content = this.get('content');\n if (!content) {\n return;\n }\n if ('number' === typeof removing) {\n set.forEach(function(index) {\n var row;\n row = content.objectAt(index);\n if (row) {\n return row.set('isSelected', false);\n }\n });\n } else if (removing) {\n removing.forEach(function(index) {\n var row;\n row = content.objectAt(index);\n if (row) {\n return row.set('isSelected', false);\n }\n });\n }\n if (adding && 'number' !== typeof adding) {\n return adding.forEach(function(index) {\n var row;\n row = content.objectAt(index);\n if (row) {\n return row.set('isSelected', true);\n }\n });\n }\n },\n mouseDown: function(event) {\n var index, sel;\n index = this.getIndexForEvent(event);\n sel = this.get('selectionIndices');\n if (sel.contains(index) && sel.length === 1) {\n return sel.clear();\n }\n return this.setSelectionIndex(index);\n },\n keyDown: function(event) {\n var map, method, _ref;\n map = this.get('KEY_EVENTS');\n method = map[event.keyCode];\n if (method) {\n return (_ref = this.get(method)) != null ? _ref.apply(this, arguments) : void 0;\n }\n },\n upArrowPressed: function(event) {\n var index, sel;\n event.preventDefault();\n sel = this.get('selectionIndices.lastObject');\n index = event.ctrlKey || event.metaKey ? 0 : sel - 1;\n return this.setSelectionIndex(index);\n },\n downArrowPressed: function(event) {\n var clen, index, sel;\n event.preventDefault();\n sel = this.get('selectionIndices.lastObject');\n clen = this.get('content.length');\n index = event.ctrlKey || event.metaKey ? clen - 1 : sel + 1;\n return this.setSelectionIndex(index);\n },\n getIndexForEvent: function(event) {\n return this.getRowIndexFast(this.getRowForEvent(event));\n },\n getRowForEvent: function(event) {\n var $rowView, view;\n $rowView = $(event.target).parents('.table-row');\n view = Ember.View.views[$rowView.attr('id')];\n if (view) {\n return view.get('row');\n }\n },\n getRowIndexFast: function(row) {\n var index, numRows, startIndex, sublist;\n startIndex = this.get('startIndex');\n numRows = this.get('numItemsShowing') + 1;\n sublist = this.get('content').slice(startIndex, startIndex + numRows);\n index = sublist.indexOf(row);\n if (index < 0) {\n return index;\n } else {\n return index + startIndex;\n }\n },\n setSelectionIndex: function(index) {\n var sel;\n if (!this.ensureIndex(index)) {\n return;\n }\n sel = this.get('selectionIndices');\n this.get('selectionIndices').clear();\n return this.toggleSelectionIndex(index);\n },\n toggleSelectionIndex: function(index) {\n var sel;\n if (!this.ensureIndex(index)) {\n return;\n }\n sel = this.get('selectionIndices');\n if (sel.contains(index)) {\n sel.remove(index);\n } else {\n sel.add(index);\n }\n return this.ensureVisible(index);\n },\n ensureIndex: function(index) {\n var clen;\n clen = this.get('content.length');\n return index >= 0 && index < clen;\n },\n ensureVisible: function(index) {\n var endIndex, numRows, startIndex;\n startIndex = this.get('startIndex');\n numRows = this.get('numItemsShowing');\n endIndex = startIndex + numRows;\n if (index < startIndex) {\n return this.scrollToRowIndex(index);\n } else if (index >= endIndex) {\n return this.scrollToRowIndex(index - numRows + 1);\n }\n },\n scrollToRowIndex: function(index) {\n var rowHeight, scrollTop;\n rowHeight = this.get('rowHeight');\n scrollTop = index * rowHeight;\n return this.set('scrollTop', scrollTop);\n }\n});\n\nEmber.Table.RowMultiSelectionMixin = Ember.Mixin.create(Ember.Table.RowSelectionMixin, {\n selectionRange: void 0,\n enumerableDidChange: function(set, removing, adding) {\n if ('number' === typeof removing) {\n this.set('selectionRange', void 0);\n } else if (removing) {\n this.reduceSelectionRange(removing);\n }\n if (adding && 'number' !== typeof adding) {\n return this.expandSelectionRange(adding);\n }\n },\n expandSelectionRange: function(indices) {\n var max, min, range, _ref;\n range = this.get('selectionRange');\n _ref = [Math.min.apply(null, indices), Math.max.apply(null, indices)], min = _ref[0], max = _ref[1];\n if (!range) {\n range = {\n min: min,\n max: max\n };\n }\n range = {\n min: Math.min(range.min, min),\n max: Math.max(range.max, max)\n };\n return this.set('selectionRange', range);\n },\n reduceSelectionRange: function(indices) {\n var max, min, range, _ref;\n indices = this.get('selectionIndices');\n _ref = [Math.min.apply(null, indices), Math.max.apply(null, indices)], min = _ref[0], max = _ref[1];\n range = {\n min: min,\n max: max\n };\n return this.set('selectionRange', range);\n },\n mouseDown: function(event) {\n var index, range, row;\n row = this.getRowForEvent(event);\n index = this.getRowIndexFast(row);\n if (event.ctrlKey || event.metaKey) {\n return this.toggleSelectionIndex(index);\n } else if (event.shiftKey) {\n range = this.get('selectionRange');\n if (range) {\n return this.setSelectionRange(range.min, index, index);\n }\n } else {\n return this._super(event);\n }\n },\n upArrowPressed: function(event) {\n var index, range;\n event.preventDefault();\n if (event.shiftKey) {\n range = this.get('selectionRange');\n index = range.min - 1;\n if (range) {\n return this.setSelectionRange(index, range.max, index);\n }\n } else {\n return this._super(event);\n }\n },\n downArrowPressed: function(event) {\n var index, range;\n event.preventDefault();\n if (event.shiftKey) {\n range = this.get('selectionRange');\n index = range.max + 1;\n if (range) {\n return this.setSelectionRange(range.min, index, index);\n }\n } else {\n return this._super(event);\n }\n },\n setSelectionRange: function(start, end, visibleIndex) {\n var beg, sel, _i, _results;\n if (!(this.ensureIndex(start) && this.ensureIndex(end))) {\n return;\n }\n beg = start < end ? start : end;\n end = start < end ? end : start;\n sel = this.get('selectionIndices');\n sel.clear();\n sel.addObjects((function() {\n _results = [];\n for (var _i = beg; beg <= end ? _i <= end : _i >= end; beg <= end ? _i++ : _i--){ _results.push(_i); }\n return _results;\n }).apply(this));\n return this.ensureVisible(visibleIndex);\n }\n});\n\n\n})();//@ sourceURL=build/src/row_selection_mixin.js")
18
+
19
+ eval("(function() {\n\n\nEmber.Table.TablesContainer = Ember.View.extend(Ember.ResizeHandler, {\n templateName: 'tables-container',\n classNames: 'tables-container',\n didInsertElement: function() {\n var isLion, scrollBarWidth;\n this._super();\n this.elementSizeDidChange();\n scrollBarWidth = $.getScrollbarWidth();\n isLion = (typeof navigator !== \"undefined\" && navigator !== null ? navigator.appVersion['10_7'] : void 0) !== -1 && scrollBarWidth === 0;\n if (isLion) {\n scrollBarWidth = 8;\n }\n this.set('controller._scrollbarSize', scrollBarWidth);\n return this.set('controller._tableScrollTop', 0);\n },\n onResize: function() {\n return this.elementSizeDidChange();\n },\n elementSizeDidChange: function() {\n this.set('controller._width', this.$().width());\n return this.set('controller._height', this.$().height());\n }\n});\n\nEmber.Table.TableContainer = Ember.View.extend(Ember.StyleBindingsMixin, {\n classNames: ['table-container'],\n styleBindings: ['height', 'width']\n});\n\nEmber.Table.TableBlock = Ember.CollectionView.extend(Ember.StyleBindingsMixin, {\n classNames: ['table-block'],\n styleBindings: ['width', 'height'],\n itemViewClass: Ember.computed.alias('controller.tableRowViewClass'),\n columns: null,\n content: null,\n scrollLeft: null,\n onScrollLeftDidChange: Ember.observer(function() {\n return this.$().scrollLeft(this.get('scrollLeft'));\n }, 'scrollLeft')\n});\n\nEmber.Table.LazyTableBlock = Ember.LazyContainerView.extend({\n classNames: ['table-block'],\n styleBindings: ['width'],\n itemViewClass: Ember.computed.alias('controller.tableRowViewClass'),\n rowHeight: Ember.computed.alias('controller.rowHeight'),\n columns: null,\n content: null,\n scrollLeft: null,\n scrollTop: null,\n onScrollLeftDidChange: Ember.observer(function() {\n return this.$().scrollLeft(this.get('scrollLeft'));\n }, 'scrollLeft')\n});\n\nEmber.Table.TableRow = Ember.LazyItemView.extend({\n templateName: 'table-row',\n classNames: 'table-row',\n classNameBindings: ['row.isActive:active', 'row.isSelected:selected'],\n styleBindings: ['width', 'height'],\n row: Ember.computed.alias('content'),\n columns: Ember.computed.alias('parentView.columns'),\n width: Ember.computed.alias('controller._rowWidth'),\n height: Ember.computed.alias('controller.rowHeight'),\n mouseEnter: function(event) {\n var row;\n row = this.get('row');\n if (row) {\n return row.set('isActive', true);\n }\n },\n mouseLeave: function(event) {\n var row;\n row = this.get('row');\n if (row) {\n return row.set('isActive', false);\n }\n },\n teardownContent: function() {\n var row;\n row = this.get('row');\n if (row) {\n return row.set('isActive', false);\n }\n }\n});\n\nEmber.Table.TableCell = Ember.View.extend(Ember.StyleBindingsMixin, {\n defaultTemplate: Ember.Handlebars.compile(\"<span class='content'>{{view.cellContent}}</span>\"),\n classNames: ['table-cell'],\n styleBindings: ['width'],\n row: Ember.computed.alias('parentView.row'),\n column: Ember.computed.alias('content'),\n rowContent: Ember.computed.alias('row.content'),\n width: Ember.computed.alias('column.columnWidth'),\n cellContent: Ember.computed(function(key, value) {\n var column, row;\n row = this.get('rowContent');\n column = this.get('column');\n if (!(row && column)) {\n return;\n }\n if (arguments.length === 1) {\n value = column.getCellContent(row);\n } else {\n column.setCellContent(row, value);\n }\n return value;\n }).property('rowContent.isLoaded', 'column')\n});\n\nEmber.Table.HeaderBlock = Ember.Table.TableBlock.extend({\n classNames: ['header-block'],\n itemViewClass: 'Ember.Table.HeaderRow',\n content: Ember.computed(function() {\n return [this.get('columns')];\n }).property('columns')\n});\n\nEmber.Table.HeaderRow = Ember.View.extend(Ember.StyleBindingsMixin, {\n templateName: 'header-row',\n classNames: ['table-row', 'header-row'],\n styleBindings: ['height', 'width'],\n columns: Ember.computed.alias('content'),\n height: Ember.computed.alias('controller.headerHeight'),\n width: Ember.computed.alias('controller._tableColumnsWidth'),\n sortableOption: Ember.computed(function() {\n return {\n axis: 'x',\n cursor: 'pointer',\n helper: 'clone',\n containment: 'parent',\n placeholder: 'ui-state-highlight',\n scroll: true,\n tolerance: 'pointer',\n update: jQuery.proxy(this.onColumnSort, this)\n };\n }).property(),\n didInsertElement: function() {\n this._super();\n return this.$('> div').sortable(this.get('sortableOption'));\n },\n onColumnSort: function(event, ui) {\n var column, columns, newIndex, view;\n newIndex = ui.item.index();\n view = Ember.View.views[ui.item.attr('id')];\n columns = this.get('columns');\n column = view.get('column');\n columns.removeObject(column);\n return columns.insertAt(newIndex, column);\n }\n});\n\nEmber.Table.HeaderCell = Ember.View.extend(Ember.StyleBindingsMixin, {\n templateName: 'header-cell',\n classNames: ['table-cell', 'header-cell'],\n styleBindings: ['width', 'height'],\n column: Ember.computed.alias('content'),\n width: Ember.computed.alias('column.columnWidth'),\n height: Ember.computed.alias('controller.headerHeight'),\n resizableOption: Ember.computed(function() {\n return {\n handles: 'e',\n minHeight: 40,\n minWidth: this.get(\"column.minWidth\") || 100,\n maxWidth: this.get(\"column.maxWidth\") || 500,\n resize: jQuery.proxy(this.onColumnResize, this),\n stop: jQuery.proxy(this.onColumnResize, this)\n };\n }).property(),\n didInsertElement: function() {\n var fluid;\n fluid = this.get(\"controller.fluidTable\");\n if (!fluid || (fluid && this.get(\"column._nextColumn\"))) {\n this.$().resizable(this.get('resizableOption'));\n return this._resizableWidget = this.$().resizable('widget');\n }\n },\n onColumnResize: function(event, ui) {\n var max;\n max = this.get(\"column\").resize(ui.size.width);\n if (max) {\n return this.$().resizable(\"option\", \"maxWidth\", max);\n }\n }\n});\n\nEmber.Table.HeaderTableContainer = Ember.Table.TableContainer.extend(Ember.MouseWheelHandlerMixin, {\n templateName: 'header-container',\n classNames: ['table-container', 'fixed-table-container', 'header-container'],\n height: Ember.computed.alias('controller.headerHeight'),\n width: Ember.computed.alias('controller._tableContainerWidth'),\n scrollLeft: Ember.computed.alias('controller._tableScrollLeft'),\n onMouseWheel: function(event, delta, deltaX, deltaY) {\n var scrollLeft;\n scrollLeft = this.$('.right-table-block').scrollLeft() + deltaX * 50;\n this.set('scrollLeft', scrollLeft);\n return event.preventDefault();\n }\n});\n\nEmber.Table.BodyTableContainer = Ember.Table.TableContainer.extend(Ember.MouseWheelHandlerMixin, Ember.ScrollHandlerMixin, {\n templateName: 'body-container',\n classNames: ['table-container', 'body-container'],\n height: Ember.computed.alias('controller._bodyHeight'),\n width: Ember.computed.alias('controller._width'),\n scrollTop: Ember.computed.alias('controller._tableScrollTop'),\n scrollLeft: Ember.computed.alias('controller._tableScrollLeft'),\n onScrollTopDidChange: Ember.observer(function() {\n return this.$().scrollTop(this.get('scrollTop'));\n }, 'scrollTop'),\n onScroll: function(event) {\n this.set('scrollTop', event.target.scrollTop);\n return event.preventDefault();\n },\n onMouseWheel: function(event, delta, deltaX, deltaY) {\n var scrollLeft;\n if (!(Math.abs(deltaX) > Math.abs(deltaY))) {\n return;\n }\n scrollLeft = this.$('.right-table-block').scrollLeft() + deltaX * 50;\n this.set('scrollLeft', scrollLeft);\n return event.preventDefault();\n }\n});\n\nEmber.Table.FooterTableContainer = Ember.Table.TableContainer.extend(Ember.MouseWheelHandlerMixin, {\n templateName: 'footer-container',\n classNames: ['table-container', 'fixed-table-container', 'footer-container'],\n styleBindings: ['top'],\n height: Ember.computed.alias('controller.footerHeight'),\n width: Ember.computed.alias('controller._tableContainerWidth'),\n scrollLeft: Ember.computed.alias('controller._tableScrollLeft'),\n top: Ember.computed(function() {\n var bodyHeight, contentHeight, headerHeight;\n headerHeight = this.get('controller.headerHeight');\n contentHeight = this.get('controller._tableContentHeight') + headerHeight;\n bodyHeight = this.get('controller._bodyHeight') + headerHeight;\n if (contentHeight < bodyHeight) {\n return contentHeight;\n } else {\n return bodyHeight;\n }\n }).property('controller._bodyHeight', 'controller.headerHeight', 'controller._tableContentHeight'),\n onMouseWheel: function(event, delta, deltaX, deltaY) {\n var scrollLeft;\n scrollLeft = this.$('.right-table-block').scrollLeft() + deltaX * 50;\n this.set('scrollLeft', scrollLeft);\n return event.preventDefault();\n }\n});\n\nEmber.Table.ScrollContainer = Ember.View.extend(Ember.StyleBindingsMixin, Ember.ScrollHandlerMixin, {\n template: Ember.Handlebars.compile(\"{{view Ember.Table.ScrollPanel}}\"),\n classNames: 'scroll-container',\n styleBindings: ['top', 'left', 'width', 'height'],\n width: Ember.computed.alias('controller._scrollContainerWidth'),\n height: Ember.computed.alias('controller._scrollContainerHeight'),\n top: Ember.computed.alias('controller.headerHeight'),\n left: Ember.computed.alias('controller._fixedColumnsWidth'),\n scrollTop: Ember.computed.alias('controller._tableScrollTop'),\n scrollLeft: Ember.computed.alias('controller._tableScrollLeft'),\n onScroll: function(event) {\n this.set('scrollLeft', event.target.scrollLeft);\n return event.preventDefault();\n },\n onScrollLeftDidChange: Ember.observer(function() {\n return this.$().scrollLeft(this.get('scrollLeft'));\n }, 'scrollLeft')\n});\n\nEmber.Table.ScrollPanel = Ember.View.extend(Ember.StyleBindingsMixin, {\n classNames: ['scroll-panel'],\n styleBindings: ['width', 'height'],\n width: Ember.computed.alias('controller._tableColumnsWidth'),\n height: Ember.computed.alias('controller._tableContentHeight')\n});\n\n\n})();//@ sourceURL=build/src/views.js")
@@ -0,0 +1,209 @@
1
+ .presentation-container {
2
+ width: 800px;
3
+ height: 600px;
4
+ margin: 50px auto;
5
+ }
6
+ .tables-container {
7
+ height: 100%;
8
+ width: 100%;
9
+ position: relative;
10
+ outline: 0;
11
+ z-index: 0;
12
+ font-size: 0;
13
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
14
+ background-color: #E1E1E1;
15
+ border: 1px solid #E1E1E1;
16
+ }
17
+ .tables-container * {
18
+ -moz-box-sizing: border-box;
19
+ -webkit-box-sizing: border-box;
20
+ box-sizing: border-box;
21
+ }
22
+ .tables-container a {
23
+ color: #333;
24
+ }
25
+ .tables-container .table-container {
26
+ overflow-x: hidden;
27
+ overflow-y: auto;
28
+ position: relative;
29
+ background-color: #FFF;
30
+ z-index: 3;
31
+ }
32
+ .tables-container .table-container .table-fixed-wrapper,
33
+ .tables-container .table-container .table-scrollable-wrapper {
34
+ overflow: visible;
35
+ white-space: nowrap;
36
+ }
37
+ .tables-container .table-container .table-fixed-wrapper .table-block,
38
+ .tables-container .table-container .table-scrollable-wrapper .table-block {
39
+ display: inline-block;
40
+ position: relative;
41
+ vertical-align: top;
42
+ overflow: hidden;
43
+ background-color: #F5F5F5;
44
+ }
45
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row,
46
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row {
47
+ position: absolute;
48
+ border-bottom: 1px solid #E1E1E1;
49
+ -webkit-user-select: none;
50
+ -moz-user-select: none;
51
+ -ms-user-select: none;
52
+ -o-user-select: none;
53
+ user-select: none;
54
+ }
55
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row > div,
56
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row > div {
57
+ height: 100%;
58
+ }
59
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row.selected,
60
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row.selected {
61
+ background-color: #227ECB !important;
62
+ color: #FFF;
63
+ cursor: pointer;
64
+ }
65
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .table-cell,
66
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .table-cell {
67
+ float: left;
68
+ font-size: 13px;
69
+ border-right: 1px solid #E1E1E1;
70
+ white-space: nowrap;
71
+ text-overflow: ellipsis;
72
+ overflow: hidden;
73
+ height: 100%;
74
+ }
75
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .table-cell span,
76
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .table-cell span {
77
+ vertical-align: middle;
78
+ padding: 0;
79
+ height: 100%;
80
+ line-height: 30px;
81
+ }
82
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .table-cell .content,
83
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .table-cell .content {
84
+ padding: 0 5px;
85
+ }
86
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .header-cell,
87
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .header-cell {
88
+ padding: 0px;
89
+ position: relative;
90
+ }
91
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .header-cell span,
92
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .header-cell span {
93
+ padding: 5px;
94
+ line-height: 50px;
95
+ }
96
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .header-cell .toggle,
97
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .header-cell .toggle {
98
+ padding: 0 0 0 5px;
99
+ }
100
+ .tables-container .table-container .table-fixed-wrapper .table-block .table-row .header-cell .column-title,
101
+ .tables-container .table-container .table-scrollable-wrapper .table-block .table-row .header-cell .column-title {
102
+ padding: 0;
103
+ }
104
+ .tables-container .table-container .table-fixed-wrapper .lazy-list-container,
105
+ .tables-container .table-container .table-scrollable-wrapper .lazy-list-container {
106
+ position: relative;
107
+ }
108
+ .tables-container .table-container .table-fixed-wrapper .lazy-list-container .table-row,
109
+ .tables-container .table-container .table-scrollable-wrapper .lazy-list-container .table-row {
110
+ position: absolute;
111
+ background-color: #FFF;
112
+ }
113
+ .tables-container .table-container .table-fixed-wrapper .right-table-block .table-cell:last-child,
114
+ .tables-container .table-container .table-scrollable-wrapper .right-table-block .table-cell:last-child {
115
+ border-right: none;
116
+ }
117
+ .tables-container .table-container .table-fixed-wrapper {
118
+ overflow: hidden;
119
+ }
120
+ .tables-container .table-container .table-scrollable-wrapper {
121
+ display: block;
122
+ }
123
+ .tables-container .scroll-container {
124
+ position: absolute;
125
+ overflow-x: auto;
126
+ overflow-y: hidden;
127
+ z-index: 1;
128
+ }
129
+ .tables-container .fixed-table-container {
130
+ z-index: 4;
131
+ background-color: #E8E8E8;
132
+ }
133
+ .tables-container .footer-container {
134
+ position: absolute;
135
+ border-top: 1px solid #E1E1E1;
136
+ overflow: hidden;
137
+ }
138
+ .tables-container .header-container {
139
+ border-bottom: 1px solid #E1E1E1;
140
+ overflow: hidden;
141
+ }
142
+ .tables-container .header-container .ui-resizable {
143
+ background-color: #F5F5F5;
144
+ }
145
+ .tables-container .header-container .ui-state-highlight {
146
+ float: left;
147
+ height: 50px;
148
+ width: 150px;
149
+ background-color: #E1E1E1;
150
+ }
151
+ .tables-container .header-container .ui-resizable-handle {
152
+ position: absolute;
153
+ right: 0;
154
+ top: 0;
155
+ background-color: #F5F5F5;
156
+ height: 100%;
157
+ width: 4px;
158
+ transition: background-color 0.1s ease-in;
159
+ -moz-transition: background-color 0.1s ease-in;
160
+ -webkit-transition: background-color 0.1s ease-in;
161
+ -o-transition: background-color 0.1s ease-in;
162
+ }
163
+ .tables-container .header-container .ui-resizable-handle:hover {
164
+ background-color: #C1C1C1;
165
+ cursor: ew-resize;
166
+ }
167
+ .tables-container .header-container .ui-sortable {
168
+ width: 100%;
169
+ height: 100%;
170
+ position: relative;
171
+ }
172
+ .tables-container .header-container .ui-sortable-helper {
173
+ background-color: #EAEAEA;
174
+ }
175
+ .tables-container .header-container .ui-sortable-helper .ui-resizable-handle {
176
+ background-color: #EAEAEA;
177
+ }
178
+ .header-cell .toggle {
179
+ margin-top: 3px;
180
+ padding-left: 5px;
181
+ }
182
+ .header-cell .toggle i {
183
+ padding-left: 3px;
184
+ }
185
+ .toggle-icon {
186
+ display: none;
187
+ }
188
+ .toggle .toggle-icon {
189
+ display: inline-block;
190
+ cursor: pointer;
191
+ width: 14px;
192
+ padding-left: 3px;
193
+ }
194
+ .expand .toggle-icon {
195
+ transform: rotate(-90deg);
196
+ -webkit-transform: rotate(-90deg);
197
+ -moz-transform: rotate(-90deg);
198
+ -ms-transform: rotate(-90deg);
199
+ -o-transform: rotate(-90deg);
200
+ margin-top: -3px;
201
+ padding-left: 0;
202
+ vertical-align: text-top;
203
+ }
204
+ .footer-container .table-cell .toggle {
205
+ padding: 0 3px 0 5px !important;
206
+ }
207
+ .footer-container .table-cell .toggle .toggle-icon:before {
208
+ content: none !important;
209
+ }
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember-magic-table
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Chris Nelson
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-06-13 00:00:00 -04:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: Uses ember-table. Makes all the properties editable. Is awesome(ish)
23
+ email:
24
+ - chris@gaslightsoftware.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.md
35
+ - Rakefile
36
+ - ember-magic-table.gemspec
37
+ - lib/assets/javascripts/controller.js.coffee
38
+ - lib/assets/javascripts/ember-magic-table.js.coffee
39
+ - lib/assets/javascripts/views.js.coffee
40
+ - lib/ember-magic-table.rb
41
+ - lib/ember-magic-table/version.rb
42
+ - vendor/assets/javascripts/ember-table.js
43
+ - vendor/assets/stylesheets/ember-table.css
44
+ has_rdoc: true
45
+ homepage: ""
46
+ licenses: []
47
+
48
+ post_install_message:
49
+ rdoc_options: []
50
+
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ hash: 3
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ requirements: []
72
+
73
+ rubyforge_project: ember-magic-table
74
+ rubygems_version: 1.3.7
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: An ember component that produces an editable table given an Ember Data Model
78
+ test_files: []
79
+