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

Custom Search For TableScreen #639

Closed
wants to merge 64 commits into from
Closed

Conversation

sxross
Copy link
Contributor

@sxross sxross commented Mar 2, 2015

This enables TableScreen to be backward compatible if the user wants to use default search on title or search_text, but allows custom search to be specified. E.g.:

class MySearchable < PM::TableScreen
  searchable placeholder: "Search events", with: -> (cell, search_string) {
    return cell[:properties][:event_name].downcase.strip.include?(search_string.downcase.strip)
  }
end

For those wanting code that does not resist refactoring quite so much, you can specify a method:

class MySearchable < PM::TableScreen
  searchable placeholder: "Search events", with: :search_method

  # other stuff
  def search_method
    return cell[:properties][:event_name].downcase.strip.include?(search_string.downcase.strip)
  end
  }
end

Real world examples would probably be more complex.

markrickert and others added 30 commits November 10, 2014 14:35
If defined in your subclass, it will call:

header_will_display, header_will_display(view) or header_will_display(view, section)

This is so that you can modofy the view of a header before it is displayed.
* master: (21 commits)
  Version 2.2.0
  Refactored a little
  Auto-hide the toolbar when passed nil or false.
  table view auto size row height functionality
  Fixes issue jamonholmgren#572
  Add longpressable example table screen to demo app.
  Implement @silasjmatson's idea about moving move_cell into promotion_table_data
  Allow the user to restrict the cell's movement within a section.
  Fix failing tests.
  Moar specs! 🙀
  Change edit? to edit_mode?
  Make cell_moved on_cell_moved to conform to on_cell_deleted.
  Fix true|false bug.
  Tests for moveable cells.
  Initial moveable cells functionality.
  Scroll the table to show the refresh control unless the user initiates the refresh manually.
  Version 2.1.0 + README update
  Added on_load and on_styled hooks for UIViews and on_reuse for UITableViewCells
  Make second param a hash instead of just the animation.
  Allow screens to choose their status bar style.
  ...

Conflicts:
	app/test_screens/test_table_screen.rb
…o/ProMotion into multiple_nav_bar_buttons

* 'multiple_nav_bar_buttons' of github.com:clearsightstudio/ProMotion:
  Allow nav bar buttons to be set with a barbuttonitem instead of a hash.
  Allow setting of multiple nav bar buttons instead of just one left an one right.
* multiple_nav_bar_buttons:
  Allow nav bar buttons to be set with a barbuttonitem instead of a hash.
  Allow setting of multiple nav bar buttons instead of just one left an one right.
…o add-tab-feature

* 'add-tab-feature' of github.com:squidpunch/ProMotion:
  handles didSelecteViewController; raises on_tab_selected
* add-tab-feature:
  handles didSelecteViewController; raises on_tab_selected
…ightstudio/ProMotion into feature/navbarbutton-class-method

* 'feature/navbarbutton-class-method' of github.com:clearsightstudio/ProMotion:
  implemented nav_bar_button class method RE jamonholmgren#272
* feature/navbarbutton-class-method:
  implemented nav_bar_button class method RE jamonholmgren#272
…Motion into header_will_display

* 'header_will_display' of github.com:clearsightstudio/ProMotion:
  Change will_display_header to header_will_display
  Adds header_will_display method to PM::TableScreen
* header_will_display:
  Change will_display_header to header_will_display
  Adds header_will_display method to PM::TableScreen
* feature/tab-bar-item-props:
  Add totally awesome spec which verifies that the image inset feature works
  Add image inset support for tab bar item
…nto version-2.3

* 'version-2.3' of github.com:clearsightstudio/ProMotion:
  Version 2.2.1
  snake case variables for consistency.
  added tests
  Fixes issue with auto-detected links not opening.
  implemented workaround for image autorotate crash jamonholmgren#562
  Write spec to ensure on_init is not used in the future
  Cleanup screen_setup
  Disabled another Travis test
  Disabled another test. This is getting monotonous
  More Travis skipped tests
  Use Travis env variables instead
  Disable failing test for Travis
  Fix: wrong cell detection problem in search_result_table of longpressable TableScreen.
  No version bump yet
  Specs updated for iOS 7 and iOS 8
  Resolving iOS 7 errors
  Updated splitview to iOS 8 compatibility
just like table_header_view so i merged the two constructors into an each loop.
…tion into table_footer_view

* 'table_footer_view' of github.com:clearsightstudio/ProMotion:
  Adds capability for table_footer_view
* uitabbar-deprecation:
  As per apple docs, setFinishedSelectedImage:withFinishedUnselectedImage: is deprecated as of 7.0
kevinvangelder and others added 21 commits February 4, 2015 11:29
…nto version-2.3

* 'version-2.3' of github.com:clearsightstudio/ProMotion:
  updated docs with searchable - hide_initially
…nto version-2.3

* 'version-2.3' of github.com:clearsightstudio/ProMotion:
  documented tabs - on_tab_selected
  documented screen - nav_bar_button
  updated docs with will_display_header
- Instead of passing the controller into the table data,
  pass a proc bound in the context of the controller.
  Thanks @jasonholmgren.

- Remove params as second argument to search -- the params will
  have been resolved when the table_data is allocated.

- Which one wins: If the user passes more than one proc or symbol
  using the params hash, the behavior is undefined, but the last
  one evaluated is the one that becomes the custom action. Because
  hashes are not necessarily ordered sets, order is meaningless
  in this context.
@jamonholmgren
Copy link
Owner

This is awesome.

One more thing. We're currently working on the version-2.3 branch. Could you close this PR and bring your branch up to date with version-2.3 and do a new PR into that branch? I may not merge it in time for 2.3 but definitely for 2.4.

With that change, we're also including documentation (via the ./docs folder) in future PRs, so update the markdown documentation there.

Sorry to make you jump through so many hoops. You'll be a card-carrying ProMotion contributor of note after this one. ;)

@sxross
Copy link
Contributor Author

sxross commented Mar 5, 2015

I've updated sxross/ProMotion -b search_with to the version-2.3 code. Feel free to pull this whenever ready. I guess my git-foo returned (to some extent :).

@jamonholmgren
Copy link
Owner

Moved to #641.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants