-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
light-table: add iconSortable
property
#464
Merged
buschtoens
merged 3 commits into
adopted-ember-addons:master
from
ignatius-j:feature/icon_sortable
Jul 22, 2017
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -69,13 +69,24 @@ 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. | ||
* 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. | ||
* | ||
* For instance, if you have installed `ember-font-awesome` or include the | ||
* `font-awesome` assets manually (e.g. via a CDN), you can set | ||
* `iconAscending` to `'fa fa-sort-asc'`, which would yield this markup: | ||
* `<i class="lt-sort-icon fa fa-sort-asc"></i>` | ||
* `iconSortable` to `'fa fa-sort'`, which would yield this markup: | ||
* `<i class="lt-sort-icon fa fa-sort"></i>` | ||
* | ||
* @property iconSortable | ||
* @type {String} | ||
* @default '' | ||
*/ | ||
iconSortable: '', | ||
|
||
/** | ||
* See `iconSortable`. CSS classes to apply to `<i class="lt-sort-icon"></i>` | ||
* when the column is sorted ascending. | ||
* | ||
* @property iconAscending | ||
* @type {String} | ||
|
@@ -84,9 +95,10 @@ export default Mixin.create({ | |
iconAscending: '', | ||
|
||
/** | ||
* See `iconAscending`. | ||
* See `iconSortable`. CSS classes to apply to `<i class="lt-sort-icon"></i>` | ||
* when the column is sorted descending. | ||
* | ||
* @property iconDescending | ||
* @property iconDesci | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops? 😛 |
||
* @type {String} | ||
* @default '' | ||
*/ | ||
|
@@ -103,8 +115,8 @@ export default Mixin.create({ | |
subColumns: computed.readOnly('table.visibleSubColumns'), | ||
columns: computed.readOnly('table.visibleColumns'), | ||
|
||
sortIcons: computed('iconAscending', 'iconDescending', function() { | ||
return this.getProperties(['iconAscending', 'iconDescending']); | ||
sortIcons: computed('iconSortable', 'iconAscending', 'iconDescending', function() { | ||
return this.getProperties(['iconSortable', 'iconAscending', 'iconDescending']); | ||
}).readOnly(), | ||
|
||
init() { | ||
|
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 |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
{{component column.component column=column table=table tableActions=tableActions sortIcons=sortIcons}} | ||
{{else}} | ||
{{label}} | ||
{{#if column.sorted}} | ||
<i class="lt-sort-icon {{if column.ascending sortIcons.iconAscending sortIcons.iconDescending}}"></i> | ||
{{#if column.sortable}} | ||
<i class="lt-sort-icon {{get sortIcons sortIcon}}"></i> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the other comment regarding {{#if sortIcon}}
<i class="lt-sort-icon {{get sortIcons sortIcon}}"></i>
{{/if}} |
||
{{/if}} | ||
{{/if}} | ||
|
||
|
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would rather mark
sortIcon
asprivate
(for now). And only return asortIcon
, if it was set. That way later down in the template, we can just call{{if sortIcon}}
as to not insert a "meaningless"<i>
tag.This behavior is slightly different than the current one, but I think this makes more sense. I doubt that the "empty"
<i>
tag is used in the wild.Also, brace expansion, yay! 🎉
@alexander-alvarez What is your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
The only thing I can add is a 🚲 🏡 on the name --
sortIconProperty
orsortIconAttribute
just so it's clear that this string represents the attribute that will be pulled from to generate the icon simply from the name (we could add docs for it too)