freerangestylin 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,26 @@
1
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-size: 100%;
5
+ vertical-align: baseline;
6
+ border: 0;
7
+ outline: 0;
8
+ background: transparent;
9
+ }
10
+
11
+ ol, ul {
12
+ list-style: none;
13
+ }
14
+
15
+ blockquote, q {
16
+ quotes: none;
17
+ }
18
+
19
+ :focus {
20
+ outline: 0;
21
+ }
22
+
23
+ table {
24
+ border-collapse: collapse;
25
+ border-spacing: 0;
26
+ }
@@ -0,0 +1 @@
1
+ script/generate freerange_stylin
@@ -0,0 +1,35 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
+
3
+ class FreerangeStylinGenerator < Rails::Generator::Base
4
+
5
+ def manifest
6
+ record do |m|
7
+ app_layout = "app/views/layouts/application.html.html"
8
+
9
+ unless File.exists?(app_layout)
10
+ m.directory File.join("app", "views", "layouts")
11
+ m.file "application.html.html", user_model
12
+ end
13
+
14
+ m.directory File.join("app", "stylesheets")
15
+
16
+ m.file "fancy.less", "app/stylesheets/fancy.less"
17
+ m.file "ie.less", "app/stylesheets/ie.less"
18
+ m.file "master.less", "app/stylesheets/master.less"
19
+ m.file "reset.less", "app/stylesheets/reset.less"
20
+ m.file "screen.less", "app/stylesheets/screen.less"
21
+
22
+ m.directory File.join("app", "javascripts")
23
+
24
+ m.file "application.js", "app/javascripts/application.js"
25
+ m.file "hashgrid.js", "app/javascripts/hashgrid.js"
26
+ m.file "plugins.js", "app/javascripts/plugins.js"
27
+
28
+ m.insert_into "config/routes.rb",
29
+ "FreerangeStylin::Routes.draw(map)"
30
+
31
+ m.readme "README"
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,35 @@
1
+ # Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
2
+
3
+ # and Jase stole it from http://github.com/thoughtbot/clearance/blob/master/generators/clearance/lib/insert_commands.rb
4
+
5
+ Rails::Generator::Commands::Base.class_eval do
6
+ def file_contains?(relative_destination, line)
7
+ File.read(destination_path(relative_destination)).include?(line)
8
+ end
9
+ end
10
+
11
+ Rails::Generator::Commands::Create.class_eval do
12
+ def insert_into(file, line)
13
+ logger.insert "#{line} into #{file}"
14
+ unless options[:pretend] || file_contains?(file, line)
15
+ gsub_file file, /^(class|module|.*Routes).*$/ do |match|
16
+ "#{match}\n #{line}"
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ Rails::Generator::Commands::Destroy.class_eval do
23
+ def insert_into(file, line)
24
+ logger.remove "#{line} from #{file}"
25
+ unless options[:pretend]
26
+ gsub_file file, "\n #{line}", ''
27
+ end
28
+ end
29
+ end
30
+
31
+ Rails::Generator::Commands::List.class_eval do
32
+ def insert_into(file, line)
33
+ logger.insert "#{line} into #{file}"
34
+ end
35
+ end
@@ -0,0 +1,17 @@
1
+ *******************************************************************************
2
+
3
+ Next:
4
+
5
+ 1. Install sprockets plugin and gem.
6
+
7
+ gem "sprockets" # if using bundler (or gem install sprockets)
8
+ script/plugin install git://github.com/sstephenson/sprockets-rails.git
9
+
10
+ 2. Install less gem and more plugin.
11
+
12
+ gem "less" # if using bundler (or gem install less)
13
+ script/plugin install git://github.com/cloudhead/more.git
14
+
15
+ 3. Make beautiful things.
16
+
17
+ *******************************************************************************
@@ -0,0 +1,271 @@
1
+ /**
2
+ * hashgrid (jQuery version)
3
+ * http://github.com/dotjay/hashgrid
4
+ * Version 3, 22 Feb 2010
5
+ * By Jon Gibbins, accessibility.co.uk
6
+ *
7
+ * // Using a basic #grid setup
8
+ * var grid = new hashgrid();
9
+ *
10
+ * // Using #grid with a custom id (e.g. #mygrid)
11
+ * var grid = new hashgrid("mygrid");
12
+ *
13
+ * // Using #grid with additional options
14
+ * var grid = new hashgrid({
15
+ * id: 'mygrid', // id for the grid container
16
+ * modifierKey: 'alt', // optional 'ctrl', 'alt' or 'shift'
17
+ * showGridKey: 's', // key to show the grid
18
+ * holdGridKey: 'enter', // key to hold the grid in place
19
+ * foregroundKey: 'f', // key to toggle foreground/background
20
+ * jumpGridsKey: 'd', // key to cycle through the grid classes
21
+ * numberOfGrids: 2, // number of grid classes used
22
+ * classPrefix: 'class', // prefix for the grid classes
23
+ * cookiePrefix: 'mygrid' // prefix for the cookie name
24
+ * });
25
+ *
26
+ */
27
+
28
+ $(document).ready(function() {
29
+
30
+ var grid = new hashgrid({
31
+ numberOfGrids: 1
32
+ });
33
+
34
+ });
35
+
36
+
37
+ /**
38
+ * hashgrid overlay
39
+ */
40
+ var hashgrid = function(set) {
41
+
42
+ var options = {
43
+ id: 'grid', // id for the grid container
44
+ modifierKey: null, // optional 'ctrl', 'alt' or 'shift'
45
+ showGridKey: 'g', // key to show the grid
46
+ holdGridKey: 'h', // key to hold the grid in place
47
+ foregroundKey: 'f', // key to toggle foreground/background
48
+ jumpGridsKey: 'j', // key to cycle through the grid classes
49
+ numberOfGrids: 1, // number of grid classes used
50
+ classPrefix: 'grid-', // prefix for the grid classes
51
+ cookiePrefix: 'hashgrid'// prefix for the cookie name
52
+ };
53
+ var overlayOn = false,
54
+ sticky = false,
55
+ overlayZState = 'B',
56
+ overlayZBackground = -1,
57
+ overlayZForeground = 9999,
58
+ classNumber = 1;
59
+
60
+ // Apply options
61
+ if (typeof set == 'object') {
62
+ var k;
63
+ for (k in set) options[k] = set[k];
64
+ }
65
+ else if (typeof set == 'string') {
66
+ options.id = set;
67
+ }
68
+
69
+ // Remove any conflicting overlay
70
+ if ($('#' + options.id).length > 0) {
71
+ $('#' + options.id).remove();
72
+ }
73
+
74
+ // Create overlay, hidden before adding to DOM
75
+ var overlayEl = $('<div></div>');
76
+ overlayEl
77
+ .attr('id', options.id)
78
+ .addClass(options.classPrefix + classNumber)
79
+ .css('display', 'none');
80
+ $("body").prepend(overlayEl);
81
+ var overlay = $('#' + options.id);
82
+
83
+ // Unless a custom z-index is set, ensure the overlay will be behind everything
84
+ if (overlay.css('z-index') == 'auto') overlay.css('z-index', overlayZBackground);
85
+
86
+ // Override the default overlay height with the actual page height
87
+ var pageHeight = parseFloat($(document).height());
88
+ overlay.height(pageHeight);
89
+
90
+ // Add the first grid line so that we can measure it
91
+ overlay.append('<div class="horiz first-line">');
92
+
93
+ // Calculate the number of grid lines needed
94
+ var overlayGridLines = overlay.children('.horiz'),
95
+ overlayGridLineHeight = parseFloat(overlayGridLines.css('height')) + parseFloat(overlayGridLines.css('border-bottom-width'));
96
+
97
+ // Break on zero line height
98
+ if (overlayGridLineHeight <= 0) return true;
99
+
100
+ // Add the remaining grid lines
101
+ var i, numGridLines = Math.floor(pageHeight / overlayGridLineHeight);
102
+ for (i = numGridLines - 1; i >= 1; i--) {
103
+ overlay.append('<div class="horiz"></div>');
104
+ }
105
+
106
+ // Check for saved state
107
+ var overlayCookie = readCookie(options.cookiePrefix + options.id);
108
+ if (typeof overlayCookie == 'string') {
109
+ var state = overlayCookie.split(',');
110
+ state[2] = Number(state[2]);
111
+ if ((typeof state[2] == 'number') && !isNaN(state[2])) {
112
+ classNumber = state[2].toFixed(0);
113
+ overlay.addClass(options.classPrefix + classNumber);
114
+ }
115
+ if (state[1] == 'F') {
116
+ overlayZState = 'F';
117
+ overlay.css('z-index', overlayZForeground);
118
+ }
119
+ if (state[0] == '1') {
120
+ overlayOn = true;
121
+ sticky = true;
122
+ overlay.show();
123
+ }
124
+ }
125
+
126
+ // Keyboard controls
127
+ $(document).bind('keydown', keydownHandler);
128
+ $(document).bind('keyup', keyupHandler);
129
+
130
+ /**
131
+ * Helpers
132
+ */
133
+
134
+ function getModifier(e) {
135
+ if (options.modifierKey == null) return true; // Bypass by default
136
+ var m = true;
137
+ switch(options.modifierKey) {
138
+ case 'ctrl':
139
+ m = (e.ctrlKey ? e.ctrlKey : false);
140
+ break;
141
+
142
+ case 'alt':
143
+ m = (e.altKey ? e.altKey : false);
144
+ break;
145
+
146
+ case 'shift':
147
+ m = (e.shiftKey ? e.shiftKey : false);
148
+ break;
149
+ }
150
+ return m;
151
+ }
152
+
153
+ function getKey(e) {
154
+ var k = false, c = (e.keyCode ? e.keyCode : e.which);
155
+ // Handle keywords
156
+ if (c == 13) k = 'enter';
157
+ // Handle letters
158
+ else k = String.fromCharCode(c).toLowerCase();
159
+ return k;
160
+ }
161
+
162
+ function saveState() {
163
+ createCookie(options.cookiePrefix + options.id, (sticky ? '1' : '0') + ',' + overlayZState + ',' + classNumber, 1);
164
+ }
165
+
166
+ /**
167
+ * Event handlers
168
+ */
169
+
170
+ function keydownHandler(e) {
171
+ var source = e.target.tagName.toLowerCase();
172
+ if ((source == 'input') || (source == 'textarea') || (source == 'select')) return true;
173
+ var m = getModifier(e);
174
+ if (!m) return true;
175
+ var k = getKey(e);
176
+ if (!k) return true;
177
+ switch(k) {
178
+ case options.showGridKey:
179
+ if (!overlayOn) {
180
+ overlay.show();
181
+ overlayOn = true;
182
+ }
183
+ else if (sticky) {
184
+ overlay.hide();
185
+ overlayOn = false;
186
+ sticky = false;
187
+ saveState();
188
+ }
189
+ break;
190
+ case options.holdGridKey:
191
+ if (overlayOn && !sticky) {
192
+ // Turn sticky overlay on
193
+ sticky = true;
194
+ saveState();
195
+ }
196
+ break;
197
+ case options.foregroundKey:
198
+ if (overlayOn) {
199
+ // Toggle sticky overlay z-index
200
+ if (overlay.css('z-index') == overlayZForeground) {
201
+ overlay.css('z-index', overlayZBackground);
202
+ overlayZState = 'B';
203
+ }
204
+ else {
205
+ overlay.css('z-index', overlayZForeground);
206
+ overlayZState = 'F';
207
+ }
208
+ saveState();
209
+ }
210
+ break;
211
+ case options.jumpGridsKey:
212
+ if (overlayOn && (options.numberOfGrids > 1)) {
213
+ // Cycle through the available grids
214
+ overlay.removeClass(options.classPrefix + classNumber);
215
+ classNumber++;
216
+ if (classNumber > options.numberOfGrids) classNumber = 1;
217
+ overlay.addClass(options.classPrefix + classNumber);
218
+ saveState();
219
+ }
220
+ break;
221
+ }
222
+ }
223
+
224
+ function keyupHandler(e) {
225
+ var m = getModifier(e);
226
+ if (!m) return true;
227
+ var k = getKey(e);
228
+ if (!k) return true;
229
+ switch(k) {
230
+ case options.showGridKey:
231
+ if (!sticky) {
232
+ overlay.hide();
233
+ overlayOn = false;
234
+ }
235
+ break;
236
+ }
237
+ }
238
+
239
+ }
240
+
241
+
242
+ /**
243
+ * Cookie functions
244
+ *
245
+ * By Peter-Paul Koch:
246
+ * http://www.quirksmode.org/js/cookies.html
247
+ */
248
+ function createCookie(name,value,days) {
249
+ if (days) {
250
+ var date = new Date();
251
+ date.setTime(date.getTime()+(days*24*60*60*1000));
252
+ var expires = "; expires="+date.toGMTString();
253
+ }
254
+ else var expires = "";
255
+ document.cookie = name+"="+value+expires+"; path=/";
256
+ }
257
+
258
+ function readCookie(name) {
259
+ var nameEQ = name + "=";
260
+ var ca = document.cookie.split(';');
261
+ for(var i=0;i < ca.length;i++) {
262
+ var c = ca[i];
263
+ while (c.charAt(0)==' ') c = c.substring(1,c.length);
264
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
265
+ }
266
+ return null;
267
+ }
268
+
269
+ function eraseCookie(name) {
270
+ createCookie(name,"",-1);
271
+ }
@@ -0,0 +1 @@
1
+ /* custom jQuery plugins .. */
@@ -0,0 +1 @@
1
+ /* Get down with the latest CSS tricks y'all */
@@ -0,0 +1,14 @@
1
+ /* PNG fix */
2
+
3
+ /* for IE<6 */
4
+ * html #selector { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='img/image.png'); background-image: none; background-repeat: no-repeat; background-color: transparent; }
5
+
6
+ /* self-clear floats */
7
+
8
+ * html .group { /* IE6 */
9
+ height: 1%;
10
+ }
11
+
12
+ *:first-child+html .group { /* IE7 */
13
+ min-height: 1px;
14
+ }
@@ -0,0 +1,114 @@
1
+ /*
2
+ Master styles for application.
3
+ */
4
+
5
+ /* Global Variables */
6
+
7
+ @bg_colour = #eee;
8
+ @link_colour = red;
9
+ @font_family = Helvetica, Arial, sans-serif;
10
+
11
+
12
+ body {
13
+ font-family: @font_family;
14
+ font-size: 62.5%;
15
+ background: @base_colour;
16
+ color: @link_colour;
17
+ }
18
+
19
+ /* links */
20
+
21
+ a:link, a:visited {
22
+ font-weight: bold;
23
+ text-decoration: none;
24
+ outline: none;
25
+ color: @link_color;
26
+ }
27
+
28
+ /* page structure
29
+ --------------------------------------------- */
30
+ @base_line = 22px;
31
+ @base_fontsize = 1.2em; // 12pt
32
+
33
+ #page {
34
+ font-size: @base_fontsize;
35
+ baseline: @base_line;
36
+ }
37
+
38
+ /* header
39
+ --------------------------------------------- */
40
+
41
+ #header {
42
+
43
+ }
44
+
45
+ /* logo */
46
+
47
+
48
+ /* navigation */
49
+
50
+ ul#nav {
51
+
52
+ }
53
+
54
+
55
+ /* main styles
56
+ --------------------------------------------- */
57
+
58
+ #content {
59
+
60
+ }
61
+
62
+ /* headings */
63
+
64
+ h1 {
65
+
66
+ }
67
+
68
+ h2 {
69
+
70
+ }
71
+
72
+ h3 {
73
+
74
+ }
75
+
76
+ h4 {
77
+
78
+ }
79
+
80
+ span.amp {
81
+ font-family: Baskerville, "Goudy Old Style", "Palatino", "Book Antiqua", serif;
82
+ font-weight: normal;
83
+ font-style: italic;
84
+ font-size: 1.2em;
85
+ color: #766557;
86
+ }
87
+
88
+ /* footer
89
+ --------------------------------------------- */
90
+
91
+ #footer a {
92
+ color: #51463d;
93
+ }
94
+
95
+ /* misc.
96
+ --------------------------------------------- */
97
+
98
+ hr, .hide {
99
+ display: none;
100
+ }
101
+
102
+ a img {
103
+ border: none;
104
+ }
105
+
106
+ /* self-clear floats */
107
+
108
+ .group:after {
109
+ content: ".";
110
+ display: block;
111
+ height: 0;
112
+ clear: both;
113
+ visibility: hidden;
114
+ }
@@ -0,0 +1,26 @@
1
+ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
2
+ margin: 0;
3
+ padding: 0;
4
+ font-size: 100%;
5
+ vertical-align: baseline;
6
+ border: 0;
7
+ outline: 0;
8
+ background: transparent;
9
+ }
10
+
11
+ ol, ul {
12
+ list-style: none;
13
+ }
14
+
15
+ blockquote, q {
16
+ quotes: none;
17
+ }
18
+
19
+ :focus {
20
+ outline: 0;
21
+ }
22
+
23
+ table {
24
+ border-collapse: collapse;
25
+ border-spacing: 0;
26
+ }
@@ -0,0 +1,16 @@
1
+ /*
2
+ FreeRange stylesheet framework, inspiration from Dan Cederholm's
3
+ own probject framework as described in the book
4
+ Handcrafted CSS.
5
+
6
+ Uses LESS css to manage the framework.
7
+ http://lesscss.org
8
+
9
+ Author: jason.cale@gofreerange.com
10
+ */
11
+
12
+ /* import stylesheets and hide from IE/Mac \*/
13
+ @import "reset";
14
+ @import "master";
15
+ @import "ie";
16
+ /* end import/hide */
@@ -0,0 +1,18 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Application name | page name
5
+ <!--[if gte IE 7]><!-->
6
+ =stylesheet_link_tag %w(screen)
7
+ <!-- <![endif]-->
8
+ <script type="text/javascript" src="http://use.typekit.com/sgp7rhz.js"></script>
9
+ <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
10
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
11
+ =javascript_include_tag %w(plugins application hashgrid)
12
+ %body
13
+ #page
14
+ #header
15
+ %ul#nav
16
+ #content
17
+ =yield
18
+ #footer
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jason Cale
@@ -53,6 +53,20 @@ files:
53
53
  - README
54
54
  - lib/freerange_stylin/routes.rb
55
55
  - lib/freerange_stylin.rb
56
+ - app/stylesheets/reset.less
57
+ - generators/freerange_stylin/freerange_stylin_generator.rb
58
+ - generators/freerange_stylin/lib/insert_commands.rb
59
+ - generators/freerange_stylin/templates/javascripts/application.js
60
+ - generators/freerange_stylin/templates/javascripts/hashgrid.js
61
+ - generators/freerange_stylin/templates/javascripts/plugins.js
62
+ - generators/freerange_stylin/templates/README
63
+ - generators/freerange_stylin/templates/stylesheets/fancy.less
64
+ - generators/freerange_stylin/templates/stylesheets/ie.less
65
+ - generators/freerange_stylin/templates/stylesheets/master.less
66
+ - generators/freerange_stylin/templates/stylesheets/reset.less
67
+ - generators/freerange_stylin/templates/stylesheets/screen.less
68
+ - generators/freerange_stylin/templates/views/layouts/main.html.haml
69
+ - generators/freerange_stylin/USAGE
56
70
  has_rdoc: true
57
71
  homepage: http://gofreerange.com
58
72
  licenses: []
@@ -63,6 +77,8 @@ rdoc_options:
63
77
  - README
64
78
  require_paths:
65
79
  - lib
80
+ - app
81
+ - generators
66
82
  required_ruby_version: !ruby/object:Gem::Requirement
67
83
  requirements:
68
84
  - - ">="