diff --git a/app/controllers/admin/archive_files_controller.rb b/app/controllers/admin/archive_files_controller.rb index d193043..5d5463a 100644 --- a/app/controllers/admin/archive_files_controller.rb +++ b/app/controllers/admin/archive_files_controller.rb @@ -39,7 +39,7 @@ class Admin::ArchiveFilesController < OrbitAdminController respond_to do |format| if @archive_file.save - format.html { redirect_to(admin_archive_files_path) } + format.html { redirect_to(edit_admin_archive_file_path(@archive_file.id)) } format.xml { render :xml => @archive_file, :status => :created, :location => @archive_file } else @tags = @module_app.tags @@ -58,7 +58,7 @@ class Admin::ArchiveFilesController < OrbitAdminController respond_to do |format| if @archive_file.update_attributes(archive_vars) - format.html { redirect_to(admin_archive_files_path(:page => params[:page])) } + format.html { redirect_to(edit_admin_archive_file_path(@archive_file.id)) } format.xml { head :ok } else format.html { render :action => "edit" } diff --git a/app/controllers/archives_controller.rb b/app/controllers/archives_controller.rb index 17c833f..a326ea7 100644 --- a/app/controllers/archives_controller.rb +++ b/app/controllers/archives_controller.rb @@ -20,7 +20,7 @@ class ArchivesController < ApplicationController } end files = [] - archive.archive_file_multiples.order_by(:sort_number=>'asc').each do |file| + archive.archive_file_multiples.order_by(:sort_number=>'desc').each do |file| if file.choose_lang.include?(I18n.locale.to_s) title = (file.file_title.blank? ? File.basename(file.file.path) : file.file_title) rescue "" extension = file.file.file.extension.downcase rescue "" diff --git a/app/views/admin/archive_files/_form.html.erb b/app/views/admin/archive_files/_form.html.erb index 58adaf0..badcfe0 100644 --- a/app/views/admin/archive_files/_form.html.erb +++ b/app/views/admin/archive_files/_form.html.erb @@ -3,11 +3,18 @@ <%= stylesheet_link_tag "lib/main-forms" %> <%= stylesheet_link_tag "lib/fileupload" %> <%= stylesheet_link_tag "lib/main-list" %> + <% end %> <% content_for :page_specific_javascript do %> <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/module-area" %> + <%= javascript_include_tag "lib/jquery-ui-sortable.min" %> <% end %> <%#= f.error_messages %> @@ -123,11 +130,20 @@
- +

+ <%= hidden_field_tag 'archive_file_multiple_field_count', @archive_file.archive_file_multiples.count %> + <%= t(:add) %> +

+
+
+
+
+ +
<% if @archive_file && !@archive_file.archive_file_multiples.blank? %> -
- <% @archive_file.archive_file_multiples.each_with_index do |archive_file_multiple, i| %> +
+ <% @archive_file.archive_file_multiples.desc(:sort_number).each_with_index do |archive_file_multiple, i| %> <%= f.fields_for :archive_file_multiples, archive_file_multiple do |f| %> <%= render :partial => 'form_file', :object => archive_file_multiple, :locals => {:f => f, :i => i} %> <% end %> @@ -135,40 +151,38 @@
<% end %> - - -
-
-

- <%= hidden_field_tag 'archive_file_multiple_field_count', @archive_file.archive_file_multiples.count %> - <%= t(:add) %> -

-
-
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %> <%= f.submit t('submit'), class: 'btn btn-primary' %> - Cancel + Back to Archives
<% content_for :page_specific_javascript do %>