!!!
%html{ :lang => 'en' }
  %head
    %link{:href => "stylesheets/stylesheet.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}/
    = js 'jquery-1.4.3.min'
    = js 'jquery.scrollTo-1.4.2'
    = js 'jquery.timer'
    
    = js 'picky.extensions'
    = js 'picky.translations'
    = js 'picky.data'
    = js 'picky.view'
    = js 'picky.backend'
    = js 'picky.controller'
    = js 'picky.client'
    = js 'picky.addination'
    = js 'picky.results_renderer'
    = js 'picky.allocation_renderer'
    = js 'picky.allocations_cloud'
    
    / = js 'picky.min'
  %body
    %img{:src => "images/picky.png"}/
    %p
      %a{:href => "http://floere.github.com/picky"} To the Picky Homepage
      \/
      %a{:href => '/configure' } Configuring this app server
    %p
      Try a few examples
      = succeed ":" do
        %span.explanation (on a simple database with 540 books - note that the server is on Heroku and needs a little time to ramp up)
    %p
      A simple word,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('alan');"} alan
      %span.explanation
        (Finds Alan in the title, and Alans who wrote books. The title is ranked higher due to weighing.)
        %span
    %p
      With qualifier,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('title:women');"} title:women
      %span.explanation
        (Finds "women*" just in titles.)
        %span
    %p
      With similarity,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('pinchn~');"} pinchn~
      %span.explanation (Finds "pynchon", note: Only title in example with similarity. Uses a combination of double metaphone and Levenshtein.)
    %p
      More complex,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('title:lyterature~');"} title:lyterature~
      %span.explanation (Finds similar titles)
    %p
      With choice,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('sp');"} sp
      %span.explanation (Finds "sp*" in multiple categories. Choose the one you're looking for.)
    %p
      More complex,
      = succeed "." do
        %a{:href => "#", :onclick => "pickyClient.insert('soc* s');"} soc* s
      %span.explanation (this is where Picky really shines, "the title started with soc, and the author starts with s")
    = Picky::Helper.cached_interface
    :javascript
      pickyClient = new PickyClient({
        // A full query displays the rendered results.
        //
        full: '/search/full',
        
        // A live query just updates the count.
        //
        live: '/search/live',
        
        // showResultsLimit: 10, // Optional. Default is 10.
        
        // before: function(params, query, offset) {  }, // Optional. Before Picky sends any data.
        // success: function(data, query) {  }, // Optional. Just after Picky receives data. (Get a PickyData object)
        // after: function(data, query) {  }, // Optional. After Picky has handled the data and updated the view.
        
        // This is used to generate the correct query strings, localized. E.g. "subject:war".
        // Optional. If you don't give these, the field identifier given in the Picky server is used.
        //
        qualifiers: {
          en:{
            subjects:  'subject'
          }
        },
        
        // This is used to explain the preceding word in the suggestion text, localized. E.g. "Peter (author)".
        // Optional. Default are the field identifiers from the Picky server.
        //
        explanations: {
          en:{
            title:     'titled',
            author:    'written by',
            isbn:      'ISBN-13',
            year:      'published in',
            publisher: 'published by',
            subjects:  'topics'
          }
        }
      });
      
      // An initial search text, prefilled.
      //
      pickyClient.insert('italy');