I am facing a problem which is hard to explain in words but i will try my best.
Problem: Adding a modal in the header to my rails application makes other links disabled which are situated beside it until the modal is accessed.
Example: |Home| Mail |Settings(Modal Link)|
Above example is how my header looks and above mentioned three are links.
Until i access Settings modal, Home and Mail links remain disabled. But once i view Modal, i can access Home and Mail again.
When i used Chrome developer tools (Inspect Element), i could see that the Modal is hiding on top of those two Home and Mail links. After accessing Settings(Modal Link), There is no hidden Modal on top of those links and can be accessed.
Any inputs on it ?
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="/">
<%= image_tag 'logos/logo.png' %>
<%= image_tag 'logos/tagline.png' %>
</a>
<%= render 'shared/search' %>
<ul class="nav pull-right">
<% if !user_signed_in? %>
<li><%= link_to 'Join Us', new_user_registration_path %></li>
<li><%= link_to 'Sign In', new_user_session_path %></li>
<li><%= link_to "Facebook", '#' %></li> <!-- user_omniauth_authorize_path(:facebook)-->
<% else %>
<li><%= link_to "Home", root_path %></li>
<% if current_user %>
<li class="dropdown">
<a class="dropdown-toggle notifySymbol" data-toggle="dropdown" href="#">
<%= notifyCount %>
</a>
<div class="dropdown-menu" style="max-height:450px; width:370px; overflow:auto">
<%= notify %>
</div>
</li>
<%end%>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<%= image_tag "#{#group.group_pic}", :size => '25x25', :class => "img-rounded" %>
<%= #group.group_name %>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li> <%= link_to raw('<i class="icon-eye-open"></i> Edit Profile'), edit_profile_path %></li>
<li> <%= link_to raw('<i class="icon-edit"></i> Edit Settings'), edit_settings_path %></li>
<li> <%= list_groups %> </li>
<li class="divider"></li>
<li> <%= link_to raw('<i class="fa fa-user"></i> Admin Tasks'), '#', :data => {:toggle => 'modal', :target => '#myAdminModal'} %> </li>
</ul>
<% end %>
</ul>
</div>
</div>
</div>
<div class="modal fade" id="myAdminModal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"> <i class="fa fa-tasks"> Admin Tasks</i> </h4>
</div>
<div class="modal-body">
<div class="tree" >
<ul>
<li>
<span class="badge badge-success"> <i class="fa fa-smile-o"> Send </i></span>
<ul>
<li>
<%= link_to "All Group", send_all_groups_path %>
</li>
<li>
<%= link_to "Selected Members", '#' %>
</li>
</ul>
</li>
<li>
<span class="badge badge-success"><i class="fa fa-envelope-square"> Send Messages</i> </span>
<ul>
<li>
<%= link_to "All Group", '#' %>
</li>
<li>
<%= link_to "Selected Members", '#' %>
</li>
</ul>
</li>
<li>
<span class="badge badge-warning"><i class="fa fa-paper-plane"> Send Group Invites </i> </span>
<ul>
<li>
<%= link_to "To Member", '#' %>
</li>
<li>
<%= link_to "To Non-Member", '#' %>
</li>
<li>
<%= link_to "Check Invite Status", '#' %>
</li>
</ul>
</div>
</div>
<div class="modal-footer" data-dismiss="modal" aria-hidden="true">
<p class = "btn btn-info" > Close </p>
</div>
</div>
</div>
</div>
Related
<div class="dropdown pull-right">
<a id="dropdown" data-toggle="dropdown" aria-haspopup="false" aria-expanded="true">
<%= theme_icon_tag "settings" %>
</a>
<ul class="dropdown-menu" aria-labelledby="dropdown" style="padding: 0.25em">
<li><%= link_to "Edit", edit_book_review_path(review.book, review), class: "btn btn-outline-primary dropdown-item" %></li>
<li><%= link_to "Delete", book_review_path(review.book, review), method: :delete, data: {confirm: "Are you sure?"}, class: "btn btn-outline-danger dropdown-item" %></li>
</ul>
</div>
<% end %>
<% end %>
</div>
This is my dropdown and it's working fine on desktop.
Ive got my phone laying around and wanted to test it's functionality and I realized that I am not able to click the icon to open the dropdown-menu.
Why is that?
This link will help you stackoverflow.com/a/17841690/6392696
Find this file bootstrap.min.js , In substring
"ontouchstart"
Replace it with
"disable-ontouchstart"
Hopefully this will help!
I have a problem with the content of my application page in rails,I basically cannot put any content after the <% yield %> tag.
My problem is that when I put a footer underneath the <% yield %> it shows up over the yield content, not bellow. I am sure there is a simple solution for this but I just cannot get it to work as I would like to.
I anyone have an idea of were the problem could be would be really helpful.
<body>
<nav class="navbar navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<%= link_to (image_tag("logo.png", class:"food-image")), root_path%>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="sections"><%= link_to 'Dishes', posts_path %></li>
<li class="sections"><%= link_to 'Events', posts_path %></li>
<li class="sections"><%= link_to "About", about_path %></li>
<ul class="social-icons">
<li class="fa fa-twitter fa-2x"></li>
<li class="fa fa-facebook fa-2x"></li>
<li class="fa fa-instagram fa-2x"></li>
<li class="fa fa-pinterest fa-2x"></li>
</ul>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<% if current_page?(root_path) %>
<div class="image-header">
</div>
<% end %>
<div class="anchor">
</div>
<%= yield %>
<footer>
<div class="container-fluid" id="logs">
<div class="login-buttons">
<% if user_signed_in? %>
<button><%= link_to "New Post", new_post_path , class:"sing_in"%></button>
<button><%= link_to("Logout", destroy_user_session_path, :method => :delete, class:"sing_in") %></button>
<% else %>
<button><%= link_to("Login", new_user_session_path, class:"sing_in") %></button>
<% end %>
</div>
<p>lnjkbhjghfxgdzfxgchvjbknl</p>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
</div><!-- container-fluid-->
</footer>
Thanks in advance
This sounds like a CSS problem. If there's a float in the yield somewhere, you could need to clear it. Immediately after the yield and before footer, insert a spacer ...
<div style="clear:both"> </div>
Hopefully that puts you on the right track.
My navigation bar currently looks like this:
My code is below:
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
Text Planner
</a>
</div>
<% if user_signed_in? %>
<p class="navbar-text navbar-left">Welcome, <strong><%= current_user.first_name.to_s+" "+current_user.last_name.to_s %></strong></p>
<div class="nav navbar-nav navbar-right">
<%= link_to "Home", home_path, :class => 'btn btn-default navbar-button' %>
<div class="btn btn-default dropdown-toggle navbar-button" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Menu</div>
<ul class="dropdown-menu">
<li><%= link_to "Search For Events", root_path %></li>
<li><%= link_to "My Bookmarks", user_bookmarks_path(current_user.id)%></li>
<li><%= link_to "My Upcoming Reminders", user_reminders_path(current_user.id)%></li>
<li><%= link_to "My Profile", user_path(current_user.id)%></li>
<li role="separator" class="divider"></li>
<li><%= link_to "Logout", destroy_user_session_path, method: :delete %></li>
</ul>
</div>
<% else %>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", home_path, :class => 'navbar-text' %></li>
<li><%= link_to "Sign up", new_user_registration_path, :class => 'navbar-text' %></li>
<li><%= link_to "Login", new_user_session_path, :class => 'navbar-text' %></li>
</ul>
<% end %>
</div>
</nav>
How do I move the home and menu buttons to the left and center them vertically? Also, I would like to keep them clickable buttons while removing the outline of a button with the white background so they match the left side of my navigation bar. Thanks in advance.
It's very simple, actually, set your line-height and div height to the same (here's a quick example):
#navbar a{
width: 200px;
height: 40px;
display:inline-block;
color:white;
line-height:40px;
}
This is provided your buttons are formed using CSS, but I believe it works for other elements, as well.
I am using bootstrap for creating twitter like app. The contents on the nav bar, under "nav pull-right" disappears when the window size resized to small. How do i do that? Here is my erb file..
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<%= link_to "cntwitter", root_path, id: "logo" %>
<nav>
<ul class="nav pull-right" id="right_nav">
<li><%= link_to "Home", root_path %></li>
<% if signed_in? %>
<li><%= link_to "Users", users_path %></li>
<li id="fat-menu" class="dropdown">
Account <b class="caret"></b>
<ul class="dropdown-menu">
<li><%= link_to "Profile", current_user %></li>
<li><%= link_to "Settings", edit_user_path(current_user) %></li>
<li class="divider"></li>
<li>
<%= link_to "Sign out", signout_path, method: "delete" %>
</li>
</ul>
</li>
<% else %>
<li><%= link_to "Sign in", signin_path %></li>
<% end %>
</ul>
</nav>
</div>
</div>
</header>
The twitter bootstrap scaffolding, or grid, is static by default. It sounds like you want the contents of your web page to scale with the browser window. In that case, I would recommend using the "fluid" scaffolding :: http://twitter.github.com/bootstrap/scaffolding.html#fluidGridSystem
how can i join the ruby code with the html code? I want that the html "href" link with the path (ruby). Could somebody help me? For example: <li class="active">Home</li> , the href linked to Ruby <%= link_to "Home", root_path %> .
Ill want that my Button Home, for example is linked with the Ruby root_path.
HTML Code
> <div class="navbar navbar-fixed-top">
> <div class="navbar-inner">
> <div class="container">
> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
> <span class="icon-bar"></span>
> <span class="icon-bar"></span>
> <span class="icon-bar"></span>
> </a>
> <a class="brand" href="#">My Workingtimes</a>
> <div class="nav-collapse">
> <ul class="nav">
> <li class="active">Home</li>
> <li>Log In</li>
> <li>Sign In</li>
> </ul>
> </div><!--/.nav-collapse -->
> </div>
> </div>
> </div>
RUBY CODE
<div id="container">
<div id="content">
<% if flash[:notice] %>
<p id="notice">
<%= flash[:notice] %>
</p>
<% end %>
<% if flash[:alert] %>
<p id= "alert">
<%= flash[:alert] %>
</p>
<% end %>
</div>
<div id="footer">
<%= link_to "Home", root_path %> |
<%= link_to "Sign In", new_user_path %> |
<% if user_signed_in? %>
<%= link_to "Logout", logout_path, method: :delete %> |
<%= link_to "My Workingtimes", mytimes_path %>
<% else %>
<%= link_to "Login", login_path %>
<% end %>
<%= yield %>
</div>
</div>
You can run rake routes and see what, for instance, root_path points to.
Unless you haven't made any changes, it probably points to /, in which case you can have href = "/"
This is assuming that you absolutely need to enter the path name in the HTML. Otherwise, I would highly recommend converting your .html to .html.erb and then use something like <%= link_to "Home", root_path %> as you had mentioned.