fix cmtool pages index
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
.bundle/
|
||||
log/*.log
|
||||
pkg/
|
||||
*.swp
|
||||
spec/dummy/db/*.sqlite3
|
||||
spec/dummy/log/*.log
|
||||
spec/dummy/tmp/
|
||||
|
||||
@@ -3,7 +3,7 @@ module Cmtool
|
||||
# GET /pages
|
||||
# GET /pages.xml
|
||||
def index
|
||||
@pages = ::Page.all.sort_by{|p| "#{p.parent.presence.try(:reverse) || p.name}#{p.position.to_s.rjust(6, "0")}" }
|
||||
#@pages = ::Page.all.sort_by{|p| "#{p.parent.presence.try(:reverse) || p.name}#{p.position.to_s.rjust(6, "0")}" }
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
|
||||
@@ -15,7 +15,7 @@ module Cmtool
|
||||
|
||||
#== VALIDATIONS
|
||||
klass.validates_presence_of :email
|
||||
klass.validates_uniqueness_of :email
|
||||
klass.validates_uniqueness_of :email, if: lambda{ |u| u.email.present? }
|
||||
klass.validates_presence_of :encrypted_password, if: lambda{ |u| u.email.present? }
|
||||
klass.validates_confirmation_of :password, if: lambda{ |u| u.password.present? }
|
||||
|
||||
|
||||
Binary file not shown.
@@ -50,6 +50,14 @@ RSpec.configure do |config|
|
||||
fill_in 'user[password]', with: @user.password
|
||||
click_on 'Sign in'
|
||||
end
|
||||
|
||||
def create_pages_tree
|
||||
root1 = Page.create(name: 'root1', locale: 'en')
|
||||
root2 = Page.create(name: 'root2', locale: 'en')
|
||||
child1_1 = Page.create( name: 'child1.1', locale: 'en', parent: root1 )
|
||||
child2_1 = Page.create( name: 'child2.1', locale: 'en', parent: root2 )
|
||||
child2_2 = Page.create( name: 'child2.2', locale: 'en', parent: root2 )
|
||||
end
|
||||
# ## Mock Framework
|
||||
#
|
||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||
|
||||
Reference in New Issue
Block a user