forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request emberjs#9 from serenaf/serena/add-toc
Adding a table of contents component
- Loading branch information
Showing
24 changed files
with
121 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Component from '@ember/component'; | ||
import { get, computed } from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
elementId: 'toc-list', | ||
tagName: 'ol', | ||
tocLevel: computed('level', function() { | ||
return `level-${get(this, 'level')}`; | ||
}), | ||
level: '1', | ||
sortDefinition: ['since'], | ||
sortedGroupedResults: computed.sort('groupedResults', 'sortDefinition') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Controller from '@ember/controller'; | ||
import EmberObject, { computed } from '@ember/object'; | ||
|
||
export default Controller.extend({ | ||
groupedResults: computed('sortedResults.[]', function() { | ||
let result = []; | ||
this.get('content').forEach(function(item) { | ||
let since = result.findBy('since', item.get('since')); | ||
if(!since) { | ||
result.pushObject(EmberObject.create({ | ||
since: item.get('since'), | ||
contents: [] | ||
})); | ||
} | ||
result.findBy('since', item.get('since')).get('contents').pushObject(item); | ||
}); | ||
return result; | ||
}), | ||
sortDefinition: ['since'], | ||
sortedResults: computed.sort('content.[]', 'sortDefinition') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#sidebar ol#toc-list li.level-1 { | ||
text-transform: uppercase; | ||
} | ||
|
||
#sidebar ol#toc-list li { | ||
font-size: 12px; | ||
list-style: none; | ||
margin: 0px; | ||
padding: 0px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<h4>{{model.title}}</h4> | ||
{{!-- <h6>until: <%= resource.data.until %></h6> | ||
<h6>id: <%= resource.data.id %></h6> --}} | ||
<h6>UNTIL: {{model.until}}</h6> | ||
<h6>SINCE: {{model.since}}</h6> | ||
<p> | ||
{{markdown-to-html model.content}} | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{{#each sortedGroupedResults as |result|}} | ||
<li class="level-1"> | ||
<a class="slide-widget-head" href="#toc toc_deprecations-added-in-ember-2-x"> | ||
Deprecations added in {{result.since}} | ||
</a> | ||
</li> | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
<h2 class="anchorable-toc" id="toc_deprecations-added-in-ember-2-x"><a class="toc-anchor" href="#toc_deprecations-added-in-ember-2-x"></a>Deprecations Added in Ember 2.x</h2> | ||
<p>What follows is a list of deprecations introduced to Ember.js during the 2.x | ||
cycle.</p> | ||
<p>For more information on deprecations in Ember, see the <a href="/deprecations">main deprecations page</a>.</p> | ||
<div id="sidebar"> | ||
{{table-of-contents groupedResults=groupedResults}} | ||
<div id="back-to-top"><a id="back-top-top" href="#">⬆ Back to Top</a></div> | ||
</div> | ||
|
||
{{#each model as |deprecation|}} | ||
{{deprecation-article model=deprecation}} | ||
{{/each}} | ||
<div class="has-sidebar" id="content"> | ||
|
||
<h2 class="anchorable-toc" id="toc_deprecations-added-in-ember-2-x"><a class="toc-anchor" href="#toc_deprecations-added-in-ember-2-x"></a>Deprecations Added in Ember 2.x</h2> | ||
<p>What follows is a list of deprecations introduced to Ember.js during the 2.x | ||
cycle.</p> | ||
<p>For more information on deprecations in Ember, see the <a href="/deprecations">main deprecations page</a>.</p> | ||
|
||
{{#each sortedResults as |deprecation|}} | ||
{{deprecation-article model=deprecation}} | ||
{{/each}} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
id: ember-metal.ember-backburner | ||
name: Ember.Backburner | ||
title: Ember.Backburner | ||
until: 2.8.0 | ||
since: 2.7 | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
id: ember-metal.binding | ||
name: Ember.Binding | ||
title: Ember.Binding | ||
until: 3.0.0 | ||
since: 2.7 | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { moduleForComponent, test } from 'ember-qunit'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
moduleForComponent('table-of-contents', 'Integration | Component | table of contents', { | ||
integration: true | ||
}); | ||
|
||
test('it renders', function(assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
|
||
this.render(hbs`{{table-of-contents}}`); | ||
|
||
assert.equal(this.$().text().trim(), ''); | ||
|
||
// Template block usage: | ||
this.render(hbs` | ||
{{#table-of-contents}} | ||
template block text | ||
{{/table-of-contents}} | ||
`); | ||
|
||
assert.equal(this.$().text().trim(), 'template block text'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { moduleFor, test } from 'ember-qunit'; | ||
|
||
moduleFor('controller:v2', 'Unit | Controller | v2', { | ||
// Specify the other units that are required for this test. | ||
// needs: ['controller:foo'] | ||
}); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
let controller = this.subject(); | ||
assert.ok(controller); | ||
}); |