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

input appended to input #729

Open
yucjk0120 opened this issue May 22, 2024 · 1 comment
Open

input appended to input #729

yucjk0120 opened this issue May 22, 2024 · 1 comment

Comments

@yucjk0120
Copy link

I want to create input group like this with bootstrap_form.
image
It is made by following code.

<div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Username" aria-label="Username">
  <span class="input-group-text">@</span>
  <input type="text" class="form-control" placeholder="Server" aria-label="Server">
</div>

So, I thought it works well appending '@' and domain part input to username input.

= f.text_field :username, append: ['@', f.text_field_without_bootstrap(:domain)]

But this made...
image

As L83 in lib/bootstrap_form/helpers/bootstrap.rb

      def input_group_content(content)
        return content if content.include?("btn")

        tag.span(content, class: "input-group-text")
      end

Other than btn tag, appending or prepending content will be surrounded by span tags.

Is there any prefer usage? or it may accept some input tags?

@yucjk0120
Copy link
Author

yucjk0120 commented May 22, 2024

Otherwise I can avoid this adding meaningless 'btn' string into apending content....

= f.text_field :username, append: ['@', f.text_field_without_bootstrap(:domain, btn: 'btn')]

😢

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

No branches or pull requests

1 participant