All Projects → bootstrap-ruby → Bootstrap Navbar

bootstrap-ruby / Bootstrap Navbar

Licence: mit
Helpers to generate a Twitter Bootstrap navbar

Programming Languages

ruby
36898 projects - #4 most used programming language

Labels

Projects that are alternatives of or similar to Bootstrap Navbar

Vue Plan
使用vue+vue-router+vuex+boostrap实现计划表系统
Stars: ✭ 33 (-17.5%)
Mutual labels:  bootstrap
Qlcommonmark
QuickLook generator for beautifully rendering CommonMark documents on macOS
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Ng1bs4
AngularJS with Bootstrap 4
Stars: ✭ 39 (-2.5%)
Mutual labels:  bootstrap
Vue Ts Ex
Vue2+ + TypeScript2+ example All-in vue typescript example with single file component, hot reload, bootstrap 4, webpack , express server, local storage, vuex , router, pre-compiled templates all out of the box! Using official typescript component `vue-class-component`
Stars: ✭ 35 (-12.5%)
Mutual labels:  bootstrap
Adminx
AdminX – a free and open source admin control panel based on Bootstrap 4.x
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Redmine bootstrap kit
A Redmine plugin which makes developing your own Redmine plugin easy ;)
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Price Tracker
Live and historical prices for fiat currencies, crypto currencies and gold/silver over REST and WebSocket APIs, using Redis as storage. Node.js, jQuery, Bootstrap
Stars: ✭ 32 (-20%)
Mutual labels:  bootstrap
Spring Web Rss Channels
A Full Stack RSS Reader web application built with Spring MVC and JSP. It uses libraries like Spring, JPA, Bootstrap, Apache Tiles, JSP etc. There is also a static code analysis tool called Checkstyle.
Stars: ✭ 40 (+0%)
Mutual labels:  bootstrap
Angular4 Admin Front
Admin system front based on Angular. 基于Angular4的后台管理系统(no longer maintain)
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Mdb Webpack Starter
Webpack Starter for Material Design for Bootstrap UI Kit based on the latest Bootstrap 5.
Stars: ✭ 39 (-2.5%)
Mutual labels:  bootstrap
Startbootstrap Round About
A Bootstrap HTML template for creating about pages - created by Start Bootstrap
Stars: ✭ 35 (-12.5%)
Mutual labels:  bootstrap
Bootstrap 4 Autocomplete
A simple autocomplete/typeahead for Bootstrap 4 and jQuery
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Bootstrap Show Modal
A Bootstrap 4 / jQuery plugin wrapper, to create modals dynamically in JavaScript
Stars: ✭ 38 (-5%)
Mutual labels:  bootstrap
Bootstrap Vue Treeview
A treeview component for Bootstrap and Vue.js 2.0+
Stars: ✭ 34 (-15%)
Mutual labels:  bootstrap
Gramophone
WordPress, Bootstrap 4 & <3
Stars: ✭ 39 (-2.5%)
Mutual labels:  bootstrap
Notifo
Multi channel notification service for collaboration tools, e-commerce, news service and more.
Stars: ✭ 32 (-20%)
Mutual labels:  bootstrap
Webpack React
📦 A sample project to demonstrate bundling ES6, React, SASS and Bootstrap with Webpack
Stars: ✭ 36 (-10%)
Mutual labels:  bootstrap
Startbootstrap 2 Col Portfolio
A two column Bootstrap HTML portfolio template - created by Start Bootstrap
Stars: ✭ 40 (+0%)
Mutual labels:  bootstrap
Freelancers Market
Laravel Project to help freelance websites clients and freelancers to find each other.
Stars: ✭ 39 (-2.5%)
Mutual labels:  bootstrap
Awesome Bootstrap
✨ Awesome - A curated list of amazing Bootstrap tools and themes.
Stars: ✭ 991 (+2377.5%)
Mutual labels:  bootstrap

BootstrapNavbar

Gem Version Build Status Code Climate

Helpers to generate a Bootstrap style navbar

Installation

This gem only provides a helper module with methods to generate HTML. It can be used by other gems to make these helpers available to a framework's rendering engine, e.g.:

In short: Unless you know what you're doing, do not use this gem directly in your app!

Requirements

Only Bootstrap >= 2.1.0 is supported. It might work with earlier versions as well though.

Setup

Set bootstrap_version (required)

BootstrapNavbar needs to know what version of Bootstrap it's dealing with since each version has small changes compared to the previous one.

BootstrapNavbar.configure do |config|
  config.bootstrap_version = '4.0.0'
end

Set current_url_method (required)

BootstrapNavbar has to be able to query for the current URL when rendering the navbar, e.g. to determine if a menu item is active or not. Since the way the current URL is determined varies depending on whether you use Rails, Sinatra, etc., this has to be set beforehand in some kind of initializer:

# For Rails >= 3.2
BootstrapNavbar.configure do |config|
  config.current_url_method = 'request.original_url'
end

current_url_method should be set to a string which can be evaled later.

Set up HTML escaping (optional)

If the framework or rendering engine that you use BootstrapNavbar with escapes HTML by default, you can instruct BootstrapNavbar to mark the returned HTML as html_safe by default by overriding BootstrapNavbar#prepare_html:

# For Rails
module BootstrapNavbar::Helpers
  def prepare_html(html)
    html.html_safe
  end
end

Set up root paths (optional)

When deciding whether a navbar link is marked as current, the following steps are followed:

  • If the link target is one of the root paths (only "/" by default), the link is only marked as current if the target is the current path.
  • Otherwise the link is marked as current if the target is the current path or a sub path of the current path.

In certain cases you might want to treat more paths as root paths, e.g. when different locales are mapped at "/en", "/de" etc. This can be achieved by setting the root_paths configuration.

BootstrapNavbar.configure do |config|
  config.root_paths = ['/', '/en', '/de'] # default: ['/']
end

With this configuration, if your brand link would be "/en" for example, it would not be marked as current if you are on "/en/some-page".

Mix in the helpers into the rendering engine (required)

# For Rails
ActionView::Base.send :include, BootstrapNavbar::Helpers

Usage

Since the navbar format differs quite a bit between Bootstrap 2, 3 and 4, generating them using this gem works quite differently as well. Check out the Wiki pages for detailed instructions:

Usage with Bootstrap 2

Usage with Bootstrap 3

Usage with Bootstrap 4

Changes

See CHANGELOG

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Support

If you like this project, consider buying me a coffee! :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].