set/all/form_elements.rb in card-mod-edit-0.16.0 vs set/all/form_elements.rb in card-mod-edit-0.17.0

- old
+ new

@@ -40,9 +40,23 @@ define_method(method_name) do |*args| form.send(method_name, *args) end end + # Generates an HTML submit button with optional parameters. + # + # @param [Hash] args The options for the submit button. + # @option args [String] :text ("Submit") The text displayed on the button. + # @option args [String] :situation ("primary") The visual style of the button. + # Possible values: "primary", "secondary", "success", "danger", etc. + # @option args [Hash] :data ({}) Additional data attributes for the button. + # @option args [String] :disable_with ("Submitting") Text to display on the button + # while it is being submitted/disabled. + # + # @return [String] The HTML code for the submit button. + # + # @example + # submit_button(text: "Create", situation: "success", disable_with: "Creating") def submit_button args={} text = args.delete(:text) || "Submit" args.reverse_merge! situation: "primary", data: {} args[:data][:disable_with] ||= args.delete(:disable_with) || "Submitting" button_tag text, args