-
-
Notifications
You must be signed in to change notification settings - Fork 1
Improve flexibility for options on collection_order_toggle_indicator
component
#13
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
Comments
default
, asc
, and desc
options on collection_order_toggle_indicator
componentcollection_order_toggle_indicator
component
Experimented and cooked something up to demonstrate what I wanted to achieve on the dummy app for matestack-ui-bootstrap. Let me know your thoughts 😉 @jonasjabari . This is using sort-up and sort-down bootstrap icons and the code snippet looks like this: NOTE: def table_head
#...
collection_order_toggle_indicator key: key,
slots: {
asc: method(:asc_partial),
desc: method(:desc_partial)
}
#...
end
def asc_partial
bs_icon name: 'sort-up'
end
def desc_partial
bs_icon name: 'sort-down'
end |
@aaron-contreras I like this idea! Feel free to work on this improvement! |
@jonasjabari Nice. I had a similar thought. My idea of it was that I could provide in the {
sorting: true # or sortable?
columns: {
# columns defined here
}
} and this would enable sorting on all columns being the standard case. However, if I wanted to provide a custom sorting slot that would be used like you indicated in a non-table way or in any other scenario, I could do something like this which would generate the corresponding dropdowns you talked about: {
sorting: {
some_column_name: {
text: "Sort by some_column_name",
default: :asc
},
# all columns I would like to provide the dropdowns for sorting
}
} or if I want to provide my own sorting rendering {
slots: {
collection_rendering: method(:my_collection_rendering),
sort_rendering: method(:my_sort_rendering)
}
} |
Currently, the way to provide what we render for default, ascending and descending sort options for the
collection_order_toggle_indicator
component is only via a "text" option. Also, options forasc
anddesc
are rendered as "unescaped", while thedefault
option gets rendered as plaintext. I can see the why behind this (perhaps to provide some unicode characters as the ascending and descending arrows and wanting those to be unescaped).I feel a bit limited by the current behavior. Instead, I'd like to use arrow
bs_icon
s for example on matestack-ui-bootstrap for these or provide my own rendering or template for what these should render. I propose using slots somewhat similar to the interface as we have inbs_card
on matestack-ui-bootstrap, where you can provide abody
via a text option or define a method that provides the rendering forbody
and add it as a slot.Also, I'd like
default
,asc
, anddesc
as text to all render as plaintext and not some plaintext and some unescaped. If we want unescaped text forasc
anddesc
we could have the text be unescaped from the caller's side. This is more flexible in my opinion and doesn't hide the fact that whatever string/text is passed in as an argument is unescaped.An example of the desired API would look something like this:
The text was updated successfully, but these errors were encountered: