classiccms 0.5.14 → 0.5.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,7 +36,7 @@ module Classiccms
36
36
  show index
37
37
  end
38
38
 
39
- use Dragonfly::Middleware, :image
39
+
40
40
  not_found do
41
41
  show :'404', views: File.join(Classiccms::ROOT, 'views/cms')
42
42
  end
@@ -60,21 +60,23 @@ module Classiccms
60
60
  end
61
61
  #renders all child pages of the given position (id)
62
62
  def section(section_name, parent_id = nil)
63
- html = {}
63
+ html = ""
64
64
  parent_id = get_parent_id(parent_id)
65
-
65
+ objects_to_render = {}
66
66
  Base.where(:'connections.parent_id' => parent_id, :'connections.section' => section_name, :'connections.file'.ne => nil).each do |record|
67
67
  connection = record.connections.where(:parent_id => parent_id, :section => section_name, :file.ne => nil).first
68
68
 
69
- #render html
70
- rendering = show connection.file, {views: ["app/views/#{record._type}", "app/views/#{record._type.downcase}"]}, {record: record}
71
- if html[connection.order_id] == nil
72
- html[connection.order_id] = rendering
69
+ if objects_to_render[connection.order_id] == nil
70
+ number = connection.order_id
73
71
  else
74
- html[get_unique_number(html, connection.order_id)] = rendering
72
+ number = get_unique_number(objects_to_render, connection.order_id)
75
73
  end
74
+ objects_to_render[number] = {:record => record, :connection => connection}
75
+ end
76
+ Hash[objects_to_render.sort].each do |k, object|
77
+ html += show object[:connection].file, {views: ["app/views/#{object[:record]._type}", "app/views/#{object[:record]._type.downcase}"]}, {record: object[:record]}
76
78
  end
77
- Hash[html.sort].map{|k,v| v}.join
79
+ return html
78
80
  end
79
81
  def get_unique_number(hash, number)
80
82
  if hash[number] == nil
@@ -1,3 +1,3 @@
1
1
  module Classiccms #:nodoc
2
- VERSION = "0.5.14"
2
+ VERSION = "0.5.15"
3
3
  end
data/spec/helpers_spec.rb CHANGED
@@ -168,7 +168,7 @@ describe Classiccms do
168
168
  last_response.body.should == "<h1>#{m.id}</h1>\n"
169
169
  end
170
170
  end
171
- it 'should return items base upon order_id' do
171
+ it 'should return items based upon order_id' do
172
172
  with_constants :CONFIG => {home: 'application/index5'} do
173
173
  set_file "views/application/index5.haml", "= section 'menu', 0"
174
174
  create_dir 'views/menu'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classiccms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.5.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-11 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec