rawnet / rawnet-admin

An inheritable admin interface for Ruby on Rails apps
MIT License
0 stars 2 forks source link

Remove search by default #3

Closed tombeynon closed 9 years ago

tombeynon commented 9 years ago

Not 100% sure about this so any comments would be great. Search is now removed from the index view by default, but can be re-included using content_for(:search).

The main problem with this is that the index view will now need to be overridden just to add search, and where possible we want to avoid overriding templates. To make this easier, I've stripped back the index.html.erb template so it just includes a few partials, rather than the whole listing table.

Alternatively, we could render a search partial into the index template, but leave it blank by default. Then that partial can be overridden to include the content_for, rather than the whole index view.

The other alternative is to implement a searchable? method on the controller, which is false by default but can be overridden by resource controllers.

Thoughts?

vertism commented 9 years ago

I think I like your last suggestion to have a searchable? method

boxofrad commented 9 years ago

I vote option A ("null / empty partial")

efexen commented 9 years ago

My only concern with this is around the naming, search is very generic and could be used by someone consuming this, maybe rawnet_admin_search or admin_search or something that's less likely to be implemented by someone else using this?

tombeynon commented 9 years ago

Personally I love the idea of having a searchable? method, but I feel like we'll end up littering the controllers with this kind of config if we're not careful. Think the empty partial makes more sense to keep it clean, especially as the chances are they'll have to modify the search form anyway (extra params etc).

@efexen the views are namespaces to rawnet_admin and the resource, so the chances of a clash are slim. I'll name it listing_search though.