bootstrap-sass-extras 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/.gitignore +7 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +107 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +86 -0
  7. data/Rakefile +1 -0
  8. data/app/helpers/bootstrap_flash_helper.rb +17 -0
  9. data/bootstrap-sass-extras.gemspec +23 -0
  10. data/lib/.DS_Store +0 -0
  11. data/lib/bootstrap-sass-extras.rb +3 -0
  12. data/lib/bootstrap-sass-extras/engine.rb +9 -0
  13. data/lib/bootstrap-sass-extras/version.rb +3 -0
  14. data/lib/generators/.DS_Store +0 -0
  15. data/lib/generators/bootstrap/install/install_generator.rb +21 -0
  16. data/lib/generators/bootstrap/install/templates/.DS_Store +0 -0
  17. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +17 -0
  18. data/lib/generators/bootstrap/layout/layout_generator.rb +23 -0
  19. data/lib/generators/bootstrap/layout/templates/layout.html.erb +109 -0
  20. data/lib/generators/bootstrap/layout/templates/layout.html.haml +69 -0
  21. data/lib/generators/bootstrap/layout/templates/layout.html.slim +69 -0
  22. data/lib/generators/bootstrap/partial/partial_generator.rb +20 -0
  23. data/lib/generators/bootstrap/partial/templates/_login.html.erb +29 -0
  24. data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +13 -0
  25. data/lib/generators/bootstrap/themed/templates/_form.html.erb +16 -0
  26. data/lib/generators/bootstrap/themed/templates/_form.html.haml +10 -0
  27. data/lib/generators/bootstrap/themed/templates/_form.html.slim +11 -0
  28. data/lib/generators/bootstrap/themed/templates/edit.html.erb +5 -0
  29. data/lib/generators/bootstrap/themed/templates/edit.html.haml +4 -0
  30. data/lib/generators/bootstrap/themed/templates/edit.html.slim +4 -0
  31. data/lib/generators/bootstrap/themed/templates/index.html.erb +40 -0
  32. data/lib/generators/bootstrap/themed/templates/index.html.haml +25 -0
  33. data/lib/generators/bootstrap/themed/templates/index.html.slim +27 -0
  34. data/lib/generators/bootstrap/themed/templates/new.html.erb +5 -0
  35. data/lib/generators/bootstrap/themed/templates/new.html.haml +4 -0
  36. data/lib/generators/bootstrap/themed/templates/new.html.slim +4 -0
  37. data/lib/generators/bootstrap/themed/templates/show.html.erb +23 -0
  38. data/lib/generators/bootstrap/themed/templates/show.html.haml +15 -0
  39. data/lib/generators/bootstrap/themed/templates/show.html.slim +17 -0
  40. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.erb +14 -0
  41. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.haml +11 -0
  42. data/lib/generators/bootstrap/themed/templates/simple_form/_form.html.slim +12 -0
  43. data/lib/generators/bootstrap/themed/themed_generator.rb +148 -0
  44. data/script/rails +8 -0
  45. data/spec/dummy/README.rdoc +261 -0
  46. data/spec/dummy/Rakefile +7 -0
  47. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  48. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  49. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  50. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  51. data/spec/dummy/app/mailers/.gitkeep +0 -0
  52. data/spec/dummy/app/models/.gitkeep +0 -0
  53. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  54. data/spec/dummy/config.ru +4 -0
  55. data/spec/dummy/config/application.rb +65 -0
  56. data/spec/dummy/config/boot.rb +10 -0
  57. data/spec/dummy/config/database.yml +25 -0
  58. data/spec/dummy/config/environment.rb +5 -0
  59. data/spec/dummy/config/environments/development.rb +37 -0
  60. data/spec/dummy/config/environments/production.rb +67 -0
  61. data/spec/dummy/config/environments/test.rb +37 -0
  62. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  63. data/spec/dummy/config/initializers/inflections.rb +15 -0
  64. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  65. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  66. data/spec/dummy/config/initializers/session_store.rb +8 -0
  67. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  68. data/spec/dummy/config/locales/en.yml +5 -0
  69. data/spec/dummy/config/routes.rb +58 -0
  70. data/spec/dummy/lib/assets/.gitkeep +0 -0
  71. data/spec/dummy/log/.gitkeep +0 -0
  72. data/spec/dummy/public/404.html +26 -0
  73. data/spec/dummy/public/422.html +26 -0
  74. data/spec/dummy/public/500.html +25 -0
  75. data/spec/dummy/public/favicon.ico +0 -0
  76. data/spec/dummy/script/rails +6 -0
  77. data/spec/helpers/bootstrap_flash_helper_spec.rb +17 -0
  78. data/spec/spec_helper.rb +9 -0
  79. metadata +211 -0
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
7
+ spec/dummy/.sass-cache
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in bootstrap-sass-extras.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
@@ -0,0 +1,107 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bootstrap-sass-extras (0.0.1)
5
+ rails (>= 3.1.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.13)
11
+ actionpack (= 3.2.13)
12
+ mail (~> 2.5.3)
13
+ actionpack (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.13)
24
+ activesupport (= 3.2.13)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.13)
27
+ activemodel (= 3.2.13)
28
+ activesupport (= 3.2.13)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.13)
32
+ activemodel (= 3.2.13)
33
+ activesupport (= 3.2.13)
34
+ activesupport (3.2.13)
35
+ i18n (= 0.6.1)
36
+ multi_json (~> 1.0)
37
+ arel (3.0.2)
38
+ builder (3.0.4)
39
+ diff-lcs (1.1.3)
40
+ erubis (2.7.0)
41
+ hike (1.2.1)
42
+ i18n (0.6.1)
43
+ journey (1.0.4)
44
+ json (1.7.7)
45
+ mail (2.5.3)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.21)
50
+ multi_json (1.7.2)
51
+ polyglot (0.3.3)
52
+ rack (1.4.5)
53
+ rack-cache (1.2)
54
+ rack (>= 0.4)
55
+ rack-ssl (1.3.3)
56
+ rack
57
+ rack-test (0.6.2)
58
+ rack (>= 1.0)
59
+ rails (3.2.13)
60
+ actionmailer (= 3.2.13)
61
+ actionpack (= 3.2.13)
62
+ activerecord (= 3.2.13)
63
+ activeresource (= 3.2.13)
64
+ activesupport (= 3.2.13)
65
+ bundler (~> 1.0)
66
+ railties (= 3.2.13)
67
+ railties (3.2.13)
68
+ actionpack (= 3.2.13)
69
+ activesupport (= 3.2.13)
70
+ rack-ssl (~> 1.3.2)
71
+ rake (>= 0.8.7)
72
+ rdoc (~> 3.4)
73
+ thor (>= 0.14.6, < 2.0)
74
+ rake (10.0.3)
75
+ rdoc (3.12.2)
76
+ json (~> 1.4)
77
+ rspec-core (2.12.2)
78
+ rspec-expectations (2.12.1)
79
+ diff-lcs (~> 1.1.3)
80
+ rspec-mocks (2.12.1)
81
+ rspec-rails (2.12.1)
82
+ actionpack (>= 3.0)
83
+ activesupport (>= 3.0)
84
+ railties (>= 3.0)
85
+ rspec-core (~> 2.12.0)
86
+ rspec-expectations (~> 2.12.0)
87
+ rspec-mocks (~> 2.12.0)
88
+ sprockets (2.2.2)
89
+ hike (~> 1.2)
90
+ multi_json (~> 1.0)
91
+ rack (~> 1.0)
92
+ tilt (~> 1.1, != 1.3.0)
93
+ sqlite3 (1.3.7)
94
+ thor (0.17.0)
95
+ tilt (1.3.6)
96
+ treetop (1.4.12)
97
+ polyglot
98
+ polyglot (>= 0.3.1)
99
+ tzinfo (0.3.37)
100
+
101
+ PLATFORMS
102
+ ruby
103
+
104
+ DEPENDENCIES
105
+ bootstrap-sass-extras!
106
+ rspec-rails
107
+ sqlite3
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Doabit
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,86 @@
1
+ # Bootstrap::Sass::Extras
2
+
3
+ [bootstrap-sass][1] extras, idea and codes from [twitter-bootstrap-rails][2]
4
+
5
+ [1]: https://github.com/thomas-mcdonald/bootstrap-sass
6
+ [2]: https://github.com/seyhunak/twitter-bootstrap-rails
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'bootstrap-sass-extras'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install bootstrap-sass-extras
21
+
22
+ ## Generating locale, layouts and views
23
+
24
+ You can run following generators to get started with Twitter Bootstrap quickly.
25
+
26
+ Generate locale
27
+
28
+
29
+ Usage:
30
+
31
+
32
+ rails g bootstrap:install
33
+
34
+
35
+ Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
36
+
37
+
38
+ Usage:
39
+
40
+
41
+ rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
42
+
43
+
44
+ Example of a fixed layout:
45
+
46
+
47
+ rails g bootstrap:layout application fixed
48
+
49
+
50
+ Example of a responsive layout:
51
+
52
+
53
+ rails g bootstrap:layout application fluid
54
+
55
+
56
+ Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
57
+
58
+
59
+ Usage:
60
+
61
+
62
+ rails g bootstrap:themed [RESOURCE_NAME]
63
+
64
+
65
+ Example:
66
+
67
+
68
+ rails g scaffold Post title:string description:text
69
+ rake db:migrate
70
+ rails g bootstrap:themed Posts
71
+
72
+ Notice the plural usage of the resource to generate bootstrap:themed.
73
+
74
+ ## Using Helpers
75
+
76
+ ### Flash helper
77
+ Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
78
+
79
+
80
+ ## Contributing
81
+
82
+ 1. Fork it
83
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
84
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
85
+ 4. Push to the branch (`git push origin my-new-feature`)
86
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
1
+ module BootstrapFlashHelper
2
+ def bootstrap_flash
3
+ output = ''
4
+ flash.each do |type, message|
5
+ output += flash_container(type, message)
6
+ end
7
+
8
+ raw(output)
9
+ end
10
+
11
+ def flash_container(type, message)
12
+ raw(content_tag(:div, :class => "alert alert-#{type}") do
13
+ content_tag(:a, raw("&times;"),:class => 'close', :data => {:dismiss => 'alert'}) +
14
+ message
15
+ end)
16
+ end
17
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bootstrap-sass-extras/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "bootstrap-sass-extras"
8
+ gem.version = BootstrapSassExtras::VERSION
9
+ gem.authors = ["doabit"]
10
+ gem.email = ["doinsist@gmail.com"]
11
+ gem.description = %q{bootstrap-sass extras.}
12
+ gem.summary = %q{bootstrap-sass extras.}
13
+ gem.homepage = "https://github.com/doabit/bootstrap-sass-extra"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ gem.add_dependency "rails", ">= 3.1.0"
20
+
21
+ gem.add_development_dependency "rspec-rails"
22
+ gem.add_development_dependency "sqlite3"
23
+ end
Binary file
@@ -0,0 +1,3 @@
1
+ module BootstrapSassExtras
2
+ require "bootstrap-sass-extras/engine"
3
+ end
@@ -0,0 +1,9 @@
1
+ module BootstrapSassExtras
2
+ class Engine < ::Rails::Engine
3
+ initializer 'bootstrap-sass-extras.setup_helpers' do |app|
4
+ app.config.to_prepare do
5
+ ActionController::Base.send :helper, BootstrapFlashHelper
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module BootstrapSassExtras
2
+ VERSION = "0.0.1"
3
+ end
Binary file
@@ -0,0 +1,21 @@
1
+ require 'rails/generators'
2
+
3
+ module Bootstrap
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+
7
+ source_root File.expand_path("../templates", __FILE__)
8
+ desc "This generator installs Twitter Bootstrap locale"
9
+
10
+ def add_locale
11
+ if File.exist?("config/locales/en.bootstrap.yml")
12
+ localez = File.read("config/locales/en.bootstrap.yml")
13
+ insert_into_file "config/locales/en.bootstrap.yml", localez, :after => "en\n"
14
+ else
15
+ copy_file "en.bootstrap.yml", "config/locales/en.bootstrap.yml"
16
+ end
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,17 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ helpers:
6
+ actions: "Actions"
7
+ links:
8
+ back: "Back"
9
+ cancel: "Cancel"
10
+ confirm: "Are you sure?"
11
+ destroy: "Delete"
12
+ new: "New"
13
+ titles:
14
+ edit: "Edit"
15
+ save: "Save"
16
+ new: "New"
17
+ delete: "Delete"
@@ -0,0 +1,23 @@
1
+ require 'rails/generators'
2
+
3
+ module Bootstrap
4
+ module Generators
5
+ class LayoutGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
7
+ desc "This generator generates layout file with navigation."
8
+ argument :layout_name, :type => :string, :default => "application"
9
+ argument :layout_type, :type => :string, :default => "fixed",
10
+ :banner => "*fixed or fluid"
11
+
12
+ attr_reader :app_name, :container_class
13
+
14
+ def generate_layout
15
+ app = ::Rails.application
16
+ @app_name = app.class.to_s.split("::").first
17
+ @container_class = layout_type == "fluid" ? "container-fluid" : "container"
18
+ ext = app.config.generators.options[:rails][:template_engine] || :erb
19
+ template "layout.html.#{ext}", "app/views/layouts/#{layout_name}.html.#{ext}"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,109 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title><%%= content_for?(:title) ? yield(:title) : "<%= app_name %>" %></title>
8
+ <%%= csrf_meta_tags %>
9
+
10
+ <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
11
+ <!--[if lt IE 9]>
12
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>
13
+ <![endif]-->
14
+
15
+ <%%= stylesheet_link_tag "application", :media => "all" %>
16
+
17
+ <!-- For third-generation iPad with high-resolution Retina display: -->
18
+ <!-- Size should be 144 x 144 pixels -->
19
+ <%%= favicon_link_tag 'images/apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
+
21
+ <!-- For iPhone with high-resolution Retina display: -->
22
+ <!-- Size should be 114 x 114 pixels -->
23
+ <%%= favicon_link_tag 'images/apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
+
25
+ <!-- For first- and second-generation iPad: -->
26
+ <!-- Size should be 72 x 72 pixels -->
27
+ <%%= favicon_link_tag 'images/apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
+
29
+ <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
+ <!-- Size should be 57 x 57 pixels -->
31
+ <%%= favicon_link_tag 'images/apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
+
33
+ <!-- For all other devices -->
34
+ <!-- Size should be 32 x 32 pixels -->
35
+ <%%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
36
+ </head>
37
+ <body>
38
+
39
+ <div class="navbar navbar-<%= layout_type %>-top">
40
+ <div class="navbar-inner">
41
+ <div class="<%= container_class %>">
42
+ <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
43
+ <span class="icon-bar"></span>
44
+ <span class="icon-bar"></span>
45
+ <span class="icon-bar"></span>
46
+ </a>
47
+ <a class="brand" href="#"><%= app_name %></a>
48
+ <div class="<%= container_class %> nav-collapse">
49
+ <ul class="nav">
50
+ <li><%%= link_to "Link1", "/path1" %></li>
51
+ <li><%%= link_to "Link2", "/path2" %></li>
52
+ <li><%%= link_to "Link3", "/path3" %></li>
53
+ </ul>
54
+ </div><!--/.nav-collapse -->
55
+ </div>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="<%= container_class %>">
60
+ <%- if layout_type == "fluid" -%>
61
+ <div class="row-fluid">
62
+ <div class="span3">
63
+ <div class="well sidebar-nav">
64
+ <ul class="nav nav-list">
65
+ <li class="nav-header">Sidebar</li>
66
+ <li><%%= link_to "Link1", "/path1" %></li>
67
+ <li><%%= link_to "Link2", "/path2" %></li>
68
+ <li><%%= link_to "Link3", "/path3" %></li>
69
+ </ul>
70
+ </div><!--/.well -->
71
+ </div><!--/span-->
72
+ <div class="span9">
73
+ <%%= bootstrap_flash %>
74
+ <%%= yield %>
75
+ </div>
76
+ </div><!--/row-->
77
+ <%- else -%>
78
+ <div class="row">
79
+ <div class="span9">
80
+ <%%= bootstrap_flash %>
81
+ <%%= yield %>
82
+ </div>
83
+ <div class="span3">
84
+ <div class="well sidebar-nav">
85
+ <h3>Sidebar</h3>
86
+ <ul class="nav nav-list">
87
+ <li class="nav-header">Sidebar</li>
88
+ <li><%%= link_to "Link1", "/path1" %></li>
89
+ <li><%%= link_to "Link2", "/path2" %></li>
90
+ <li><%%= link_to "Link3", "/path3" %></li>
91
+ </ul>
92
+ </div><!--/.well -->
93
+ </div><!--/span-->
94
+ </div><!--/row-->
95
+ <%- end -%>
96
+
97
+ <footer>
98
+ <p>&copy; Company 2013</p>
99
+ </footer>
100
+
101
+ </div> <!-- /container -->
102
+
103
+ <!-- Javascripts
104
+ ================================================== -->
105
+ <!-- Placed at the end of the document so the pages load faster -->
106
+ <%%= javascript_include_tag "application" %>
107
+
108
+ </body>
109
+ </html>