photomix/app/views/collections/_form.html.erb
2012-07-30 23:08:48 +04:00

49 lines
1.9 KiB
Plaintext

<fieldset>
<div class="control-group">
<%= form.label :title, t('activerecord.models.collection.attributes.title'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_field :title, {:class => 'input-xlarge'} %>
</div>
</div>
<div class="control-group">
<%= form.label :description, t('activerecord.models.collection.attributes.description'), {:class => 'control-label'} %>
<div class="controls">
<%= form.text_area :description, {:class => 'input-xlarge', :rows => 5} %>
</div>
</div>
<div class="control-group">
<%= form.label :public, t('activerecord.models.collection.attributes.visible'), {:class => 'control-label'} %>
<div class="controls">
<label class="checkbox">
<%= check_box 'collection', :public %> <%= t(:make_visible_for_all) %>
</label>
</div>
</div>
<% unless @collection.albums.empty? %>
<%= form.label :albums %>
<% @collection.albums.each do |album| %>
<%= form.fields_for :album_list do |album_fields| %>
<%= image_tag "delete-24x24.png", :class => "delete", :alt => "Delete" -%>
<% if album.photos.empty? %>
<%= album.title %>
<% else %>
<%= image_tag album.photos.first.attachment.thumb.url, :alt => album.title %>
<% end %>
<%= album_fields.hidden_field album.id %>
<% end %>
<% end %>
<%
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) %>
<% end %>
</fieldset>