-
Notifications
You must be signed in to change notification settings - Fork 148
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
Add scopes to searchable module #509
Comments
Can you elaborate? I'm not following entirely. |
My idea is that if you define cells with this additional parameter: {
# ...
scope: :one
},
{
# ...
scope: [:one, :two]
},
{
# ...
scope: :two
} It would automatically set the We might want to have a mechanism to turn on Thoughts on this design pattern? |
I think that would be cool; what I'm not sure about is whether it makes sense to include this functionality in PM core. How much code would we be introducing, do you think? |
Probably not more than a few methods. The scoping is a native API to the UISearchBar component. |
That's great. I'd be fine with this. I think class MyTable < PM::TableScreen
searchable placeholder: "Search", scoped: true
def table_data
[{
cells: [{
scope: :one,
# ...
}]
]}
end
end |
I think the scope should probably be a string, actually, instead of a symbol. Makes more sense in this context. |
Yeah, I agree that it should probably be a string, but since strings are created in memory each time and symbols are reused in memory, I thought for larger datasets that symbols would be more appropriate, then titleize them. You've got to set the scope button titles when you initialize the UISearchBar and they can't change. I can make this its own gem, but i think that it fits nicely into the functionality of ProMotion core. But just becuase I need it and think it's a good idea, doesn't mean it should be in core :) I have no problem just extending the search functionality through a gem: |
No, I think it's cool in core, since it's native functionality and pretty slim. And if we include it in |
Cool, well I'll get started on adding this functionality tonight and we'll leave it in the searchable module for now. |
Regarding symbols, I think maybe we just allow either (and We'll probably need to specify the scopes in the searchable scoped: [ "First", "Second", "Third" ] |
Yeah, good call. I'll have something to look at later tonight probably. |
👍 |
here's the initial work done: https://dl.dropboxusercontent.com/u/12954/search_scopes.mov Working on getting the ":all" scope implemented now |
Initial work is in this branch: https://github.com/clearsightstudio/ProMotion/tree/search_scopes Change the app delegate to |
OK, done for the evening. @jamonholmgren, have a look at that branch and let me know what you think so far. Everything is working, including indicating a custom string that you want for "All" to search. |
Nice work, @markrickert! I'm holding off on merging until we get 2.0.0 out the door, but then we'll have a lot of cool new features for 2.1 already. :) 2.0 should be released soon. Just need to find about an hour to look it over again and then push it out with a blog post. |
Yeah. Understood. Any comments in the way I implemented it or the :all feature where you can specify your own button title? I'll continue to use my "franken-fork" for all these features I need in prod. lol |
Haha. I'll look at it this weekend. |
There needs to be a way to set a search scope so that if you set scopes on cells, the scope buttons appear under the search bar. Cells should be able to belong to multiple scopes.
The text was updated successfully, but these errors were encountered: