Merge branch 'master' into 'master'

Master

fix error for the admin's index page

See merge request !4
This commit is contained in:
wmcheng 2019-09-17 00:14:19 +08:00
commit 526ceabda0
5 changed files with 22 additions and 6 deletions

View File

@ -1,16 +1,22 @@
class Admin::ArchiveFilesController < OrbitAdminController
def show
module_pages = Page.where(:module => 'archive').collect{|p| p.url}
if module_pages.length<1
render :text => t('archive.no_page').to_s
else
redirect_to '/' + I18n.locale.to_s + module_pages[0] + '?title=' + params['title'].to_s
end
end
def index
if ArchiveSortOrder.count == 0
ArchiveSortOrder.new('sort_order' => false).save
end
if !params['order_asc'].nil?
if !(params['order_asc'].nil?)
if params['order_asc'] == 'true'
ArchiveSortOrder.first.update_attributes('sort_order' => true)
elsif params['order_asc'] == 'false'
ArchiveSortOrder.first.update_attributes('sort_order' => false)
end
else
ArchiveSortOrder.first.update_attributes('sort_order' => false)
end
@choose = ArchiveSortOrder.first['sort_order']
@table_fields = [:status, :category, :title, :updated_at,:last_modified,"archive.downloaded_times"]

View File

@ -25,7 +25,7 @@
<% end %>
</td>
<td>
<a href="#" target="_blank"><%= archive.title %></a>
<a href="/admin/archive_files/show?title=<%= archive.title %>" target="_blank"><%= archive.title %></a>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(archive) %>

View File

@ -1,10 +1,18 @@
<script>
function change_order(){
var value = $("form[name='order_form']").find("input[type='checkbox']")[0].checked
$("input[name='order_asc']").val(String(value))
document.order_form.submit()
}
</script>
<form method="get" action='?' name='order_form'>
<input type='hidden' name='order_asc' value=''>
<nobr>
<%= t('archive.choose_order')+':' %>
<% if @choose %>
<input type="checkbox" name="order_asc" value="false" onchange='document.order_form.submit()' checked><span><%= t('archive.yes') %></span>
<input type="checkbox" onchange='change_order()' checked><span><%= t('archive.yes') %></span>
<% else %>
<input type="checkbox" name="order_asc" value="true" onchange='document.order_form.submit()'><span><%= t('archive.no') %></span>
<input type="checkbox" onchange='change_order()'><span><%= t('archive.no') %></span>
<% end %>
</nobr>
</form>

View File

@ -1,6 +1,7 @@
en:
archive:
no_page: You have to create at least one page for archive module
choose_order: Order with ascending
"yes": "Yes"
"no": "No"

View File

@ -1,6 +1,7 @@
zh_tw:
archive:
no_page: 請至少為檔案室模組新增一頁內容頁
choose_order: 升序排列
"yes":
"no":