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,35 @@
|
|
1
|
+
Bootstrap.BsPanelComponent = Ember.Component.extend(Bootstrap.TypeSupport,
|
2
|
+
layoutName: 'components/bs-panel'
|
3
|
+
classNames: ['panel']
|
4
|
+
classTypePrefix: ['panel']
|
5
|
+
classNameBindings: ['fade', 'fade:in']
|
6
|
+
clicked: null
|
7
|
+
onClose: null
|
8
|
+
fade: true
|
9
|
+
collapsible: false
|
10
|
+
open: true
|
11
|
+
|
12
|
+
actions:
|
13
|
+
close: (event) ->
|
14
|
+
@sendAction('onClose')
|
15
|
+
@$().removeClass('in')
|
16
|
+
#TODO: Causes ' Object #<HTMLDivElement> has no method 'destroyElement' '
|
17
|
+
#@$().one($.support.transition.end, @destroy).emulateTransitionEnd(150)
|
18
|
+
#Workaround
|
19
|
+
setTimeout (->
|
20
|
+
@destroy()
|
21
|
+
).bind(@), 250
|
22
|
+
|
23
|
+
click: (event) ->
|
24
|
+
@sendAction('clicked', event)
|
25
|
+
|
26
|
+
collapsibleBodyId: (->
|
27
|
+
"#{@get('elementId')}_body"
|
28
|
+
).property('collapsible')
|
29
|
+
|
30
|
+
collapsibleBodyLink: (->
|
31
|
+
"##{@get('elementId')}_body"
|
32
|
+
).property('collapsibleBodyId')
|
33
|
+
)
|
34
|
+
|
35
|
+
Ember.Handlebars.helper 'bs-panel', Bootstrap.BsPanelComponent
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Bootstrap.BsPill = Bootstrap.ItemView.extend(Bootstrap.NavItem, Bootstrap.ItemSelection,
|
2
|
+
template: Ember.Handlebars.compile '''
|
3
|
+
{{#if view.content.linkTo}}
|
4
|
+
{{#if view.parentView.dynamicLink}}
|
5
|
+
{{#link-to view.content.linkTo model}}{{view.title}}{{/link-to}}
|
6
|
+
{{else}}
|
7
|
+
{{#link-to view.content.linkTo}}{{view.title}}{{/link-to}}
|
8
|
+
{{/if}}
|
9
|
+
{{else}}
|
10
|
+
{{view view.pillAsLinkView}}
|
11
|
+
{{/if}}
|
12
|
+
'''
|
13
|
+
|
14
|
+
pillAsLinkView: Ember.View.extend(
|
15
|
+
tagName: 'a'
|
16
|
+
template: Ember.Handlebars.compile('{{view.parentView.title}}')
|
17
|
+
attributeBindings: ['href']
|
18
|
+
href: "#"
|
19
|
+
)
|
20
|
+
)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Bootstrap.BsPills = Bootstrap.ItemsView.extend(Bootstrap.Nav,
|
2
|
+
navType: 'pills'
|
3
|
+
classNameBindings: ['stacked:nav-stacked', 'justified:nav-justified']
|
4
|
+
attributeBindings: ['style']
|
5
|
+
|
6
|
+
itemViewClass: Bootstrap.BsPill
|
7
|
+
)
|
8
|
+
|
9
|
+
Ember.Handlebars.helper 'bs-pills', Bootstrap.BsPills
|
data/lib/bootstrap-for-ember-rails/bootstrap-for-ember/app/scripts/components/BsPopover.coffee
ADDED
@@ -0,0 +1,443 @@
|
|
1
|
+
#Contributed by: patricklx https://github.com/patricklx
|
2
|
+
popoverTemplate = '' +
|
3
|
+
'<div class="arrow"></div>' +
|
4
|
+
'{{#if title}}<h3 class="popover-title">{{title}}</h3>{{/if}}' +
|
5
|
+
'<div class="popover-content">' +
|
6
|
+
'{{#if template}}' +
|
7
|
+
' {{partial partialTemplateName}}' +
|
8
|
+
'{{else}}' +
|
9
|
+
' {{#if content}}' +
|
10
|
+
' {{#if html}}' +
|
11
|
+
' {{{content}}}' +
|
12
|
+
' {{else}}'+
|
13
|
+
' {{content}}' +
|
14
|
+
' {{/if}}' +
|
15
|
+
' {{else}}' +
|
16
|
+
' {{yield}}' +
|
17
|
+
' {{/if}}' +
|
18
|
+
'{{/if}}' +
|
19
|
+
' </div>'
|
20
|
+
|
21
|
+
Ember.TEMPLATES["components/bs-popover"] = Ember.Handlebars.compile(popoverTemplate)
|
22
|
+
|
23
|
+
tooltipTemplate = '' +
|
24
|
+
'<div class="tooltip-arrow"></div>' +
|
25
|
+
'<div class="tooltip-inner">' +
|
26
|
+
'{{#if html}}' +
|
27
|
+
' {{{content}}}' +
|
28
|
+
'{{else}}' +
|
29
|
+
' {{content}}' +
|
30
|
+
'{{/if}}' +
|
31
|
+
'</div>'
|
32
|
+
|
33
|
+
Ember.TEMPLATES["components/bs-tooltip"] = Ember.Handlebars.compile(tooltipTemplate)
|
34
|
+
|
35
|
+
Bootstrap.BsPopoverComponent = Ember.Component.extend(
|
36
|
+
layoutName: 'components/bs-popover'
|
37
|
+
classNames: "popover"
|
38
|
+
classNameBindings: [
|
39
|
+
"fade"
|
40
|
+
"in"
|
41
|
+
"top"
|
42
|
+
"left"
|
43
|
+
"right"
|
44
|
+
"bottom"
|
45
|
+
]
|
46
|
+
|
47
|
+
top: (->
|
48
|
+
@get("realPlacement") is "top"
|
49
|
+
).property("realPlacement")
|
50
|
+
|
51
|
+
left: (->
|
52
|
+
@get("realPlacement") is "left"
|
53
|
+
).property("realPlacement")
|
54
|
+
|
55
|
+
right: (->
|
56
|
+
@get("realPlacement") is "right"
|
57
|
+
).property("realPlacement")
|
58
|
+
|
59
|
+
bottom: (->
|
60
|
+
@get("realPlacement") is "bottom"
|
61
|
+
).property("realPlacement")
|
62
|
+
|
63
|
+
titleBinding: "data.title"
|
64
|
+
content: Ember.computed.alias('data.content')
|
65
|
+
html: false
|
66
|
+
delay: 0
|
67
|
+
animation: true
|
68
|
+
|
69
|
+
fade: (->
|
70
|
+
@get "animation"
|
71
|
+
).property("animation")
|
72
|
+
|
73
|
+
in: (->
|
74
|
+
@get "isVisible"
|
75
|
+
).property("isVisible")
|
76
|
+
|
77
|
+
placement: (->
|
78
|
+
@get("data.placement") or "top"
|
79
|
+
).property("data.placement")
|
80
|
+
|
81
|
+
$element: null
|
82
|
+
$tip: null
|
83
|
+
inserted: false
|
84
|
+
|
85
|
+
styleUpdater: (->
|
86
|
+
return if not @$tip or not @get("isVisible")
|
87
|
+
@$tip.css(
|
88
|
+
top: 0
|
89
|
+
left: 0
|
90
|
+
display: "block"
|
91
|
+
).addClass @get("realPlacement")
|
92
|
+
placement = @get("realPlacement")
|
93
|
+
pos = @getPosition()
|
94
|
+
actualWidth = @$tip[0].offsetWidth
|
95
|
+
actualHeight = @$tip[0].offsetHeight
|
96
|
+
calculatedOffset = @getCalculatedOffset(placement, pos, actualWidth, actualHeight)
|
97
|
+
@$tip.css "top", calculatedOffset.top
|
98
|
+
@$tip.css "left", calculatedOffset.left
|
99
|
+
|
100
|
+
if @firstTime
|
101
|
+
@firstTime = false
|
102
|
+
@styleUpdater()
|
103
|
+
@firstTime = true
|
104
|
+
).observes("content", "realPlacement", "inserted", "isVisible")
|
105
|
+
|
106
|
+
init: ->
|
107
|
+
@_super()
|
108
|
+
@set "html", @get("data.html") or false
|
109
|
+
@set "template", @get("data.template") isnt `undefined`
|
110
|
+
if @get("template")
|
111
|
+
name = "components/bs-popover/_partial-content-" + @get("tip_id")
|
112
|
+
tpl = @get("data.template")
|
113
|
+
if typeof tpl is "function"
|
114
|
+
Ember.TEMPLATES[name] = tpl
|
115
|
+
else
|
116
|
+
Ember.TEMPLATES[name] = Ember.Handlebars.compile(tpl)
|
117
|
+
@set "partialTemplateName", name
|
118
|
+
|
119
|
+
didInsertElement: ->
|
120
|
+
@$tip = @$()
|
121
|
+
name = Bootstrap.TooltipBoxManager.attribute
|
122
|
+
name = "[" + name + "='" + @get("tip_id") + "']"
|
123
|
+
@$element = $(name)
|
124
|
+
@set "inserted", true
|
125
|
+
|
126
|
+
if @get("data.trigger") is "hover" and @get("data.sticky")
|
127
|
+
@$().on "mouseenter", ->
|
128
|
+
clearTimeout Bootstrap.TooltipBoxManager.timeout
|
129
|
+
|
130
|
+
@$().on "mouseleave", =>
|
131
|
+
Bootstrap.TooltipBoxManager.removeTip @get("tip_id")
|
132
|
+
|
133
|
+
@$().find("img").load =>
|
134
|
+
@afterRender()
|
135
|
+
|
136
|
+
afterRender: ->
|
137
|
+
@notifyPropertyChange "content"
|
138
|
+
|
139
|
+
realPlacement: (->
|
140
|
+
return null unless @$tip
|
141
|
+
placement = @get("placement") or ""
|
142
|
+
autoToken = /\s?auto?\s?/i
|
143
|
+
autoPlace = autoToken.test(placement)
|
144
|
+
placement = placement.replace(autoToken, "") or "top" if autoPlace
|
145
|
+
pos = @getPosition()
|
146
|
+
actualWidth = @$tip[0].offsetWidth
|
147
|
+
actualHeight = @$tip[0].offsetHeight
|
148
|
+
|
149
|
+
if autoPlace
|
150
|
+
$parent = @$element.parent()
|
151
|
+
orgPlacement = placement
|
152
|
+
docScroll = document.documentElement.scrollTop or document.body.scrollTop
|
153
|
+
parentWidth = window.innerWidth
|
154
|
+
parentHeight = window.innerHeight
|
155
|
+
parentLeft = 0
|
156
|
+
|
157
|
+
placement = (if placement is "bottom" and pos.top + pos.height + actualHeight - docScroll > parentHeight then "top" else (if placement is "top" and pos.top - docScroll - actualHeight < 0 then "bottom" else (if placement is "right" and pos.right + actualWidth > parentWidth then "left" else (if placement is "left" and pos.left - actualWidth < parentLeft then "right" else placement))))
|
158
|
+
|
159
|
+
return placement
|
160
|
+
).property("placement", "inserted")
|
161
|
+
|
162
|
+
hasContent: ->
|
163
|
+
@get "title"
|
164
|
+
|
165
|
+
getPosition: ->
|
166
|
+
el = @$element[0]
|
167
|
+
$.extend {}, (
|
168
|
+
if (typeof el.getBoundingClientRect is "function")
|
169
|
+
el.getBoundingClientRect()
|
170
|
+
else
|
171
|
+
width: el.offsetWidth
|
172
|
+
height: el.offsetHeight
|
173
|
+
), @$element.offset()
|
174
|
+
|
175
|
+
getCalculatedOffset: (placement, pos, actualWidth, actualHeight) ->
|
176
|
+
if placement is "bottom"
|
177
|
+
top: pos.top + pos.height
|
178
|
+
left: pos.left + pos.width / 2 - actualWidth / 2
|
179
|
+
else if placement is "top"
|
180
|
+
top: pos.top - actualHeight
|
181
|
+
left: pos.left + pos.width / 2 - actualWidth / 2
|
182
|
+
else if placement is "left"
|
183
|
+
top: pos.top + pos.height / 2 - actualHeight / 2
|
184
|
+
left: pos.left - actualWidth
|
185
|
+
else
|
186
|
+
top: pos.top + pos.height / 2 - actualHeight / 2 # placement == 'right'
|
187
|
+
left: pos.left + pos.width
|
188
|
+
|
189
|
+
actions:
|
190
|
+
close: ->
|
191
|
+
Bootstrap.TooltipBoxManager.removeTip @get("tip_id")
|
192
|
+
)
|
193
|
+
|
194
|
+
Ember.Handlebars.helper 'bs-popover', Bootstrap.BsPopoverComponent
|
195
|
+
|
196
|
+
Bootstrap.BsTooltipComponent = Bootstrap.BsPopoverComponent.extend(
|
197
|
+
classNames: "tooltip"
|
198
|
+
layoutName: 'components/bs-tooltip'
|
199
|
+
init: ->
|
200
|
+
@_super()
|
201
|
+
@classNames.removeObject "popover"
|
202
|
+
@set "content", @get("content") or @get("title")
|
203
|
+
)
|
204
|
+
|
205
|
+
Ember.Handlebars.helper 'bs-tooltip', Bootstrap.BsTooltipComponent
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
###
|
219
|
+
The tooltipBox controller is used to render the popovers into the named outlet "bs-tooltip-box"
|
220
|
+
with the template tooltip-box
|
221
|
+
###
|
222
|
+
Bootstrap.TooltipBoxController = Ember.Controller.extend(
|
223
|
+
popoversBinding: "Bootstrap.TooltipBoxManager.popovers"
|
224
|
+
tooltipsBinding: "Bootstrap.TooltipBoxManager.tooltips"
|
225
|
+
)
|
226
|
+
|
227
|
+
template = "" +
|
228
|
+
"{{#each pop in popovers}}" +
|
229
|
+
" {{bs-popover" +
|
230
|
+
" tip_id=pop.tip_id" +
|
231
|
+
" data=pop.data" +
|
232
|
+
" }}" +
|
233
|
+
"{{/each}}" +
|
234
|
+
"{{#each pop in tooltips}}" +
|
235
|
+
" {{bs-tooltip" +
|
236
|
+
" tip_id=pop.tip_id" +
|
237
|
+
" data=pop.data" +
|
238
|
+
" }}" +
|
239
|
+
"{{/each}}"
|
240
|
+
|
241
|
+
Ember.TEMPLATES["bs-tooltip-box"] = Ember.Handlebars.compile(template)
|
242
|
+
|
243
|
+
###
|
244
|
+
The Manager is based on the code from the emberjs action helper.
|
245
|
+
the tooltip/popover helper sets the attribute TooltipBoxManager.attribute (currently: bootstrap-tip-id)
|
246
|
+
with an id that will be increased with each tip.
|
247
|
+
AfterRender the manager binds a function to each element containing the attribute "bootstrap-tip-id"
|
248
|
+
and on "willClearRender" it will be removed
|
249
|
+
###
|
250
|
+
Bootstrap.TooltipBoxManager = Ember.Object.create(
|
251
|
+
uuid: 0
|
252
|
+
attribute: "bootstrap-tip-id"
|
253
|
+
willSetup: false
|
254
|
+
registeredTips: {}
|
255
|
+
registerTip: (type, object, options) ->
|
256
|
+
id = ++@uuid
|
257
|
+
self = this
|
258
|
+
@registeredTips[id] =
|
259
|
+
id: id
|
260
|
+
data: object
|
261
|
+
eventName: object.trigger or ((if type is "popover" then "click" else "hover"))
|
262
|
+
bound: false
|
263
|
+
type: type
|
264
|
+
sticky: object.sticky
|
265
|
+
show: ->
|
266
|
+
self.showTip id
|
267
|
+
return
|
268
|
+
|
269
|
+
hide: ->
|
270
|
+
self.hideTip id, true
|
271
|
+
return
|
272
|
+
|
273
|
+
toggle: ->
|
274
|
+
self.toggleTip id
|
275
|
+
return
|
276
|
+
|
277
|
+
unless @willSetup
|
278
|
+
@willSetup = true
|
279
|
+
Ember.run.scheduleOnce "afterRender", this, ->
|
280
|
+
self.setupBindings()
|
281
|
+
return
|
282
|
+
|
283
|
+
options.data.view.on "willClearRender", ->
|
284
|
+
Bootstrap.TooltipBoxManager.removeTip id
|
285
|
+
$("[" + self.attribute + "='" + id + "']").unbind()
|
286
|
+
delete Bootstrap.TooltipBoxManager.registeredTips[id]
|
287
|
+
|
288
|
+
return
|
289
|
+
|
290
|
+
id
|
291
|
+
|
292
|
+
setupBindings: ->
|
293
|
+
for i of @registeredTips
|
294
|
+
pop = @registeredTips[i]
|
295
|
+
if pop.bound is false
|
296
|
+
pop.bound = true
|
297
|
+
elem = $("[" + @attribute + "='" + i + "']")
|
298
|
+
switch pop.eventName
|
299
|
+
when "click"
|
300
|
+
elem.on "click", $.proxy(pop.toggle, pop)
|
301
|
+
when "hover"
|
302
|
+
elem.on "mouseenter", $.proxy(pop.show, pop)
|
303
|
+
elem.on "mouseleave", $.proxy(pop.hide, pop)
|
304
|
+
when "focus"
|
305
|
+
elem.on "focusin", $.proxy(pop.show, pop)
|
306
|
+
elem.on "focusout", $.proxy(pop.hide, pop)
|
307
|
+
when "manual"
|
308
|
+
pop.data.addObserver "show", pop, (sender, key) ->
|
309
|
+
value = sender.get(key)
|
310
|
+
if value
|
311
|
+
@show()
|
312
|
+
else
|
313
|
+
@hide()
|
314
|
+
return
|
315
|
+
|
316
|
+
@show() if pop.data.show
|
317
|
+
@willSetup = false
|
318
|
+
return
|
319
|
+
|
320
|
+
popovers: []
|
321
|
+
tooltips: []
|
322
|
+
showing: {}
|
323
|
+
timeout: null
|
324
|
+
showTip: (id) ->
|
325
|
+
data = @registeredTips[id].data
|
326
|
+
type = @registeredTips[id].type
|
327
|
+
unless @showing[id]
|
328
|
+
@showing[id] = true
|
329
|
+
obj = Ember.Object.create(
|
330
|
+
data: data
|
331
|
+
tip_id: id
|
332
|
+
)
|
333
|
+
if type is "tooltip"
|
334
|
+
@tooltips.pushObject obj
|
335
|
+
else
|
336
|
+
@popovers.pushObject obj
|
337
|
+
return
|
338
|
+
|
339
|
+
hideTip: (id, allowTimer) ->
|
340
|
+
if @showing[id]
|
341
|
+
data = @registeredTips[id].data
|
342
|
+
if allowTimer and data.sticky
|
343
|
+
@timedRemove id
|
344
|
+
else
|
345
|
+
@removeTip id
|
346
|
+
return
|
347
|
+
|
348
|
+
toggleTip: (id) ->
|
349
|
+
if @showing[id]
|
350
|
+
@hideTip id
|
351
|
+
else
|
352
|
+
@showTip id
|
353
|
+
return
|
354
|
+
|
355
|
+
timedRemove: (id) ->
|
356
|
+
self = this
|
357
|
+
@timeout = setTimeout(->
|
358
|
+
self.removeTip id
|
359
|
+
return
|
360
|
+
, 100)
|
361
|
+
return
|
362
|
+
|
363
|
+
removeTip: (id) ->
|
364
|
+
pop = @popovers.findProperty("tip_id", id) or @tooltips.findProperty("tip_id")
|
365
|
+
@popovers.removeObject pop
|
366
|
+
@tooltips.removeObject pop
|
367
|
+
delete @showing[id]
|
368
|
+
|
369
|
+
return
|
370
|
+
|
371
|
+
addFromView: (view, type, object) ->
|
372
|
+
unless view.attributeBindings.contains(Bootstrap.TooltipBoxManager.attribute)
|
373
|
+
console.warn "TooltipBoxManager.addFromView: You need to add \"TooltipBoxManager.attribute\" to the attributeBindings!"
|
374
|
+
return
|
375
|
+
options = data:
|
376
|
+
view: view
|
377
|
+
|
378
|
+
id = Bootstrap.TooltipBoxManager.registerTip(type, object, options)
|
379
|
+
view.set Bootstrap.TooltipBoxManager.attribute, id
|
380
|
+
return
|
381
|
+
|
382
|
+
helper: (path, object, options) ->
|
383
|
+
#passing an object that has all variables
|
384
|
+
if (typeof path is "string") and path isnt ""
|
385
|
+
p = path.split(".")
|
386
|
+
keyword = p[0]
|
387
|
+
o = options.data.keywords[keyword]
|
388
|
+
if o
|
389
|
+
p.removeAt 0
|
390
|
+
p.insertAt 0, "this"
|
391
|
+
p = p.join(".")
|
392
|
+
object = o.get(p)
|
393
|
+
else
|
394
|
+
object = @get(path)
|
395
|
+
|
396
|
+
#passing all variables individually
|
397
|
+
#strings and variables are supported!!
|
398
|
+
if path instanceof Object
|
399
|
+
object = Ember.Object.create({})
|
400
|
+
for name of path.hash
|
401
|
+
value = path.hash[name]
|
402
|
+
type = options.hashTypes[name]
|
403
|
+
|
404
|
+
#set string directrly
|
405
|
+
if type is "STRING"
|
406
|
+
object.set name, value
|
407
|
+
else if type is "ID"
|
408
|
+
|
409
|
+
#is variable to which we can bind
|
410
|
+
#get context from keywords -> the each helper defines it
|
411
|
+
p = value.split(".")
|
412
|
+
keyword = p[0]
|
413
|
+
o = options.data.keywords[keyword]
|
414
|
+
unless o
|
415
|
+
|
416
|
+
#no context in keywords, assuming current context
|
417
|
+
o = this
|
418
|
+
else
|
419
|
+
p.removeAt 0
|
420
|
+
object._bindings = o unless object._bindings
|
421
|
+
p.insertAt 0, "_bindings"
|
422
|
+
p = p.join(".")
|
423
|
+
object[name] = ""
|
424
|
+
binding = Ember.Binding.from(p).to(name)
|
425
|
+
binding.connect object
|
426
|
+
else
|
427
|
+
object.set name, value
|
428
|
+
object
|
429
|
+
)
|
430
|
+
|
431
|
+
Ember.Handlebars.registerHelper "bs-bind-popover", (path) ->
|
432
|
+
options = arguments[arguments.length - 1]
|
433
|
+
object = this
|
434
|
+
object = Bootstrap.TooltipBoxManager.helper.call(this, path, object, options)
|
435
|
+
id = Bootstrap.TooltipBoxManager.registerTip("popover", object, options)
|
436
|
+
new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute + "='" + id + "'")
|
437
|
+
|
438
|
+
Ember.Handlebars.registerHelper "bs-bind-tooltip", (path) ->
|
439
|
+
options = arguments[arguments.length - 1]
|
440
|
+
object = this
|
441
|
+
object = Bootstrap.TooltipBoxManager.helper.call(this, path, object, options)
|
442
|
+
id = Bootstrap.TooltipBoxManager.registerTip("tooltip", object, options)
|
443
|
+
new Ember.Handlebars.SafeString(Bootstrap.TooltipBoxManager.attribute + "='" + id + "'")
|