Permalink
Browse files

fixes

  • Loading branch information...
1 parent 34b319e commit 3e38851199f0eb715dcce73b13577f6d9e3e8c9b @seyhunak committed Feb 4, 2012
View
5 .travis.yml
@@ -0,0 +1,5 @@
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+ - ree
View
42 README.md
@@ -11,10 +11,6 @@ Include Bootstrap in Gemfile;
gem 'twitter-bootstrap-rails', :group => :assets
-Include Bootstrap in Gemfile (latest release)
-
- gem "twitter-bootstrap-rails", "~> 2.0rc0", :group => :assets
-
or you can install from latest build;
gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
@@ -38,13 +34,13 @@ Usage:
rails g bootstrap:install
-Layout (generates Twitter Bootstrap compatible layout.) - (Haml and Slim supported)
+Layout (generates Twitter Bootstrap compatible layout with flash messages) - (Haml and Slim supported)
Usage:
- rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]
+ rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
Example:
@@ -59,7 +55,7 @@ Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim
Usage:
- rails g bootstrap:themed [RESOURCE_NAME] [LAYOUT] [options]
+ rails g bootstrap:themed [RESOURCE_NAME]
Example:
@@ -87,12 +83,14 @@ You have to require Bootstrap LESS (bootstrap.less) in your application.css
Now, you can override LESS files provided by Twitter Bootstrap
+Also, you can import additional files (.ie responsive)
+
+ @import "twitter/bootstrap";
- @import "twitter/bootstrap";
+ // import responsive layout
+ @import "twitter/bootstrap/responsive";
- // Baseline grid
- @basefont: 13px;
- @baseline: 18px;
+ // Your custom stylesheets goes here (override Less here)
## Using Javascripts
@@ -112,27 +110,17 @@ Using Twitter Bootstrap with the CoffeeScript is easy.
twitter-bootstrap-rails generates a "bootstrap.js.coffee" file for you
to /app/assets/javascripts/ folder.
- $ ->
- $(".alert").alert()
- $ ->
+ jQuery ->
+ $(".alert-message").alert()
$(".tabs").button()
- $ ->
$(".carousel").carousel()
- $ ->
$(".collapse").collapse()
- $ ->
$(".dropdown-toggle").dropdown()
- $ ->
- $(".modal").modal
- $ ->
- $("a[rel]").popover
- $ ->
+ $(".modal").modal()
+ $("a[rel]").popover()
$(".navbar").scrollspy()
- $ ->
$(".tab").tab "show"
- $ ->
- $(".tooltip").tooltip
- $ ->
+ $(".tooltip").tooltip()
$(".typeahead").typeahead()
@@ -166,6 +154,8 @@ twitter-bootstrap-rails has seperate branch (w/o Less) that just serves latest s
<li>Transitioning to 2.0</li>
<li>Released gem v.2.0rc0</li>
<li>Added Haml and Slim support</li>
+ <li>Added Twitter Bootstrap compatible flash messages</li>
+ <li>Fixes and release 2.0.0</li>
</ul>
View
2 Rakefile
@@ -1,3 +1,3 @@
+#!/usr/bin/env rake
require 'bundler'
Bundler::GemHelper.install_tasks
-
View
22 lib/generators/bootstrap/install/templates/bootstrap.coffee
@@ -1,22 +1,12 @@
-$ ->
- $(".alert").alert()
-$ ->
+jQuery ->
+ $(".alert-message").alert()
$(".tabs").button()
-$ ->
$(".carousel").carousel()
-$ ->
$(".collapse").collapse()
-$ ->
$(".dropdown-toggle").dropdown()
-$ ->
- $(".modal").modal
-$ ->
- $("a[rel]").popover
-$ ->
+ $(".modal").modal()
+ $("a[rel]").popover()
$(".navbar").scrollspy()
-$ ->
$(".tab").tab "show"
-$ ->
- $(".tooltip").tooltip
-$ ->
- $(".typeahead").typeahead()
+ $(".tooltip").tooltip()
+ $(".typeahead").typeahead()
View
7 lib/generators/bootstrap/install/templates/bootstrap.less
@@ -1,5 +1,6 @@
@import "twitter/bootstrap";
-// Baseline grid
-@basefont: 13px;
-@baseline: 18px;
+// import responsive layout
+@import "twitter/bootstrap/responsive";
+
+// Your custom stylesheets goes here (override Less here)
View
12 lib/generators/bootstrap/layout/layout_generator.rb
@@ -4,13 +4,23 @@ module Bootstrap
module Generators
class LayoutGenerator < ::Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
- desc "This generator creates layout file with navigation."
+ desc "This generator generates layout file with navigation."
argument :layout_name, :type => :string, :default => "application"
argument :layout_type, :type => :string, :default => "fixed",
:banner => "*fixed or fluid"
attr_reader :app_name, :container_class
+ def add_helper
+ if File.exists?(Rails.root.join("app/helpers/application_helper.rb"))
+ say "Bootstrap helpers installs to application_helper..."
+ insert_into_file "app/helpers/application_helper.rb",
+ " def flash_class(level)\n case level\n when :notice then 'info'\n when :error then 'error'\n when :alert then 'warning'\n end\n end\n", :after => "module ApplicationHelper\n"
+ else
+ say "Already installed"
+ end
+ end
+
def generate_layout
app = ::Rails.application
@app_name = app.class.to_s.split("::").first
View
20 lib/generators/bootstrap/layout/templates/layout.html.erb
@@ -11,7 +11,7 @@
<![endif]-->
<!-- Le styles -->
- <%%= stylesheet_link_tag "application" %>
+ <%%= stylesheet_link_tag "application", :media => "all" %>
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
@@ -64,14 +64,30 @@
</div><!--/.well -->
</div><!--/span-->
<div class="span9">
+ <%% [:notice, :error, :alert].each do |level| %>
+ <%% unless flash[level].blank? %>
+ <div data-alert="alert" class="alert alert-<%%= flash_class(level) %> fade in">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <%= content_tag :p, flash[level] %>
+ </div>
+ <%% end %>
+ <%% end %>
<%%= yield %>
</div>
</div><!--/row-->
<%- else -%>
<div class="content">
<div class="row">
<div class="span9">
- <%%= yield %>
+ <%% [:notice, :error, :alert].each do |level| %>
+ <%% unless flash[level].blank? %>
+ <div data-alert="alert" class="alert alert-<%%= flash_class(level) %> fade in">
+ <a class="close" data-dismiss="alert" href="#">&times;</a>
+ <%%= content_tag :p, flash[level] %>
+ </div>
+ <%% end %>
+ <%% end %>
+ <%%= yield %>
</div>
<div class="span1">&nbsp;</div>
<div class="span3">
View
2 lib/generators/bootstrap/themed/templates/_form.html.erb
@@ -6,7 +6,7 @@
</div>
</div>
<%- end -%>
-<div class="actions">
+<div class="form-actions">
<button class="btn primary" type="submit">Save</button> or
<%%= link_to "Cancel", <%= controller_routing_path %>_path %>
</div>
View
3 lib/generators/bootstrap/themed/templates/_form.html.haml
@@ -5,8 +5,7 @@
= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
<%- end -%>
-.actions
+.form-actions
%button{:class => "btn primary", :type => "submit"} Save
or
= link_to "Cancel", <%= controller_routing_path %>_path
-
View
2 lib/generators/bootstrap/themed/templates/_form.html.slim
@@ -5,7 +5,7 @@
= f.<%= column.field_type %> :<%= column.name %>, :class => '<%= column.field_type %>'
<%- end -%>
-.actions
+.form-actions
button class="btn primary" type="submit" Save
| or
= link_to "Cancel", <%= controller_routing_path %>_path
View
4 lib/generators/bootstrap/themed/templates/index.html.erb
@@ -1,5 +1,5 @@
<h1><%= resource_name.titleize %>s</h1>
-<table class="zebra-striped">
+<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
@@ -31,4 +31,4 @@
</tbody>
</table>
-<%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary' %>
+<%%= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary' %>
View
4 lib/generators/bootstrap/themed/templates/index.html.haml
@@ -1,5 +1,5 @@
%h1 <%= resource_name.titleize %>s
-%table{:class => "zebra-striped"}
+%table{:class => "table table-striped"}
%thead
%tr
%th ID
@@ -22,4 +22,4 @@
= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
= link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
-= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary'
+= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
View
4 lib/generators/bootstrap/themed/templates/index.html.slim
@@ -1,5 +1,5 @@
h1 <%= resource_name.titleize %>s
-table class="zebra-striped"
+table class="table table-striped"
thead
tr
th ID
@@ -22,4 +22,4 @@ table class="zebra-striped"
= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>)
= link_to "Destroy", <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}"
-= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn primary'
+= link_to "New", new_<%= singular_controller_routing_path %>_path, :class => 'btn btn-primary'
View
9 lib/generators/bootstrap/themed/templates/show.html.erb
@@ -2,8 +2,9 @@
<label class="label"><%%= t("activerecord.attributes.<%= singular_controller_routing_path %>.<%= column.name %>", :default => t("activerecord.labels.<%= column.name %>", :default => "<%= column.name.humanize %>")) %>:</label>
<p><%%= @<%= resource_name %>.<%= column.name %> %></p>
<%- end -%>
-<div class="actions">
-<%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary' %>
-<%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary' %>
-<%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary' %>
+
+<div class="form-actions">
+<%%= link_to "Back", <%= controller_routing_path %>_path, :class => 'btn' %>
+<%%= link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn' %>
+<%%= link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn' %>
</div>
View
8 lib/generators/bootstrap/themed/templates/show.html.haml
@@ -3,7 +3,7 @@
%p= @<%= resource_name %>.<%= column.name %>
<%- end -%>
-.actions
- = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary'
- = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary'
- = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary'
+.form-actions
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
+ = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn'
View
8 lib/generators/bootstrap/themed/templates/show.html.slim
@@ -3,7 +3,7 @@ label class="label"= t("activerecord.attributes.<%= singular_controller_routing_
p= @<%= resource_name %>.<%= column.name %>
<%- end -%>
-.actions
- = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn primary'
- = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn primary'
- = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn primary'
+.form-actions
+ = link_to "Back", <%= controller_routing_path %>_path, :class => 'btn'
+ = link_to "Edit", edit_<%= singular_controller_routing_path %>_path(@<%= resource_name %>), :class => 'btn'
+ = link_to "Delete", <%= singular_controller_routing_path %>_path(@<%= resource_name %>), :method => "delete", :confirm => "#{t("web-app-theme.confirm", :default => "Are you sure?")}", :class => 'btn'
View
6 lib/generators/bootstrap/themed/themed_generator.rb
@@ -17,12 +17,6 @@ def initialize(args, *options)
def copy_views
generate_views
- if ext == :erb
- gsub_file(File.join('app/views/layouts', "#{layout}.html.erb"), /\<ul\s+class=\"nav\">.*\<\/ul\>/mi) do |match|
- match.gsub!(/\<\/ul\>/, "")
- %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
- end
- end
end
protected
View
2 lib/twitter/bootstrap/rails/version.rb
@@ -1,7 +1,7 @@
module Twitter
module Bootstrap
module Rails
- VERSION = "2.0rc0"
+ VERSION = "2.0.0"
end
end
end
View
3 vendor/toolkit/twitter/bootstrap/button-groups.less
@@ -29,7 +29,7 @@
position: relative;
float: left;
margin-left: -1px;
- .border-radius(0);
+ .border-radius(0px);
}
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
.btn-group .btn:first-child {
@@ -144,4 +144,3 @@
.btn-small .caret {
margin-top: 4px;
}
-
View
6 vendor/toolkit/twitter/bootstrap/forms.less
@@ -86,7 +86,7 @@ input[type="radio"] {
line-height: normal;
border: 0;
cursor: pointer;
- .border-radius(0);
+ .border-radius(0px); /* mirror bootstrap commit 9b9e1d3 reversing IE9 hack and use mixin instead */
}
// Reset the file input to browser defaults
@@ -309,7 +309,7 @@ select:focus:required:invalid {
border-color: #ee5f5b;
&:focus {
border-color: darken(#ee5f5b, 10%);
- .box-shadow(0 0 6px lighten(#ee5f5b, 20%));
+ .box-shadow(0 0 6px lighten(#ee5f5b, 20%));
}
}
@@ -412,7 +412,7 @@ select:focus:required:invalid {
.border-radius(3px 0 0 3px);
}
.uneditable-input {
- border-right-color: #ccc;
+ border-right-color: #ccc;
}
.add-on {
margin-right: 0;
View
4 vendor/toolkit/twitter/bootstrap/navbar.less
@@ -161,7 +161,7 @@
.navbar-fixed-top .navbar-inner {
padding-left: 0;
padding-right: 0;
- .border-radius(0);
+ .border-radius(0px);
}
@@ -289,4 +289,4 @@
left: auto;
right: 13px;
}
-}
+}
View
7 vendor/toolkit/twitter/bootstrap/navs.less
@@ -49,13 +49,12 @@
.nav-list > li + .nav-header {
margin-top: 9px;
}
-.nav-list .active > a,
-.nav-list .active > a:hover {
+.nav-list .active > a {
color: @white;
text-shadow: 0 -1px 0 rgba(0,0,0,.2);
background-color: @linkColor;
}
-.nav-list [class^="icon-"] {
+.nav-list .icon {
margin-right: 2px;
}
@@ -152,7 +151,7 @@
}
.nav-tabs.nav-stacked > li > a {
border: 1px solid #ddd;
- .border-radius(0);
+ .border-radius(0px);
}
.nav-tabs.nav-stacked > li:first-child > a {
.border-radius(4px 4px 0 0);
View
2 vendor/toolkit/twitter/bootstrap/responsive.less
@@ -242,7 +242,7 @@
padding: 0;
background-color: transparent;
border: none;
- .border-radius(0);
+ .border-radius(0px);
.box-shadow(none);
}
.navbar .dropdown-menu:before,

0 comments on commit 3e38851

Please sign in to comment.