Merge branch 'master' into 'master'
Master fix error for the admin's index page See merge request !4
This commit is contained in:
commit
526ceabda0
|
@ -1,16 +1,22 @@
|
||||||
class Admin::ArchiveFilesController < OrbitAdminController
|
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
|
def index
|
||||||
if ArchiveSortOrder.count == 0
|
if ArchiveSortOrder.count == 0
|
||||||
ArchiveSortOrder.new('sort_order' => false).save
|
ArchiveSortOrder.new('sort_order' => false).save
|
||||||
end
|
end
|
||||||
if !params['order_asc'].nil?
|
if !(params['order_asc'].nil?)
|
||||||
if params['order_asc'] == 'true'
|
if params['order_asc'] == 'true'
|
||||||
ArchiveSortOrder.first.update_attributes('sort_order' => true)
|
ArchiveSortOrder.first.update_attributes('sort_order' => true)
|
||||||
elsif params['order_asc'] == 'false'
|
elsif params['order_asc'] == 'false'
|
||||||
ArchiveSortOrder.first.update_attributes('sort_order' => false)
|
ArchiveSortOrder.first.update_attributes('sort_order' => false)
|
||||||
end
|
end
|
||||||
else
|
|
||||||
ArchiveSortOrder.first.update_attributes('sort_order' => false)
|
|
||||||
end
|
end
|
||||||
@choose = ArchiveSortOrder.first['sort_order']
|
@choose = ArchiveSortOrder.first['sort_order']
|
||||||
@table_fields = [:status, :category, :title, :updated_at,:last_modified,"archive.downloaded_times"]
|
@table_fields = [:status, :category, :title, :updated_at,:last_modified,"archive.downloaded_times"]
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<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">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if can_edit_or_delete?(archive) %>
|
<% if can_edit_or_delete?(archive) %>
|
||||||
|
|
|
@ -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'>
|
<form method="get" action='?' name='order_form'>
|
||||||
|
<input type='hidden' name='order_asc' value=''>
|
||||||
<nobr>
|
<nobr>
|
||||||
<%= t('archive.choose_order')+':' %>
|
<%= t('archive.choose_order')+':' %>
|
||||||
<% if @choose %>
|
<% 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 %>
|
<% 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 %>
|
<% end %>
|
||||||
</nobr>
|
</nobr>
|
||||||
</form>
|
</form>
|
|
@ -1,6 +1,7 @@
|
||||||
en:
|
en:
|
||||||
|
|
||||||
archive:
|
archive:
|
||||||
|
no_page: You have to create at least one page for archive module
|
||||||
choose_order: Order with ascending
|
choose_order: Order with ascending
|
||||||
"yes": "Yes"
|
"yes": "Yes"
|
||||||
"no": "No"
|
"no": "No"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
|
||||||
archive:
|
archive:
|
||||||
|
no_page: 請至少為檔案室模組新增一頁內容頁
|
||||||
choose_order: 升序排列
|
choose_order: 升序排列
|
||||||
"yes": 是
|
"yes": 是
|
||||||
"no": 否
|
"no": 否
|
||||||
|
|
Loading…
Reference in New Issue