Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change form_group_builder method to public #301

Closed
wants to merge 1 commit into from

Conversation

antpaw
Copy link
Contributor

@antpaw antpaw commented Oct 24, 2016

I would like to have this method as a public method. With it i can pass in a block for just the input, and not care about error, help or label text. I can add docs, tests and changelog if this is considered a good idea.

Example:

<%= f.form_group_builder :signup_ends, wrapper_class: 'js-datepicker' do %>
  <div class="row">
    <div class="col-xs-6 col-lg-4">
      <input type="text" class="form-control js-date" required="required">
    </div>
    <div class="col-xs-4 col-lg-3">
      <input type="text" class="form-control js-time" required="required">
    </div>
    <%= f.hidden_field(:signup_ends, class: 'js-timestamp')) %>
  </div>
<% end %>

@mattbrictson
Copy link
Contributor

It has been a while since I've reviewed the code, so could you refresh my memory: what is the difference between form_group and form_group_builder? I assume that form_group is not what you need for your use case, but could you explain that in more detail?

I'm not opposed to making form_group_builder public if I first understand its intended usage. Maybe you could share a draft of the documentation you plan on adding for it? Thanks!

@mattbrictson mattbrictson mentioned this pull request Dec 9, 2016
@antpaw
Copy link
Contributor Author

antpaw commented Dec 10, 2016

Hi, no problem, here is the difference, its much more convienient for me to use the form_group_builder because i don't need to care about about error, help or label elements, they will just be appended if needed

form_group_builder:

<div class="form-group">
   <label class="control-label" for="player_is_captain">Is Captain</label>
   <div class="form-check"><label class="form-check-label" for="player_is_captain">
      <input name="player[is_captain]" type="hidden" value="0">
      <input class="form-check-input" type="checkbox" value="1" checked="checked" name="player[is_captain]" id="player_is_captain"> 
      Is Captain
   </label>
</div>
</div>

form_group:

<div class="form-group">
  <div class="form-check">
     <label class="form-check-label" for="player_is_captain">
        <input name="player[is_captain]" type="hidden" value="0">
        <input class="form-check-input" type="checkbox" value="1" checked="checked" name="player[is_captain]" id="player_is_captain"> 
        Is Captain</label>
    </div>
</div>

@mattbrictson
Copy link
Contributor

Closed in favor of #289.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants