0.0
No commit activity in last 3 years
No release in over 3 years
Includes month_choices, year_choices, country_choices
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 1.0
 Project Readme

Sinatra Helpers: a common collection of useful utilities

Bare minimum, close to the metal helpers for your average sinatra application. Read the full documentation at http://labs.sinefunc.com/sinatra-helpers/doc.

Defines...

# from a Sinatra context point of view...
set :default_year_loffset, -60 
set :default_year_uoffset, 0
set :default_month_names, Date::MONTHNAMES

set :default_currency_unit, '$'
set :default_currency_precision, 2
set :default_currency_separator, ','

Examples

# what are helpers for if you don't have `h` ^_^
=h "<Bar>"

%select(name='country')
  != country_choices

%select(name='birthday[month'])
  != month_choices

%select(name='birthday[day]')
  != day_choices

%select(name='birthday[year'])
  != year_choices

%select(name="categories")
  != select_options [['First', 1], ['Second', 2]]

= currency(100)
-# displays $ 100.00

= percentage(100)
-# displays 100.00%

# If you have an ohm model which you want to present the errors of:
# (this is taken from the reddit-clone courtesy of citrusbyte)

# This should be put in your HAML file

- errors_on @user do |e|
  - e.on [:email, :not_present] "You must supply an email address"
  - e.on [:password, :not_present] "A password is required"
  - e.on [:password, :not_confirmed] "You must confirm your password"

Copyright

Copyright (c) 2010 Cyril David. See LICENSE for details.