bootstrap-for-ember-rails 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +2 -0
- data/bootstrap-for-ember-rails.gemspec +36 -0
- data/lib/bootstrap-for-ember-rails.rb +9 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/.bowerrc +3 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/.gitignore +5 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/Gruntfile.js +459 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/LICENSE +191 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/README.md +80 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/index.html +176 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsAlertComponent.coffee +30 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsBadgeComponent.coffee +8 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsBreadcrumbs.coffee +65 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsBtnGroup.coffee +19 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsBtnToolbarComponent.coffee +11 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsButtonComponent.coffee +45 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsItemsActionBar.coffee +45 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsLabelComponent.coffee +8 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsListGroupComponent.coffee +34 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsModalComponent.coffee +204 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPageHeaderComponent.coffee +6 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPanelComponent.coffee +35 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPill.coffee +20 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPills.coffee +9 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPopover.coffee +443 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsProgressComponent.coffee +19 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsProgressbarComponent.coffee +22 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsTabPane.coffee +2 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsTabs.coffee +9 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsTabsPanes.coffee +6 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsWellComponent.coffee +10 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsWizardComponent.coffee +175 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/GrowlNotifications.coffee +161 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/Notifications.coffee +88 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/init.coffee +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/ItemSelection.coffee +68 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/ItemValue.coffee +18 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/ItemsSelection.coffee +14 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/Nav.coffee +13 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/NavItem.coffee +7 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/Size.coffee +37 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/Type.coffee +17 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/mixins/WithRouter.coffee +8 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase.coffee +16 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsAlertController.coffee +11 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsButtonController.coffee +24 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsItemsActionBarController.coffee +39 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsPanelController.coffee +8 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsPopoverController.coffee +45 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsProgressbarController.coffee +11 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsTooltipBoxController.coffee +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowComponentsWellController.coffee +4 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentButtonGroupController.coffee +8 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentPillsController.coffee +20 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsGrowlNotifController.coffee +11 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsListGroupController.coffee +12 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsModalController.coffee +53 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsNotificationsController.coffee +11 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsTabsController.coffee +12 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsTabsFooController.coffee +2 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsTabsPanesController.coffee +6 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/ShowcaseComponentsWizardController.coffee +45 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/controllers/UserController.coffee +7 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/router.coffee +29 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/routes/ApplicationRoute.coffee +26 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/showcase/routes/PopoverRoute.coffee +10 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/vendor/bootstrap.js +2276 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/views/ItemPaneView.coffee +29 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/views/ItemView.coffee +49 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/views/ItemsPanesView.coffee +12 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/views/ItemsView.coffee +15 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/styles/components/growl-notifications.css +58 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/styles/main.scss +7 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-alert.hbs +4 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-badge.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-btn-toolbar.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-button.hbs +4 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-label.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-modal.hbs +28 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-page-header.hbs +6 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-panel.hbs +26 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-progress.hbs +5 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-progressbar.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/components/bs-well.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/ads.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/application.hbs +51 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/demo-template.hbs +4 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/footer.hbs +0 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/header.hbs +0 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/index.hbs +7 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/leftnav.hbs +13 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/nav-main.hbs +24 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/alert.md +115 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/badge.md +80 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/breadcrumbs.md +28 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/button.md +247 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/buttonGroup.md +99 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/growl-notif.md +70 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/items_action_bar.md +87 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/label.md +44 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/list-group.md +70 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/modal.md +167 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/notifications.md +76 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/page-header.md +15 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/panel.md +123 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/pills.md +104 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/popover.md +213 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/progressbar.md +117 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/tabs-panes.md +42 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/tabs-with-routes.md +64 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/tabs.md +30 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/template.jst +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/well.md +84 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/show_components/wizard.md +109 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/social-buttons.hbs +13 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/tabs/bar-tabpane.hbs +2 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/tabs/baz-tabpane.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/tabs/foo-tabpane.hbs +2 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/user.hbs +3 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/user/activities.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/user/general.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/user/privacy.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/wizard/step1.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/wizard/step2.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/showcase/wizard/step3.hbs +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/templates/views/item-pane.hbs +3 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/bower.json +59 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/css/bs-growl-notifications.min.css +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-alert.max.js +158 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-alert.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-badge.max.js +26 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-badge.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-basic.max.js +230 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-basic.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-breadcrumbs.max.js +77 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-breadcrumbs.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-button.max.js +275 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-button.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-core.max.js +476 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-core.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-growl-notifications.max.js +162 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-growl-notifications.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-items-action-bar.max.js +45 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-items-action-bar.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-label.max.js +26 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-label.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-list-group.max.js +29 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-list-group.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-modal.max.js +314 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-modal.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-nav.max.js +51 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-nav.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-notifications.max.js +111 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-notifications.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-popover.max.js +402 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-popover.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-progressbar.max.js +102 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-progressbar.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-wizard.max.js +182 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/dist/js/bs-wizard.min.js +1 -0
- data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/package.json +36 -0
- data/lib/bootstrap-for-ember-rails/version.rb +3 -0
- metadata +253 -0
@@ -0,0 +1 @@
|
|
1
|
+
!function(){Bootstrap.BsModalComponent=Ember.Component.extend(Ember.Evented,{layoutName:"components/bs-modal",classNames:["modal"],attributeBindings:["role","aria-labelledby","isAriaHidden:aria-hidden","ariaLabelledBy:aria-labelledby"],isAriaHidden:function(){return""+this.get("isVisible")}.property("isVisible"),modalBackdrop:'<div class="modal-backdrop fade in"></div>',role:"dialog",footerViews:[],backdrop:!0,title:null,isVisible:!1,manual:!1,didInsertElement:function(){var a;return this._super(),this.setupBinders(),a=this.get("name"),Ember.assert("Modal name is required for modal view "+this.get("elementId"),this.get("name")),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.add(a,this),this.manual?this.show():void 0},becameVisible:function(){return this.get("backdrop")?this.appendBackdrop():void 0},becameHidden:function(){return this._backdrop?this._backdrop.remove():void 0},appendBackdrop:function(){var a;return a=this.$().parent(),this._backdrop=Em.$(this.modalBackdrop).appendTo(a)},show:function(){return this.set("isVisible",!0)},hide:function(){return this.set("isVisible",!1)},toggle:function(){return this.toggleProperty("isVisible")},click:function(a){var b,c;return b=a.target,c=b.getAttribute("data-dismiss"),"modal"===c?this.close():void 0},keyPressed:function(a){return 27===a.keyCode?this.close(a):void 0},close:function(){return this.get("manual")?this.destroy():this.hide(),this.trigger("closed")},willDestroyElement:function(){var a;return this.removeHandlers(),a=this.get("name"),null==a&&(a=this.get("elementId")),Bootstrap.ModalManager.remove(a,this),this._backdrop?this._backdrop.remove():void 0},removeHandlers:function(){return jQuery(window.document).unbind("keyup",this._keyUpHandler)},setupBinders:function(){var a,b=this;return a=function(a){return b.keyPressed(a)},jQuery(window.document).bind("keyup",a),this._keyUpHandler=a}}),Bootstrap.ModalManager=Ember.Object.create({add:function(a,b){return this.set(a,b)},register:function(a,b){return this.add(a,b),b.appendTo(b.get("targetObject").namespace.rootElement)},remove:function(a){return this.set(a,null)},close:function(a){return this.get(a).close()},hide:function(a){return this.get(a).hide()},show:function(a){return this.get(a).show()},toggle:function(a){return this.get(a).toggle()},confirm:function(a,b,c,d,e){var f,g;return null==d&&(d="Confirm"),null==e&&(e="Cancel"),f=Ember.View.extend({template:Ember.Handlebars.compile(c||"Are you sure you would like to perform this action?")}),g=[Ember.Object.create({title:d,clicked:"modalConfirmed",dismiss:"modal"}),Ember.Object.create({title:e,clicked:"modalCanceled",dismiss:"modal"})],this.open("confirm-modal",b||"Confirmation required!",f,g,a)},openModal:function(a,b){var c,d;return null==b&&(b={}),d=b.rootElement||".ember-application",c=a.create(b),c.appendTo(d)},open:function(a,b,c,d,e){var f,g,h;return f=e.container.lookup("component-lookup:main"),g=f.lookupFactory("bs-modal",e.get("container")).create(),g.setProperties({name:a,title:b,manual:!0,footerButtons:d,targetObject:e}),"string"===Ember.typeOf(c)?(h=e.container.lookup("template:"+c),Ember.assert("Template "+c+" was specified for Modal but template could not be found.",h),h&&g.setProperties({body:Ember.View.extend({template:h,controller:e})})):"class"===Ember.typeOf(c)&&g.setProperties({body:c,controller:e}),g.appendTo(e.namespace.rootElement)}}),Ember.Application.initializer({name:"bs-modal",initialize:function(a){return a.register("component:bs-modal",Bootstrap.BsModalComponent)}})}.call(this),this.Ember=this.Ember||{},this.Ember.TEMPLATES=this.Ember.TEMPLATES||{},this.Ember.TEMPLATES["components/bs-modal"]=Ember.Handlebars.template(function(a,b,c,d,e){function f(a,b){var d,e,f,g,h="";return b.buffer.push("\n <i "),e={"class":a},f={"class":"STRING"},g={hash:{"class":"titleIconClasses"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(p((d=c["bind-attr"]||a["bind-attr"],d?d.call(a,g):o.call(a,"bind-attr",g)))),b.buffer.push("></i>\n "),h}function g(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(p(c.view.call(a,"view.body",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function h(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(p(c._triageMustache.call(a,"yield",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}function i(a,b){var d,e,f,g,h="";return b.buffer.push("\n "),e={content:a,targetObjectBinding:a},f={content:"ID",targetObjectBinding:"STRING"},g={hash:{content:"",targetObjectBinding:"view.targetObject"},contexts:[],types:[],hashContexts:e,hashTypes:f,data:b},b.buffer.push(p((d=c["bs-button"]||a["bs-button"],d?d.call(a,g):o.call(a,"bs-button",g)))),b.buffer.push("\n "),h}function j(a,b){var d,e,f="";return b.buffer.push("\n "),d={},e={},b.buffer.push(p(c.view.call(a,"",{hash:{},contexts:[a],types:["ID"],hashContexts:e,hashTypes:d,data:b}))),b.buffer.push("\n "),f}this.compilerInfo=[4,">= 1.0.0"],c=this.merge(c,Ember.Handlebars.helpers),e=e||{};var k,l,m,n="",o=c.helperMissing,p=this.escapeExpression,q=this;return e.buffer.push('<div class="modal-dialog">\n <div class="modal-content">\n <div class="modal-header">\n <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n <h4 class="modal-title">\n '),l={},m={},k=c["if"].call(b,"titleIconClasses",{hash:{},inverse:q.noop,fn:q.program(1,f,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n "),m={unescaped:b},l={unescaped:"STRING"},k=c._triageMustache.call(b,"title",{hash:{unescaped:"true"},contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push('\n </h4>\n </div>\n <div class="modal-body">\n '),l={},m={},k=c["if"].call(b,"body",{hash:{},inverse:q.program(5,h,e),fn:q.program(3,g,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push('\n </div>\n <div class="modal-footer">\n '),l={},m={},k=c.each.call(b,"footerButtons",{hash:{},inverse:q.noop,fn:q.program(7,i,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n "),l={},m={},k=c.each.call(b,"footerViews",{hash:{},inverse:q.noop,fn:q.program(9,j,e),contexts:[b],types:["ID"],hashContexts:m,hashTypes:l,data:e}),(k||0===k)&&e.buffer.push(k),e.buffer.push("\n </div>\n </div>\n</div>"),n});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
(function() {
|
2
|
+
Bootstrap.BsPill = Bootstrap.ItemView.extend(Bootstrap.NavItem, Bootstrap.ItemSelection, {
|
3
|
+
template: Ember.Handlebars.compile('{{#if view.content.linkTo}}\n {{#if view.parentView.dynamicLink}}\n {{#link-to view.content.linkTo model}}{{view.title}}{{/link-to}}\n {{else}}\n {{#link-to view.content.linkTo}}{{view.title}}{{/link-to}}\n {{/if}}\n{{else}}\n {{view view.pillAsLinkView}}\n{{/if}}'),
|
4
|
+
pillAsLinkView: Ember.View.extend({
|
5
|
+
tagName: 'a',
|
6
|
+
template: Ember.Handlebars.compile('{{view.parentView.title}}'),
|
7
|
+
attributeBindings: ['href'],
|
8
|
+
href: "#"
|
9
|
+
})
|
10
|
+
});
|
11
|
+
|
12
|
+
}).call(this);
|
13
|
+
|
14
|
+
(function() {
|
15
|
+
Bootstrap.BsPills = Bootstrap.ItemsView.extend(Bootstrap.Nav, {
|
16
|
+
navType: 'pills',
|
17
|
+
classNameBindings: ['stacked:nav-stacked', 'justified:nav-justified'],
|
18
|
+
attributeBindings: ['style'],
|
19
|
+
itemViewClass: Bootstrap.BsPill
|
20
|
+
});
|
21
|
+
|
22
|
+
Ember.Handlebars.helper('bs-pills', Bootstrap.BsPills);
|
23
|
+
|
24
|
+
}).call(this);
|
25
|
+
|
26
|
+
(function() {
|
27
|
+
Bootstrap.BsTabPane = Bootstrap.ItemPaneView.extend();
|
28
|
+
|
29
|
+
}).call(this);
|
30
|
+
|
31
|
+
(function() {
|
32
|
+
Bootstrap.BsTabsPanes = Bootstrap.ItemsPanesView.extend({
|
33
|
+
classNames: ['tab-content'],
|
34
|
+
itemViewClass: Bootstrap.BsTabPane
|
35
|
+
});
|
36
|
+
|
37
|
+
Ember.Handlebars.helper('bs-tabs-panes', Bootstrap.BsTabsPanes);
|
38
|
+
|
39
|
+
}).call(this);
|
40
|
+
|
41
|
+
(function() {
|
42
|
+
Bootstrap.BsTabs = Bootstrap.ItemsView.extend(Bootstrap.Nav, {
|
43
|
+
navType: 'tabs',
|
44
|
+
classNameBindings: ['justified:nav-justified'],
|
45
|
+
attributeBindings: ['style'],
|
46
|
+
itemViewClass: Bootstrap.BsPill
|
47
|
+
});
|
48
|
+
|
49
|
+
Ember.Handlebars.helper('bs-tabs', Bootstrap.BsTabs);
|
50
|
+
|
51
|
+
}).call(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){Bootstrap.BsPill=Bootstrap.ItemView.extend(Bootstrap.NavItem,Bootstrap.ItemSelection,{template:Ember.Handlebars.compile("{{#if view.content.linkTo}}\n {{#if view.parentView.dynamicLink}}\n {{#link-to view.content.linkTo model}}{{view.title}}{{/link-to}}\n {{else}}\n {{#link-to view.content.linkTo}}{{view.title}}{{/link-to}}\n {{/if}}\n{{else}}\n {{view view.pillAsLinkView}}\n{{/if}}"),pillAsLinkView:Ember.View.extend({tagName:"a",template:Ember.Handlebars.compile("{{view.parentView.title}}"),attributeBindings:["href"],href:"#"})})}.call(this),function(){Bootstrap.BsPills=Bootstrap.ItemsView.extend(Bootstrap.Nav,{navType:"pills",classNameBindings:["stacked:nav-stacked","justified:nav-justified"],attributeBindings:["style"],itemViewClass:Bootstrap.BsPill}),Ember.Handlebars.helper("bs-pills",Bootstrap.BsPills)}.call(this),function(){Bootstrap.BsTabPane=Bootstrap.ItemPaneView.extend()}.call(this),function(){Bootstrap.BsTabsPanes=Bootstrap.ItemsPanesView.extend({classNames:["tab-content"],itemViewClass:Bootstrap.BsTabPane}),Ember.Handlebars.helper("bs-tabs-panes",Bootstrap.BsTabsPanes)}.call(this),function(){Bootstrap.BsTabs=Bootstrap.ItemsView.extend(Bootstrap.Nav,{navType:"tabs",classNameBindings:["justified:nav-justified"],attributeBindings:["style"],itemViewClass:Bootstrap.BsPill}),Ember.Handlebars.helper("bs-tabs",Bootstrap.BsTabs)}.call(this);
|
@@ -0,0 +1,111 @@
|
|
1
|
+
/*
|
2
|
+
A view that displays notification (messages).
|
3
|
+
|
4
|
+
Currently a single notification is displayed as an Alert on top of the screen, each notification in a time.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
Bootstrap.NotificationsView = Ember.CollectionView.extend({
|
10
|
+
classNames: ['notifications'],
|
11
|
+
attributeBindings: ['style'],
|
12
|
+
contentBinding: 'Bootstrap.NM.content',
|
13
|
+
showTime: 2000,
|
14
|
+
fadeInTime: 500,
|
15
|
+
fadeOutTime: 3000,
|
16
|
+
showTimeTimeoutId: null,
|
17
|
+
/*
|
18
|
+
itemViewClass: Bootstrap.BsAlertComponent.extend(
|
19
|
+
messageBinding: 'content.message'
|
20
|
+
typeBinding: 'content.type'
|
21
|
+
fadeInTimeBinding: 'parentView.fadeInTime'
|
22
|
+
isVisible: false
|
23
|
+
|
24
|
+
didInsertElement: ->
|
25
|
+
@$().fadeIn(@get('fadeInTime'))
|
26
|
+
)
|
27
|
+
*/
|
28
|
+
|
29
|
+
itemViewClass: Ember.View.extend({
|
30
|
+
classNames: ['alert', 'notification'],
|
31
|
+
template: Ember.Handlebars.compile('{{view.content.message}}'),
|
32
|
+
classNameBindings: ["alertType"],
|
33
|
+
isVisible: false,
|
34
|
+
alertType: (function() {
|
35
|
+
return this.get('content').get('classType');
|
36
|
+
}).property('content'),
|
37
|
+
didInsertElement: function() {
|
38
|
+
return this.$().fadeIn(this.get('fadeInTime'));
|
39
|
+
}
|
40
|
+
}),
|
41
|
+
contentChanged: (function() {
|
42
|
+
if (this.get('content').length > 0) {
|
43
|
+
return this.resetShowTime();
|
44
|
+
}
|
45
|
+
}).observes('content.length'),
|
46
|
+
resetShowTime: function() {
|
47
|
+
var _this = this;
|
48
|
+
this.$().css({
|
49
|
+
display: 'block'
|
50
|
+
});
|
51
|
+
if (this.$().is(":animated")) {
|
52
|
+
this.$().stop().animate({
|
53
|
+
opacity: "100"
|
54
|
+
});
|
55
|
+
}
|
56
|
+
if (this.showTimeTimeoutId != null) {
|
57
|
+
clearTimeout(this.showTimeTimeoutId);
|
58
|
+
}
|
59
|
+
return this.showTimeTimeoutId = setTimeout(function() {
|
60
|
+
return _this.fadeOut(_this);
|
61
|
+
}, this.showTime);
|
62
|
+
},
|
63
|
+
fadeOut: function(that) {
|
64
|
+
return that.$().fadeOut(that.fadeOutTime, function() {
|
65
|
+
return that.get('content').clear();
|
66
|
+
});
|
67
|
+
},
|
68
|
+
mouseEnter: function() {
|
69
|
+
if (this.$().is(":animated")) {
|
70
|
+
return this.$().stop().animate({
|
71
|
+
opacity: "100"
|
72
|
+
});
|
73
|
+
}
|
74
|
+
},
|
75
|
+
mouseLeave: function() {
|
76
|
+
return this.resetShowTime();
|
77
|
+
}
|
78
|
+
});
|
79
|
+
|
80
|
+
Ember.Handlebars.helper('bs-notifications', Bootstrap.NotificationsView);
|
81
|
+
|
82
|
+
Bootstrap.NM = Bootstrap.NotificationManager = Ember.Object.create({
|
83
|
+
content: Ember.A(),
|
84
|
+
push: function(message, type) {
|
85
|
+
var notif;
|
86
|
+
type = type != null ? type : type = 'info';
|
87
|
+
notif = Bootstrap.Notification.create({
|
88
|
+
message: message,
|
89
|
+
type: type
|
90
|
+
});
|
91
|
+
return this.get('content').pushObject(notif);
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
/*
|
96
|
+
This object represents a notification to be displayed.
|
97
|
+
Notification(s) are added into the NotificationQueue by the pushNotification function.
|
98
|
+
*/
|
99
|
+
|
100
|
+
|
101
|
+
Bootstrap.Notification = Ember.Object.extend({
|
102
|
+
classType: (function() {
|
103
|
+
if (this.type != null) {
|
104
|
+
return "alert-" + this.type;
|
105
|
+
} else {
|
106
|
+
return null;
|
107
|
+
}
|
108
|
+
}).property('type').cacheable()
|
109
|
+
});
|
110
|
+
|
111
|
+
}).call(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){Bootstrap.NotificationsView=Ember.CollectionView.extend({classNames:["notifications"],attributeBindings:["style"],contentBinding:"Bootstrap.NM.content",showTime:2e3,fadeInTime:500,fadeOutTime:3e3,showTimeTimeoutId:null,itemViewClass:Ember.View.extend({classNames:["alert","notification"],template:Ember.Handlebars.compile("{{view.content.message}}"),classNameBindings:["alertType"],isVisible:!1,alertType:function(){return this.get("content").get("classType")}.property("content"),didInsertElement:function(){return this.$().fadeIn(this.get("fadeInTime"))}}),contentChanged:function(){return this.get("content").length>0?this.resetShowTime():void 0}.observes("content.length"),resetShowTime:function(){var a=this;return this.$().css({display:"block"}),this.$().is(":animated")&&this.$().stop().animate({opacity:"100"}),null!=this.showTimeTimeoutId&&clearTimeout(this.showTimeTimeoutId),this.showTimeTimeoutId=setTimeout(function(){return a.fadeOut(a)},this.showTime)},fadeOut:function(a){return a.$().fadeOut(a.fadeOutTime,function(){return a.get("content").clear()})},mouseEnter:function(){return this.$().is(":animated")?this.$().stop().animate({opacity:"100"}):void 0},mouseLeave:function(){return this.resetShowTime()}}),Ember.Handlebars.helper("bs-notifications",Bootstrap.NotificationsView),Bootstrap.NM=Bootstrap.NotificationManager=Ember.Object.create({content:Ember.A(),push:function(a,b){var c;return b=null!=b?b:b="info",c=Bootstrap.Notification.create({message:a,type:b}),this.get("content").pushObject(c)}}),Bootstrap.Notification=Ember.Object.extend({classType:function(){return null!=this.type?"alert-"+this.type:null}.property("type").cacheable()})}.call(this);
|
@@ -0,0 +1,402 @@
|
|
1
|
+
(function() {
|
2
|
+
var popoverTemplate, template, tooltipTemplate;
|
3
|
+
|
4
|
+
popoverTemplate = '' + '<div class="arrow"></div>' + '{{#if title}}<h3 class="popover-title">{{title}}</h3>{{/if}}' + '<div class="popover-content">' + '{{#if template}}' + ' {{partial partialTemplateName}}' + '{{else}}' + ' {{#if content}}' + ' {{#if html}}' + ' {{{content}}}' + ' {{else}}' + ' {{content}}' + ' {{/if}}' + ' {{else}}' + ' {{yield}}' + ' {{/if}}' + '{{/if}}' + ' </div>';
|
5
|
+
|
6
|
+
Ember.TEMPLATES["components/bs-popover"] = Ember.Handlebars.compile(popoverTemplate);
|
7
|
+
|
8
|
+
tooltipTemplate = '' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner">' + '{{#if html}}' + ' {{{content}}}' + '{{else}}' + ' {{content}}' + '{{/if}}' + '</div>';
|
9
|
+
|
10
|
+
Ember.TEMPLATES["components/bs-tooltip"] = Ember.Handlebars.compile(tooltipTemplate);
|
11
|
+
|
12
|
+
Bootstrap.BsPopoverComponent = Ember.Component.extend({
|
13
|
+
layoutName: 'components/bs-popover',
|
14
|
+
classNames: "popover",
|
15
|
+
classNameBindings: ["fade", "in", "realPlacement"],
|
16
|
+
titleBinding: "data.title",
|
17
|
+
content: Ember.computed.alias('data.content'),
|
18
|
+
html: false,
|
19
|
+
delay: 0,
|
20
|
+
animation: true,
|
21
|
+
fade: Ember.computed.oneWay("animation"),
|
22
|
+
"in": Ember.computed.oneWay("isVisible"),
|
23
|
+
placement: (function() {
|
24
|
+
return this.get("data.placement") || "top";
|
25
|
+
}).property("data.placement"),
|
26
|
+
$element: null,
|
27
|
+
$tip: null,
|
28
|
+
inserted: false,
|
29
|
+
styleUpdater: (function() {
|
30
|
+
var actualHeight, actualWidth, calculatedOffset, placement, pos;
|
31
|
+
if (!this.$tip || !this.get("isVisible")) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
this.$tip.css({
|
35
|
+
top: 0,
|
36
|
+
left: 0,
|
37
|
+
display: "block"
|
38
|
+
}).addClass(this.get("realPlacement"));
|
39
|
+
placement = this.get("realPlacement");
|
40
|
+
pos = this.getPosition();
|
41
|
+
actualWidth = this.$tip[0].offsetWidth;
|
42
|
+
actualHeight = this.$tip[0].offsetHeight;
|
43
|
+
calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
|
44
|
+
this.$tip.css("top", calculatedOffset.top);
|
45
|
+
this.$tip.css("left", calculatedOffset.left);
|
46
|
+
if (this.firstTime) {
|
47
|
+
this.firstTime = false;
|
48
|
+
this.styleUpdater();
|
49
|
+
return this.firstTime = true;
|
50
|
+
}
|
51
|
+
}).observes("content", "realPlacement", "inserted", "isVisible"),
|
52
|
+
init: function() {
|
53
|
+
var name, tpl;
|
54
|
+
this._super();
|
55
|
+
this.set("html", this.get("data.html") || false);
|
56
|
+
this.set("template", this.get("data.template") !== undefined);
|
57
|
+
if (this.get("template")) {
|
58
|
+
name = "components/bs-popover/_partial-content-" + this.get("tip_id");
|
59
|
+
tpl = this.get("data.template");
|
60
|
+
if (typeof tpl === "function") {
|
61
|
+
Ember.TEMPLATES[name] = tpl;
|
62
|
+
} else {
|
63
|
+
Ember.TEMPLATES[name] = Ember.Handlebars.compile(tpl);
|
64
|
+
}
|
65
|
+
return this.set("partialTemplateName", name);
|
66
|
+
}
|
67
|
+
},
|
68
|
+
didInsertElement: function() {
|
69
|
+
var name,
|
70
|
+
_this = this;
|
71
|
+
this.$tip = this.$();
|
72
|
+
name = Bootstrap.TooltipBoxManager.attribute;
|
73
|
+
name = "[" + name + "='" + this.get("tip_id") + "']";
|
74
|
+
this.$element = $(name);
|
75
|
+
this.set("inserted", true);
|
76
|
+
if (this.get("data.trigger") === "hover" && this.get("data.sticky")) {
|
77
|
+
this.$().on("mouseenter", function() {
|
78
|
+
return clearTimeout(Bootstrap.TooltipBoxManager.timeout);
|
79
|
+
});
|
80
|
+
}
|
81
|
+
this.$().on("mouseleave", function() {
|
82
|
+
return Bootstrap.TooltipBoxManager.removeTip(_this.get("tip_id"));
|
83
|
+
});
|
84
|
+
return this.$().find("img").load(function() {
|
85
|
+
return _this.afterRender();
|
86
|
+
});
|
87
|
+
},
|
88
|
+
afterRender: function() {
|
89
|
+
return this.notifyPropertyChange("content");
|
90
|
+
},
|
91
|
+
realPlacement: (function() {
|
92
|
+
var $parent, actualHeight, actualWidth, autoPlace, autoToken, docScroll, orgPlacement, parentHeight, parentLeft, parentWidth, placement, pos;
|
93
|
+
if (!this.$tip) {
|
94
|
+
return null;
|
95
|
+
}
|
96
|
+
placement = this.get("placement") || "";
|
97
|
+
autoToken = /\s?auto?\s?/i;
|
98
|
+
autoPlace = autoToken.test(placement);
|
99
|
+
if (autoPlace) {
|
100
|
+
placement = placement.replace(autoToken, "") || "top";
|
101
|
+
}
|
102
|
+
pos = this.getPosition();
|
103
|
+
actualWidth = this.$tip[0].offsetWidth;
|
104
|
+
actualHeight = this.$tip[0].offsetHeight;
|
105
|
+
if (autoPlace) {
|
106
|
+
$parent = this.$element.parent();
|
107
|
+
orgPlacement = placement;
|
108
|
+
docScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
109
|
+
parentWidth = window.innerWidth;
|
110
|
+
parentHeight = window.innerHeight;
|
111
|
+
parentLeft = 0;
|
112
|
+
placement = (placement === "bottom" && pos.top + pos.height + actualHeight - docScroll > parentHeight ? "top" : (placement === "top" && pos.top - docScroll - actualHeight < 0 ? "bottom" : (placement === "right" && pos.right + actualWidth > parentWidth ? "left" : (placement === "left" && pos.left - actualWidth < parentLeft ? "right" : placement))));
|
113
|
+
}
|
114
|
+
return placement;
|
115
|
+
}).property("placement", "inserted"),
|
116
|
+
hasContent: function() {
|
117
|
+
return this.get("title");
|
118
|
+
},
|
119
|
+
getPosition: function() {
|
120
|
+
var el;
|
121
|
+
el = this.$element[0];
|
122
|
+
return $.extend({}, (typeof el.getBoundingClientRect === "function" ? el.getBoundingClientRect() : {
|
123
|
+
width: el.offsetWidth,
|
124
|
+
height: el.offsetHeight
|
125
|
+
}), this.$element.offset());
|
126
|
+
},
|
127
|
+
getCalculatedOffset: function(placement, pos, actualWidth, actualHeight) {
|
128
|
+
if (placement === "bottom") {
|
129
|
+
return {
|
130
|
+
top: pos.top + pos.height,
|
131
|
+
left: pos.left + pos.width / 2 - actualWidth / 2
|
132
|
+
};
|
133
|
+
} else if (placement === "top") {
|
134
|
+
return {
|
135
|
+
top: pos.top - actualHeight,
|
136
|
+
left: pos.left + pos.width / 2 - actualWidth / 2
|
137
|
+
};
|
138
|
+
} else if (placement === "left") {
|
139
|
+
return {
|
140
|
+
top: pos.top + pos.height / 2 - actualHeight / 2,
|
141
|
+
left: pos.left - actualWidth
|
142
|
+
};
|
143
|
+
} else {
|
144
|
+
return {
|
145
|
+
top: pos.top + pos.height / 2 - actualHeight / 2,
|
146
|
+
left: pos.left + pos.width
|
147
|
+
};
|
148
|
+
}
|
149
|
+
},
|
150
|
+
actions: {
|
151
|
+
close: function() {
|
152
|
+
return Bootstrap.TooltipBoxManager.removeTip(this.get("tip_id"));
|
153
|
+
}
|
154
|
+
}
|
155
|
+
});
|
156
|
+
|
157
|
+
Ember.Handlebars.helper('bs-popover', Bootstrap.BsPopoverComponent);
|
158
|
+
|
159
|
+
Bootstrap.BsTooltipComponent = Bootstrap.BsPopoverComponent.extend({
|
160
|
+
classNames: "tooltip",
|
161
|
+
layoutName: 'components/bs-tooltip',
|
162
|
+
init: function() {
|
163
|
+
this._super();
|
164
|
+
this.classNames.removeObject("popover");
|
165
|
+
return this.set("content", this.get("content") || this.get("title"));
|
166
|
+
}
|
167
|
+
});
|
168
|
+
|
169
|
+
Ember.Handlebars.helper('bs-tooltip', Bootstrap.BsTooltipComponent);
|
170
|
+
|
171
|
+
/*
|
172
|
+
The tooltipBox controller is used to render the popovers into the named outlet "bs-tooltip-box"
|
173
|
+
with the template tooltip-box
|
174
|
+
*/
|
175
|
+
|
176
|
+
|
177
|
+
Bootstrap.TooltipBoxController = Ember.Controller.extend({
|
178
|
+
popoversBinding: "Bootstrap.TooltipBoxManager.popovers",
|
179
|
+
tooltipsBinding: "Bootstrap.TooltipBoxManager.tooltips"
|
180
|
+
});
|
181
|
+
|
182
|
+
template = "" + "{{#each pop in popovers}}" + " {{bs-popover" + " tip_id=pop.tip_id" + " data=pop.data" + " }}" + "{{/each}}" + "{{#each pop in tooltips}}" + " {{bs-tooltip" + " tip_id=pop.tip_id" + " data=pop.data" + " }}" + "{{/each}}";
|
183
|
+
|
184
|
+
Ember.TEMPLATES["bs-tooltip-box"] = Ember.Handlebars.compile(template);
|
185
|
+
|
186
|
+
/*
|
187
|
+
The Manager is based on the code from the emberjs action helper.
|
188
|
+
the tooltip/popover helper sets the attribute TooltipBoxManager.attribute (currently: bootstrap-tip-id)
|
189
|
+
with an id that will be increased with each tip.
|
190
|
+
AfterRender the manager binds a function to each element containing the attribute "bootstrap-tip-id"
|
191
|
+
and on "willClearRender" it will be removed
|
192
|
+
*/
|
193
|
+
|
194
|
+
|
195
|
+
Bootstrap.TooltipBoxManager = Ember.Object.create({
|
196
|
+
uuid: 0,
|
197
|
+
attribute: "bootstrap-tip-id",
|
198
|
+
willSetup: false,
|
199
|
+
registeredTips: {},
|
200
|
+
registerTip: function(type, object, options) {
|
201
|
+
var id, self;
|
202
|
+
id = ++this.uuid;
|
203
|
+
self = this;
|
204
|
+
this.registeredTips[id] = {
|
205
|
+
id: id,
|
206
|
+
data: object,
|
207
|
+
eventName: object.trigger || (type === "popover" ? "click" : "hover"),
|
208
|
+
bound: false,
|
209
|
+
type: type,
|
210
|
+
sticky: object.sticky,
|
211
|
+
show: function() {
|
212
|
+
self.showTip(id);
|
213
|
+
},
|
214
|
+
hide: function() {
|
215
|
+
self.hideTip(id, true);
|
216
|
+
},
|
217
|
+
toggle: function() {
|
218
|
+
self.toggleTip(id);
|
219
|
+
}
|
220
|
+
};
|
221
|
+
if (!this.willSetup) {
|
222
|
+
this.willSetup = true;
|
223
|
+
Ember.run.scheduleOnce("afterRender", this, function() {
|
224
|
+
self.setupBindings();
|
225
|
+
});
|
226
|
+
}
|
227
|
+
options.data.view.on("willClearRender", function() {
|
228
|
+
Bootstrap.TooltipBoxManager.removeTip(id);
|
229
|
+
$("[" + self.attribute + "='" + id + "']").unbind();
|
230
|
+
delete Bootstrap.TooltipBoxManager.registeredTips[id];
|
231
|
+
});
|
232
|
+
return id;
|
233
|
+
},
|
234
|
+
setupBindings: function() {
|
235
|
+
var elem, i, pop;
|
236
|
+
for (i in this.registeredTips) {
|
237
|
+
pop = this.registeredTips[i];
|
238
|
+
if (pop.bound === false) {
|
239
|
+
pop.bound = true;
|
240
|
+
elem = $("[" + this.attribute + "='" + i + "']");
|
241
|
+
switch (pop.eventName) {
|
242
|
+
case "click":
|
243
|
+
elem.on("click", $.proxy(pop.toggle, pop));
|
244
|
+
break;
|
245
|
+
case "hover":
|
246
|
+
elem.on("mouseenter", $.proxy(pop.show, pop));
|
247
|
+
elem.on("mouseleave", $.proxy(pop.hide, pop));
|
248
|
+
break;
|
249
|
+
case "focus":
|
250
|
+
elem.on("focusin", $.proxy(pop.show, pop));
|
251
|
+
elem.on("focusout", $.proxy(pop.hide, pop));
|
252
|
+
break;
|
253
|
+
case "manual":
|
254
|
+
pop.data.addObserver("show", pop, function(sender, key) {
|
255
|
+
var value;
|
256
|
+
value = sender.get(key);
|
257
|
+
if (value) {
|
258
|
+
this.show();
|
259
|
+
} else {
|
260
|
+
this.hide();
|
261
|
+
}
|
262
|
+
});
|
263
|
+
if (pop.data.show) {
|
264
|
+
this.show();
|
265
|
+
}
|
266
|
+
}
|
267
|
+
}
|
268
|
+
}
|
269
|
+
this.willSetup = false;
|
270
|
+
},
|
271
|
+
popovers: [],
|
272
|
+
tooltips: [],
|
273
|
+
showing: {},
|
274
|
+
timeout: null,
|
275
|
+
showTip: function(id) {
|
276
|
+
var data, obj, type;
|
277
|
+
data = this.registeredTips[id].data;
|
278
|
+
type = this.registeredTips[id].type;
|
279
|
+
if (!this.showing[id]) {
|
280
|
+
this.showing[id] = true;
|
281
|
+
obj = Ember.Object.create({
|
282
|
+
data: data,
|
283
|
+
tip_id: id
|
284
|
+
});
|
285
|
+
if (type === "tooltip") {
|
286
|
+
this.tooltips.pushObject(obj);
|
287
|
+
} else {
|
288
|
+
this.popovers.pushObject(obj);
|
289
|
+
}
|
290
|
+
}
|
291
|
+
},
|
292
|
+
hideTip: function(id, allowTimer) {
|
293
|
+
var data;
|
294
|
+
if (this.showing[id]) {
|
295
|
+
data = this.registeredTips[id].data;
|
296
|
+
if (allowTimer && data.sticky) {
|
297
|
+
this.timedRemove(id);
|
298
|
+
} else {
|
299
|
+
this.removeTip(id);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
},
|
303
|
+
toggleTip: function(id) {
|
304
|
+
if (this.showing[id]) {
|
305
|
+
this.hideTip(id);
|
306
|
+
} else {
|
307
|
+
this.showTip(id);
|
308
|
+
}
|
309
|
+
},
|
310
|
+
timedRemove: function(id) {
|
311
|
+
var self;
|
312
|
+
self = this;
|
313
|
+
this.timeout = setTimeout(function() {
|
314
|
+
self.removeTip(id);
|
315
|
+
}, 100);
|
316
|
+
},
|
317
|
+
removeTip: function(id) {
|
318
|
+
var pop;
|
319
|
+
pop = this.popovers.findProperty("tip_id", id) || this.tooltips.findProperty("tip_id");
|
320
|
+
this.popovers.removeObject(pop);
|
321
|
+
this.tooltips.removeObject(pop);
|
322
|
+
delete this.showing[id];
|
323
|
+
},
|
324
|
+
addFromView: function(view, type, object) {
|
325
|
+
var id, options;
|
326
|
+
if (!view.attributeBindings.contains(Bootstrap.TooltipBoxManager.attribute)) {
|
327
|
+
console.warn("TooltipBoxManager.addFromView: You need to add \"TooltipBoxManager.attribute\" to the attributeBindings!");
|
328
|
+
return;
|
329
|
+
}
|
330
|
+
options = {
|
331
|
+
data: {
|
332
|
+
view: view
|
333
|
+
}
|
334
|
+
};
|
335
|
+
id = Bootstrap.TooltipBoxManager.registerTip(type, object, options);
|
336
|
+
view.set(Bootstrap.TooltipBoxManager.attribute, id);
|
337
|
+
},
|
338
|
+
helper: function(path, object, options) {
|
339
|
+
var binding, keyword, name, o, p, type, value;
|
340
|
+
if ((typeof path === "string") && path !== "") {
|
341
|
+
p = path.split(".");
|
342
|
+
keyword = p[0];
|
343
|
+
o = options.data.keywords[keyword];
|
344
|
+
if (o) {
|
345
|
+
p.removeAt(0);
|
346
|
+
p.insertAt(0, "this");
|
347
|
+
p = p.join(".");
|
348
|
+
object = o.get(p);
|
349
|
+
} else {
|
350
|
+
object = this.get(path);
|
351
|
+
}
|
352
|
+
}
|
353
|
+
if (path instanceof Object) {
|
354
|
+
object = Ember.Object.create({});
|
355
|
+
for (name in path.hash) {
|
356
|
+
value = path.hash[name];
|
357
|
+
type = options.hashTypes[name];
|
358
|
+
if (type === "STRING") {
|
359
|
+
object.set(name, value);
|
360
|
+
} else if (type === "ID") {
|
361
|
+
p = value.split(".");
|
362
|
+
keyword = p[0];
|
363
|
+
o = options.data.keywords[keyword];
|
364
|
+
if (!o) {
|
365
|
+
o = this;
|
366
|
+
} else {
|
367
|
+
p.removeAt(0);
|
368
|
+
}
|
369
|
+
if (!object._bindings) {
|
370
|
+
object._bindings = o;
|
371
|
+
}
|
372
|
+
p.insertAt(0, "_bindings");
|
373
|
+
p = p.join(".");
|
374
|
+
object[name] = "";
|
375
|
+
binding = Ember.Binding.from(p).to(name);
|
376
|
+
binding.connect(object);
|
377
|
+
}
|
378
|
+
}
|
379
|
+
}
|
380
|
+
return object;
|
381
|
+
}
|
382
|
+
});
|
383
|
+
|
384
|
+
Ember.Handlebars.registerHelper("bs-bind-popover", function(path) {
|
385
|
+
var id, object, options;
|
386
|
+
options = arguments[arguments.length - 1];
|
387
|
+
object = this;
|
388
|
+
object = Bootstrap.TooltipBoxManager.helper.call(this, path, object, options);
|
389
|
+
id = Bootstrap.TooltipBoxManager.registerTip("popover", object, options);
|
390
|
+
return new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute + "='" + id + "'");
|
391
|
+
});
|
392
|
+
|
393
|
+
Ember.Handlebars.registerHelper("bs-bind-tooltip", function(path) {
|
394
|
+
var id, object, options;
|
395
|
+
options = arguments[arguments.length - 1];
|
396
|
+
object = this;
|
397
|
+
object = Bootstrap.TooltipBoxManager.helper.call(this, path, object, options);
|
398
|
+
id = Bootstrap.TooltipBoxManager.registerTip("tooltip", object, options);
|
399
|
+
return new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute + "='" + id + "'");
|
400
|
+
});
|
401
|
+
|
402
|
+
}).call(this);
|