Method: Ezframe::SubEditor#public_edit_post

Defined in:
lib/ezframe/sub_editor.rb

#public_edit_postObject

データ編集受信



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ezframe/sub_editor.rb', line 46

def public_edit_post
  @id ||= get_id
  unless @event[:form]
    data = @column_set.set_from_db(@id)
    # データが空ならエラーページ
    return { inject: "##{edit_inject_element}", body: "データがありません: #{@id}"} unless data
    # フォームの表示
    form = make_edit_form
    found_a = Ht.search(form, tag: "input")
    found_a.each { |h| h.add_class("#{@class_snake}-edit-box") if h[:size] }
    return { inject: "##{edit_inject_element}", body: Html.convert(form) }
  else
    if @event[:cancel]
      data = @column_set.set_from_db(@id)
      return act_after_cancel
    else
      # 値を保存
      @column_set.update(@id, @event[:form])
    end
    return act_after_edit
  end
end