Skip to content

Commit

Permalink
Accordion does not use shadow dom
Browse files Browse the repository at this point in the history
  • Loading branch information
ufoscout committed May 21, 2014
1 parent 6e455a4 commit 5be7822
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
6 changes: 4 additions & 2 deletions lib/accordion/accordion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// All rights reserved. Please see the LICENSE.md file.
library angular.ui.accordion;

import 'dart:html' as html;
import 'package:angular/angular.dart';
//import 'package:angular_ui/app/injectable_service.dart';
import 'package:angular/utils.dart' as utils;
Expand All @@ -17,6 +18,7 @@ class AccordionModule extends Module {
bind(AccordionComponent);
bind(AccordionHeadingComponent);
bind(AccordionGroupComponent);
bind(AccordionHeadingTranscludeComponent);
bind(AccordionConfig, toValue:new AccordionConfig());
}
}
Expand All @@ -31,14 +33,14 @@ class AccordionConfig {
publishAs: 'ctrl',
visibility: Directive.CHILDREN_VISIBILITY,
templateUrl: 'packages/angular_ui/accordion/accordion.html',
applyAuthorStyles: true
useShadowDom: false
)
@Component(
selector: '[accordion]',
publishAs: 'ctrl',
visibility: Directive.CHILDREN_VISIBILITY,
templateUrl: 'packages/angular_ui/accordion/accordion.html',
applyAuthorStyles: true
useShadowDom: false
)
class AccordionComponent {
@NgTwoWay('close-others') bool isCloseOthers;
Expand Down
41 changes: 31 additions & 10 deletions lib/accordion/accordion_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ part of angular.ui.accordion;
publishAs: 'ctrl',
visibility: Directive.CHILDREN_VISIBILITY,
templateUrl: 'packages/angular_ui/accordion/accordion_group.html',
applyAuthorStyles: true
useShadowDom: false
)
class AccordionGroupComponent implements DetachAware {
bool _isOpen = false;
@NgAttr('heading') String heading;
@NgAttr('heading') var heading;
Scope scope;
AccordionComponent accordion;

Expand All @@ -29,6 +29,7 @@ class AccordionGroupComponent implements DetachAware {
}
}

@override
void detach() {
this.accordion.removeGroup(this);
}
Expand All @@ -40,15 +41,35 @@ class AccordionGroupComponent implements DetachAware {
* <accordion-heading>Heading containing HTML - <img src="..."></accordion-heading>
* </accordion-group>
*/
@Component(
selector: 'accordion-heading',
publishAs: 'ctrl',
template: '<content></content>',
applyAuthorStyles: true
@Decorator(
selector: 'accordion-heading'
)
class AccordionHeadingComponent {
Scope _scope;
AccordionHeadingComponent(this._scope, AccordionGroupComponent accordionGroup) {
_log.fine('AccordionHeadingComponent');
AccordionHeadingComponent(html.Element elem, AccordionGroupComponent acc) {
elem.remove();
acc.heading = elem;
}
}

@Decorator(
selector: 'accordion-heading-transclude'
)
class AccordionHeadingTranscludeComponent {

final html.Element elem;

@NgOneWay('parent-accordion-group-component')
set accordionGroupComponent(AccordionGroupComponent acc) {
if (acc.heading!=null) {
if (acc.heading is String){
elem.appendText(acc.heading);
} else {
elem.append(acc.heading);
}
}
}

AccordionHeadingTranscludeComponent(this.elem) {
_log.fine('TabsetComponent');
}
}
3 changes: 2 additions & 1 deletion lib/accordion/accordion_group.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" ng-click="ctrl.isOpen = !ctrl.isOpen"><content select="accordion-heading"></content>{{ctrl.heading}}
<a class="accordion-toggle" ng-click="ctrl.isOpen = !ctrl.isOpen">
<accordion-heading-transclude parent-accordion-group-component="ctrl"></accordion-heading-transclude>
</a>
</h4>
</div>
Expand Down
1 change: 1 addition & 0 deletions lib/tabs/tab_heading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ part of angular.ui.tabs;
)
class TabHeading {
TabHeading(Element elem, TabComponent tab) {
elem.remove();
tab.heading = elem;
}
}
Expand Down

0 comments on commit 5be7822

Please sign in to comment.