ember-bootstrap-rails 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +35 -0
  4. data/Rakefile +27 -0
  5. data/app/assets/javascripts/ember-bootstrap/all.js +6 -0
  6. data/app/assets/javascripts/ember-bootstrap/core.js +1 -0
  7. data/app/assets/javascripts/ember-bootstrap/forms.js +15 -0
  8. data/app/assets/javascripts/ember-bootstrap/forms/checkbox.js +13 -0
  9. data/app/assets/javascripts/ember-bootstrap/forms/field.js +114 -0
  10. data/app/assets/javascripts/ember-bootstrap/forms/select.js +19 -0
  11. data/app/assets/javascripts/ember-bootstrap/forms/text_area.js +8 -0
  12. data/app/assets/javascripts/ember-bootstrap/forms/text_field.js +9 -0
  13. data/app/assets/javascripts/ember-bootstrap/forms/uneditable_input.js +16 -0
  14. data/app/assets/javascripts/ember-bootstrap/mixins.js +3 -0
  15. data/app/assets/javascripts/ember-bootstrap/mixins/first_last_view_support.js +17 -0
  16. data/app/assets/javascripts/ember-bootstrap/mixins/item_selection_support.js +28 -0
  17. data/app/assets/javascripts/ember-bootstrap/mixins/item_view_href_support.js +15 -0
  18. data/app/assets/javascripts/ember-bootstrap/mixins/item_view_title_support.js +15 -0
  19. data/app/assets/javascripts/ember-bootstrap/mixins/item_view_value_support.js +13 -0
  20. data/app/assets/javascripts/ember-bootstrap/mixins/size_support.js +13 -0
  21. data/app/assets/javascripts/ember-bootstrap/mixins/text_support.js +14 -0
  22. data/app/assets/javascripts/ember-bootstrap/mixins/type_support.js +13 -0
  23. data/app/assets/javascripts/ember-bootstrap/views/alert_message.js +27 -0
  24. data/app/assets/javascripts/ember-bootstrap/views/badge.js +8 -0
  25. data/app/assets/javascripts/ember-bootstrap/views/block_alert_message.js +5 -0
  26. data/app/assets/javascripts/ember-bootstrap/views/breadcrumb.js +15 -0
  27. data/app/assets/javascripts/ember-bootstrap/views/label.js +8 -0
  28. data/app/assets/javascripts/ember-bootstrap/views/modal_pane.js +106 -0
  29. data/app/assets/javascripts/ember-bootstrap/views/nav_list.js +18 -0
  30. data/app/assets/javascripts/ember-bootstrap/views/pager.js +26 -0
  31. data/app/assets/javascripts/ember-bootstrap/views/pagination.js +19 -0
  32. data/app/assets/javascripts/ember-bootstrap/views/pill_item.js +4 -0
  33. data/app/assets/javascripts/ember-bootstrap/views/pills.js +8 -0
  34. data/app/assets/javascripts/ember-bootstrap/views/progress_bar.js +16 -0
  35. data/app/assets/javascripts/ember-bootstrap/views/tabs.js +11 -0
  36. data/app/assets/javascripts/ember-bootstrap/views/well.js +8 -0
  37. data/lib/ember-bootstrap-rails.rb +4 -0
  38. data/lib/ember-bootstrap-rails/engine.rb +4 -0
  39. data/lib/ember-bootstrap-rails/version.rb +3 -0
  40. metadata +96 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a3edcb0eac4fcda3d14f612735949daa5024f05
4
+ data.tar.gz: dee90e39a068cfffa11affadbbe31843da00843f
5
+ SHA512:
6
+ metadata.gz: 3723e5885d82fee9cc7aec727646cbb4a085f9594376a7502e0341be776149e4dd06910541b0c281769a7fe68b79eed6d2e523a8adaa2087ad200ef8c7742b2d
7
+ data.tar.gz: f7464906657439dc500e14252515bf85b0a41a788ee9f8b69b727f717ff790aa235b55baad3f012936db48ef4d900cf613235db3f8fc87858286c159aa2250dd
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # Ember Bootstrap Rails
2
+
3
+ Add ember-boostrap to your rails/ember project :)
4
+
5
+ ## Install
6
+
7
+ Gemfile
8
+
9
+ ```ruby
10
+ gem 'ember-bootstrap-rails'
11
+ ```
12
+
13
+ And then `bundle` :)
14
+
15
+ In your js mainfest file:
16
+
17
+ ```javascript
18
+ //= require ember-bootstrap/all
19
+ ````
20
+
21
+ Enjoy!
22
+
23
+ ## Version
24
+
25
+ Current version based on https://github.com/emberjs-addons/ember-bootstrap/commit/90ebf13c87dbd6ec3046b73bcca2fd195557714a
26
+
27
+ Please send pull request to update to a later version ;)
28
+
29
+ ## Notice
30
+
31
+ Has not been tested yet :P Please be brave and be the first!
32
+
33
+ ## Copyright
34
+
35
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'EmberBootstrapRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+
24
+
25
+
26
+ Bundler::GemHelper.install_tasks
27
+
@@ -0,0 +1,6 @@
1
+ //= require ./core
2
+ //= require ./mixins
3
+ //= require ./forms
4
+ //= require ./forms/field
5
+ //= require_tree ./forms
6
+ //= require_tree ./views
@@ -0,0 +1 @@
1
+ var Bootstrap = window.Bootstrap = Ember.Namespace.create();
@@ -0,0 +1,15 @@
1
+ window.Bootstrap.Forms = Ember.Namespace.create({
2
+
3
+ human: function(value) {
4
+ if (value === undefined || value === false)
5
+ return;
6
+
7
+ // Underscore string
8
+ value = Ember.String.decamelize(value);
9
+ // Replace all _ with spaces
10
+ value = value.replace(/_/g, " ");
11
+ // Capitalize the first letter of every word
12
+ value = value.replace(/(^|\s)([a-z])/g, function(m,p1,p2){ return p1+p2.toUpperCase(); });
13
+ return value;
14
+ }
15
+ });
@@ -0,0 +1,13 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Forms.Checkbox = Bootstrap.Forms.Field.extend({
3
+
4
+ inputField: Ember.Checkbox.extend({
5
+ attributeBindings: ['name'],
6
+ checkedBinding: 'parentView.checked',
7
+ disabledBinding: 'parentView.disabled',
8
+ classNameBindings: 'parentView.inputClassNames',
9
+ name: Ember.computed(function() {
10
+ return this.get('parentView.name') || this.get('parentView.label');
11
+ }).property('parentView.name', 'parentView.label')
12
+ })
13
+ });
@@ -0,0 +1,114 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Forms.Field = Ember.View.extend({
3
+ tagName: 'div',
4
+ classNames: ['control-group'],
5
+ labelCache: undefined,
6
+ help: undefined,
7
+ template: Ember.Handlebars.compile([
8
+ '{{view view.labelView viewName="labelView"}}',
9
+ '<div class="controls">',
10
+ ' {{view view.inputField viewName="inputField"}}',
11
+ ' {{view view.errorsView}}',
12
+ ' {{view view.helpView}}',
13
+ '</div>'].join("\n")),
14
+
15
+ label: Ember.computed(function(key, value) {
16
+ if(arguments.length === 1){
17
+ if(this.get('labelCache') === undefined){
18
+ var path = this.get('valueBinding._from');
19
+ if (path) {
20
+ path = path.split(".");
21
+ return path[path.length - 1];
22
+ }
23
+ } else {
24
+ return this.get('labelCache');
25
+ }
26
+ } else {
27
+ this.set('labelCache', value);
28
+ return value;
29
+ }
30
+ }).property(),
31
+
32
+ labelView: Ember.View.extend({
33
+ tagName: 'label',
34
+ classNames: ['control-label'],
35
+ template: Ember.Handlebars.compile('{{view.value}}'),
36
+
37
+ value: Ember.computed(function(key, value) {
38
+ var parent = this.get('parentView');
39
+
40
+ if (value && value !== parent.get('label')) {
41
+ parent.set('label', value);
42
+ } else {
43
+ value = parent.get('label');
44
+ }
45
+
46
+ // If the labelCache property is present on parent, then the
47
+ // label was set manually, and there's no need to humanise it.
48
+ // Otherwise, it comes from the binding and needs to be
49
+ // humanised.
50
+ return parent.get('labelCache') === undefined || parent.get('labelCache') === false ?
51
+ Bootstrap.Forms.human(value) : value;
52
+ }).property('parentView.label'),
53
+
54
+ inputElementId: 'for',
55
+ forBinding: 'inputElementId',
56
+ attributeBindings: ['for']
57
+ }),
58
+
59
+ inputField: Ember.View.extend({
60
+ classNames: ['ember-bootstrap-extend'],
61
+ tagName: 'div',
62
+ template: Ember.Handlebars.compile('This class is not meant to be used directly, but extended.')
63
+ }),
64
+
65
+ errorsView: Ember.View.extend({
66
+ tagName: 'div',
67
+ classNames: ['errors', 'help-inline'],
68
+
69
+ _updateContent: Ember.observer(function() {
70
+ var parent = this.get('parentView');
71
+
72
+ if (parent !== null) {
73
+ var binding = parent.get('valueBinding._from');
74
+ var fieldName = null;
75
+ var object = null;
76
+
77
+ if (binding) {
78
+ binding = binding.replace("_parentView.", "").split(".");
79
+ fieldName = binding[binding.length - 1];
80
+ object = parent.get(binding.slice(0, binding.length-1).join('.'));
81
+ } else {
82
+ fieldName = parent.get('label');
83
+ object = parent.get('context');
84
+ }
85
+
86
+ if (object && !object.get('isValid')) {
87
+ var errors = object.get('errors');
88
+
89
+ if (errors && fieldName in errors && !Ember.isEmpty(errors[fieldName])) {
90
+ parent.$().addClass('error');
91
+ this.$().html(errors[fieldName].join(', '));
92
+ } else {
93
+ parent.$().removeClass('error');
94
+ this.$().html('');
95
+ }
96
+ } else {
97
+ parent.$().removeClass('error');
98
+ this.$().html('');
99
+ }
100
+ }
101
+ }, 'parentView.context.isValid', 'parentView.label')
102
+ }),
103
+
104
+ helpView: Ember.View.extend({
105
+ tagName: 'div',
106
+ classNames: ['help-block'],
107
+ template: Ember.Handlebars.compile('{{view.content}}'),
108
+ contentBinding: 'parentView.help'
109
+ }),
110
+
111
+ didInsertElement: function() {
112
+ this.set('labelView.inputElementId', this.get('inputField.elementId'));
113
+ }
114
+ });
@@ -0,0 +1,19 @@
1
+ var Bootstrap = window.Bootstrap;
2
+
3
+ Bootstrap.Forms.Select = Bootstrap.Forms.Field.extend({
4
+ optionLabelPath: 'content',
5
+ optionValuePath: 'content',
6
+
7
+ inputField: Ember.Select.extend({
8
+ contentBinding: 'parentView.content',
9
+
10
+ optionLabelPathBinding: 'parentView.optionLabelPath',
11
+ optionValuePathBinding: 'parentView.optionValuePath',
12
+
13
+ valueBinding: 'parentView.value',
14
+ selectionBinding: 'parentView.selection',
15
+ promptBinding: 'parentView.prompt',
16
+ multipleBinding: 'parentView.multiple',
17
+ disabledBinding: 'parentView.disabled'
18
+ })
19
+ });
@@ -0,0 +1,8 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Forms.TextArea = Bootstrap.Forms.Field.extend({
3
+
4
+ inputField: Ember.TextArea.extend(Bootstrap.TextSupport, {
5
+ rowsBinding: 'parentView.rows',
6
+ colsBinding: 'parentView.cols'
7
+ })
8
+ });
@@ -0,0 +1,9 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Forms.TextField = Bootstrap.Forms.Field.extend({
3
+ type: 'text',
4
+
5
+ inputField: Ember.TextField.extend(Bootstrap.TextSupport, {
6
+ typeBinding: 'parentView.type',
7
+ sizeBinding: 'parentView.size'
8
+ })
9
+ });
@@ -0,0 +1,16 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Forms.UneditableInput = Bootstrap.Forms.Field.extend({
3
+
4
+ inputField: Ember.View.extend({
5
+ tagName: 'span',
6
+ classNames: ['uneditable-input'],
7
+ attributeBindings: ['name'],
8
+ template: Ember.Handlebars.compile('{{view.value}}'),
9
+
10
+ valueBinding: 'parentView.value',
11
+ classNameBindings: 'parentView.inputClassNames',
12
+ name: Ember.computed(function() {
13
+ return this.get('parentView.name') || this.get('parentView.label');
14
+ }).property('parentView.name', 'parentView.label')
15
+ })
16
+ });
@@ -0,0 +1,3 @@
1
+ //= require ./mixins/item_view_value_support
2
+ //= require ./mixins/item_view_title_support
3
+ //= require_tree ./mixins
@@ -0,0 +1,17 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.FirstLastViewSupport = Ember.Mixin.create({
5
+ createChildView: function(view, attrs) {
6
+ if (attrs) {
7
+ var content = get(this, "content");
8
+ if (attrs.contentIndex === 0) {
9
+ view = get(this, "firstItemViewClass") || view;
10
+ }
11
+ if (attrs.contentIndex === (content.get("length") - 1)) {
12
+ view = get(this, "lastItemViewClass") || view;
13
+ }
14
+ }
15
+ return this._super(view, attrs);
16
+ }
17
+ });
@@ -0,0 +1,28 @@
1
+ var get = Ember.get, set = Ember.set;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.ItemSelectionSupport = Ember.Mixin.create(Bootstrap.ItemViewValueSupport, Bootstrap.ItemViewTitleSupport, {
5
+ classNameBindings: ["isActive:active"],
6
+ allowsEmptySelection: false,
7
+
8
+ isActive: Ember.computed(function() {
9
+ var parentView = get(this, 'parentView'),
10
+ selection, value;
11
+ if (!parentView) return false;
12
+ selection = get(parentView, 'selection');
13
+ value = get(this, 'value');
14
+ return selection === value;
15
+ }).property('parentView.selection', 'value').cacheable(),
16
+
17
+ click: function(event) {
18
+ var value = get(this, 'value'),
19
+ parentView = get(this, 'parentView'),
20
+ allowsEmptySelection = get(parentView, 'allowsEmptySelection'),
21
+ selection = get(parentView, 'selection');
22
+ if (allowsEmptySelection === true && selection === value) {
23
+ value = null;
24
+ }
25
+ set(parentView, 'selection', value);
26
+ return true;
27
+ }
28
+ });
@@ -0,0 +1,15 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.ItemViewHrefSupport = Ember.Mixin.create({
5
+ href: Ember.computed(function() {
6
+ var parentView = get(this, 'parentView'),
7
+ content, hrefKey;
8
+ content = get(this, 'content');
9
+ if (parentView) {
10
+ hrefKey = get(parentView, 'itemHrefKey') || 'link';
11
+ return get(content, hrefKey) || "#";
12
+ }
13
+ return content;
14
+ }).property('content').cacheable()
15
+ });
@@ -0,0 +1,15 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.ItemViewTitleSupport = Ember.Mixin.create({
5
+ title: Ember.computed(function() {
6
+ var parentView = get(this, 'parentView'),
7
+ content, titleKey;
8
+ content = get(this, 'content');
9
+ if (parentView) {
10
+ titleKey = get(parentView, 'itemTitleKey') || 'title';
11
+ return get(content, titleKey) || content;
12
+ }
13
+ return content;
14
+ }).property('content').cacheable()
15
+ });
@@ -0,0 +1,13 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.ItemViewValueSupport = Ember.Mixin.create({
5
+ value: Ember.computed(function() {
6
+ var parentView = get(this, 'parentView'),
7
+ content, valueKey;
8
+ if (!parentView) return null;
9
+ content = get(this, 'content');
10
+ valueKey = get(parentView, 'itemValueKey') || 'value';
11
+ return get(content, valueKey) || content;
12
+ }).property('content').cacheable()
13
+ });
@@ -0,0 +1,13 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.SizeSupport = Ember.Mixin.create({
5
+ baseClassName: Ember.required(String),
6
+ classNameBindings: "sizeClass",
7
+ size: null, // mini, small || large
8
+ sizeClass: Ember.computed(function() {
9
+ var size = get(this, "size"),
10
+ baseClassName = get(this, "baseClassName");
11
+ return size ? baseClassName + "-" + size : null;
12
+ }).property("size").cacheable()
13
+ });
@@ -0,0 +1,14 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.TextSupport = Ember.Mixin.create({
5
+ valueBinding: 'parentView.value',
6
+ placeholderBinding: 'parentView.placeholder',
7
+ disabledBinding: 'parentView.disabled',
8
+ maxlengthBinding: 'parentView.maxlength',
9
+ classNameBindings: 'parentView.inputClassNames',
10
+ attributeBindings: ['name'],
11
+ name: Ember.computed(function() {
12
+ return get(this, 'parentView.name') || get(this, 'parentView.label');
13
+ }).property('parentView.name', 'parentView.label').cacheable()
14
+ });
@@ -0,0 +1,13 @@
1
+ var get = Ember.get, set = Ember.set;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.TypeSupport = Ember.Mixin.create({
5
+ baseClassName: Ember.required(String),
6
+ classNameBindings: "typeClass",
7
+ type: null, // success, warning, error, info || inverse
8
+ typeClass: Ember.computed(function() {
9
+ var type = get(this, "type"),
10
+ baseClassName = get(this, "baseClassName");
11
+ return type ? baseClassName + "-" + type : null;
12
+ }).property("type").cacheable()
13
+ });
@@ -0,0 +1,27 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.AlertMessage = Ember.View.extend(Bootstrap.TypeSupport, {
5
+ classNames: ['alert', 'alert-message'],
6
+ baseClassName: 'alert',
7
+ template: Ember.Handlebars.compile('<a class="close" rel="close" href="#">&times;</a>{{{view.message}}}'),
8
+ message: null,
9
+ removeAfter: null,
10
+
11
+ didInsertElement: function() {
12
+ var removeAfter = get(this, 'removeAfter');
13
+ if (removeAfter > 0) {
14
+ Ember.run.later(this, 'destroy', removeAfter);
15
+ }
16
+ },
17
+
18
+ click: function(event) {
19
+ var target = event.target,
20
+ targetRel = target.getAttribute('rel');
21
+
22
+ if (targetRel === 'close') {
23
+ this.destroy();
24
+ return false;
25
+ }
26
+ }
27
+ });
@@ -0,0 +1,8 @@
1
+ var Bootstrap = window.Bootstrap;
2
+
3
+ Bootstrap.Badge = Ember.View.extend(Bootstrap.TypeSupport, {
4
+ tagName: "span",
5
+ classNames: "badge",
6
+ baseClassName: "badge",
7
+ template: Ember.Handlebars.compile("{{view.content}}")
8
+ });
@@ -0,0 +1,5 @@
1
+ var Bootstrap = window.Bootstrap;
2
+
3
+ Bootstrap.BlockAlertMessage = Bootstrap.AlertMessage.extend({
4
+ classNames: ['alert', 'alert-block']
5
+ });
@@ -0,0 +1,15 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.Breadcrumb = Ember.CollectionView.extend(Bootstrap.FirstLastViewSupport, {
5
+ tagName: "ul",
6
+ classNames: "breadcrumb",
7
+ divider: "/",
8
+ itemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, {
9
+ template: Ember.Handlebars.compile('<a href="#">{{title}}</a><span class="divider">{{view.parentView.divider}}</span>')
10
+ }),
11
+ lastItemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, {
12
+ classNames: "active",
13
+ template: Ember.Handlebars.compile("{{title}}")
14
+ })
15
+ });
@@ -0,0 +1,8 @@
1
+ var Bootstrap = window.Bootstrap;
2
+
3
+ Bootstrap.Label = Ember.View.extend(Bootstrap.TypeSupport, {
4
+ tagName: "span",
5
+ classNames: "label",
6
+ baseClassName: "label",
7
+ template: Ember.Handlebars.compile("{{view.content}}")
8
+ });
@@ -0,0 +1,106 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+ var jQuery = window.jQuery;
4
+
5
+ var modalPaneTemplate = [
6
+ '<div class="modal-header">',
7
+ ' <a href="#" class="close" rel="close">&times;</a>',
8
+ ' {{view view.headerViewClass}}',
9
+ '</div>',
10
+ '<div class="modal-body">{{view view.bodyViewClass}}</div>',
11
+ '<div class="modal-footer">',
12
+ ' {{#if view.secondary}}<a href="#" class="btn btn-secondary" rel="secondary">{{view.secondary}}</a>{{/if}}',
13
+ ' {{#if view.primary}}<a href="#" class="btn btn-primary" rel="primary">{{view.primary}}</a>{{/if}}',
14
+ '</div>'].join("\n");
15
+ var modalPaneBackdrop = '<div class="modal-backdrop"></div>';
16
+
17
+ Bootstrap.ModalPane = Ember.View.extend({
18
+ classNames: 'modal',
19
+ defaultTemplate: Ember.Handlebars.compile(modalPaneTemplate),
20
+ heading: null,
21
+ message: null,
22
+ primary: null,
23
+ secondary: null,
24
+ showBackdrop: true,
25
+ headerViewClass: Ember.View.extend({
26
+ tagName: 'h3',
27
+ template: Ember.Handlebars.compile('{{view.parentView.heading}}')
28
+ }),
29
+ bodyViewClass: Ember.View.extend({
30
+ tagName: 'p',
31
+ template: Ember.Handlebars.compile('{{{view.parentView.message}}}')
32
+ }),
33
+
34
+ didInsertElement: function() {
35
+ if (get(this, 'showBackdrop')) this._appendBackdrop();
36
+ this._setupDocumentKeyHandler();
37
+ },
38
+
39
+ willDestroyElement: function() {
40
+ if (this._backdrop) this._backdrop.remove();
41
+ this._removeDocumentKeyHandler();
42
+ },
43
+
44
+ keyPress: function(event) {
45
+ if (event.keyCode === 27) {
46
+ this._triggerCallbackAndDestroy({ close: true }, event);
47
+ }
48
+ },
49
+
50
+ click: function(event) {
51
+ var target = event.target,
52
+ targetRel = target.getAttribute('rel');
53
+
54
+ if (targetRel === 'close') {
55
+ this._triggerCallbackAndDestroy({ close: true }, event);
56
+ return false;
57
+
58
+ } else if (targetRel === 'primary') {
59
+ this._triggerCallbackAndDestroy({ primary: true }, event);
60
+ return false;
61
+
62
+ } else if (targetRel === 'secondary') {
63
+ this._triggerCallbackAndDestroy({ secondary: true }, event);
64
+ return false;
65
+ }
66
+ },
67
+
68
+ _appendBackdrop: function() {
69
+ var parentLayer = this.$().parent();
70
+ this._backdrop = jQuery(modalPaneBackdrop).appendTo(parentLayer);
71
+ },
72
+
73
+ _setupDocumentKeyHandler: function() {
74
+ var cc = this,
75
+ handler = function(event) {
76
+ cc.keyPress(event);
77
+ };
78
+ jQuery(window.document).bind('keyup', handler);
79
+ this._keyUpHandler = handler;
80
+ },
81
+
82
+ _removeDocumentKeyHandler: function() {
83
+ jQuery(window.document).unbind('keyup', this._keyUpHandler);
84
+ },
85
+
86
+ _triggerCallbackAndDestroy: function(options, event) {
87
+ var destroy;
88
+ if (this.callback) {
89
+ destroy = this.callback(options, event);
90
+ }
91
+ if (destroy === undefined || destroy) this.destroy();
92
+ }
93
+ });
94
+
95
+ Bootstrap.ModalPane.reopenClass({
96
+ rootElement: ".ember-application",
97
+ popup: function(options) {
98
+ var modalPane, rootElement;
99
+ if (!options) options = {};
100
+ modalPane = this.create(options);
101
+ rootElement = get(this, 'rootElement');
102
+ modalPane.appendTo(rootElement);
103
+ return modalPane;
104
+ }
105
+ });
106
+
@@ -0,0 +1,18 @@
1
+ var get = Ember.get, set = Ember.set;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.NavList = Ember.CollectionView.extend({
5
+ classNames: ['nav', 'nav-list'],
6
+ tagName: 'ul',
7
+
8
+ itemViewClass: Ember.View.extend(Bootstrap.ItemSelectionSupport, Bootstrap.ItemViewHrefSupport, {
9
+ template: Ember.Handlebars.compile('{{view view.item}}'),
10
+
11
+ item: Ember.View.extend({
12
+ tagName: 'a',
13
+ template: Ember.Handlebars.compile('{{view.parentView.title}}'),
14
+ attributeBindings: ['href'],
15
+ hrefBinding: 'parentView.href'
16
+ })
17
+ })
18
+ });
@@ -0,0 +1,26 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Pager = Ember.CollectionView.extend({
3
+ tagName: "ul",
4
+ classNames: "pager",
5
+ itemTitleKey: "title",
6
+ itemHrefKey: "href",
7
+ init: function() {
8
+ this._super();
9
+ if (!this.get("content")) {
10
+ this.set("content", Ember.A([
11
+ Ember.Object.create({ title: "&larr;" }),
12
+ Ember.Object.create({ title: "&rarr;" })
13
+ ]));
14
+ }
15
+ },
16
+ itemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, Bootstrap.ItemViewHrefSupport, {
17
+ classNameBindings: ["content.next", "content.previous", "content.disabled"],
18
+ template: Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{view.title}}</a>')
19
+ }),
20
+ arrayDidChange: function(content, start, removed, added) {
21
+ if (content) {
22
+ Ember.assert("content must always has at the most 2 elements", content.get("length") <= 2);
23
+ }
24
+ return this._super(content, start, removed, added);
25
+ }
26
+ });
@@ -0,0 +1,19 @@
1
+ var get = Ember.get, set = Ember.set, A = Ember.A;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.Pagination = Ember.CollectionView.extend({
5
+ tagName: "ul",
6
+ classNames: "pagination",
7
+ itemTitleKey: "title",
8
+ itemHrefKey: "href",
9
+ init: function() {
10
+ this._super();
11
+ if (!this.get("content")) {
12
+ this.set("content", new A([]));
13
+ }
14
+ },
15
+ itemViewClass: Ember.View.extend(Bootstrap.ItemSelectionSupport, Bootstrap.ItemViewHrefSupport, {
16
+ classNameBindings: ["content.disabled"],
17
+ template: Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{view.title}}</a>')
18
+ })
19
+ });
@@ -0,0 +1,4 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.PillItem = Ember.View.extend(Bootstrap.ItemSelectionSupport, {
3
+ template: Ember.Handlebars.compile('<a href="#">{{view.title}}</a>')
4
+ });
@@ -0,0 +1,8 @@
1
+ var Bootstrap = window.Bootstrap;
2
+ Bootstrap.Pills = Ember.CollectionView.extend({
3
+ classNames: ['nav', 'nav-pills'],
4
+ classNameBindings: ['isStacked:nav-stacked'],
5
+ tagName: 'ul',
6
+ itemViewClass: Bootstrap.PillItem,
7
+ selection: null
8
+ });
@@ -0,0 +1,16 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.ProgressBar = Ember.View.extend({
5
+ classNames: ['progress'],
6
+ classNameBindings: ['isStriped:progress-striped', 'isAnimated:active'],
7
+ template: Ember.Handlebars.compile('<div class="bar" {{bindAttr style="view.style"}}></div>'),
8
+ isAnimated: false,
9
+ isStriped: false,
10
+ progress: 0,
11
+
12
+ style: Ember.computed(function() {
13
+ var progress = get(this, 'progress');
14
+ return "width:" + progress + "%;";
15
+ }).property('progress').cacheable()
16
+ });
@@ -0,0 +1,11 @@
1
+ var Bootstrap = window.Bootstrap;
2
+
3
+ Bootstrap.Tabs = Ember.CollectionView.extend({
4
+ classNames: ['nav', 'nav-tabs'],
5
+ classNameBindings: ['isStacked:nav-stacked'],
6
+ tagName: 'ul',
7
+ itemViewClass: Bootstrap.PillItem,
8
+ selection: null
9
+ });
10
+
11
+
@@ -0,0 +1,8 @@
1
+ var get = Ember.get;
2
+ var Bootstrap = window.Bootstrap;
3
+
4
+ Bootstrap.Well = Ember.View.extend({
5
+ template: Ember.Handlebars.compile('{{view.content}}'),
6
+ classNames: 'well',
7
+ content: null
8
+ });
@@ -0,0 +1,4 @@
1
+ require "ember-bootstrap-rails/engine"
2
+
3
+ module EmberBootstrapRails
4
+ end
@@ -0,0 +1,4 @@
1
+ module EmberBootstrapRails
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module EmberBootstrapRails
2
+ VERSION = "0.0.3"
3
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ember-bootstrap-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Kristian Mandrup
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-04-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.0
27
+ description: Add ember-boostrap to your rails/ember project :)
28
+ email:
29
+ - kmandrup@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - app/assets/javascripts/ember-bootstrap/all.js
35
+ - app/assets/javascripts/ember-bootstrap/core.js
36
+ - app/assets/javascripts/ember-bootstrap/forms/checkbox.js
37
+ - app/assets/javascripts/ember-bootstrap/forms/field.js
38
+ - app/assets/javascripts/ember-bootstrap/forms/select.js
39
+ - app/assets/javascripts/ember-bootstrap/forms/text_area.js
40
+ - app/assets/javascripts/ember-bootstrap/forms/text_field.js
41
+ - app/assets/javascripts/ember-bootstrap/forms/uneditable_input.js
42
+ - app/assets/javascripts/ember-bootstrap/forms.js
43
+ - app/assets/javascripts/ember-bootstrap/mixins/first_last_view_support.js
44
+ - app/assets/javascripts/ember-bootstrap/mixins/item_selection_support.js
45
+ - app/assets/javascripts/ember-bootstrap/mixins/item_view_href_support.js
46
+ - app/assets/javascripts/ember-bootstrap/mixins/item_view_title_support.js
47
+ - app/assets/javascripts/ember-bootstrap/mixins/item_view_value_support.js
48
+ - app/assets/javascripts/ember-bootstrap/mixins/size_support.js
49
+ - app/assets/javascripts/ember-bootstrap/mixins/text_support.js
50
+ - app/assets/javascripts/ember-bootstrap/mixins/type_support.js
51
+ - app/assets/javascripts/ember-bootstrap/mixins.js
52
+ - app/assets/javascripts/ember-bootstrap/views/alert_message.js
53
+ - app/assets/javascripts/ember-bootstrap/views/badge.js
54
+ - app/assets/javascripts/ember-bootstrap/views/block_alert_message.js
55
+ - app/assets/javascripts/ember-bootstrap/views/breadcrumb.js
56
+ - app/assets/javascripts/ember-bootstrap/views/label.js
57
+ - app/assets/javascripts/ember-bootstrap/views/modal_pane.js
58
+ - app/assets/javascripts/ember-bootstrap/views/nav_list.js
59
+ - app/assets/javascripts/ember-bootstrap/views/pager.js
60
+ - app/assets/javascripts/ember-bootstrap/views/pagination.js
61
+ - app/assets/javascripts/ember-bootstrap/views/pill_item.js
62
+ - app/assets/javascripts/ember-bootstrap/views/pills.js
63
+ - app/assets/javascripts/ember-bootstrap/views/progress_bar.js
64
+ - app/assets/javascripts/ember-bootstrap/views/tabs.js
65
+ - app/assets/javascripts/ember-bootstrap/views/well.js
66
+ - lib/ember-bootstrap-rails/engine.rb
67
+ - lib/ember-bootstrap-rails/version.rb
68
+ - lib/ember-bootstrap-rails.rb
69
+ - MIT-LICENSE
70
+ - Rakefile
71
+ - README.md
72
+ homepage: https://github.com/kristianmandrup/ember-bootstrap-rails
73
+ licenses: []
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.0.0
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Rails 3.1+ Asset pipeline integration for ember-bootstrap js assets
95
+ test_files: []
96
+ has_rdoc: