bootstrap-sass-extras 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile.lock +4 -3
  5. data/README.md +49 -0
  6. data/app/helpers/glyph_helper.rb +11 -0
  7. data/app/helpers/modal_helper.rb +55 -0
  8. data/app/helpers/twitter_breadcrumbs_helper.rb +5 -0
  9. data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +14 -0
  10. data/lib/bootstrap-sass-extras/engine.rb +3 -0
  11. data/lib/bootstrap-sass-extras/version.rb +1 -1
  12. data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +1 -0
  13. data/lib/generators/bootstrap/layout/templates/layout.html.erb +4 -4
  14. data/lib/generators/bootstrap/layout/templates/layout.html.haml +5 -5
  15. data/lib/generators/bootstrap/layout/templates/layout.html.slim +7 -5
  16. data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -1
  17. data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
  18. data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
  19. data/lib/generators/bootstrap/themed/templates/index.html.erb +1 -1
  20. data/lib/generators/bootstrap/themed/templates/index.html.haml +1 -1
  21. data/lib/generators/bootstrap/themed/templates/index.html.slim +1 -1
  22. data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -1
  23. data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
  24. data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
  25. data/lib/generators/bootstrap/themed/templates/show.html.erb +1 -1
  26. data/lib/generators/bootstrap/themed/templates/show.html.haml +1 -1
  27. data/lib/generators/bootstrap/themed/templates/show.html.slim +1 -1
  28. metadata +7 -5
  29. data/lib/.DS_Store +0 -0
  30. data/lib/generators/.DS_Store +0 -0
  31. data/lib/generators/bootstrap/install/templates/.DS_Store +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 143c8cd1522b62fb8c99b3e234b165dfb88e0993
4
- data.tar.gz: ad5fec9a199ce248c1705b6175117906167e2706
3
+ metadata.gz: a3fb89b0dac2bdbce1b2c0b80f970f8c2f8f4b4f
4
+ data.tar.gz: ff4cb7955a581564fa9f33b1e2a7d3cd20bff4a2
5
5
  SHA512:
6
- metadata.gz: e9b4314f8ac8ff1e126cbc4e3aa3a06472f7923fe27bb75059f0c6ce4db3ce987465cfe38310e85f2d4fa488de51d78813303deecf1dbdf53fb69aaf4fd3dcc7
7
- data.tar.gz: 981f7ccf5278a336b618b14f766036c6f3a58ca0a669324c929ce7c52908b47f3d7c8d9827057112955935ff53c7b238271a55019ea8717c19486acabc36898f
6
+ metadata.gz: 991f34f1c4b0c695d9aca47d7604fe04b33e5397b807d99940d1f89384c0fe9ba44945a8b30d8e48157ef9c0c409fa6054909fb95d52ea809be7d17cc27953bb
7
+ data.tar.gz: 10f5f1afbdbcb87cd455a0cceef1fc73adada250b1a6e2fca9d8e663a1889bc2c182cf3c44de3894c8e13c8591c7b8b098c4ae762da0f825d63676aa0d0c7867
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ spec/dummy/db/*.sqlite3
5
5
  spec/dummy/log/*.log
6
6
  spec/dummy/tmp/
7
7
  spec/dummy/.sass-cache
8
+ .DS_Store
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ ## Relese 0.0.3
4
+
5
+ * Add glyph, model and breadcrumbs helpers
6
+ * Update templates
7
+
8
+ ## Release 0.0.2
9
+
10
+ * Add layout and views generators
11
+
12
+ ## Release 0.0.1
13
+
14
+ * Initial version
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bootstrap-sass-extras (0.0.2)
4
+ bootstrap-sass-extras (0.0.1)
5
5
  rails (>= 3.1.0)
6
6
 
7
7
  GEM
@@ -42,10 +42,11 @@ GEM
42
42
  i18n (0.6.1)
43
43
  journey (1.0.4)
44
44
  json (1.7.7)
45
- mail (2.5.4)
45
+ mail (2.5.3)
46
+ i18n (>= 0.4.0)
46
47
  mime-types (~> 1.16)
47
48
  treetop (~> 1.4.8)
48
- mime-types (1.23)
49
+ mime-types (1.21)
49
50
  multi_json (1.7.2)
50
51
  polyglot (0.3.3)
51
52
  rack (1.4.5)
data/README.md CHANGED
@@ -76,6 +76,55 @@ Notice the plural usage of the resource to generate bootstrap:themed.
76
76
  ### Flash helper
77
77
  Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
78
78
 
79
+ ### Modal Helper
80
+ You can create modals easily using the following example. The header, body, and footer all accept content_tag or plain html.
81
+ The href of the button to launch the modal must matche the id of the modal dialog.
82
+
83
+ ```ruby
84
+ <%= content_tag :a, "Modal", :href => "#modal", :class => 'btn', :data => {:toggle => modal'} %>
85
+
86
+ <%= modal_dialog :id => "modal",
87
+ :header => { :show_close => true, :dismiss => 'modal', :title => 'Modal header' },
88
+ :body => 'This is the body',
89
+ :footer => content_tag(:button, 'Save', :class => 'btn') %>
90
+ ```
91
+
92
+ ### Breadcrumbs Helpers
93
+
94
+ *Notice* If your application is using [breadcrumbs-on-rails](https://github.com/weppos/breadcrumbs_on_rails) you will have a namespace collision with the add_breadcrumb method.
95
+ You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.
96
+
97
+ Add breadcrumbs helper `<%= render_breadcrumbs %>` to your layout.
98
+
99
+ ```ruby
100
+ class ApplicationController
101
+ add_breadcrumb :index, :root_path
102
+ end
103
+ ```
104
+
105
+ ```ruby
106
+ class ExamplesController < ApplicationController
107
+ add_breadcrumb :index, :examples_path
108
+
109
+ def index
110
+ end
111
+
112
+ def show
113
+ @example = Example.find params[:id]
114
+ add_breadcrumb @example.name, example_path(@example)
115
+ # add_breadcrumb :show, example_path(@example)
116
+ end
117
+ end
118
+ ```
119
+
120
+ ### Glyp Helper
121
+
122
+ ```ruby
123
+ glyph(:share_alt)
124
+ # => <i class="icon-share-alt"></i>
125
+ glyph(:lock, :white)
126
+ # => <i class="icon-lock icon-white"></i>
127
+ ```
79
128
 
80
129
  ## Contributing
81
130
 
@@ -0,0 +1,11 @@
1
+ module GlyphHelper
2
+ # ==== Examples
3
+ # glyph(:share_alt)
4
+ # # => <i class="icon-share-alt"></i>
5
+ # glyph(:lock, :white)
6
+ # # => <i class="icon-lock icon-white"></i>
7
+
8
+ def glyph(*names)
9
+ content_tag :i, nil, :class => names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
10
+ end
11
+ end
@@ -0,0 +1,55 @@
1
+ module ModalHelper
2
+
3
+ #modals have a header, a body, a footer for options.
4
+ def modal_dialog(options = {}, &block)
5
+ content_tag :div, :id => options[:id], :class => "bootstrap-modal modal hide fade" do
6
+ modal_header(options[:header]) +
7
+ modal_body(options[:body]) +
8
+ modal_footer(options[:footer])
9
+ end
10
+ end
11
+
12
+ def modal_header(options = {}, &block)
13
+ content_tag :div, :class => 'modal-header' do
14
+ if options[:show_close]
15
+ close_button(options[:dismiss]) +
16
+ content_tag(:h3, options[:title], &block)
17
+ else
18
+ content_tag(:h3, options[:title], &block)
19
+ end
20
+ end
21
+ end
22
+
23
+ def modal_body(options = {}, &block)
24
+ content_tag :div, options, :class => 'modal-body', &block
25
+ end
26
+
27
+ def modal_footer(options = {}, &block)
28
+ content_tag :div, options, :class => 'modal-footer', &block
29
+ end
30
+
31
+ def close_button(dismiss)
32
+ #It doesn't seem to like content_tag, so we do this instead.
33
+ raw("<button class=\"close\" data-dismiss=\"#{dismiss}\">&times;</button>")
34
+ end
35
+
36
+ def modal_toggle(content_or_options = nil, options = {}, &block)
37
+ if block_given?
38
+ options = content_or_options if content_or_options.is_a?(Hash)
39
+ default_options = { :class => 'btn', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
40
+
41
+ content_tag :a, nil, default_options, true, &block
42
+ else
43
+ default_options = { :class => 'btn', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
44
+ content_tag :a, content_or_options, default_options, true
45
+ end
46
+ end
47
+
48
+ def modal_cancel_button content, options = {}
49
+ default_options = { :class => "btn bootstrap-modal-cancel-button" }
50
+
51
+ content_tag_string "a", content, default_options.merge(options)
52
+ end
53
+
54
+ end
55
+
@@ -0,0 +1,5 @@
1
+ module TwitterBreadcrumbsHelper
2
+ def render_breadcrumbs(divider = '/')
3
+ render :partial => 'twitter-bootstrap/breadcrumbs', :locals => { :divider => divider }
4
+ end
5
+ end
@@ -0,0 +1,14 @@
1
+ <% if @breadcrumbs.present? %>
2
+ <ul class="breadcrumb">
3
+ <% separator = divider %>
4
+ <% @breadcrumbs[0..-2].each do |crumb| %>
5
+ <li>
6
+ <%= link_to crumb[:name], crumb[:url], crumb[:options] %>
7
+ <span class="divider"><%= separator %></span>
8
+ </li>
9
+ <% end %>
10
+ <li class="active">
11
+ <%= @breadcrumbs.last[:name] %>
12
+ </li>
13
+ </ul>
14
+ <% end %>
@@ -3,6 +3,9 @@ module BootstrapSassExtras
3
3
  initializer 'bootstrap-sass-extras.setup_helpers' do |app|
4
4
  app.config.to_prepare do
5
5
  ActionController::Base.send :helper, BootstrapFlashHelper
6
+ ActionController::Base.send :helper, GlyphHelper
7
+ ActionController::Base.send :helper, ModalHelper
8
+ ActionController::Base.send :helper, TwitterBreadcrumbsHelper
6
9
  end
7
10
  end
8
11
  end
@@ -1,3 +1,3 @@
1
1
  module BootstrapSassExtras
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -10,6 +10,7 @@ en:
10
10
  confirm: "Are you sure?"
11
11
  destroy: "Delete"
12
12
  new: "New"
13
+ edit: "Edit"
13
14
  titles:
14
15
  edit: "Edit"
15
16
  save: "Save"
@@ -16,19 +16,19 @@
16
16
 
17
17
  <!-- For third-generation iPad with high-resolution Retina display: -->
18
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' %>
19
+ <%%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
20
20
 
21
21
  <!-- For iPhone with high-resolution Retina display: -->
22
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' %>
23
+ <%%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
24
24
 
25
25
  <!-- For first- and second-generation iPad: -->
26
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' %>
27
+ <%%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
28
28
 
29
29
  <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
30
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' %>
31
+ <%%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
32
32
 
33
33
  <!-- For all other devices -->
34
34
  <!-- Size should be 32 x 32 pixels -->
@@ -10,11 +10,11 @@
10
10
  /[if lt IE 9]
11
11
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
12
12
  = stylesheet_link_tag "application", :media => "all"
13
- %link(href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144")
14
- %link(href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114")
15
- %link(href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72")
16
- %link(href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed")
17
- %link(href="favicon.ico" rel="shortcut icon")
13
+ = favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
14
+ = favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
15
+ = favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
16
+ = favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
17
+ = favicon_link_tag 'favicon.ico', :rel => 'shortcut icon'
18
18
 
19
19
 
20
20
  %body
@@ -11,11 +11,13 @@ html lang="en"
11
11
  /[if lt IE 9]
12
12
  = javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
13
13
  = stylesheet_link_tag "application", :media => "all"
14
- link href="images/apple-touch-icon-144x144.png" rel="apple-touch-icon-precomposed" sizes="144x144"
15
- link href="images/apple-touch-icon-114x114.png" rel="apple-touch-icon-precomposed" sizes="114x114"
16
- link href="images/apple-touch-icon-72x72.png" rel="apple-touch-icon-precomposed" sizes="72x72"
17
- link href="images/apple-touch-icon.png" rel="apple-touch-icon-precomposed"
18
- link href="favicon.ico" rel="shortcut icon"
14
+ = favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
15
+ = favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
16
+ = favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
17
+ = favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
18
+ = favicon_link_tag 'favicon.ico', :rel => 'shortcut icon'
19
+
20
+
19
21
 
20
22
  body
21
23
  .navbar.navbar-<%= layout_type %>-top
@@ -1,5 +1,5 @@
1
1
  <%%- model_class = <%= resource_name.classify %> -%>
2
2
  <div class="page-header">
3
- <h1><%%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human %></h1>
3
+ <h1><%%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize %></h1>
4
4
  </div>
5
5
  <%%= render :partial => 'form' %>
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  .page-header
3
- %h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human
3
+ %h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  div class="page-header"
3
- h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human
3
+ h1=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -1,6 +1,6 @@
1
1
  <%%- model_class = <%= resource_name.classify %> -%>
2
2
  <div class="page-header">
3
- <h1><%%=t '.title', :default => model_class.model_name.human.pluralize %></h1>
3
+ <h1><%%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
4
4
  </div>
5
5
  <table class="table table-striped">
6
6
  <thead>
@@ -1,6 +1,6 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  .page-header
3
- %h1=t '.title', :default => model_class.model_name.human.pluralize
3
+ %h1=t '.title', :default => model_class.model_name.human.pluralize.titleize
4
4
  %table.table.table-striped
5
5
  %thead
6
6
  %tr
@@ -1,6 +1,6 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  div class="page-header"
3
- h1=t '.title', :default => model_class.model_name.human.pluralize
3
+ h1=t '.title', :default => model_class.model_name.human.pluralize.titleize
4
4
  table class="table table-striped"
5
5
  thead
6
6
  tr
@@ -1,5 +1,5 @@
1
1
  <%%- model_class = <%= resource_name.classify %> -%>
2
2
  <div class="page-header">
3
- <h1><%%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human %></h1>
3
+ <h1><%%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize %></h1>
4
4
  </div>
5
5
  <%%= render :partial => 'form' %>
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  .page-header
3
- %h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human
3
+ %h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -1,4 +1,4 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  div class="page-header"
3
- h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human
3
+ h1=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize
4
4
  = render :partial => "form"
@@ -1,6 +1,6 @@
1
1
  <%%- model_class = <%= resource_name.classify %> -%>
2
2
  <div class="page-header">
3
- <h1><%%=t '.title', :default => model_class.model_name.human %></h1>
3
+ <h1><%%=t '.title', :default => model_class.model_name.human.titleize %></h1>
4
4
  </div>
5
5
 
6
6
  <dl class="dl-horizontal">
@@ -1,6 +1,6 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  .page-header
3
- %h1=t '.title', :default => model_class.model_name.human
3
+ %h1=t '.title', :default => model_class.model_name.human.titleize
4
4
 
5
5
  <%- columns.each do |column| -%>
6
6
  %p
@@ -1,6 +1,6 @@
1
1
  - model_class = <%= resource_name.classify %>
2
2
  div class="page-header"
3
- h1=t '.title', :default => model_class.model_name.human
3
+ h1=t '.title', :default => model_class.model_name.human.titleize
4
4
 
5
5
  <%- columns.each do |column| -%>
6
6
  p
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-sass-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - doabit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-14 00:00:00.000000000 Z
11
+ date: 2013-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -61,20 +61,22 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
63
  - .rspec
64
+ - CHANGELOG.md
64
65
  - Gemfile
65
66
  - Gemfile.lock
66
67
  - MIT-LICENSE
67
68
  - README.md
68
69
  - Rakefile
69
70
  - app/helpers/bootstrap_flash_helper.rb
71
+ - app/helpers/glyph_helper.rb
72
+ - app/helpers/modal_helper.rb
73
+ - app/helpers/twitter_breadcrumbs_helper.rb
74
+ - app/views/twitter-bootstrap/_breadcrumbs.html.erb
70
75
  - bootstrap-sass-extras.gemspec
71
- - lib/.DS_Store
72
76
  - lib/bootstrap-sass-extras.rb
73
77
  - lib/bootstrap-sass-extras/engine.rb
74
78
  - lib/bootstrap-sass-extras/version.rb
75
- - lib/generators/.DS_Store
76
79
  - lib/generators/bootstrap/install/install_generator.rb
77
- - lib/generators/bootstrap/install/templates/.DS_Store
78
80
  - lib/generators/bootstrap/install/templates/en.bootstrap.yml
79
81
  - lib/generators/bootstrap/layout/layout_generator.rb
80
82
  - lib/generators/bootstrap/layout/templates/layout.html.erb
data/lib/.DS_Store DELETED
Binary file
Binary file