classiccms 0.5.14 → 0.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/classiccms/controllers/website.rb +1 -1
 - data/lib/classiccms/helpers.rb +10 -8
 - data/lib/classiccms/version.rb +1 -1
 - data/spec/helpers_spec.rb +1 -1
 - metadata +2 -2
 
    
        data/lib/classiccms/helpers.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
                     
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       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 
     | 
    
         
            -
                       
     | 
| 
      
 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 
     | 
    
         
            -
                   
     | 
| 
      
 79 
     | 
    
         
            +
                  return html
         
     | 
| 
       78 
80 
     | 
    
         
             
                end
         
     | 
| 
       79 
81 
     | 
    
         
             
                def get_unique_number(hash, number)
         
     | 
| 
       80 
82 
     | 
    
         
             
                  if hash[number] == nil
         
     | 
    
        data/lib/classiccms/version.rb
    CHANGED
    
    
    
        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  
     | 
| 
      
 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. 
     | 
| 
      
 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- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-09-14 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rspec
         
     |