Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
seyhunak committed Oct 16, 2011
0 parents commit 02c229c
Show file tree
Hide file tree
Showing 33 changed files with 3,618 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
5 changes: 5 additions & 0 deletions Gemfile
@@ -0,0 +1,5 @@
source "http://rubygems.org"

# Specify your gem's dependencies in twitter-bootstrap-rails.gemspec
gemspec
gem 'less-rails', :path => ENV['LESS_RAILS_PATH'] if ENV['LESS_RAILS_PATH']
133 changes: 133 additions & 0 deletions README.md
@@ -0,0 +1,133 @@
# Twitter Bootstrap for Rails 3.1 Asset Pipeline
Bootstrap is a toolkit from Twitter designed to kickstart development of webapps and sites.
It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.


twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline


## Installing Gem

Include Bootstrap in Gemfile;

gem 'twitter-bootstrap-rails'

or you can install from latest build;

gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'

You can run bundle from command line

bundle install


## Using with Less

Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less,
a CSS preprocessor for faster and easier web development.

## Using stylesheets with Less

You have to require Bootstrap LESS (bootstrap.less) in your application.css

/*
*= require bootstrap
*/

/* Your stylesheets goes here... */


Now, you can override LESS files provided by Twitter Bootstrap

@import "bootstrap";
// Baseline grid
@basefont: 13px;
@baseline: 18px;


## Using javascripts

You have to require Bootstrap JS (bootstrap.js) in your application.js

//= require bootstrap

$(document).ready(function(){
/* Your javascripts goes here... */
});


## Using with coffeescript

Using Twitter Bootstrap with the CoffeeScript is easy.
Just create a application.js.coffee file to /app/assets/javascripts/ folder and put lines below.

$ ->
$("body > .topbar").scrollSpy()
$ ->
$(".tabs").tabs()
$ ->
$("a[rel=twipsy]").twipsy live: true
$ ->
$("a[rel=popover]").popover offset: 10
$ ->
$(".topbar-wrapper").dropdown()
$ ->
$(".alert-message").alert()
$ ->
domModal = $(".modal").modal(
backdrop: true
closeOnEscape: true
)
$(".open-modal").click ->
domModal.toggle()


## Using Static CSS, JS (w/o Less)

twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest static CSS, JS files.

You can install from latest build (from branch);

gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :branch => "static"


## Changelog
<ul>
<li>Version 0.0.5 deprecated</li>
<li>Asset files updated to latest and removed version numbers</li>
<li>Implemented Less::Rails Railtie to use with LESS</li>
<li>Fixed railtie to only initialize Less when installed</li>
<li>Created new branch for the static version of Bootstrap (w/o Less) - check static branch</li>
<li>Added path to support heroku deploy</li>
</ul>

## Credits
Seyhun Akyürek - seyhunak [at] gmail com

[Follow me on Twitter](http://twitter.com/seyhunak "Twitter")


## Contributors & Patches
<ul>
<li>Daniel Morris</li>
<li>Bradly Feeley</li>
<li>Guilherme Moreira</li>
<li>Alex Behar</li>
<li>Brandon Keene</li>
<li>Anthony Corcutt</li>
</ul>


## Thanks
Twitter Bootstrap
http://twitter.github.com/bootstrap


## License
Copyright (c) 2011 Seyhun Akyürek

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

3 changes: 3 additions & 0 deletions Rakefile
@@ -0,0 +1,3 @@
require 'bundler'
Bundler::GemHelper.install_tasks

10 changes: 10 additions & 0 deletions lib/twitter-bootstrap-rails.rb
@@ -0,0 +1,10 @@
require 'less-rails'
require "twitter/bootstrap/rails/version"
require "twitter/bootstrap/rails/engine"

module Twitter
module Bootstrap
module Rails
end
end
end
9 changes: 9 additions & 0 deletions lib/twitter-bootstrap-rails.rb~
@@ -0,0 +1,9 @@
module Twitter
module Bootstrap
module Rails
end
end
end
require 'less-rails'
require "twitter/bootstrap/rails/version"
require "twitter/bootstrap/rails/engine"
2 changes: 2 additions & 0 deletions lib/twitter/bootstrap/bootstrap.rb~
@@ -0,0 +1,2 @@
require "twitter/bootstrap/rails/version"
require "twitter/bootstrap/rails/engine"
15 changes: 15 additions & 0 deletions lib/twitter/bootstrap/rails/engine.rb
@@ -0,0 +1,15 @@
module Twitter
module Bootstrap
module Rails
class Engine < ::Rails::Engine

initializer 'twitter-bootstrap-rails.setup',
:after => 'less-rails.after.load_config_initializers',
:group => :all do |app|
app.config.less.paths << File.join(config.root, 'vendor', 'toolkit')
end

end
end
end
end
15 changes: 15 additions & 0 deletions lib/twitter/bootstrap/rails/engine.rb~
@@ -0,0 +1,15 @@
module Twitter
module Bootstrap
module Rails
class Engine < ::Rails::Engine
config.after_initialize do |app|
# Only run when less is installed
if app.config.try(:less)
app.config.less.paths << "#{config.root}vendor/stylesheets/bootstrap"
app.config.less.paths << "#{config.root}vendor/assets/stylesheets/bootstrap"
end
end
end
end
end
end
8 changes: 8 additions & 0 deletions lib/twitter/bootstrap/rails/version.rb
@@ -0,0 +1,8 @@
module Twitter
module Bootstrap
module Rails
VERSION = "1.3.0"
end
end
end

29 changes: 29 additions & 0 deletions twitter-bootstrap-rails.gemspec
@@ -0,0 +1,29 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "twitter/bootstrap/rails/version"

Gem::Specification.new do |s|
s.name = "twitter-bootstrap-rails"
s.version = Twitter::Bootstrap::Rails::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Seyhun Akyurek"]
s.email = ["seyhunak@gmail.com"]
s.homepage = "https://github.com/seyhunak/twitter-bootstrap-rails"
s.summary = %q{Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline}
s.description = %q{twitter-bootstrap-rails project integrates Bootstrap CSS toolkit for Rails 3.1 Asset Pipeline}

s.rubyforge_project = "twitter-bootstrap-rails"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib","vendor"]

s.add_runtime_dependency 'less'
s.add_runtime_dependency "less-rails", "~> 2.0.1"
s.add_runtime_dependency 'railties'
s.add_runtime_dependency 'actionpack'
s.add_development_dependency "bundler"
s.add_development_dependency 'rails', '~> 3.1.1'
end

7 changes: 7 additions & 0 deletions vendor/assets/javascripts/bootstrap.js
@@ -0,0 +1,7 @@
//= require twitter/bootstrap/bootstrap-alerts
//= require twitter/bootstrap/bootstrap-dropdown
//= require twitter/bootstrap/bootstrap-modal
//= require twitter/bootstrap/bootstrap-twipsy
//= require twitter/bootstrap/bootstrap-popover
//= require twitter/bootstrap/bootstrap-scrollspy
//= require twitter/bootstrap/bootstrap-tabs
15 changes: 15 additions & 0 deletions vendor/assets/javascripts/bootstrap.js~
@@ -0,0 +1,15 @@
//= require bootstrap-alerts
//= require bootstrap-dropdown
//= require bootstrap-modal
//= require bootstrap-twipsy
//= require bootstrap-popover
//= require bootstrap-scrollspy
//= require bootstrap-tabs

//= require twitter/bootstrap/bootstrap-alerts
//= require twitter/bootstrap/bootstrap-dropdown
//= require twitter/bootstrap/bootstrap-modal
//= require twitter/bootstrap/twipsy
//= require twitter/bootstrap/popover
//= require twitter/bootstrap/scrollspy
//= require twitter/bootstrap/tabs
104 changes: 104 additions & 0 deletions vendor/assets/javascripts/twitter/bootstrap/bootstrap-alerts.js
@@ -0,0 +1,104 @@
/* ==========================================================
* bootstrap-alerts.js v1.3.0
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2011 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */


!function( $ ){

/* CSS TRANSITION SUPPORT (https://gist.github.com/373874)
* ======================================================= */

var transitionEnd

$(document).ready(function () {

$.support.transition = (function () {
var thisBody = document.body || document.documentElement
, thisStyle = thisBody.style
, support = thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined
return support
})()

// set CSS transition event type
if ( $.support.transition ) {
transitionEnd = "TransitionEnd"
if ( $.browser.webkit ) {
transitionEnd = "webkitTransitionEnd"
} else if ( $.browser.mozilla ) {
transitionEnd = "transitionend"
} else if ( $.browser.opera ) {
transitionEnd = "oTransitionEnd"
}
}

})

/* ALERT CLASS DEFINITION
* ====================== */

var Alert = function ( content, selector ) {
this.$element = $(content)
.delegate(selector || '.close', 'click', this.close)
}

Alert.prototype = {

close: function (e) {
var $element = $(this).parent('.alert-message')

e && e.preventDefault()
$element.removeClass('in')

function removeElement () {
$element.remove()
}

$.support.transition && $element.hasClass('fade') ?
$element.bind(transitionEnd, removeElement) :
removeElement()
}

}


/* ALERT PLUGIN DEFINITION
* ======================= */

$.fn.alert = function ( options ) {

if ( options === true ) {
return this.data('alert')
}

return this.each(function () {
var $this = $(this)

if ( typeof options == 'string' ) {
return $this.data('alert')[options]()
}

$(this).data('alert', new Alert( this ))

})
}

$(document).ready(function () {
new Alert($('body'), '.alert-message[data-alert] .close')
})

}( window.jQuery || window.ender );

0 comments on commit 02c229c

Please sign in to comment.