<%= form_for @movie, html: { multipart: true, class: 'square' } do |f| %>
  <%= render 'shared/errors', messages: @movie.errors.full_messages %>

  <% if @movie.file %>
    <%= link_to "View File", edit_data_file_path(@movie.file), class: 'button tiny' %>
  <% end %>

  <div class="fields horizontal">
    <%= f.label :name %>
    <%= f.text_field :name, { value: @movie.file.to_s } %>
  </div>
  <div class="fields horizontal">
    <%= f.label :category_id %>
    <%= f.select :category_id, Category.ordered.collect { |c| ["#{c.domains[c.domain]} - #{c}", c.id] } %>
  </div>
  <div class="fields horizontal">
    <%= f.label :content %>
    <%= f.text_field :content %>
  </div>
  <div class="fields horizontal">
    <%= f.label :format %>
    <%= f.text_field :format %>
  </div>
  <div class="fields horizontal">
    <%= f.label :length, "Length in seconds" %>
    <%= f.text_field :length %>
  </div>
  <div class="fields horizontal">
    <%= f.label :user_name, "Author" %>
    <%= f.text_field :user_name, { value: @movie.get_user } %>
  </div>
  <div class="fields horizontal">
    <%= f.label :file %>
    <div class="inputs">
      <%= f.select :file_id, DataFile.movies.collect { |d| ["#{d.name}", d.id] }, { include_blank: true } %>  
    </div>
  </div>
  <div class="fields horizontal">
    <%= f.label :preview_id %>
    <%= f.select :preview_id, @movie.all_files.collect { |d| ["#{d.name}", d.id] }, { include_blank: true } %>
  </div>
  <div class="fields horizontal">
    <%= f.label :picture %>
    <%= f.file_field :picture %>
  </div>

  <div class="controls">
    <%= f.submit 'Save' %>
  </div>
<% end %>
