sinatra-bootstrap 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +154 -8
  3. data/lib/sinatra/bootstrap.rb +3 -3
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4efe9ab9b465d643e2218156c7741e7d7c810e15
4
- data.tar.gz: ddcfe17210716c6501015115910a14cb15f267a2
3
+ metadata.gz: e51e819310a0b1ff30bf90f69f8966e1c9a1e71a
4
+ data.tar.gz: b105d8c9aa710e7c5adc8eb18b627ad4ae535b8c
5
5
  SHA512:
6
- metadata.gz: 3a65af50b43abf9e6a7aef1fa5adfa7ca9ec2d9a4fd36c9903017bdf1a7298a7427f9a910a1c4d7cdb63783a9133ce368fd913d228ccecc6f846d4cfa0e36401
7
- data.tar.gz: 58de8ecf912a5e0748ab8784aff4105ac97fed2ce7d93ac14fa84426e4fa1ac3de616fdc2dab6c9e61afd966af673373166ce126805903e8b806e0fb4ff6fe00
6
+ metadata.gz: b7c89d280256cb0d0694d6a6f4edbafe8fb91784fd4ddf14eed11917d42e750cf791c50527f776d4b7503103afe79e7f13f8d66d6b1bddf63579d05655b6ef8a
7
+ data.tar.gz: c59bc967f292cf6af2247b3fa619c2147fae9c91eb4ddaab8d3f1d3c1e5072a58f67df80303f8054c30199ffaf500d0b52effaff3e477d2ba39b023ec4c8c47a
data/README.md CHANGED
@@ -1,19 +1,165 @@
1
- Cool README.md coming soon enough.
2
1
 
3
- For now, to put it short, this is a fork of sinatra-twitter-bootstrap by mfojtik. Which you can check out at https://github.com/mfojtik/sinatra-twitter-bootstrap.
2
+ sinatra-bootstrap
3
+ =================
4
+
5
+ This is a fork of sinatra-twitter-bootstrap by mfojtik. Which you can check out at https://github.com/mfojtik/sinatra-twitter-bootstrap.
4
6
 
5
7
  When I found it it was exactly what I was looking for, but I wanted bootstrap 3, so I made this fork just to bump the bootstrap and do a pull-request.
6
- Bootstrap 3 was significantly different though, so I ended up having to do a major revamp of this
7
- (and some more will follow, when I add the helpers for grid and etc). Because of that, I decided to keep this fork separated, at least for now.
8
+ Bootstrap 3 was significantly different though, so I ended up having to do a major revamp of the code.
8
9
 
9
- License
10
+ Because of that, I decided to keep this fork separated, at least for now. He can feel free to pull this to a branch or whatever (or you, whoever you are).
11
+
12
+ What it does right now?
13
+ -----------------------
14
+
15
+ * [Include helpers for Bootstrap 3](https://github.com/mateusmedeiros/sinatra-bootstrap/wiki/Include-helpers)
16
+ * [Content helpers for cols/offsets, row and container](https://github.com/mateusmedeiros/sinatra-bootstrap/wiki/Content-helpers), and more to come, when I decide which.
17
+
18
+ The helpers should work on ERB and HAML. Adding at least Slim to that list is in my top priorities, but that will have to wait for now.
19
+ Note that the gem will take care of everything (including etag and cache), you just need to add the gem and the include there.
20
+
21
+ Getting started
22
+ ---------------
23
+
24
+
25
+ #### Bundler
26
+
27
+ If you use bundler, you should add this to your Gemfile:
28
+
29
+ ```ruby
30
+ gem 'sinatra-bootstrap', :require => 'sinatra/bootstrap'
31
+ ```
32
+
33
+ and then `bundle install`
34
+
35
+ As noted in [Bundler setup](http://bundler.io/bundler_setup.html), you will probably also need to require them manually if you don't have Bundler set up to require them automagically.
36
+
37
+
38
+ #### Non-bundler
39
+
40
+ If you don't use bundler (like me):
41
+
42
+ ```bash
43
+ gem install sinatra-bootstrap
44
+ ```
45
+
46
+ then you should add this to your application main file (the one where you require sinatra)
47
+
48
+ ```ruby
49
+ register Sinatra::Bootstrap::Assets
50
+ ```
51
+
52
+ (put it inside your application block if you're using the modular style)
53
+
54
+ and don't forget to require it
55
+
56
+ ```ruby
57
+ require 'sinatra/bootstrap'
58
+ ```
59
+
60
+
61
+ Overview
10
62
  --------
11
63
 
12
- This and sinatra-twitter-bootstrap are licensed under Apache Software License 2.0
64
+ ```rhtml
65
+ <html>
66
+ <head>
67
+ <%= bootstrap_css false, "attribute='foo'"%>
68
+ <%= bootstrap_js_legacy %>
69
+ </head>
70
+ <body>
71
+ <% container :div do %>
72
+ <% row :div do %>
73
+ <% cols :a, cols: "a2b2", offset: "a2b2", any1:"attr1", "data-any2" => "attr2" do %>
74
+ Hello, world!
75
+ <% end %>
76
+ <% end %>
77
+ <% row :section do %>
78
+ <% cols :a, cols: "b2d2a32", class: "hey extra classes", href: "https://github.com/mateusmedeiros/sinatra-bootstrap" do %>
79
+ This is an example!
80
+ <% end %>
81
+ <% end %>
82
+ <% end %>
83
+ <%= bootstrap_js_default %>
84
+ </body>
85
+ </html>
86
+ ```
87
+
88
+ Will result in the following html:
89
+
90
+ ```html
91
+ <html>
92
+ <head>
93
+ <link rel='stylesheet' type='text/css' attribute='foo' href='http://something:someport/css/bootstrap.min.css'>
94
+ <!--[if lt IE 9]>
95
+ <script type='text/javascript' src='http://something:someport/js/html5.js'></script>
96
+ <script type='text/javascript' src='http://something:someport/js/respond.min.js'></script>
97
+ <![endif]-->
98
+ </head>
99
+ <body>
100
+ <div class="container">
101
+ <div class="row">
102
+ <a class="col-xs-2 col-sm-2 col-xs-offset-2 col-sm-offset-2" any1="attr1" data-any2="attr2">
103
+ Hello, world!
104
+ </a>
105
+ </div>
106
+ <section class="row">
107
+ <a class="col-xs-32 col-sm-2 col-lg-2 hey extra classes" href="https://github.com/mateusmedeiros/sinatra-bootstrap">
108
+ This is an example!
109
+ </a>
110
+ </section>
111
+ </div>
112
+ <script type='text/javascript' src='http://something:someport/js/jquery.min.js'></script>
113
+ <script type='text/javascript' src='http://something:someport/js/bootstrap.min.js'></script>
114
+ </body>
115
+ </html>
116
+ ```
117
+
118
+ I made the cols helper the shortest I could (very soon I'll add the option to use just c: and o: instead of cols: and offset: to make it even shorter).
119
+
120
+ The way you use the cols and offsets is "aXXbXXcXXdXX".
121
+ "a" is equivalent to "xs", "b" to "sm", "c" to "md" and "d" to "lg".
122
+
123
+ The XX are the numbers you want, but note that sinatra-bootstrap won't make any try to see if you used a valid number (<= 12).
124
+
125
+ sinatra-bootstrap also won't care if you use "a" on offset, because even though there's no col-xs-offset, AFAIK, it's planned for Bootstrap 3.1 .
126
+
127
+ e.g.
128
+ `cols :div, cols: "a2d14", offset: "a1d2"` :
129
+
130
+ `<div class="col-xs-2 col-lg-14 col-xs-offset-1 col-lg-offset-2"></div>`
131
+
132
+ For more info refer to the example above and the complete ones in example folder, and specially [the wiki](https://github.com/mateusmedeiros/sinatra-bootstrap/wiki)
133
+
134
+
135
+ TO-DO
136
+ -----
137
+
138
+ * ~~Rework include helpers~~
139
+ * ~~Add helpers for cols~~
140
+ * Correct stuff about licenses
141
+ * Add RSpec tests
142
+ * Add support for other template engines (right now only ERB and HAML are supported)
143
+ * Add Rdoc
144
+ * Finish wiki
145
+ * Completely correct any indentation problem for all template engines
146
+ * Add some more content helpers
147
+
148
+
149
+ License
150
+ -------
151
+
152
+
153
+ sinatra-twitter-bootstrap is licensed under Apache Software License 2.0 (ASLv2)
13
154
  http://www.apache.org/licenses/LICENSE-2.0.txt
14
155
 
15
- Bootstrap is licenced under Apache Software License (ASL)
156
+ Bootstrap is licenced under Apache Software License 2.0 (ASLv2) (though 3.1 will be under MIT, thanks god)
16
157
  http://www.apache.org/licenses/LICENSE-2.0.txt
17
158
 
18
159
  JQuery is licenced under MIT license.
19
- HTML5 Shiv is licenced under MIT/GPL2 (https://github.com/aFarkas/html5shiv)
160
+ html5Shiv is licenced under MIT/GPL2 (https://github.com/aFarkas/html5shiv)
161
+
162
+ Any code added by me is licensed under WTFPL, so you can DO WHAT THE F... YOU WANT with it
163
+ http://www.wtfpl.net/txt/copying/
164
+
165
+
@@ -62,7 +62,7 @@ module Sinatra
62
62
  output += "<meta name='viewport' content='width=device-width, initial-scale=1.0'>\n" if meta
63
63
 
64
64
  Assets::ASSETS[:css].each do |file, _|
65
- output += Assets::css_tag url('/css/%s' % file, attrb)
65
+ output += Assets::css_tag url('/css/%s' % file), attrb
66
66
  end
67
67
 
68
68
  output.chomp
@@ -72,7 +72,7 @@ module Sinatra
72
72
  output = ''
73
73
 
74
74
  Assets::ASSETS[:legacy_js].each do |file, _|
75
- output += Assets::js_tag url('/js/%s' % file, attrb)
75
+ output += Assets::js_tag url('/js/%s' % file), attrb
76
76
  end
77
77
 
78
78
  "<!--[if lt IE 9]> \n#{output.chomp} \n<![endif]-->"
@@ -82,7 +82,7 @@ module Sinatra
82
82
  output = ''
83
83
 
84
84
  Assets::ASSETS[:default_js].each do |file, _|
85
- output += Assets::js_tag url('/js/%s' % file, attrb)
85
+ output += Assets::js_tag url('/js/%s' % file), attrb
86
86
  end
87
87
 
88
88
  output.chomp
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Fojtik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-20 00:00:00.000000000 Z
12
+ date: 2013-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime