Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document changes to sorting icons and icon component #812

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions addon/mixins/table-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ export default Mixin.create({
resizeOnDrag: false,

/**
* CSS classes to be applied to an `<i class="lt-sort-icon"></i>` tag that is
* inserted into the column's `<th>` element when the column is sortable but
* not yet sorted.
* Name of the icon that is inserted into the column's `<th>`
* element when the column is sortable but not yet sorted.
*
* For instance, if you have installed `ember-font-awesome` or include the
* `font-awesome` assets manually (e.g. via a CDN), you can set
* `iconSortable` to `'sort'`, which would yield this markup:
* `<i class="lt-sort-icon sort"></i>`
* The name is passed to the component assigned to the
* iconComponent property when the table is rendered.
*
* The addon includes the Font Awesome icon `sort`.
*
* @property iconSortable
* @type {String}
Expand All @@ -94,8 +93,10 @@ export default Mixin.create({
iconSortable: '',

/**
* See `iconSortable`. CSS classes to apply to `<i class="lt-sort-icon"></i>`
* when the column is sorted ascending.
* See `iconSortable`. Icon name to use when the
* column is sorted ascending.
*
* The addon includes the Font Awesome icon `sort-up`.
*
* @property iconAscending
* @type {String}
Expand All @@ -104,8 +105,10 @@ export default Mixin.create({
iconAscending: '',

/**
* See `iconSortable`. CSS classes to apply to `<i class="lt-sort-icon"></i>`
* when the column is sorted descending.
* See `iconSortable`. Icon name to use when the
* column is sorted descending.
*
* The addon includes the Font Awesome icon `sort-down`.
*
* @property iconDescending
* @type {String}
Expand All @@ -114,7 +117,10 @@ export default Mixin.create({
iconDescending: '',

/**
* Custom sorting component name to use instead of the default `<i class="lt-sort-icon"></i>` template.
* Name of custom component to render the sorting icons template. This component
* is required to render sorting icons. Duplicate the `fa-icon-wrapper` from the
* dummy app to use the included Font Awesome icons.
*
* See `iconSortable`, `iconAsending`, or `iconDescending`.
* @property iconComponent
* @type {String}
Expand Down
5 changes: 2 additions & 3 deletions tests/dummy/app/components/cookbook/client-side-table.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{{! BEGIN-SNIPPET client-side-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
7 changes: 3 additions & 4 deletions tests/dummy/app/components/cookbook/custom-row-table.hbs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{{! BEGIN-SNIPPET custom-row-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
@onColumnClick={{this.onColumnClick}}
@iconSortable="sort"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{{! BEGIN-SNIPPET horizontal-scrolling-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
9 changes: 4 additions & 5 deletions tests/dummy/app/components/cookbook/occluded-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
@estimatedRowHeight={{50}}
as |t|>

{{!--
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
--}}
{{!
See the simple table example on using sorting icons
and icon components.
}}

<t.head @fixed={{true}}/>

Expand Down
5 changes: 2 additions & 3 deletions tests/dummy/app/components/cookbook/paginated-table.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{{! BEGIN-SNIPPET paginated-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
5 changes: 2 additions & 3 deletions tests/dummy/app/components/cookbook/table-actions-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
}} as |t|
>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
4 changes: 3 additions & 1 deletion tests/dummy/app/components/fa-icon-wrapper.hbs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<FaIcon @icon={{get @sortIcons @sortIconProperty}}/>
{{! BEGIN-SNIPPET fa-icon-wrapper }}
<FaIcon @icon={{get @sortIcons @sortIconProperty}}/>
{{! END-SNIPPET }}
5 changes: 2 additions & 3 deletions tests/dummy/app/components/responsive-table.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
@onAfterResponsiveChange={{this.onAfterResponsiveChange}} as |t|
>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
5 changes: 2 additions & 3 deletions tests/dummy/app/components/scrolling-table.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{{! BEGIN-SNIPPET scrolling-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
See the simple table example on using sorting icons
and icon components.
}}

<t.head
Expand Down
13 changes: 10 additions & 3 deletions tests/dummy/app/components/simple-table.hbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{{! BEGIN-SNIPPET simple-table }}
<LightTable @table={{this.table}} @height="65vh" as |t|>
{{!
In order for `sort-up` and `sort-down` icons to work,
you need to have ember-font-awesome installed or manually include
the font-awesome assets, e.g. via a CDN.
The `sort`, `sort-up` and `sort-down` Font Awesome icons are
rendered by the `fa-icon-wrapper` component. The
component uses the @fortawesome/ember-fontawesome addon.

The 'fa-icon-wrapper` component may be used with other
Font Awesome icons by installing the appropiate icon
package.

Other icon systems can be used with a custom icon
component. See the custom sort icon cookbook example.
}}

<t.head
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/columns/draggable.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"draggable-table.js"
"base-table.js"
"draggable-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/columns/grouped.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"grouped-table.js"
"base-table.js"
"grouped-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/columns/resizable.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"resizable-table.js"
"base-table.js"
"resizable-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/cookbook/client-side.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"client-side-table.js"
"base-table.js"
"client-side-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/cookbook/custom-row.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base-table.js"
"custom-row-table.hbs"
"colored-row.js"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"horizontal-scrolling-table.js"
"base-table.js"
"horizontal-scrolling-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/cookbook/occlusion-rendering.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"occluded-table.js"
"base-table.js"
"occluded-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/cookbook/pagination.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"paginated-table.js"
"base-table.js"
"paginated-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/cookbook/table-actions.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base-table.js"
"table-actions-table.hbs"
"user-actions.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"simple-table.js"
"base-table.js"
"simple-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/responsive.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base-table.js"
"responsive-table.hbs"
"responsive-expanded-row.hbs"
"fa-icon-wrapper.hbs"
"row-toggle.hbs"
"user-avatar.hbs"
"table-loader.hbs"
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/rows/expandable.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"base-table.js"
"expandable-table.hbs"
"expanded-row.hbs"
"fa-icon-wrapper.hbs"
"table-loader.hbs"
}}>
<Rows::ExpandableTable @model={{this.model}}/>
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/rows/selectable.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"selectable-table.js"
"base-table.js"
"selectable-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"no-data.hbs"
"table-loader.hbs"
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/templates/scrolling.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scrolling-table.js"
"base-table.js"
"scrolling-table.hbs"
"fa-icon-wrapper.hbs"
"user-avatar.hbs"
"table-loader.hbs"
}}>
Expand Down