Fix archive module back end pagination and front end html

This commit is contained in:
chris 2013-02-06 16:26:17 +08:00
parent 1f11293fbe
commit 236f68ba84
7 changed files with 30 additions and 27 deletions

View File

@ -13,6 +13,7 @@ class Panel::Archive::BackEnd::ArchiveFilesController < OrbitBackendController
respond_to do |format|
format.html # index.html.erb
format.js
format.xml { render :xml => @archive_files }
end
end

View File

@ -12,5 +12,9 @@ class ArchiveFileCategory
has_many :archive_files
validates :title, :at_least_one => true
def self.from_id(id)
ArchiveFileCategory.find(id) rescue nil
end
end

View File

@ -1,30 +1,30 @@
<tr id="<%= dom_id post %>" class="with_action">
<tr id="<%= dom_id archive_file %>" class="with_action">
<td>
<% if post.is_top? %>
<% if archive_file.is_top? %>
<span class="label label-success"><%= t(:top) %></span>
<% end %>
<% if post.is_hot? %>
<% if archive_file.is_hot? %>
<span class="label label-important"><%= t(:hot) %></span>
<% end %>
<% if post.is_hidden? %>
<% if archive_file.is_hidden? %>
<span class="label"><%= t(:hidden) %></span>
<% end %>
<% if is_manager?%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('archive_file.edit'), edit_panel_archive_back_end_archive_file_path(post) %></li>
<li><%= link_to t('archive_file.delete'), panel_archive_back_end_archive_file_path(post), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
<li><%= link_to t('archive_file.edit'), edit_panel_archive_back_end_archive_file_path(archive_file) %></li>
<li><%= link_to t('archive_file.delete'), panel_archive_back_end_archive_file_path(archive_file), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
</ul>
</div>
<%end%>
</td>
<td><%= post.archive_file_category.title %></td>
<td><%= archive_file.archive_file_category.title %></td>
<td>
<%= link_to post.title, panel_archive_front_end_archive_file_path(post) %>
<%= link_to archive_file.title, panel_archive_front_end_archive_file_path(archive_file) %>
</td>
<td>
<% post.tags.each do |tag| %>
<% archive_file.tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %>
</td>

View File

@ -10,14 +10,11 @@
<th class="span1-2"><%= t('archive_file.tags') %></th>
</tr>
</thead>
<tbody>
<% @archive_files.each do |post| %>
<%= render :partial => 'archive_files', :locals => {:post => post} %>
<% end %>
<tbody id="tbody_archive">
<%= render :partial => 'archive_file', :collection => @archive_files %>
</tbody>
</table>
<%= paginate @archive_files %>
<div id="archive_pagination">
<%= paginate @archive_files %>
</div>

View File

@ -0,0 +1,2 @@
$("#tbody_archive").html("<%= j render :partial => 'archive_file', :collection => @archive_files %>");
$("#archive_pagination").html("<%= j paginate @archive_files %>");

View File

@ -4,17 +4,17 @@
<%#= paginate @archive_files, :params => {:inner => false}%>
<% if @title %>
<h1 class="h1"><%= @title %></h1>
<% end %>
<%# if @title %>
<!-- <h1 class="h1"><%#= @title %></h1> -->
<%# end %>
<ul class="subm">
<% @archive_file_categorys.each do |afcpost| %>
<li><%= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li>
<% end %>
</ul>
<!-- <ul class="subm"> -->
<%# @archive_file_categorys.each do |afcpost| %>
<!-- <li><%#= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li> -->
<%# end %>
<!-- </ul> -->
<h3><%= @archive_files.first.archive_file_category.title rescue nil %></h3>
<h3><%= @current_category.title rescue nil %></h3>
<% @archive_files.each do |post| %>

View File

@ -3,7 +3,6 @@ Rails.application.routes.draw do
namespace :panel do
namespace :archive do
namespace :back_end do
root :to => "archive_files#index"
resources :archive_files
resources :archive_file_categorys
resources :tags