class Panko::Crud
Public Instance Methods
build()
click to toggle source
Calls superclass method
Panko::Base#build
# File lib/panko/crud.rb, line 6 def build super add_index add_show add_new_or_edit end
Private Instance Methods
add_index()
click to toggle source
# File lib/panko/crud.rb, line 21 def add_index add_breadcrumb t("#{t_scope}.index.title"), index_path end
add_new_or_edit()
click to toggle source
# File lib/panko/crud.rb, line 31 def add_new_or_edit if new? add_breadcrumb t("#{t_scope}.new.title"), nil elsif edit? add_breadcrumb t("#{t_scope}.edit.title"), nil end end
add_show()
click to toggle source
# File lib/panko/crud.rb, line 25 def add_show if persisted_record add_breadcrumb persisted_record.to_s, show_path end end
edit?()
click to toggle source
# File lib/panko/crud.rb, line 60 def edit? %w[edit update].include?(controller.action_name) end
index_context()
click to toggle source
# File lib/panko/crud.rb, line 52 def index_context [ record_class ] end
index_path()
click to toggle source
# File lib/panko/crud.rb, line 44 def index_path url_for(index_context) end
new?()
click to toggle source
# File lib/panko/crud.rb, line 64 def new? %w[new create].include?(controller.action_name) end
record_class()
click to toggle source
# File lib/panko/crud.rb, line 15 def record_class # E.g. "EmployeesBreadcrumbs" -> Employee. self.class.name.sub(/Breadcrumbs$/, "") .singularize.constantize end
show_context()
click to toggle source
# File lib/panko/crud.rb, line 56 def show_context [ persisted_record ] end
show_path()
click to toggle source
# File lib/panko/crud.rb, line 48 def show_path url_for(show_context) end
t_scope()
click to toggle source
# File lib/panko/crud.rb, line 39 def t_scope # E.g. "employees". record_class.name.tableize end