Hide redirected pages in collection for parent ids.
This commit is contained in:
parent
65e41efc18
commit
c3ca3e23f9
3 changed files with 4 additions and 2 deletions
|
@ -96,7 +96,7 @@ class PagesController < ApplicationController
|
|||
end
|
||||
|
||||
def all
|
||||
@pages = Page.all :order => 'updated_at DESC', :conditions => {:redirect => nil}
|
||||
@pages = Page.non_redirected.all :order => 'updated_at DESC'
|
||||
end
|
||||
|
||||
def version
|
||||
|
|
|
@ -30,6 +30,8 @@ class Page < ActiveRecord::Base
|
|||
before_validation_on_update :update_permalink
|
||||
after_update :create_redirect
|
||||
|
||||
named_scope :non_redirected, :conditions => {:redirect => nil}
|
||||
|
||||
def self.permalink(title)
|
||||
title.gsub(/[\/\.,;@\s]/, "_").gsub(/[\"\']/, "")
|
||||
end
|
||||
|
|
|
@ -97,6 +97,6 @@
|
|||
|
|
||||
= link_to "Abbrechen", @page
|
||||
| Oberseite ändern:
|
||||
= collection_select(:page, :parent_id, Page.all, :id, :permalink, {:prompt => "Neue Oberseite?", :include_blank => true})
|
||||
= collection_select(:page, :parent_id, Page.non_redirected, :id, :permalink, {:prompt => "Neue Oberseite?", :include_blank => true})
|
||||
|
||||
%div(style="clear:right; height:1px")
|
||||
|
|
Loading…
Reference in a new issue