Sha256: 17bd9c9bfb84ee94b6906e09c8b2a4a9b22d099a8a6738b058971903275a2fff

Contents?: true

Size: 629 Bytes

Versions: 14

Compression:

Stored size: 629 Bytes

Contents

module PushType
  module NodesHelper

    def nodes_array(nodes)
      nodes.map { |n| node_hash(n) }
    end

    def node_hash(asset)
      hash = [ :type, :title, :slug, :status, :published_at, :published_to, :new_record?, :published? ].inject({}) do |h, att|
        h.update att => asset.send(att)
      end
    end

    def node_back_link(node)
      if node.trashed?
        push_type_admin.trash_nodes_path
      elsif node.root?
        push_type_admin.nodes_path
      else
        push_type_admin.node_nodes_path(node.parent)
      end
    end

    def sortable?(node)
      !node || node.sortable?
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
push_type_admin-0.12.1 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.12.0 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.12.0.beta.1 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.11.2 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.11.1 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.11.0.beta.2 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.11.0.beta.1 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.4 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.3 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.2 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.1 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.0 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.0.beta.5 app/helpers/push_type/nodes_helper.rb
push_type_admin-0.10.0.beta.3 app/helpers/push_type/nodes_helper.rb