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| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.js
format.xml { render :xml => @archive_files } format.xml { render :xml => @archive_files }
end end
end end

View File

@ -12,5 +12,9 @@ class ArchiveFileCategory
has_many :archive_files has_many :archive_files
validates :title, :at_least_one => true validates :title, :at_least_one => true
def self.from_id(id)
ArchiveFileCategory.find(id) rescue nil
end
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> <td>
<% if post.is_top? %> <% if archive_file.is_top? %>
<span class="label label-success"><%= t(:top) %></span> <span class="label label-success"><%= t(:top) %></span>
<% end %> <% end %>
<% if post.is_hot? %> <% if archive_file.is_hot? %>
<span class="label label-important"><%= t(:hot) %></span> <span class="label label-important"><%= t(:hot) %></span>
<% end %> <% end %>
<% if post.is_hidden? %> <% if archive_file.is_hidden? %>
<span class="label"><%= t(:hidden) %></span> <span class="label"><%= t(:hidden) %></span>
<% end %> <% end %>
<% if is_manager?%> <% if is_manager?%>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills hide"> <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.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(post), :confirm => t('sure?'), :method => :delete, :remote => true %></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> </ul>
</div> </div>
<%end%> <%end%>
</td> </td>
<td><%= post.archive_file_category.title %></td> <td><%= archive_file.archive_file_category.title %></td>
<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>
<td> <td>
<% post.tags.each do |tag| %> <% archive_file.tags.each do |tag| %>
<span class="label label-tags"><%= tag[I18n.locale] %></span> <span class="label label-tags"><%= tag[I18n.locale] %></span>
<% end %> <% end %>
</td> </td>

View File

@ -10,14 +10,11 @@
<th class="span1-2"><%= t('archive_file.tags') %></th> <th class="span1-2"><%= t('archive_file.tags') %></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody id="tbody_archive">
<%= render :partial => 'archive_file', :collection => @archive_files %>
<% @archive_files.each do |post| %>
<%= render :partial => 'archive_files', :locals => {:post => post} %>
<% end %>
</tbody> </tbody>
</table> </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}%> <%#= paginate @archive_files, :params => {:inner => false}%>
<% if @title %> <%# if @title %>
<h1 class="h1"><%= @title %></h1> <!-- <h1 class="h1"><%#= @title %></h1> -->
<% end %> <%# end %>
<ul class="subm"> <!-- <ul class="subm"> -->
<% @archive_file_categorys.each do |afcpost| %> <%# @archive_file_categorys.each do |afcpost| %>
<li><%= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li> <!-- <li><%#= link_to afcpost.title, panel_archive_front_end_archive_files_path(:category_id => afcpost.id) %></li> -->
<% end %> <%# end %>
</ul> <!-- </ul> -->
<h3><%= @archive_files.first.archive_file_category.title rescue nil %></h3> <h3><%= @current_category.title rescue nil %></h3>
<% @archive_files.each do |post| %> <% @archive_files.each do |post| %>

View File

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