gregschmit / recurring_select

A gem for adding selectors for setting recurring events.
MIT License
333 stars 237 forks source link

recurring link #41

Open dquimper opened 10 years ago

dquimper commented 10 years ago

Hi,

I'm trying to make a link that would display the recurring popup.

Something like

= f.hidden_field :recurring_rule
%span#translation_span
= link_to_function("Repeat", "display_recurring_popup('#model_recurring_rule', '#translation_span');")

Where #model_recurring_rule is the DOM id of the hidden field where I want the rule's hash to be stored and #translation_span is the DOM id of a tag where I want to display the translation (ie: "Every 3 days").

Any hint on how I can do this? Once I succeed, I'll be happy to make a pull request if you liked.

Thanks

forrest commented 10 years ago

RecurringSelect is pretty tightly tied into the select field. I'm not sure how successful removing it entirely will be.

If you really wanted to not show a select field, and use a link to open the menu, I would probalby use a hack. Try setting the select style to height 1px, width 1px, border none, background transparent. Then use the link to focus the select field.

findchris commented 10 years ago

:+1: Great gem, so thanks for sharing!

I tend to agree that restricting the UI element to a select tag is an unexpected constraint. Would be nice to customize UI by providing a more exposed javascript interface for displaying the dialog and handling associated event callbacks.

bcardiff commented 10 years ago

Hi, I worked on a fork of the gem at https://github.com/instedd/recurring_select/tree/recurring_link in order to support a link with hidden input. I also did some other changes to show the dialog right below the link instead of a popup. And finally a helper to support storing the recurrence in a easier way. All this in different branches at the fork. Will try to submit pull request during the week, but in case I don't here is the heads up.

Awesome gems!

findchris commented 10 years ago

:+1: Nice @bcardiff. I'd love to see this make it into a pull request.