Sha256: 90905de5bf273f33cbfdbec3d787670af02814ca5c746619a9fc1e0cd381a8ff

Contents?: true

Size: 816 Bytes

Versions: 26

Compression:

Stored size: 816 Bytes

Contents

module Sunrise
  module StructureHelper
    def manage_structure_path(record, options = {})
      return "#" if record.nil?
      options = {:parent_id => record.id, :parent_type => 'Structure'}.merge(options)
      
      case record.structure_type.kind
      when :page then edit_path(:model_name => "pages", :id => record.id)
      when :posts then index_path(options.merge({:model_name => record.structure_type.kind}))
      else edit_path(:model_name => "structures", :id => record.id)
      end
    end

    def show_model_path(abstract_model, record)
      model_name = abstract_model.plural

      case model_name
      when :some_collection then index_path(:model_name => :stores, :parent_type => :some_collection, :parent_id => record.id)
      else show_path(:id => record.id)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
sunrise-cms-1.0.6 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.5 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.4 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.3 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.2 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.1 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.0 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.0.rc3 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.0.rc2 app/helpers/sunrise/structure_helper.rb
sunrise-cms-1.0.0.rc1 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.7.0.rc2 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.7.0.rc1 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.11 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.10 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.9 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.8 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.7 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.6 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.5 app/helpers/sunrise/structure_helper.rb
sunrise-cms-0.6.4 app/helpers/sunrise/structure_helper.rb