Module: Ezframe::MainPageKit::Detail

Included in:
Ezframe::MainEditor
Defined in:
lib/ezframe/main_page_kit.rb

Overview

詳細表示

Instance Method Summary collapse

Instance Method Details

#list_for_index(where: nil) ⇒ Object

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



217
218
219
220
221
222
223
# 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_pageObject



186
187
188
189
190
191
192
193
194
195
196
# 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_tableObject

詳細ページの表の生成



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# 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