Module: Ezframe::PageKit::Detail

Included in:
SinglePageEditor
Defined in:
lib/ezframe/single_page_kit.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#button_for_detail_box(data) ⇒ Object



181
182
183
184
185
186
187
# 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) ⇒ Object

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



172
173
174
175
176
177
178
179
# 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_postObject

データ詳細表示



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# 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