module Ezframe::MainPageKit::Detail

詳細表示

Public Instance Methods

list_for_index(where: nil) click to toggle source

一覧ページ用のデータリスト生成

# File lib/ezframe/main_page_kit.rb, line 217
def list_for_index(where: nil)
  where ||= {}
  where[:deleted_at] = nil
  sql = @column_set.dataset.where(where).order(@sort_key).sql
  EzLog.debug("list_for_index: #{sql}")
  return @column_set.dataset.where(where).order(@sort_key).all
end
make_detail_page() click to toggle source
# File lib/ezframe/main_page_kit.rb, line 186
def make_detail_page
  # EzLog.info "make_detail_page: #{@request.params.inspect}"
  id = get_id(@class_snake)
  unless @column_set.set_from_db(id)
    return show_message_page("no data", "data is not defined: #{id}")
  end
  right = nil
  right = right_tabs if @with_right_tabs
  layout = main_layout(center: make_detail_table, right: right)
  return show_base_template(title: Message[:customer_detail], body: Html.convert(layout))
end
make_detail_table() click to toggle source

詳細ページの表の生成

# File lib/ezframe/main_page_kit.rb, line 199
def make_detail_table
  table = []
  array = @column_set.map do |column|
    next if column.no_view?
    edit_btn = nil
    if column.type.to_s == "textarea"
      view = Ht.pre(id: "#{@class_snake}-#{column.key}-view", child: column.view)
    else
      view = Ht.span(id: "#{@class_snake}-#{column.key}-view", child: column.view)
    end
    table.push Ht.p(class: %w[hover-button-box], child: [Ht.small(column.label), view, edit_btn].compact)
  end
  edit_btn = Ht.button(id: "#{@class_snake}-detail-edit-button", class: %w[btn], child: [Ht.icon("edit"), Message[:edit_button_label]], ezevent: "on=click:url=#{make_base_url}/edit")
  table.push edit_btn
  return table
end