<div class="header">
  <h1>Lägg till sida</h1>
</div>
<div id="content">
  <%= form_for [:admin, @item], :as => :item, :url => admin_items_path do |f| %>
    <%= render 'admin/shared/error_messages', :object => f.object %>
    <%= hidden_field_tag 'type', params[:type] if params[:type] %>
    <%= hidden_field_tag 'page_template_id', params[:page_template_id] if params[:page_template_id] %>

    <%= f.label :title %>
    <div class="fullwidth"><%= f.text_field :title, :class => "title" %></div>

    <%= f.label :template_name %>
    <%= f.select :template_name, PageFileTemplate.all.collect { |t| [t.name.titlecase, t.handle] } %>

    <div class="submit">
      <%= f.submit t(:save), :class => 'commit' %> eller <%= link_to t(:cancel), admin_items_path(type: @item.class.model_name) %>
    </div>
  <% end %>
</div>
<div class="header">
  <h1>Lägg till sida</h1>
</div>
<div id="content">
  <%= form_for [:admin, @item], :as => :item, :url => admin_items_path do |f| %>
    <%= render 'admin/shared/error_messages', :object => f.object %>
    <%= hidden_field_tag 'type', params[:type] if params[:type] %>
    <%= hidden_field_tag 'page_template_id', params[:page_template_id] if params[:page_template_id] %>

    <%= f.label :title %>
    <div class="fullwidth"><%= f.text_field :title, :class => "title" %></div>

    <%= f.label :template_name %>
    <%= f.select :template_name, PageFileTemplate.all.sort_by(&:name).map { |t| [t.name.titlecase, t.handle] }, {}, class: "choose_me" %>

    <div class="submit">
      <%= f.submit t(:save), :class => 'commit' %> eller <%= link_to t(:cancel), admin_items_path(type: @item.class.model_name) %>
    </div>
  <% end %>
</div>
Sort PageFileTemplate by name and use chosen.js for select element
Sort PageFileTemplate by name and use chosen.js for select element
