开发者

What's an ideal ui for creating has-and-belongs-to-many relationships when there are a lot of records to deal with?

I have article, gallery, and photo models. A gallery has many photos, and a photo belongs to a gallery. I want to be able to include photos in a slideshow on my articles#show action. So I'm setting up a habtm relationship between articles and photos. All this is pretty standard stuff. Usually I do a checkbox setup on one of the models' forms. This works ok when you have a few dozen records at most, but in this project I have tens of thousands of photos with thousands more coming in every month.

What kind of user interface would be ideal for being able to add photos to an article?

I have a few ideas, but they all have some drawbacks. First, I could arrange the galleries on the articles form partial and have e开发者_运维知识库xpanding/collapsing divs with each galleries' photos in them, but I don't like the idea of having that many thumbnail images able to be loaded in a request. I could not load the photos until the gallery is expanded, but I still don't really like it because there are still hundreds/thousands of galleries, which would make for a really long form.

Another idea I had was to make another action in my articles controller specifically for the purpose of adding photos. Then I could use ajax pagination in the view to navigate through the galleries, and have the galleries be expandable in there.

I don't want to waste a lot of time coding a bunch of different solutions that I'll likely hate, so what's a good way to deal with this kind of user interface situation?


I've decided to load all the galleries on the page with expandable divs, but I'm using partials to fill in the divs with the galleries images, only after the div is expanded.

I'll edit this answer with my code when I'm finished writing it and accept it.

Edit, here's what I'm doing for now. I'd like to later figure out how I can select multiple photos from multiple galleries. The need for that hasn't arisen yet, so I'm not really in any hurry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜