%= javascript_include_tag('control.rating.js') -%>
<%= tagged_image_browser(@beer) %>
<%= render :partial => 'pages/page' %>
<% content_for :script do -%>
after_opens['experienceDialog'] = function(){
var r = new Control.Rating('rating_div',
{
min: 1,
max: 10,
multiple: true,
input: 'experience_rating'
});
r.setValue(5);
}
<% end -%>
<% lightbox :title => 'Add a beverage experience', :window_id => 'experienceDialog' do -%>
How do you rate this experience? (1 for bad, 10 for great)
<%= hidden_field_tag 'experience_rating' %>
<%= hidden_field_tag 'beer_id', @beer.id %>
<%= link_to_remote 'Save', :url => experiences_path(:format => :xml),
:with => "'experience[rating]='+escape($('experience_rating').value)+'&experience[beer_id]='+escape($('beer_id').value)",
:success => "Control.Modal.close();new Effect.Highlight('experience_container', {duration: 1.5})",
:update => 'experience_container' -%> <%= link_to_function 'Cancel', 'Control.Modal.close()' -%>
<% end -%>
<% content_for :sidebar do -%>
<%= new_beer_link -%>
<%= edit_beer_link(@beer) -%>
<%= link_to 'Destroy', beer_path(@beer.page.title_for_url), :confirm => 'Are you sure?', :method => :delete %>
<% unless @beer.tagged_images.empty? -%><%= tagged_image_browser_link(@beer) -%>
<% end %>
<% if @experience -%><%= remove_experience_link(@experience) -%><% else -%><%= add_experience_link -%><% end %>
<%= pluralize(@beer.people.size, 'people') -%> have experienced this beer.
<% end -%>