开发者

Handling standard user facing scenarios

*I was wondering if i could do all these in javascript, as opposed to having rails helpers

In my applic开发者_如何转开发ation, there are several types of "if-else" UI cases. This is a fairly common scenario, and i wonder if anyone has a tidy way to do these?

EG 1) There might be several types of links with the same behavior: "upvote", etc.

If it is the user's own article, i do not want it to be passed to the server, but pop up a dialog box

EG 2) There might be a several links called "follow", "become a fan", etc

If the user already have done the given action before, it should be a text "followed" instead of a link.


Normally you'd use helpers for this. You write helpers called, based on your examples, upvote_button (which might take a user as a parameter) or follow_button (where this one might take true/false for already-following/not-following.

If you can be more specific as to what you need, I can probably be more specific in my answer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜