Method: Effective::CrudController::Dsl#page_title

Defined in:
app/controllers/concerns/effective/crud_controller/dsl.rb

#page_title(label = nil, opts = {}, &block) ⇒ Object

page_title ‘My Title’, only: [:new]



65
66
67
68
69
70
71
72
73
74
# File 'app/controllers/concerns/effective/crud_controller/dsl.rb', line 65

def page_title(label = nil, opts = {}, &block)
  opts = label if label.kind_of?(Hash)
  raise 'expected a label or block' unless (label || block_given?)

  instance_exec do
    before_action(opts) do
      @page_title ||= (block_given? ? instance_exec(&block) : label).to_s
    end
  end
end