So I have a Many to Many relationship between Record and Counties in Rails, such that when I am creating a record, the user can select multiple counties. The problem is that there are over 100 counties to choose from.
So I'm looking for a more user friendly way to allow selection of multiple counties than what comes with formtastic's default.
I found this blog, but the plugin it references is a bit old and doesn't seem available anymore....http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery
Anyone implement anything with Rails 3/Formtastic to tackle this problem?
Thanks in advance.
I have just used Select2 in a project with Rails 3 and Formtastic and it works quite well.
Select2 supports multi-value select boxes, so if the select is declared with the multiple attribute then Select2 will automatially pick up on that. Thus, all you need is to do the following:
$("#multiple_select").select2();
More documentation here: http://ivaynberg.github.io/select2/
Related
Hi there working with bigcommerce Im looking to get the following style of break down on each category page
Essentially making a category version of;
%%Panel.HomeFeaturedProducts%%
%%Panel.SideTopSellers%%
%%Panel.HomeNewProducts%%
Ive gone ahead and attempted this however they seem to be pulling in from global values, and there dose not seem to me much option to break these down or limit the category, has anyone done this previously and if so how?
developerscott is correct in those panels not offering contextually unique data. I'd recommend looking into Unbxd. It has a 30 day trial so you can either investigate their programmatic solution or use it in place of making your own.
If I have a shop that displays a bunch of products and I get these products returned from the database as an array, is there a specific way that you can display this data using YII templates or is it sufficient to simply loop through the array and print it out in "divs" as needed?
I know if I just spit it out in DIVs, it would work, but is it the "correct" way to do it according to the framework?
For this there are zii widgets, and also many extensions.
I think for a store CListView will be a good start. There are many wikis that explain a lot about CListView.
You can easily extend it and add functionality.
Zii widgets provide pagination, sorting, and custom styling too, when used alongwith a data provider.
I'm interested in displaying 1-5 model instances using forms on a page using a grid similar to something one would find in a desktop database application. I understand I would need to use multiple forms or formsets but an additional requirement is that I'd prefer it to be in more of a grid format with each model's fields being display in columns with common field labels on the y-axis.
I should have the ability to edit multiple columns (so in effect, model instances) at the same time and then commit either the single column (model instance) or commit all. I'd also like to be able to highlight the changed cells that have changed to give visual feedback to the user that there are pending changes.
Sorry for the rather long list of requirements and I'm aware this probably requires a few different technologies/techniques to achieve. I'm throwing this out there because I'm asking this kind community for guidance on what components/technologies I should look at. If luck would have it, there would be some jQuery component that can handle this for me almost out of the box. If not, some guidance on achieving the editing of multiple model instances would be of help.
I will also need to build in versioning in case the data displayed on the view page is stale and to prevent overwriting a newer commit. I'd probably achieve the latter using a versioning field in the table that will perform the check and handle it accordingly.
Also, Flask and Django are both options for the engine and WTForms look to be promising at least at first look.
Thanks
There is no such ready to use solution in Django. Just create your custom form that handles as many instances as you want and do anything that you want, or extend formset.
I am developing a Rails app which should rely on existing database.
There are a couple of table names there which are the always plural words, like "Series".
Application is not working correctly with the models associated with them. How would you propose to deal with it - is there any solution without changing the naming?
Thanks in advance!
It sounds like you need to tell Rails that "Series" is uncountable - that is, that it shouldn't try inflecting it for singular/plural. To do this, add the line inflect.uncountable 'series' to your config/initializers/inflections.rb file.
Curiously, however, "series" appears to be uncountable by default; did you just pick it as an example out of a number of similar names?
As described at playframework - search module, I've installed the search-module. Of course my model consists of multiple classes. I'd now like to search for entries whose attributes consist of several tables, i.e. i'd like to search for users who have bought an article that costs more than say 500$ whereas there would be a table for customers, one for orders and one for articles.
Does anyone know how to realize this using the playframework's lucene-query-language?
thanks a lot!
The query language isn't specific to Play! You can learn about the syntax from the official Lucene documentation: http://lucene.apache.org/java/2_0_0/queryparsersyntax.html