ember-bootstrap-source 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,13 @@
1
+ // ==========================================================================
2
+ // Project: Ember Bootstrap
3
+ // Copyright: ©2012 Ember Bootstrap contributors
4
+ // License: Licensed under MIT license (see LICENSE)
5
+ // ==========================================================================
6
+
7
+
8
+
9
+ // Version: v0.0.2-22-g2410c9e
10
+ // Last commit: 2410c9e (2013-07-29 14:31:26 +0200)
11
+
12
+
13
+ !function(){var e,t;!function(){var i={},a={};e=function(e,t,a){i[e]={deps:t,callback:a}},t=function(e){if(a[e])return a[e];a[e]={};var n,r,s,l,o;if(n=i[e],!n)throw new Error("Module '"+e+"' not found.");r=n.deps,s=n.callback,l=[];for(var p=0,m=r.length;m>p;p++)"exports"===r[p]?l.push(o={}):l.push(t(r[p]));var c=s.apply(this,l);return a[e]=o||c}}(),function(){window.Bootstrap=Ember.Namespace.create()}(),function(){var e=Ember.get,t=['<div class="modal-header">',' <a href="#" class="close" rel="close">&times;</a>'," {{view view.headerViewClass}}","</div>",'<div class="modal-body">{{view view.bodyViewClass}}</div>','<div class="modal-footer">'," {{view view.footerViewClass}}","</div>"].join("\n"),i=['{{#if view.parentView.secondary}}<a href="#" class="btn btn-secondary" rel="secondary">{{view.parentView.secondary}}</a>{{/if}}','{{#if view.parentView.primary}}<a href="#" class="btn btn-primary" rel="primary">{{view.parentView.primary}}</a>{{/if}}'].join("\n"),a='<div class="modal-backdrop"></div>';Bootstrap.ModalPane=Ember.View.extend(Ember.DeferredMixin,{classNames:"modal",defaultTemplate:Ember.Handlebars.compile(t),heading:null,message:null,primary:null,secondary:null,showBackdrop:!0,headerViewClass:Ember.View.extend({tagName:"h3",template:Ember.Handlebars.compile("{{view.parentView.heading}}")}),bodyViewClass:Ember.View.extend({tagName:"p",template:Ember.Handlebars.compile("{{{view.parentView.message}}}")}),footerViewClass:Ember.View.extend({template:Ember.Handlebars.compile(i)}),didInsertElement:function(){e(this,"showBackdrop")&&this._appendBackdrop(),this._setupDocumentKeyHandler()},willDestroyElement:function(){this._backdrop&&this._backdrop.remove(),this._removeDocumentKeyHandler()},keyPress:function(e){27===e.keyCode&&this._triggerCallbackAndDestroy({close:!0},e)},click:function(e){var t=e.target,i=t.getAttribute("rel");if(i){var a={};return a[i]=!0,this._triggerCallbackAndDestroy(a,e),!1}},_appendBackdrop:function(){var e=this.$().parent();this._backdrop=jQuery(a).appendTo(e)},_setupDocumentKeyHandler:function(){var e=this,t=function(t){e.keyPress(t)};jQuery(window.document).bind("keyup",t),this._keyUpHandler=t},_removeDocumentKeyHandler:function(){jQuery(window.document).unbind("keyup",this._keyUpHandler)},_resolveOrReject:function(e,t){e.primary?this.resolve(e,t):this.reject(e,t)},_triggerCallbackAndDestroy:function(e,t){var i;this.callback&&(i=this.callback(e,t)),(void 0===i||i)&&(this._resolveOrReject(e,t),this.destroy())}}),Bootstrap.ModalPane.reopenClass({rootElement:".ember-application",popup:function(t){var i,a;return t||(t={}),i=this.create(t),a=e(this,"rootElement"),i.appendTo(a),i}})}(),function(){var e=Ember.get;Ember.set,Bootstrap.TypeSupport=Ember.Mixin.create({baseClassName:Ember.required(String),classNameBindings:["typeClass"],type:null,typeClass:Ember.computed(function(){var t=e(this,"type"),i=e(this,"baseClassName");return t?i+"-"+t:null}).property("type").cacheable()})}(),function(){var e=Ember.get;Bootstrap.AlertMessage=Ember.View.extend(Bootstrap.TypeSupport,{classNames:["alert","alert-message"],baseClassName:"alert",template:Ember.Handlebars.compile('<a class="close" rel="close" href="#">&times;</a>{{{view.message}}}'),message:null,removeAfter:null,didInsertElement:function(){var t=e(this,"removeAfter");t>0&&Ember.run.later(this,"destroy",t)},click:function(e){var t=e.target,i=t.getAttribute("rel");return"close"===i?(this.destroy(),!1):void 0}})}(),function(){Bootstrap.BlockAlertMessage=Bootstrap.AlertMessage.extend({classNames:["alert","alert-block"]})}(),function(){var e=Ember.get;Bootstrap.ItemViewValueSupport=Ember.Mixin.create({value:Ember.computed(function(){var t,i,a=e(this,"parentView");return a?(t=e(this,"content"),i=e(a,"itemValueKey")||"value",e(t,i)||t):null}).property("content").cacheable()})}(),function(){var e=Ember.get;Bootstrap.ItemViewTitleSupport=Ember.Mixin.create({title:Ember.computed(function(){var t,i,a=e(this,"parentView");return t=e(this,"content"),a?(i=e(a,"itemTitleKey")||"title",e(t,i)||t):t}).property("content").cacheable()})}(),function(){var e=Ember.get,t=Ember.set;Bootstrap.ItemSelectionSupport=Ember.Mixin.create(Bootstrap.ItemViewValueSupport,Bootstrap.ItemViewTitleSupport,{classNameBindings:["isActive:active"],allowsEmptySelection:!1,isActive:Ember.computed(function(){var t,i,a=e(this,"parentView");return a?(t=e(a,"selection"),i=e(this,"value"),t===i):!1}).property("parentView.selection","value").cacheable(),click:function(){var i=e(this,"value"),a=e(this,"parentView"),n=e(a,"allowsEmptySelection"),r=e(a,"selection");return n===!0&&r===i&&(i=null),t(a,"selection",i),!0}})}(),function(){var e=Ember.get;Bootstrap.ItemViewHrefSupport=Ember.Mixin.create({href:Ember.computed(function(){var t,i,a=e(this,"parentView");return t=e(this,"content"),a?(i=e(a,"itemHrefKey")||"link",e(t,i)||"#"):t}).property("content").cacheable()})}(),function(){Bootstrap.PillItem=Ember.View.extend(Bootstrap.ItemSelectionSupport,Bootstrap.ItemViewHrefSupport,{template:Ember.Handlebars.compile("{{view view.item}}"),item:Ember.View.extend({tagName:"a",template:Ember.Handlebars.compile("{{view.parentView.title}}"),attributeBindings:["href"],hrefBinding:"parentView.href"})})}(),function(){Bootstrap.Pills=Ember.CollectionView.extend({classNames:["nav","nav-pills"],classNameBindings:["isStacked:nav-stacked"],tagName:"ul",itemViewClass:Bootstrap.PillItem,selection:null})}(),function(){Bootstrap.Tabs=Ember.CollectionView.extend({classNames:["nav","nav-tabs"],classNameBindings:["isStacked:nav-stacked"],tagName:"ul",itemViewClass:Bootstrap.PillItem,selection:null})}(),function(){Bootstrap.NavList=Ember.CollectionView.extend({classNames:["nav","nav-list"],tagName:"ul",itemViewClass:Bootstrap.PillItem,selection:null})}(),function(){var e=Ember.get,t=Ember.String.fmt;Bootstrap.ProgressBar=Ember.View.extend({classNames:["progress"],classNameBindings:["isStriped:progress-striped","isAnimated:active"],template:Ember.Handlebars.compile('<div class="bar" {{bindAttr style="view.style"}}></div>'),isAnimated:!1,isStriped:!1,progress:0,style:Ember.computed(function(){var i=e(this,"progress");return t("width:%@%;",[i])}).property("progress").cacheable()})}(),function(){Bootstrap.Badge=Ember.View.extend(Bootstrap.TypeSupport,{tagName:"span",classNames:["badge"],baseClassName:"badge",template:Ember.Handlebars.compile("{{view.content}}")})}(),function(){Bootstrap.Label=Ember.View.extend(Bootstrap.TypeSupport,{tagName:"span",classNames:["label"],baseClassName:"label",template:Ember.Handlebars.compile("{{view.content}}")})}(),function(){Ember.get,Bootstrap.Well=Ember.View.extend({template:Ember.Handlebars.compile("{{view.content}}"),classNames:"well",content:null})}(),function(){var e=Ember.A;Bootstrap.Pagination=Ember.CollectionView.extend({tagName:"ul",classNames:["pagination"],itemTitleKey:"title",itemHrefKey:"href",init:function(){this._super(),this.get("content")||this.set("content",new e([]))},itemViewClass:Ember.View.extend(Bootstrap.ItemSelectionSupport,Bootstrap.ItemViewHrefSupport,{classNameBindings:["content.disabled"],template:Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{view.title}}</a>')})})}(),function(){Bootstrap.Pager=Ember.CollectionView.extend({tagName:"ul",classNames:["pager"],itemTitleKey:"title",itemHrefKey:"href",init:function(){this._super(),this.get("content")||this.set("content",Ember.A([Ember.Object.create({title:"&larr;"}),Ember.Object.create({title:"&rarr;"})]))},itemViewClass:Ember.View.extend(Bootstrap.ItemViewTitleSupport,Bootstrap.ItemViewHrefSupport,{classNameBindings:["content.next","content.previous","content.disabled"],template:Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{{view.title}}}</a>')}),arrayDidChange:function(e,t,i,a){return this._super(e,t,i,a)}})}(),function(){var e=Ember.get;Bootstrap.FirstLastViewSupport=Ember.Mixin.create({createChildView:function(t,i){var a;return i&&(a=e(this,"content"),0===i.contentIndex&&(t=e(this,"firstItemViewClass")||t),i.contentIndex===e(a,"length")-1&&(t=e(this,"lastItemViewClass")||t)),this._super(t,i)}})}(),function(){var e=Ember.get;Bootstrap.Breadcrumb=Ember.CollectionView.extend(Bootstrap.FirstLastViewSupport,{tagName:"ul",classNames:["breadcrumb"],divider:"/",arrayDidChange:function(t,i,a,n){var r,s,l,o,p=e(this,"lastItemViewClass"),m=e(this,"itemViewClass");if(this._super.apply(this,arguments),t){if(l=e(t,"length"),a){if(o=e(this,"childViews.lastObject"),p.detectInstance(o))return;s=l-1,r=this.createChildView(p,{content:t[s],contentIndex:s}),this.replace(s,1,[r])}n&&e(this,"childViews").forEach(function(e,i){p.detectInstance(e)&&i!==l-1&&(r=this.createChildView(m,{content:t[i],contentIndex:i}),this.replace(i,1,[r]))},this)}},itemViewClass:Ember.View.extend(Bootstrap.ItemViewTitleSupport,{template:Ember.Handlebars.compile('<a href="#">{{view.title}}</a><span class="divider">{{view.parentView.divider}}</span>')}),lastItemViewClass:Ember.View.extend(Bootstrap.ItemViewTitleSupport,{classNames:["active"],template:Ember.Handlebars.compile("{{view.title}}")})})}(),function(){var e=['<a {{bindAttr class="view.typeClass :btn :dropdown-toggle" }} data-toggle="dropdown" href="#">',"{{view.label}}",'<span class="caret"></span>',"</a>",'<ul class="dropdown-menu">'," {{#if view.items}}"," {{#each item in view.items}}",' <li {{bindAttr class="item.disabled:disabled"}}>{{view view.Item contextBinding="item"}}</li>'," {{/each}}"," {{/if}}","</ul>"].join("\n");Bootstrap.ButtonDropdown=Ember.View.extend({label:null,items:[],classNames:["btn-group"],defaultTemplate:Ember.Handlebars.compile(e),Item:Ember.View.extend({tagName:"a",attributeBindings:["href"],template:Ember.Handlebars.compile("{{label}}"),href:"#",click:function(){var e=Ember.get(this,"context"),t=Ember.get(e,"actionName"),i=Ember.get(this,"controller"),a=Ember.get(e,"disabled");a!==!0&&Ember.tryInvoke(i,t,[e])}})})}(),function(){Bootstrap.Forms=Ember.Namespace.create({human:function(e){return void 0!==e&&e!==!1?(e=Ember.String.decamelize(e),e=e.replace(/_/g," "),e=e.replace(/(^|\s)([a-z])/g,function(e,t,i){return t+i.toUpperCase()})):void 0}})}(),function(){Bootstrap.Forms.Field=Ember.View.extend({tagName:"div",classNames:["control-group"],labelCache:void 0,help:void 0,template:Ember.Handlebars.compile(['{{view view.labelView viewName="labelView"}}','<div class="controls">',' {{view view.inputField viewName="inputField"}}'," {{view view.errorsView}}"," {{view view.helpView}}","</div>"].join("\n")),label:Ember.computed(function(e,t){if(1!==arguments.length)return this.set("labelCache",t),t;if(void 0!==this.get("labelCache"))return this.get("labelCache");var i=this.get("valueBinding._from");return i?(i=i.split("."),i[i.length-1]):void 0}).property(),labelView:Ember.View.extend({tagName:"label",classNames:["control-label"],template:Ember.Handlebars.compile("{{view.value}}"),value:Ember.computed(function(e,t){var i=this.get("parentView");return t&&t!==i.get("label")?i.set("label",t):t=i.get("label"),void 0===i.get("labelCache")||i.get("labelCache")===!1?Bootstrap.Forms.human(t):t}).property("parentView.label"),inputElementId:"for",forBinding:"inputElementId",attributeBindings:["for"]}),inputField:Ember.View.extend({classNames:["ember-bootstrap-extend"],tagName:"div",template:Ember.Handlebars.compile("This class is not meant to be used directly, but extended.")}),errorsView:Ember.View.extend({tagName:"div",classNames:["errors","help-inline"],_updateContent:Ember.observer(function(){var e=this.get("parentView");if(null!==e){var t=e.get("valueBinding._from"),i=null,a=null;if(t?(t=t.replace("_parentView.","").split("."),i=t[t.length-1],a=e.get(t.slice(0,t.length-1).join("."))):(i=e.get("label"),a=e.get("context")),a&&!a.get("isValid")){var n=a.get("errors");n&&i in n&&!Ember.isEmpty(n[i])?(e.$().addClass("error"),this.$().html(n[i].join(", "))):(e.$().removeClass("error"),this.$().html(""))}else e.$().removeClass("error"),this.$().html("")}},"parentView.context.isValid","parentView.label")}),helpView:Ember.View.extend({tagName:"div",classNames:["help-block"],template:Ember.Handlebars.compile("{{view.content}}"),contentBinding:"parentView.help"}),didInsertElement:function(){this.set("labelView.inputElementId",this.get("inputField.elementId"))}})}(),function(){Bootstrap.Forms.Select=Bootstrap.Forms.Field.extend({optionLabelPath:"content",optionValuePath:"content",inputField:Ember.Select.extend({contentBinding:"parentView.content",optionLabelPathBinding:"parentView.optionLabelPath",optionValuePathBinding:"parentView.optionValuePath",valueBinding:"parentView.value",selectionBinding:"parentView.selection",promptBinding:"parentView.prompt",multipleBinding:"parentView.multiple",disabledBinding:"parentView.disabled",classNameBindings:["parentView.inputClassNames"],name:Ember.computed(function(){return this.get("parentView.name")||this.get("parentView.label")}).property("parentView.name","parentView.label")})})}(),function(){var e=Ember.get;Bootstrap.TextSupport=Ember.Mixin.create({valueBinding:"parentView.value",placeholderBinding:"parentView.placeholder",disabledBinding:"parentView.disabled",maxlengthBinding:"parentView.maxlength",classNameBindings:"parentView.inputClassNames",attributeBindings:["name"],name:Ember.computed(function(){return e(this,"parentView.name")||e(this,"parentView.label")}).property("parentView.name","parentView.label").cacheable()})}(),function(){Bootstrap.Forms.TextArea=Bootstrap.Forms.Field.extend({inputField:Ember.TextArea.extend(Bootstrap.TextSupport,{rowsBinding:"parentView.rows",colsBinding:"parentView.cols"})})}(),function(){Bootstrap.Forms.TextField=Bootstrap.Forms.Field.extend({type:"text",inputField:Ember.TextField.extend(Bootstrap.TextSupport,{typeBinding:"parentView.type",sizeBinding:"parentView.size"})})}(),function(){Bootstrap.Forms.Checkbox=Bootstrap.Forms.Field.extend({inputField:Ember.Checkbox.extend({attributeBindings:["name"],checkedBinding:"parentView.checked",disabledBinding:"parentView.disabled",classNameBindings:["parentView.inputClassNames"],name:Ember.computed(function(){return this.get("parentView.name")||this.get("parentView.label")}).property("parentView.name","parentView.label")})})}(),function(){Bootstrap.Forms.UneditableInput=Bootstrap.Forms.Field.extend({inputField:Ember.View.extend({tagName:"span",classNames:["uneditable-input"],attributeBindings:["name"],template:Ember.Handlebars.compile("{{view.value}}"),valueBinding:"parentView.value",classNameBindings:["parentView.inputClassNames"],name:Ember.computed(function(){return this.get("parentView.name")||this.get("parentView.label")}).property("parentView.name","parentView.label")})})}()}(),"undefined"==typeof location||"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname||Ember.Logger.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. If you want full error messages please use the non-minified build provided on the Ember website.");
@@ -0,0 +1,955 @@
1
+ (function() {
2
+ var define, requireModule;
3
+
4
+ (function() {
5
+ var registry = {}, seen = {};
6
+
7
+ define = function(name, deps, callback) {
8
+ registry[name] = { deps: deps, callback: callback };
9
+ };
10
+
11
+ requireModule = function(name) {
12
+ if (seen[name]) { return seen[name]; }
13
+ seen[name] = {};
14
+
15
+ var mod, deps, callback, reified , exports;
16
+
17
+ mod = registry[name];
18
+
19
+ if (!mod) {
20
+ throw new Error("Module '" + name + "' not found.");
21
+ }
22
+
23
+ deps = mod.deps;
24
+ callback = mod.callback;
25
+ reified = [];
26
+ exports;
27
+
28
+ for (var i=0, l=deps.length; i<l; i++) {
29
+ if (deps[i] === 'exports') {
30
+ reified.push(exports = {});
31
+ } else {
32
+ reified.push(requireModule(deps[i]));
33
+ }
34
+ }
35
+
36
+ var value = callback.apply(this, reified);
37
+ return seen[name] = exports || value;
38
+ };
39
+ })();
40
+ (function() {
41
+ window.Bootstrap = Ember.Namespace.create();
42
+
43
+ })();
44
+
45
+
46
+
47
+ (function() {
48
+ var get = Ember.get;
49
+
50
+ var modalPaneTemplate = [
51
+ '<div class="modal-header">',
52
+ ' <a href="#" class="close" rel="close">&times;</a>',
53
+ ' {{view view.headerViewClass}}',
54
+ '</div>',
55
+ '<div class="modal-body">{{view view.bodyViewClass}}</div>',
56
+ '<div class="modal-footer">',
57
+ ' {{view view.footerViewClass}}',
58
+ '</div>'].join("\n");
59
+
60
+ var footerTemplate = [
61
+ '{{#if view.parentView.secondary}}<a href="#" class="btn btn-secondary" rel="secondary">{{view.parentView.secondary}}</a>{{/if}}',
62
+ '{{#if view.parentView.primary}}<a href="#" class="btn btn-primary" rel="primary">{{view.parentView.primary}}</a>{{/if}}'].join("\n");
63
+
64
+ var modalPaneBackdrop = '<div class="modal-backdrop"></div>';
65
+
66
+ Bootstrap.ModalPane = Ember.View.extend(Ember.DeferredMixin, {
67
+ classNames: 'modal',
68
+ defaultTemplate: Ember.Handlebars.compile(modalPaneTemplate),
69
+ heading: null,
70
+ message: null,
71
+ primary: null,
72
+ secondary: null,
73
+ showBackdrop: true,
74
+ headerViewClass: Ember.View.extend({
75
+ tagName: 'h3',
76
+ template: Ember.Handlebars.compile('{{view.parentView.heading}}')
77
+ }),
78
+ bodyViewClass: Ember.View.extend({
79
+ tagName: 'p',
80
+ template: Ember.Handlebars.compile('{{{view.parentView.message}}}')
81
+ }),
82
+ footerViewClass: Ember.View.extend({
83
+ template: Ember.Handlebars.compile(footerTemplate)
84
+ }),
85
+
86
+ didInsertElement: function() {
87
+ if (get(this, 'showBackdrop')) this._appendBackdrop();
88
+ this._setupDocumentKeyHandler();
89
+ },
90
+
91
+ willDestroyElement: function() {
92
+ if (this._backdrop) this._backdrop.remove();
93
+ this._removeDocumentKeyHandler();
94
+ },
95
+
96
+ keyPress: function(event) {
97
+ if (event.keyCode === 27) {
98
+ this._triggerCallbackAndDestroy({ close: true }, event);
99
+ }
100
+ },
101
+
102
+ click: function(event) {
103
+ var target = event.target,
104
+ targetRel = target.getAttribute('rel');
105
+
106
+ if (targetRel) {
107
+ var options = {};
108
+ options[targetRel] = true;
109
+
110
+ this._triggerCallbackAndDestroy(options, event);
111
+ return false;
112
+ }
113
+ },
114
+
115
+ _appendBackdrop: function() {
116
+ var parentLayer = this.$().parent();
117
+ this._backdrop = jQuery(modalPaneBackdrop).appendTo(parentLayer);
118
+ },
119
+
120
+ _setupDocumentKeyHandler: function() {
121
+ var cc = this,
122
+ handler = function(event) {
123
+ cc.keyPress(event);
124
+ };
125
+ jQuery(window.document).bind('keyup', handler);
126
+ this._keyUpHandler = handler;
127
+ },
128
+
129
+ _removeDocumentKeyHandler: function() {
130
+ jQuery(window.document).unbind('keyup', this._keyUpHandler);
131
+ },
132
+
133
+ _resolveOrReject: function(options, event) {
134
+ if (options.primary) this.resolve(options, event);
135
+ else this.reject(options, event);
136
+ },
137
+
138
+ _triggerCallbackAndDestroy: function(options, event) {
139
+ var destroy;
140
+ if (this.callback) {
141
+ destroy = this.callback(options, event);
142
+ }
143
+ if (destroy === undefined || destroy) {
144
+ this._resolveOrReject(options, event);
145
+ this.destroy();
146
+ }
147
+ }
148
+ });
149
+
150
+ Bootstrap.ModalPane.reopenClass({
151
+ rootElement: ".ember-application",
152
+ popup: function(options) {
153
+ var modalPane, rootElement;
154
+ if (!options) options = {};
155
+ modalPane = this.create(options);
156
+ rootElement = get(this, 'rootElement');
157
+ modalPane.appendTo(rootElement);
158
+ return modalPane;
159
+ }
160
+ });
161
+
162
+
163
+ })();
164
+
165
+
166
+
167
+ (function() {
168
+ var get = Ember.get, set = Ember.set;
169
+
170
+ Bootstrap.TypeSupport = Ember.Mixin.create({
171
+ baseClassName: Ember.required(String),
172
+ classNameBindings: ['typeClass'],
173
+ type: null, // success, warning, error, info || inverse
174
+ typeClass: Ember.computed(function() {
175
+ var type = get(this, 'type'),
176
+ baseClassName = get(this, 'baseClassName');
177
+ return type ? baseClassName + '-' + type : null;
178
+ }).property('type').cacheable()
179
+ });
180
+
181
+ })();
182
+
183
+
184
+
185
+ (function() {
186
+ var get = Ember.get;
187
+ Bootstrap.AlertMessage = Ember.View.extend(Bootstrap.TypeSupport, {
188
+ classNames: ['alert', 'alert-message'],
189
+ baseClassName: 'alert',
190
+ template: Ember.Handlebars.compile('<a class="close" rel="close" href="#">&times;</a>{{{view.message}}}'),
191
+ message: null,
192
+ removeAfter: null,
193
+
194
+ didInsertElement: function() {
195
+ var removeAfter = get(this, 'removeAfter');
196
+ if (removeAfter > 0) {
197
+ Ember.run.later(this, 'destroy', removeAfter);
198
+ }
199
+ },
200
+
201
+ click: function(event) {
202
+ var target = event.target,
203
+ targetRel = target.getAttribute('rel');
204
+
205
+ if (targetRel === 'close') {
206
+ this.destroy();
207
+ return false;
208
+ }
209
+ }
210
+ });
211
+
212
+ })();
213
+
214
+
215
+
216
+ (function() {
217
+ Bootstrap.BlockAlertMessage = Bootstrap.AlertMessage.extend({
218
+ classNames: ['alert', 'alert-block']
219
+ });
220
+
221
+ })();
222
+
223
+
224
+
225
+ (function() {
226
+ var get = Ember.get;
227
+
228
+ Bootstrap.ItemViewValueSupport = Ember.Mixin.create({
229
+ value: Ember.computed(function() {
230
+ var parentView = get(this, 'parentView'),
231
+ content, valueKey;
232
+ if (!parentView) return null;
233
+ content = get(this, 'content');
234
+ valueKey = get(parentView, 'itemValueKey') || 'value';
235
+ return get(content, valueKey) || content;
236
+ }).property('content').cacheable()
237
+ });
238
+
239
+ })();
240
+
241
+
242
+
243
+ (function() {
244
+ var get = Ember.get;
245
+
246
+ Bootstrap.ItemViewTitleSupport = Ember.Mixin.create({
247
+ title: Ember.computed(function() {
248
+ var parentView = get(this, 'parentView'),
249
+ content,
250
+ titleKey;
251
+
252
+ content = get(this, 'content');
253
+ if (parentView) {
254
+ titleKey = get(parentView, 'itemTitleKey') || 'title';
255
+
256
+ return get(content, titleKey) || content;
257
+ }
258
+
259
+ return content;
260
+ }).property('content').cacheable()
261
+ });
262
+
263
+ })();
264
+
265
+
266
+
267
+ (function() {
268
+ var get = Ember.get, set = Ember.set;
269
+
270
+ Bootstrap.ItemSelectionSupport = Ember.Mixin.create(Bootstrap.ItemViewValueSupport, Bootstrap.ItemViewTitleSupport, {
271
+ classNameBindings: ["isActive:active"],
272
+ allowsEmptySelection: false,
273
+
274
+ isActive: Ember.computed(function() {
275
+ var parentView = get(this, 'parentView'),
276
+ selection, value;
277
+ if (!parentView) return false;
278
+ selection = get(parentView, 'selection');
279
+ value = get(this, 'value');
280
+ return selection === value;
281
+ }).property('parentView.selection', 'value').cacheable(),
282
+
283
+ click: function(event) {
284
+ var value = get(this, 'value'),
285
+ parentView = get(this, 'parentView'),
286
+ allowsEmptySelection = get(parentView, 'allowsEmptySelection'),
287
+ selection = get(parentView, 'selection');
288
+ if (allowsEmptySelection === true && selection === value) {
289
+ value = null;
290
+ }
291
+ set(parentView, 'selection', value);
292
+ return true;
293
+ }
294
+ });
295
+
296
+ })();
297
+
298
+
299
+
300
+ (function() {
301
+ var get = Ember.get;
302
+
303
+ Bootstrap.ItemViewHrefSupport = Ember.Mixin.create({
304
+ href: Ember.computed(function() {
305
+ var parentView = get(this, 'parentView'),
306
+ content, hrefKey;
307
+ content = get(this, 'content');
308
+ if (parentView) {
309
+ hrefKey = get(parentView, 'itemHrefKey') || 'link';
310
+ return get(content, hrefKey) || '#';
311
+ }
312
+ return content;
313
+ }).property('content').cacheable()
314
+ });
315
+
316
+ })();
317
+
318
+
319
+
320
+ (function() {
321
+ Bootstrap.PillItem = Ember.View.extend(Bootstrap.ItemSelectionSupport, Bootstrap.ItemViewHrefSupport, {
322
+ template: Ember.Handlebars.compile('{{view view.item}}'),
323
+
324
+ item: Ember.View.extend({
325
+ tagName: 'a',
326
+ template: Ember.Handlebars.compile('{{view.parentView.title}}'),
327
+ attributeBindings: ['href'],
328
+ hrefBinding: 'parentView.href'
329
+ })
330
+ });
331
+
332
+ })();
333
+
334
+
335
+
336
+ (function() {
337
+ Bootstrap.Pills = Ember.CollectionView.extend({
338
+ classNames: ['nav', 'nav-pills'],
339
+ classNameBindings: ['isStacked:nav-stacked'],
340
+ tagName: 'ul',
341
+ itemViewClass: Bootstrap.PillItem,
342
+ selection: null
343
+ });
344
+
345
+ })();
346
+
347
+
348
+
349
+ (function() {
350
+ Bootstrap.Tabs = Ember.CollectionView.extend({
351
+ classNames: ['nav', 'nav-tabs'],
352
+ classNameBindings: ['isStacked:nav-stacked'],
353
+ tagName: 'ul',
354
+ itemViewClass: Bootstrap.PillItem,
355
+ selection: null
356
+ });
357
+
358
+ })();
359
+
360
+
361
+
362
+ (function() {
363
+ Bootstrap.NavList = Ember.CollectionView.extend({
364
+ classNames: ['nav', 'nav-list'],
365
+ tagName: 'ul',
366
+ itemViewClass: Bootstrap.PillItem,
367
+ selection: null
368
+ });
369
+
370
+ })();
371
+
372
+
373
+
374
+ (function() {
375
+ var get = Ember.get, fmt = Ember.String.fmt;
376
+
377
+ Bootstrap.ProgressBar = Ember.View.extend({
378
+ classNames: ['progress'],
379
+ classNameBindings: ['isStriped:progress-striped', 'isAnimated:active'],
380
+ template: Ember.Handlebars.compile('<div class="bar" {{bindAttr style="view.style"}}></div>'),
381
+ isAnimated: false,
382
+ isStriped: false,
383
+ progress: 0,
384
+
385
+ style: Ember.computed(function() {
386
+ var progress = get(this, 'progress');
387
+
388
+ return fmt('width:%@%;', [progress]);
389
+ }).property('progress').cacheable()
390
+ });
391
+
392
+ })();
393
+
394
+
395
+
396
+ (function() {
397
+ Bootstrap.Badge = Ember.View.extend(Bootstrap.TypeSupport, {
398
+ tagName: 'span',
399
+ classNames: ['badge'],
400
+ baseClassName: 'badge',
401
+ template: Ember.Handlebars.compile('{{view.content}}')
402
+ });
403
+
404
+ })();
405
+
406
+
407
+
408
+ (function() {
409
+ Bootstrap.Label = Ember.View.extend(Bootstrap.TypeSupport, {
410
+ tagName: 'span',
411
+ classNames: ['label'],
412
+ baseClassName: 'label',
413
+ template: Ember.Handlebars.compile('{{view.content}}')
414
+ });
415
+
416
+ })();
417
+
418
+
419
+
420
+ (function() {
421
+ var get = Ember.get;
422
+
423
+ Bootstrap.Well = Ember.View.extend({
424
+ template: Ember.Handlebars.compile('{{view.content}}'),
425
+ classNames: 'well',
426
+ content: null
427
+ });
428
+
429
+ })();
430
+
431
+
432
+
433
+ (function() {
434
+ var A = Ember.A;
435
+
436
+ Bootstrap.Pagination = Ember.CollectionView.extend({
437
+ tagName: 'ul',
438
+ classNames: ['pagination'],
439
+ itemTitleKey: 'title',
440
+ itemHrefKey: 'href',
441
+ init: function() {
442
+ this._super();
443
+ if (!this.get('content')) {
444
+ this.set('content', new A([]));
445
+ }
446
+ },
447
+ itemViewClass: Ember.View.extend(Bootstrap.ItemSelectionSupport, Bootstrap.ItemViewHrefSupport, {
448
+ classNameBindings: ['content.disabled'],
449
+ template: Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{view.title}}</a>')
450
+ })
451
+ });
452
+
453
+ })();
454
+
455
+
456
+
457
+ (function() {
458
+ Bootstrap.Pager = Ember.CollectionView.extend({
459
+ tagName: 'ul',
460
+ classNames: ['pager'],
461
+ itemTitleKey: 'title',
462
+ itemHrefKey: 'href',
463
+ init: function() {
464
+ this._super();
465
+ if (!this.get('content')) {
466
+ this.set('content', Ember.A([
467
+ Ember.Object.create({ title: '&larr;' }),
468
+ Ember.Object.create({ title: '&rarr;' })
469
+ ]));
470
+ }
471
+ },
472
+ itemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, Bootstrap.ItemViewHrefSupport, {
473
+ classNameBindings: ['content.next', 'content.previous', 'content.disabled'],
474
+ template: Ember.Handlebars.compile('<a {{bindAttr href="view.href"}}>{{{view.title}}}</a>')
475
+ }),
476
+ arrayDidChange: function(content, start, removed, added) {
477
+ if (content) {
478
+
479
+ }
480
+ return this._super(content, start, removed, added);
481
+ }
482
+ });
483
+
484
+ })();
485
+
486
+
487
+
488
+ (function() {
489
+ var get = Ember.get;
490
+
491
+ Bootstrap.FirstLastViewSupport = Ember.Mixin.create({
492
+ createChildView: function(view, attrs) {
493
+ var content;
494
+
495
+ if (attrs) {
496
+ content = get(this, 'content');
497
+
498
+ if (attrs.contentIndex === 0) {
499
+ view = get(this, 'firstItemViewClass') || view;
500
+ }
501
+ if (attrs.contentIndex === (get(content, 'length') - 1)) {
502
+ view = get(this, 'lastItemViewClass') || view;
503
+ }
504
+ }
505
+ return this._super(view, attrs);
506
+ }
507
+ });
508
+
509
+ })();
510
+
511
+
512
+
513
+ (function() {
514
+ var get = Ember.get;
515
+
516
+ Bootstrap.Breadcrumb = Ember.CollectionView.extend(Bootstrap.FirstLastViewSupport, {
517
+ tagName: 'ul',
518
+ classNames: ['breadcrumb'],
519
+ divider: '/',
520
+ arrayDidChange: function(content, start, removed, added) {
521
+ var view,
522
+ index,
523
+ length,
524
+ item,
525
+ lastItemViewClass = get(this, 'lastItemViewClass'),
526
+ itemViewClass = get(this, 'itemViewClass'),
527
+ lastView;
528
+
529
+ this._super.apply(this, arguments);
530
+
531
+ if (!content)
532
+ return;
533
+
534
+ length = get(content, 'length');
535
+
536
+ if (removed) {
537
+ lastView = get(this, 'childViews.lastObject');
538
+
539
+ if (lastItemViewClass.detectInstance(lastView))
540
+ return;
541
+
542
+ index = length - 1;
543
+
544
+ view = this.createChildView(lastItemViewClass, {
545
+ content: content[index],
546
+ contentIndex: index
547
+ });
548
+
549
+ this.replace(index, 1, [view]);
550
+ }
551
+
552
+ if (added) {
553
+ get(this, 'childViews').forEach(function(childView, index) {
554
+ if (lastItemViewClass.detectInstance(childView) && index !== length - 1) {
555
+ view = this.createChildView(itemViewClass, {
556
+ content: content[index],
557
+ contentIndex: index
558
+ });
559
+
560
+ this.replace(index, 1, [view]);
561
+ }
562
+ }, this);
563
+
564
+ }
565
+
566
+ },
567
+ itemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, {
568
+ template: Ember.Handlebars.compile('<a href="#">{{view.title}}</a><span class="divider">{{view.parentView.divider}}</span>')
569
+ }),
570
+ lastItemViewClass: Ember.View.extend(Bootstrap.ItemViewTitleSupport, {
571
+ classNames: ['active'],
572
+ template: Ember.Handlebars.compile('{{view.title}}')
573
+ })
574
+ });
575
+
576
+ })();
577
+
578
+
579
+
580
+ (function() {
581
+ /**
582
+ * @property buttonDropdownTemplate
583
+ * @type {String}
584
+ */
585
+ var buttonDropdownTemplate = [
586
+ '<a {{bindAttr class="view.typeClass :btn :dropdown-toggle" }} data-toggle="dropdown" href="#">',
587
+ '{{view.label}}',
588
+ '<span class="caret"></span>',
589
+ '</a>',
590
+ '<ul class="dropdown-menu">',
591
+ ' {{#if view.items}}',
592
+ ' {{#each item in view.items}}',
593
+ ' <li {{bindAttr class="item.disabled:disabled"}}>{{view view.Item contextBinding="item"}}</li>',
594
+ ' {{/each}}',
595
+ ' {{/if}}',
596
+ '</ul>'
597
+ ].join("\n");
598
+
599
+ /**
600
+ * @property Bootstrap.ButtonDropdown
601
+ * @type {Ember.View}
602
+ */
603
+ Bootstrap.ButtonDropdown = Ember.View.extend({
604
+
605
+ /**
606
+ * @property label
607
+ * @type {String}
608
+ */
609
+ label: null,
610
+
611
+ /**
612
+ * @property items
613
+ * @type {Array}
614
+ */
615
+ items: [],
616
+
617
+ /**
618
+ * @property classNames
619
+ * @type {Array}
620
+ */
621
+ classNames: ['btn-group'],
622
+
623
+ /**
624
+ * @property defaultTemplate
625
+ * @type {String}
626
+ */
627
+ defaultTemplate: Ember.Handlebars.compile(buttonDropdownTemplate),
628
+
629
+ /**
630
+ * @property Item
631
+ * @type {Ember.View}
632
+ */
633
+ Item: Ember.View.extend({
634
+
635
+ /**
636
+ * @property tagName
637
+ * @type {String}
638
+ * @default "a"
639
+ */
640
+ tagName: 'a',
641
+
642
+ /**
643
+ * @property attributeBindings
644
+ * @type {Array}
645
+ */
646
+ attributeBindings: ['href'],
647
+
648
+ /**
649
+ * @property template
650
+ * @type {Function}
651
+ */
652
+ template: Ember.Handlebars.compile('{{label}}'),
653
+
654
+ /**
655
+ * @property href
656
+ * @type {Object}
657
+ * @return {String}
658
+ */
659
+ href: '#',
660
+
661
+ /**
662
+ * @method click
663
+ * Attempt to invoke the specified action name on the controller.
664
+ * @return {void}
665
+ */
666
+ click: function() {
667
+
668
+ var item = Ember.get(this, 'context'),
669
+ actionName = Ember.get(item, 'actionName'),
670
+ controller = Ember.get(this, 'controller');
671
+ var disabled = Ember.get(item, 'disabled');
672
+
673
+ if (disabled === true) {
674
+ // We won't invoke the action if it's disabled.
675
+ return;
676
+ }
677
+
678
+
679
+
680
+ // Invoke the action on the controller, passing in the item as the first param.
681
+ Ember.tryInvoke(controller, actionName, [item]);
682
+ }
683
+
684
+ })
685
+
686
+ });
687
+
688
+ })();
689
+
690
+
691
+
692
+ (function() {
693
+ Bootstrap.Forms = Ember.Namespace.create({
694
+
695
+ human: function(value) {
696
+ if (value === undefined || value === false)
697
+ return;
698
+
699
+ // Underscore string
700
+ value = Ember.String.decamelize(value);
701
+ // Replace all _ with spaces
702
+ value = value.replace(/_/g, " ");
703
+ // Capitalize the first letter of every word
704
+ value = value.replace(/(^|\s)([a-z])/g, function(m,p1,p2){ return p1+p2.toUpperCase(); });
705
+ return value;
706
+ }
707
+ });
708
+
709
+ })();
710
+
711
+
712
+
713
+ (function() {
714
+ Bootstrap.Forms.Field = Ember.View.extend({
715
+ tagName: 'div',
716
+ classNames: ['control-group'],
717
+ labelCache: undefined,
718
+ help: undefined,
719
+ template: Ember.Handlebars.compile([
720
+ '{{view view.labelView viewName="labelView"}}',
721
+ '<div class="controls">',
722
+ ' {{view view.inputField viewName="inputField"}}',
723
+ ' {{view view.errorsView}}',
724
+ ' {{view view.helpView}}',
725
+ '</div>'].join("\n")),
726
+
727
+ label: Ember.computed(function(key, value) {
728
+ if(arguments.length === 1){
729
+ if(this.get('labelCache') === undefined){
730
+ var path = this.get('valueBinding._from');
731
+ if (path) {
732
+ path = path.split(".");
733
+ return path[path.length - 1];
734
+ }
735
+ } else {
736
+ return this.get('labelCache');
737
+ }
738
+ } else {
739
+ this.set('labelCache', value);
740
+ return value;
741
+ }
742
+ }).property(),
743
+
744
+ labelView: Ember.View.extend({
745
+ tagName: 'label',
746
+ classNames: ['control-label'],
747
+ template: Ember.Handlebars.compile('{{view.value}}'),
748
+
749
+ value: Ember.computed(function(key, value) {
750
+ var parent = this.get('parentView');
751
+
752
+ if (value && value !== parent.get('label')) {
753
+ parent.set('label', value);
754
+ } else {
755
+ value = parent.get('label');
756
+ }
757
+
758
+ // If the labelCache property is present on parent, then the
759
+ // label was set manually, and there's no need to humanise it.
760
+ // Otherwise, it comes from the binding and needs to be
761
+ // humanised.
762
+ return parent.get('labelCache') === undefined || parent.get('labelCache') === false ?
763
+ Bootstrap.Forms.human(value) : value;
764
+ }).property('parentView.label'),
765
+
766
+ inputElementId: 'for',
767
+ forBinding: 'inputElementId',
768
+ attributeBindings: ['for']
769
+ }),
770
+
771
+ inputField: Ember.View.extend({
772
+ classNames: ['ember-bootstrap-extend'],
773
+ tagName: 'div',
774
+ template: Ember.Handlebars.compile('This class is not meant to be used directly, but extended.')
775
+ }),
776
+
777
+ errorsView: Ember.View.extend({
778
+ tagName: 'div',
779
+ classNames: ['errors', 'help-inline'],
780
+
781
+ _updateContent: Ember.observer(function() {
782
+ var parent = this.get('parentView');
783
+
784
+ if (parent !== null) {
785
+ var binding = parent.get('valueBinding._from');
786
+ var fieldName = null;
787
+ var object = null;
788
+
789
+ if (binding) {
790
+ binding = binding.replace("_parentView.", "").split(".");
791
+ fieldName = binding[binding.length - 1];
792
+ object = parent.get(binding.slice(0, binding.length-1).join('.'));
793
+ } else {
794
+ fieldName = parent.get('label');
795
+ object = parent.get('context');
796
+ }
797
+
798
+ if (object && !object.get('isValid')) {
799
+ var errors = object.get('errors');
800
+
801
+ if (errors && fieldName in errors && !Ember.isEmpty(errors[fieldName])) {
802
+ parent.$().addClass('error');
803
+ this.$().html(errors[fieldName].join(', '));
804
+ } else {
805
+ parent.$().removeClass('error');
806
+ this.$().html('');
807
+ }
808
+ } else {
809
+ parent.$().removeClass('error');
810
+ this.$().html('');
811
+ }
812
+ }
813
+ }, 'parentView.context.isValid', 'parentView.label')
814
+ }),
815
+
816
+ helpView: Ember.View.extend({
817
+ tagName: 'div',
818
+ classNames: ['help-block'],
819
+ template: Ember.Handlebars.compile('{{view.content}}'),
820
+ contentBinding: 'parentView.help'
821
+ }),
822
+
823
+ didInsertElement: function() {
824
+ this.set('labelView.inputElementId', this.get('inputField.elementId'));
825
+ }
826
+ });
827
+
828
+ })();
829
+
830
+
831
+
832
+ (function() {
833
+ Bootstrap.Forms.Select = Bootstrap.Forms.Field.extend({
834
+ optionLabelPath: 'content',
835
+ optionValuePath: 'content',
836
+
837
+ inputField: Ember.Select.extend({
838
+ contentBinding: 'parentView.content',
839
+
840
+ optionLabelPathBinding: 'parentView.optionLabelPath',
841
+ optionValuePathBinding: 'parentView.optionValuePath',
842
+
843
+ valueBinding: 'parentView.value',
844
+ selectionBinding: 'parentView.selection',
845
+ promptBinding: 'parentView.prompt',
846
+ multipleBinding: 'parentView.multiple',
847
+ disabledBinding: 'parentView.disabled',
848
+ classNameBindings: ['parentView.inputClassNames'],
849
+ name: Ember.computed(function() {
850
+ return this.get('parentView.name') || this.get('parentView.label');
851
+ }).property('parentView.name', 'parentView.label')
852
+ })
853
+ });
854
+
855
+ })();
856
+
857
+
858
+
859
+ (function() {
860
+ var get = Ember.get;
861
+
862
+ Bootstrap.TextSupport = Ember.Mixin.create({
863
+ valueBinding: 'parentView.value',
864
+ placeholderBinding: 'parentView.placeholder',
865
+ disabledBinding: 'parentView.disabled',
866
+ maxlengthBinding: 'parentView.maxlength',
867
+ classNameBindings: 'parentView.inputClassNames',
868
+ attributeBindings: ['name'],
869
+ name: Ember.computed(function() {
870
+ return get(this, 'parentView.name') || get(this, 'parentView.label');
871
+ }).property('parentView.name', 'parentView.label').cacheable()
872
+ });
873
+
874
+ })();
875
+
876
+
877
+
878
+ (function() {
879
+ Bootstrap.Forms.TextArea = Bootstrap.Forms.Field.extend({
880
+
881
+ inputField: Ember.TextArea.extend(Bootstrap.TextSupport, {
882
+ rowsBinding: 'parentView.rows',
883
+ colsBinding: 'parentView.cols'
884
+ })
885
+ });
886
+
887
+ })();
888
+
889
+
890
+
891
+ (function() {
892
+ Bootstrap.Forms.TextField = Bootstrap.Forms.Field.extend({
893
+ type: 'text',
894
+
895
+ inputField: Ember.TextField.extend(Bootstrap.TextSupport, {
896
+ typeBinding: 'parentView.type',
897
+ sizeBinding: 'parentView.size'
898
+ })
899
+ });
900
+
901
+ })();
902
+
903
+
904
+
905
+ (function() {
906
+ Bootstrap.Forms.Checkbox = Bootstrap.Forms.Field.extend({
907
+
908
+ inputField: Ember.Checkbox.extend({
909
+ attributeBindings: ['name'],
910
+ checkedBinding: 'parentView.checked',
911
+ disabledBinding: 'parentView.disabled',
912
+ classNameBindings: ['parentView.inputClassNames'],
913
+ name: Ember.computed(function() {
914
+ return this.get('parentView.name') || this.get('parentView.label');
915
+ }).property('parentView.name', 'parentView.label')
916
+ })
917
+ });
918
+
919
+ })();
920
+
921
+
922
+
923
+ (function() {
924
+ Bootstrap.Forms.UneditableInput = Bootstrap.Forms.Field.extend({
925
+
926
+ inputField: Ember.View.extend({
927
+ tagName: 'span',
928
+ classNames: ['uneditable-input'],
929
+ attributeBindings: ['name'],
930
+ template: Ember.Handlebars.compile('{{view.value}}'),
931
+
932
+ valueBinding: 'parentView.value',
933
+ classNameBindings: ['parentView.inputClassNames'],
934
+ name: Ember.computed(function() {
935
+ return this.get('parentView.name') || this.get('parentView.label');
936
+ }).property('parentView.name', 'parentView.label')
937
+ })
938
+ });
939
+
940
+ })();
941
+
942
+
943
+
944
+ (function() {
945
+
946
+ })();
947
+
948
+
949
+ })();
950
+
951
+
952
+ if (typeof location !== 'undefined' && (location.hostname === 'localhost' || location.hostname === '127.0.0.1')) {
953
+ Ember.Logger.warn("You are running a production build of Ember on localhost and won't receive detailed error messages. "+
954
+ "If you want full error messages please use the non-minified build provided on the Ember website.");
955
+ }