Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8021301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:56:20+00:00 2026-06-04T21:56:20+00:00

My navbar code looks like this: %header.navbar.navbar-fixed-top %div.navbar-inner %div.container %nav %ul.nav.pull-right – if user_signed_in?

  • 0

My navbar code looks like this:

%header.navbar.navbar-fixed-top
  %div.navbar-inner
    %div.container
      %nav
        %ul.nav.pull-right
          - if user_signed_in?
            %li= link_to "Sign out", '#'
          - else
            %li= link_to "Sign in", '#'

I am trying to get my navbar to look like that in the Bootstrap navbar page as shown here, however I’m not sure how to translate

<form class="navbar-search pull-left">
  <input type="text" class="search-query" placeholder="Search">
</form>

into Haml. My last attempt look like:

%header.navbar.navbar-fixed-top
  %div.navbar-inner
    %div.container
      %nav
        %ul.nav.pull-right
         %form.navbar-search
           %input.search-query
             - { :type => "text", :placeholder => "Search" }
         - if user_signed_in?
            %li= link_to "Sign out", '#'
          - else
            %li= link_to "Sign in", '#'

While the search bar appears with the proper CSS classes, the :type => "text" and :placeholder => "Search" portions do not exist in my html when I inspect it. How can I fix this? Thanks!

== EDIT ==

Perhaps to make this clearer – I’m using this in a rails 3 app and I realize that I should probably be using form_tag, but I’m not sure how to proceed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:56:22+00:00Added an answer on June 4, 2026 at 9:56 pm

    It should work like this:

    %header.navbar.navbar-fixed-top
      %nav.navbar-inner
        .container
          %ul.nav
            - if user_signed_in?
              %li= link_to "Sign out", '#'
            - else
              %li= link_to "Sign in", '#'
          = form_tag some_path, :class => "navbar-search pull-left", :method => :get do
            = text_field_tag :name, nil, :class => "search-query span3", :placeholder => "Search"
    

    Be careful with the indentation.

    I also advise you to try to start with rails app template and tutorial: http://railsapps.github.com/. As for a beginner it would be an excellent example of what and how to set up and how it should look like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this Twitter Bootstrap code <div class='navbar navbar-fixed-top'> <div class='navbar-inner'> <div class='container'> <a
I have following code in the html file: <div class=navbar navbar-fixed-top> <div class=navbar-inner> <div
This is a bit of code from Twitter Bootstrap .navbar .nav.pull-right .dropdown-menu, .navbar .nav
Why doesn't my bootstrap code scale down to mobile? <div class=navbar navbar-fixed-bottom> <div class=navbar-inner>
If I have a chunk of code like this: .hover( function () { hoverState($(#navbar
My navbar looks like: <div id=navbar> <ul class=tabnavcenter> <li class=active><a href=#tab1 data-toggle=tab>Test</a></li> <li class=aaron><a
The code is as follows: <div id=compv-navbar> <a href=#><img src=image1.png id=icon1></a> | <a href=#><img
The code is as follows: <div id=compv-navbar> <a href=#><img src=image1.png id=icon1></a> | <a href=#><img
Code is as follows: <div id=compare_view align=center> <div id=compv-navbar> <img src=image1.png> | <img src=image2.png>
I want the following code to always be in top right, regardless of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.