Giter VIP home page Giter VIP logo

bootstrap-notify-gem's Introduction

Bootstrap Notify - Rails notifications made easy.

BootstrapNotify aims to be a simple notification system that you can easily drop into your Rails project for nice looking notify flashes. BootstrapNotify is based off of bootstrap-notify by user goodybag http://goodybag.github.com/bootstrap-notify/

You can see a demo at: http://goodybag.github.com/bootstrap-notify

This is a based off of my SCSS conversion of bootstrap-notify.

Requirements:

Installation

Add it to your Gemfile:

gem 'bootstrap_notify', :git => "https://github.com/jclay/bootstrap-notify-gem.git"

Include the javascripts in application.js. Make sure to include after jQuery:

//= require jquery
//= require jquery_ujs
//= require bootstrap_notify

Import the SCSS after you import bootstrap:

@import "bootstrap";
@import "bootstrap_notify";

Implementation

Quick and Dirty style:

Create a partial with the contents

  # app/views/partials/_notify.html.haml
  - if !notice.blank?
    :javascript
      $(document).ready(function () {
        $('.top-right').notify({
          message: { text: "#{notice}" }
        }).show();
      });

Render the partial in your layout with the <head> tag, after your javascript and CSS have been included.

  # app/views/layouts/application.html.haml
  = render(:partial => "partials/notify")

Don't forget to include the div to attach the notification to:

  # app/views/layouts/application.html.haml
  .notifications.top-right

Additional configuration and placement options can be found at: http://goodybag.github.com/bootstrap-notify

Customizing Placement

You can offset the placement of the notification by adjusting the top, bottom, left or right variables.

$notify_right: 100px;
$notify_left: $notify_right;
$notify_top: 500px;
$notify_bottom: $notify_top;
@import "bootstrap_notify";

bootstrap-notify-gem's People

Contributors

chai2 avatar jclay avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.