• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 13 years ago
  • Updated almost 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A jQuery front-end for the soulmate auto-suggestion gem

soulmate.js

Soulmate.js is a jQuery plugin front-end for soulmate, an excellent auto-suggestion gem built for speed on sinatra and redis. Together, they provide lightning-fast plug-n-play auto-suggestion. See soulmate on github for more details on the back-end interface.

Note: This plugin is not affiliated with the soulmate gem or its authors. The name is merely a knock-off.

Demo

Soulmate.js is inspired by the excellent autocompletion interface used on seatgeek.com. It works and feels very similar, although the implementation is entirely original.

The demo directory in the source provides an example usage and styling of the plugin. It does not supply a back-end, however, so you will have to set up soulmate and point the demo to it.

Features

  • Well tested: Ridiculous spec coverage using Jasmine.
  • Clean markup: Renders a clean and semantic markup structure that is easy to style.
  • Speed: Minimizes requests by maintaining a list of queries with no suggestions. No additional requests are made when a user keeps typing on an empty query.
  • Cross-domain compatible: Uses jsonp to accommodate backends on separate domain (which is a good practice since it allows the auto-suggest system to get overwhelmed without affecting the main site).
  • Customizable behaviour: Customized rendering of suggestions through a callback that provides all stored data for that suggestion. Customized suggestion selection behaviour through a callback.
  • Adaptable: A modular, object-oriented design, that is meant to be very easy to adapt and modify.

Usage

First, setup an instance of soulmate. Then, grab src/compiled/jquery.soulmate.js and place it in your project. Finally, do something like the following (or follow the example in the demo directory):

index.html

...
<script type="text/javascript" src="jquery.soulmate.js">
<script type="text/javascript" src="main.js">
...
<input id="search-input" type="text" name="q" value="" autocomplete="off"/>

main.js

...
// Define the rendering and selecting behaviour for suggestions.
render = function(term, data, type){ return term; }
select = function(term, data, type){ console.log("Selected " + term); }

// Make the input field autosuggest-y.
$('#search-input').soulmate({
  url:            'http://soulmate.YOUR-DOMAIN.com/search',
  types:          ['type1', 'type2', 'type3', 'type4'],
  renderCallback: render,
  selectCallback: select,
  minQueryLength: 2,
  maxResults:     5
});
...

For more information, see the specifications in the spec/ directory.

Running Specs

Soulmate.js is covered by Jasmine and Jasmine-JQuery specs. See the spec/ directory to browse the specifications.

To run the specs, simply open spec/spec_runner.html in your browser.

More Repositories

1

neurovis

A browser-based neural network simulation
CoffeeScript
52
star
2

roleable

User roles for active-record-backed Rails 3 applications.
Ruby
30
star
3

Rubynu

A scaffold generator for ruby projects
Ruby
11
star
4

minibloom

Extremely fast pure-javascript bloom filter for node and browsers
JavaScript
7
star
5

megaman_ruby

A 2D megaman-like game written in Ruby. Demonstrates interactive programming as presented by Bret Victor.
Ruby
4
star
6

rush

Simple and fast front-end framework for prototyping or learning.
JavaScript
3
star
7

mockstrap

An ugly CSS framework
CSS
2
star
8

amazon-product-api

Amazon product advertising api
TypeScript
2
star
9

result

Typesafe results for Typescript
TypeScript
2
star
10

jukebox-1

Jukebox javascript exercises for Codecore
JavaScript
2
star
11

Rails-3-Starter-Kit

Setup a nice rails app from scratch
Ruby
2
star
12

reapp

JavaScript
2
star
13

roast

Immutable, transactional database in pure Javascript
JavaScript
2
star
14

Playground

mongodb, bootstrap, simple_form, etc.
Ruby
1
star
15

redis-promise

Promise-based Redis client for Typescript and Javascript
TypeScript
1
star
16

Paranoid

A backup script for when the world's out to get you
Ruby
1
star
17

codecore-js

Javascript course notes for CodeCore
Ruby
1
star
18

dotfiles

Mitch's custom unix configuration files
Shell
1
star
19

envy

Typesafe environment variable tools for node
JavaScript
1
star
20

bloom-filter

Persistance and hash-function agnostic bloom filter for Javascript and Typescript.
JavaScript
1
star
21

speedy-specs-talk

Lightning talk slides
1
star
22

Rails3Template

A useful template for starting rails 3 apps
Ruby
1
star
23

gotenv

Environment-variable based config for node
JavaScript
1
star
24

mcrowe.github.com

Mitch Crowe's personal blog
JavaScript
1
star
25

routes-example-app

Playing around with route nesting strategies
Ruby
1
star
26

with_object

Syntax sugar for calling a sequence of methods on a Ruby object
Ruby
1
star
27

things

Ruby
1
star
28

ts-repl

A Typescript REPL
JavaScript
1
star
29

regame

A React-inspired 2d game engine for Typescript.
JavaScript
1
star
30

roast-framework

An insanely simple, functional library for building user interfaces.
CoffeeScript
1
star
31

cc-jukebox

Jukebox rails example for cohort 8
Ruby
1
star
32

babel-plugin-react-cl

Babel plugin which gives you a shorthand for defining classNames in JSX
JavaScript
1
star
33

typerouter

A simple typesafe(ish) router for typescript.
JavaScript
1
star