module Ezframe::PageKit::Detail

詳細表示ページ生成キット

Public Instance Methods

button_for_detail_box(data) click to toggle source
# File lib/ezframe/single_page_kit.rb, line 181
def button_for_detail_box(data)
  buttons = [Ht.button(class: %w[btn right], ezevent: "on=click:url=#{make_base_url(data[:id])}/edit", child: [Ht.icon("edit"), Message[:edit_button_label]])]
  if @show_delete_button
    buttons.push(make_delete_button)
  end
  return Ht.div(class: %w[button-box], child: buttons)
end
make_detail_line(column) click to toggle source

詳細ページ用ボタン 詳細表示欄の一行を生成

# File lib/ezframe/single_page_kit.rb, line 172
def make_detail_line(column)
  view = column.view
  if view
    view = Ht.pre(view) if view.strip.index("\n")
    return Ht.p([Ht.small(column.label), view])
  end
  return nil
end
public_detail_post() click to toggle source

データ詳細表示

# File lib/ezframe/single_page_kit.rb, line 153
def public_detail_post
  @id ||= get_id
  data = @column_set.set_from_db(@id)
  target_keys = @detail_keys || @column_set.keys.select { |key| !@column_set[key].attribute[:no_view] }
  line_a = []
  target_keys.each do |key|
    column = @column_set[key]
    v = make_detail_line(column)
    line_a.push(v) if v
  end
  table = Ht.div(line_a)
  collection = Materialize::Collection.new
  # 詳細表示用のblockを追加
  collection.push(Ht.div(id: @dom_id[:detail], child: [button_for_detail_box(data), table]))
  return { inject: "##{@dom_id[:detail]}", body: Html.convert(collection.to_h) }
end