photomix/app/views/collections/_form.html.erb

39 lines
1.0 KiB
Plaintext

<%= form.label :title, :Title, {:class => 'big'} %><br />
<%= form.text_field :title, {:class => 'big'} %><br />
<%= form.label :description %><br />
<%= form.text_area :description %><br />
<% unless @collection.albums.empty? %>
<%= form.label :albums %><br />
<div id="collection_albums">
<% for album in @collection.albums %>
<%= form.fields_for :album_list do |album_fields| %>
<span>
<%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%>
<% if album.photos.empty? %>
<%= album.title %>
<% else %>
<%= image_tag album.photos.first.attachment.album.url, :alt => album.title %>
<% end %>
<%= album_fields.hidden_field album.id %>
</span>
<% end %>
<% end %>
</div>
<p class="clear">
<%
grouped_options = [
['Available albums',[['Choose album to add','']]],
['Not used', Album.unused.map{|album|[album.title, album.id]} ],
['In use', Album.used.map{|album|[album.title, album.id]} ]
]
grouped_options_for_select(grouped_options)
%>
<%= select_tag 'available_albums', grouped_options_for_select(grouped_options) %>
</p>
<% end %>