Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
formtastic_jquery_ui
Advanced tools
h1. Formtastic jQuery-UI
Adds some "jQuery UI":http://jqueryui.com widgets as input types for "Formtastic":http://github.com/justinfrench/formtastic
Currently Supports:
h2. Examples
h3. Autocomplete
The autocomplete module adds jQuery UI's autocomplete widget to belongs_to
, has_many
, and has_and_belongs_to_many
relationships.
For best results use it with "Searchlogic":http://github.com/binarylogic/searchlogic and "Will Paginate":http://github.com/mislav/will_paginate as shown below
class Product
belongs_to :brand
has_and_belongs_to_many :categories
end
class Category
has_and_belongs_to_many :products
end
The search results should be mapped into value/label pairs for a JSON query
class CategoriesController < ApplicationController
def index
@search = Category.search(params[:search])
@categories = @search.paginate(:page => params[:page])
respond_to do |format|
format.html {}
format.json { @categories.map { |category| {:label => category.title, :value => category.id} }.to_json }
end
end
end
class Brand
has_many :products
end
class BrandsController < ApplicationController
def index
@search = Brand.search(params[:search])
@brands = @search.paginate(:page => params[:page])
respond_to do |format|
format.html {}
format.json { render :json => @brands.map { |brand| {:label => brand.name, :value => brand.id} }.to_json }
end
end
end
The input method takes two extra parameters:
:url
- the URL of the data source (JSON formatted):param_name
- the parameter that will be passed to the URL (as part of the search param)<% semantic_form_for @product do |f| %>
<% f.inputs do %>
<%= f.input :categories, :as => :autocomplete, :url => categories_path(:format => :json), :param_name => 'title_begins_with' %>
<%= f.input :brand, :as => :autocomplete, :url => brands_path(:format => :json), :param_name => 'name_begins_with' %>
<% end %>
<% end %>
h3. Datepicker
<% semantic_form_for @todo do |f| %>
<% f.inputs do %>
<%= f.input :due_date, :as => :datepicker
<% end %>
<% end %>
h2. Requirements
This addon requires the following components
Copyright (c) 2010 Paul Smith, released under the MIT license
FAQs
Unknown package
We found that formtastic_jquery_ui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.