fix cmtool pages index

This commit is contained in:
2012-06-22 13:32:05 +02:00
parent 3e7c25a3fb
commit 0a10dada4d
5 changed files with 11 additions and 2 deletions
+1
View File
@@ -1,6 +1,7 @@
.bundle/
log/*.log
pkg/
*.swp
spec/dummy/db/*.sqlite3
spec/dummy/log/*.log
spec/dummy/tmp/
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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.
+8
View File
@@ -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: