Sha256: 17249ed5748524da1318012015091dc24d8c7bc68360979bf8efbf8f0ca5b97f

Contents?: true

Size: 1.07 KB

Versions: 43

Compression:

Stored size: 1.07 KB

Contents

module Releaf::Builders::ResourceView
  include Releaf::Builders::View
  include Releaf::Builders::Resource
  include Releaf::Builders::Toolbox

  def section
    tag(:section, section_attributes) do
      section_content
    end
  end

  def section_content
    section_blocks
  end

  def section_header_text
    resource.new_record? ? t("Create new resource") : resource_title(resource)
  end

  def section_header_extras
    return unless feature_available? :toolbox
    tag(:div, class: "extras toolbox-wrap") do
      toolbox(resource, index_path: index_path)
    end
  end

  def section_body
    tag(:div, section_body_attributes) do
      section_body_blocks
    end
  end

  def section_body_attributes
    {class: ["body"]}
  end

  def section_body_blocks
    []
  end

  def footer_secondary_tools
    list = []
    list << back_to_list_button if back_to_list?
    list
  end

  def back_to_list?
    feature_available?(:index) && params[:index_path].present?
  end

  def back_to_list_button
    button(t("Back to list"), "caret-left", class: "secondary", href: index_path)
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
releaf-core-3.1.0 app/builders/releaf/builders/resource_view.rb
releaf-core-3.0.3 app/builders/releaf/builders/resource_view.rb
releaf-core-3.0.2 app/builders/releaf/builders/resource_view.rb
releaf-core-3.0.1 app/builders/releaf/builders/resource_view.rb
releaf-core-3.0.0 app/builders/releaf/builders/resource_view.rb
releaf-core-2.2.1 app/builders/releaf/builders/resource_view.rb
releaf-core-2.2.0 app/builders/releaf/builders/resource_view.rb
releaf-core-2.1.2 app/builders/releaf/builders/resource_view.rb
releaf-core-2.1.1 app/builders/releaf/builders/resource_view.rb
releaf-core-2.1.0 app/builders/releaf/builders/resource_view.rb
releaf-core-2.0.1 app/builders/releaf/builders/resource_view.rb
releaf-core-2.0.0 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.22 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.21 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.20 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.19 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.18 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.17 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.16 app/builders/releaf/builders/resource_view.rb
releaf-core-1.1.15 app/builders/releaf/builders/resource_view.rb