lib/ezframe/editor.rb in ezframe-0.2.0 vs lib/ezframe/editor.rb in ezframe-0.3.0
- old
+ new
@@ -27,22 +27,22 @@
text
end
}
tr_a = data_a.map do |data|
@column_set.clear
- @column_set.values = data
+ @column_set.set_value(data, from_db: true)
line = idx_keys.map do |key|
view = @column_set[key].view
Ht.td(Ht.a(href: "#{make_base_url(data[:id])}", child: view))
end
Ht.tr(line)
end
th_a = idx_keys.map {|key| Ht.th(@column_set[key.to_sym].label) }
thead = Ht.thead(Ht.tr(th_a))
tbody = Ht.tbody(tr_a)
table_id = "enable_datatable_#{@class_snake}"
- return Ht.table(id: table_id, class: %w[enable_datatable], child: [ thead, tbody ], event: "on=load:command=enable_datatable:target=##{table_id}:size=10")
+ return Ht.table(id: table_id, class: %w[enable_datatable], child: [ thead, tbody ], ezload: "command=enable_datatable:target=##{table_id}:size=10")
end
# 新規登録フォーム表示
def public_create_get
@column_set.clear
@@ -92,11 +92,11 @@
end
#--------------------------------------------------------------------------------------------------------
# 検索
def public_search_post
- Logger.info "public_search_post: #{@parsed_body.inspect}"
+ EzLog.info "public_search_post: #{@parsed_body.inspect}"
sch_keys = @search_keys || @column_set.keys
word = @params["word"]
pattern = "%#{word}%"
pattern_a = sch_keys.map {|key| Sequel.like(key, pattern) }
data_a = @dataset.where(Sequel.|(*pattern_a)).all
@@ -105,11 +105,11 @@
show_base_template(title: Message[:search_result_page_title], body: Html.convert(layout))
end
# 詳細表示
def show_detail_page
- Logger.info "show_detail_page: #{@request.params.inspect}"
+ EzLog.info "show_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
layout = main_layout(center: make_detail_table)
@@ -144,10 +144,10 @@
# URLからのIDの取得
def get_id(class_name = nil)
class_name ||= @class_snake
params = @request.env['url_params']
return nil unless params
- # Logger.info "get_id: #{params.inspect}, #{class_name}"
+ # EzLog.info "get_id: #{params.inspect}, #{class_name}"
return params[class_name.to_sym]
end
# 値の更新
def update_value