GithubHelp home page GithubHelp logo

rubydev / recurring_select Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ciihla/recurring_select

0.0 1.0 0.0 483 KB

A gem for adding selectors for setting recurring events.

License: MIT License

Ruby 49.76% CoffeeScript 3.92% JavaScript 0.96% HTML 42.10% CSS 3.26%

recurring_select's Introduction

RecurringSelect

Build Status

This is a gem to add a number of selectors and helpers for working with recurring schedules in a rails app. It uses the IceCube recurring scheduling gem.

Created by the Jobber team for Jobber, the leading business management tool for field service companies.

Check out the live demo (code in spec\dummy folder)

Usage

Basic selector:

Load the gem: gem 'recurring_select

Require assets
Desktop view
application.js
//= require recurring_select
application.css
//= require recurring_select

or jQueryMobile interface
application.js
//= require jquery-mobile-rs
application.css
//= require jquery-mobile-rs

In the form view call the helper: <%= f.select_recurring :recurring_rule_column %>

Options

Defaults Values

f.select_recurring :current_existing_rule, [
  IceCube::Rule.weekly.day(:monday, :wednesday, :friday),
  IceCube::Rule.monthly.day_of_month(-1)
]

:allow_blank let's you pick if there is a "not recurring" value

  f.select_recurring :current_existing_rule, :allow_blank => true

Additional Helpers

RecurringSelect also comes with several helpers for parsing up the parameters when they hit your application.

You can send the column into the is_valid_rule? method to check the validity of the input. RecurringSelect.is_valid_rule?(possible_rule)

There is also a dirty_hash_to_rule method for sanitizing the inputs for IceCube. This is sometimes needed based on if you're receiving strings, fixed numbers, strings vs symbols, etc. RecurringSelect.dirty_hash_to_rule(params)

Testing and development

Start the dummy server for clicking around the interface: rails s

Use Guard and RSpec for all tests. I'd love to get jasmine running also, but haven't had time yet.

Feel free to open issues or send pull requests.

Licensing

This project rocks and uses MIT-LICENSE.

recurring_select's People

Contributors

ciihla avatar forrest avatar mhchen avatar pungoyal avatar rubenrails avatar rubydev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.