Skip to content

Commit 5e9cfe4

Browse files
authored
Merge pull request #130 from PolymerElements/links
Remove routing logic since iron-doc-viewer does it now.
2 parents a19f1e0 + 4633d01 commit 5e9cfe4

File tree

2 files changed

+10
-57
lines changed

2 files changed

+10
-57
lines changed

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"app-layout": "PolymerElements/app-layout#1 - 2",
2121
"iron-ajax": "PolymerElements/iron-ajax#1 - 2",
22-
"iron-doc-viewer": "PolymerElements/iron-doc-viewer#nav",
22+
"iron-doc-viewer": "PolymerElements/iron-doc-viewer#master",
2323
"iron-icons": "PolymerElements/iron-icons#1 - 2",
2424
"paper-icon-button": "PolymerElements/paper-icon-button#1 - 2",
2525
"paper-styles": "PolymerElements/paper-styles#1 - 2",
@@ -35,7 +35,7 @@
3535
"dependencies": {
3636
"app-layout": "PolymerElements/app-layout#^1.0.0",
3737
"iron-ajax": "PolymerElements/iron-ajax#^1.0.0",
38-
"iron-doc-viewer": "PolymerElements/iron-doc-viewer#nav",
38+
"iron-doc-viewer": "PolymerElements/iron-doc-viewer#master",
3939
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
4040
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
4141
"paper-styles": "PolymerElements/paper-styles#^1.0.0",

iron-component-page.html

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
<link rel="import" href="../iron-doc-viewer/iron-doc-viewer-default-theme.html">
1919
<link rel="import" href="../iron-doc-viewer/iron-doc-viewer.html">
2020
<link rel="import" href="../iron-icons/iron-icons.html">
21-
<link rel="import" href="../iron-location/iron-location.html">
2221
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
2322
<link rel="import" href="../paper-styles/color.html">
2423
<link rel="import" href="../paper-styles/typography.html">
@@ -61,8 +60,6 @@
6160
}
6261
</style>
6362

64-
<iron-location hash="{{_urlHash}}"></iron-location>
65-
6663
<iron-ajax
6764
auto
6865
url="[[descriptorUrl]]"
@@ -85,8 +82,8 @@
8582
<app-drawer id="drawer" slot="drawer" swipe-open>
8683
<iron-doc-nav
8784
descriptor="[[_descriptor]]"
88-
path="{{_path}}"
89-
on-select="_clearScroll">
85+
path="[[_path]]"
86+
on-select="_onNavSelect">
9087
</iron-doc-nav>
9188
</app-drawer>
9289

@@ -99,12 +96,9 @@
9996
</app-header>
10097

10198
<iron-doc-viewer
102-
id="viewer"
10399
descriptor="[[_descriptor]]"
104100
title="{{_title}}"
105-
path="[[_path]]"
106-
fragment-prefix="[[_path]]#"
107-
scroll-to="[[_scrollTo]]">
101+
path="{{_path}}">
108102
</iron-doc-viewer>
109103

110104
</app-header-layout>
@@ -131,34 +125,18 @@
131125
observer: '_descriptorChanged'
132126
},
133127

134-
_path: {
135-
type: String,
136-
observer: '_pathChanged'
137-
},
128+
_path: String,
138129

139130
_title: {
140131
type: String,
141132
observer: '_titleChanged'
142-
},
143-
144-
_urlHash: {
145-
type: String,
146-
observer: '_urlHashChanged'
147-
},
148-
149-
_scrollTo: String,
150-
151-
_changing: {
152-
type: Boolean,
153-
value: false
154133
}
155134
},
156135

157-
_clearScroll() {
136+
_onNavSelect() {
158137
document.body.scrollTop = 0;
159-
var pos = this._urlHash.indexOf('#');
160-
if (pos >= 0) {
161-
this._urlHash = this._urlHash.substring(0, pos);
138+
if (this.$.layout.narrow) {
139+
this.$.drawer.close();
162140
}
163141
},
164142

@@ -175,9 +153,7 @@
175153
this._descriptor = _flatten(descriptor);
176154
this._changing = false;
177155

178-
if (this._urlHash) {
179-
return;
180-
}
156+
return;
181157

182158
var behaviors = descriptor.metadata
183159
&& descriptor.metadata.polymer
@@ -197,31 +173,8 @@
197173
}
198174
},
199175

200-
_pathChanged(path) {
201-
if (this._changing) {
202-
return;
203-
}
204-
this._changing = true;
205-
this._urlHash = path;
206-
this._changing = false;
207-
if (this.$.layout.narrow) {
208-
this.$.drawer.close();
209-
}
210-
},
211-
212176
_titleChanged(title) {
213177
window.document.title = title;
214-
},
215-
216-
_urlHashChanged(urlHash) {
217-
if (this._changing) {
218-
return;
219-
}
220-
var parts = urlHash.split('#');
221-
this._changing = true;
222-
this._path = parts[0];
223-
this._scrollTo = parts[1];
224-
this._changing = false;
225178
}
226179
});
227180

0 commit comments

Comments
 (0)