Class: Ezframe::MainEditor
- Includes:
- EditorCommon
- Defined in:
- lib/ezframe/main_editor.rb
Instance Attribute Summary
Attributes inherited from PageBase
Instance Method Summary collapse
-
#make_index_top ⇒ Object
一覧ページの上部に表示するボタン等の生成.
-
#public_create_get ⇒ Object
新規登録フォーム表示.
-
#public_create_post ⇒ Object
新規登録受信.
-
#public_default_get ⇒ Object
一覧ページ生成.
-
#public_edit_post ⇒ Object
データ編集受信.
Methods included from EditorCommon
#get_id, #make_cancel_button, #make_delete_button, #make_edit_button, #show_label_edit, #show_label_view, #show_message_page, #update_value
Methods inherited from PageBase
#init_vars, #initialize, #login?, #make_base_url, #parse_json_body, #session, #set_request, #show_base_template, #user, #warden
Constructor Details
This class inherits a constructor from Ezframe::PageBase
Instance Method Details
#make_index_top ⇒ Object
一覧ページの上部に表示するボタン等の生成
20 21 22 |
# File 'lib/ezframe/main_editor.rb', line 20 def make_index_top end |
#public_create_get ⇒ Object
新規登録フォーム表示
25 26 27 28 29 30 |
# File 'lib/ezframe/main_editor.rb', line 25 def public_create_get @column_set.clear table = make_edit_form(:create) layout = main_layout(center: Ht.form(child: table), type: 2) show_base_template(title: Message[:parent_create_page_title], body: Html.convert(layout)) end |
#public_create_post ⇒ Object
新規登録受信
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ezframe/main_editor.rb', line 33 def public_create_post validation = @column_set.validate(@form) if @event[:branch] == "single_validate" EzLog.debug("public_create_post: single validate: event=#{@event}, form=#{@form}") return single_validation(validation, @event[:target_key]) end unless @form return { inject: "#center-panel", body: Ht.form(child: make_edit_form(:create)) } else if count_errors(validation) > 0 cmd_a = full_validation(validation) EzLog.debug("public_create_post: cmd_a=#{cmd_a}") return cmd_a if cmd_a.length > 0 end # 値の保存 id = create_data(@form) return { redirect: make_base_url(id) } end end |
#public_default_get ⇒ Object
一覧ページ生成
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/ezframe/main_editor.rb', line 7 def public_default_get @id = get_id if @id return make_detail_page else data_a = list_for_index div = [ Ht.div(id: "detail-top-area", child: make_index_top), Ht.div(id: "index-area", child: make_index_table(data_a)) ] layout = index_layout(center: Ht.form(child: div)) return show_base_template(title: Message[:index_page_title], body: Html.convert(layout)) end end |
#public_edit_post ⇒ Object
データ編集受信
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ezframe/main_editor.rb', line 55 def public_edit_post EzLog.debug("public_edit_post: #{@form}") @id = get_id validation = @column_set.validate(@form) if @event[:branch] == "single_validate" EzLog.debug("public_edit_post: single validate:event=#{@event}, form=#{@form}") return single_validation(validation, @event[:target_key]) end unless @form data = @column_set.set_from_db(@id) return ("no data", "data is not defined: #{@id}") unless data return { inject: "#center-panel", body: Html.convert(Ht.form(make_edit_form)) } else if count_errors(validation) > 0 cmd_a = full_validation(validation) return cmd_a end # 値を保存 update_data(@id, @form) return { redirect: make_base_url(@id) } end end |