html5-boilerplate 0.2.6 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.md +11 -18
  2. data/VERSION +1 -1
  3. data/stylesheets/html5-boilerplate/_fonts.scss +1 -7
  4. data/stylesheets/html5-boilerplate/_helpers.scss +2 -4
  5. data/stylesheets/html5-boilerplate/_media.scss +8 -7
  6. data/stylesheets/html5-boilerplate/_reset.scss +7 -17
  7. data/stylesheets/html5-boilerplate/_styles.scss +9 -12
  8. data/templates/project/_head.html.haml +3 -8
  9. data/templates/project/_javascripts.html.haml +8 -11
  10. data/templates/project/application.html.haml +3 -3
  11. data/templates/project/files/htaccess +194 -19
  12. data/templates/project/files/humans.txt +43 -0
  13. data/templates/project/index.html.haml +4 -13
  14. data/templates/project/javascripts/plugins.js +3 -32
  15. data/templates/project/javascripts/rails.js +137 -156
  16. data/templates/project/javascripts/script.js +26 -0
  17. data/templates/project/manifest.rb +8 -15
  18. data/templates/project/partials/_base.scss +1 -1
  19. data/templates/project/partials/_example.scss +0 -21
  20. data/templates/project/partials/_fonts.scss +4 -0
  21. data/templates/project/partials/_media.scss +21 -0
  22. data/templates/project/style.scss +14 -9
  23. metadata +8 -12
  24. data/templates/project/files/lighttpd.conf +0 -149
  25. data/templates/project/files/mime.types +0 -80
  26. data/templates/project/files/nginx.conf +0 -108
  27. data/templates/project/files/web.config +0 -207
  28. data/templates/project/javascripts/profiling/charts.swf +0 -0
  29. data/templates/project/javascripts/profiling/config.js +0 -59
  30. data/templates/project/javascripts/profiling/yahoo-profiling.css +0 -7
  31. data/templates/project/javascripts/profiling/yahoo-profiling.min.js +0 -39
@@ -0,0 +1,43 @@
1
+ /* the humans responsible & colophon */
2
+ /* humanstxt.org */
3
+
4
+
5
+ /* TEAM */
6
+ <your title>: <your name>
7
+ Site:
8
+ Twitter:
9
+ Location:
10
+
11
+ /* THANKS */
12
+ Names (& URL):
13
+
14
+ /* SITE */
15
+ Standards: HTML5, CSS3
16
+ Components: Modernizr, jQuery
17
+ Software:
18
+
19
+
20
+
21
+ -o/-
22
+ +oo//-
23
+ :ooo+//:
24
+ -ooooo///-
25
+ /oooooo//:
26
+ :ooooooo+//-
27
+ -+oooooooo///-
28
+ -://////////////+oooooooooo++////////////::
29
+ :+ooooooooooooooooooooooooooooooooooooo+:::-
30
+ -/+ooooooooooooooooooooooooooooooo+/::////:-
31
+ -:+oooooooooooooooooooooooooooo/::///////:-
32
+ --/+ooooooooooooooooooooo+::://////:-
33
+ -:+ooooooooooooooooo+:://////:--
34
+ /ooooooooooooooooo+//////:-
35
+ -ooooooooooooooooooo////-
36
+ /ooooooooo+oooooooooo//:
37
+ :ooooooo+/::/+oooooooo+//-
38
+ -oooooo/::///////+oooooo///-
39
+ /ooo+::://////:---:/+oooo//:
40
+ -o+/::///////:- -:/+o+//-
41
+ :-:///////:- -:/://
42
+ -////:- --//:
43
+ -- -:
@@ -5,7 +5,7 @@
5
5
  <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
6
6
  <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
7
7
  <!--[if (gte IE 9)|!(IE)]><!-->
8
- %html.no-js{ :lang => "en" }
8
+ %html.no-js
9
9
  <!--<![endif]-->
10
10
  %head
11
11
  %meta{ :charset => "utf-8" }/
@@ -15,11 +15,6 @@
15
15
  Remove this if you use the .htaccess
16
16
  %meta{ :content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible" }/
17
17
 
18
- -# encoding must be specified within the first 512 bytes www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset
19
-
20
- -# meta element for compatibility mode needs to be before all elements except title & meta msdn.microsoft.com/en-us/library/cc288325(VS.85).aspx
21
- -# Chrome Frame is only invoked if meta element for compatibility mode is within the first 1K bytes code.google.com/p/chromium/issues/detail?id=23003
22
-
23
18
  %title
24
19
  %meta{ :content => "", :name => "description" }/
25
20
  %meta{ :content => "", :name => "author" }/
@@ -38,9 +33,9 @@
38
33
  -# %link{ :href => "css/handheld.css?v=1", :media => "handheld", :rel => "stylesheet" }/
39
34
 
40
35
  -# All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects
41
- %script{ :src => "js/modernizr-1.6.min.js" }
36
+ %script{ :src => "js/modernizr.min.js" }
42
37
 
43
- %body
38
+ %body{ :lang => "en" }
44
39
  #container
45
40
  %header
46
41
  #main
@@ -51,7 +46,7 @@
51
46
  Grab Google CDN's jQuery. fall back to local if necessary
52
47
  %script{ :src => "http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" }
53
48
  :javascript
54
- !window.jQuery && document.write(unescape('%3Cscript src="js/jquery-1.4.4.min.js"%3E%3C/script%3E'))
49
+ !window.jQuery && document.write(unescape('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))
55
50
 
56
51
  %script{ :src => "js/plugins.js?v=1" }
57
52
  %script{ :src => "js/script.js?v=1" }
@@ -60,10 +55,6 @@
60
55
  :javascript
61
56
  $.getScript("js/dd_belatedpng.js",function(){ DD_belatedPNG.fix('img, .png_bg'); });
62
57
 
63
- -# yui profiler and profileviewer - remove for production
64
- %script{ :src => "js/profiling/yahoo-profiling.min.js?v=1" }
65
- %script{ :src => "js/profiling/config.js?v=1" }
66
-
67
58
  -# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
68
59
  -# change the UA-XXXXX-X to be your site's ID
69
60
  :javascript
@@ -1,40 +1,11 @@
1
-
2
- // remap jQuery to $
3
- (function($){
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
- })(this.jQuery);
16
-
17
-
18
-
19
- // usage: log('inside coolFunc',this,arguments);
1
+ // usage: log('inside coolFunc', this, arguments);
20
2
  // paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
21
3
  window.log = function(){
22
4
  log.history = log.history || []; // store logs to an array for reference
23
5
  log.history.push(arguments);
24
- if(this.console){
25
- console.log( Array.prototype.slice.call(arguments) );
26
- }
6
+ if(this.console) console.log( Array.prototype.slice.call(arguments) );
27
7
  };
28
8
 
29
9
 
30
10
 
31
- // catch all document.write() calls
32
- (function(doc){
33
- var write = doc.write;
34
- doc.write = function(q){
35
- log('document.write(): ',arguments);
36
- if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);
37
- };
38
- })(document);
39
-
40
-
11
+ // place any jQuery/helper plugins in here, instead of separate, slower script files.
@@ -1,156 +1,137 @@
1
- /*
2
- * jquery-ujs
3
- *
4
- * http://github.com/rails/jquery-ujs/blob/master/src/rails.js
5
- *
6
- * This rails.js file supports jQuery 1.4.3 and 1.4.4 .
7
- *
8
- */
9
-
10
- jQuery(function ($) {
11
- var csrf_token = $('meta[name=csrf-token]').attr('content'),
12
- csrf_param = $('meta[name=csrf-param]').attr('content');
13
-
14
- $.fn.extend({
15
- /**
16
- * Triggers a custom event on an element and returns the event result
17
- * this is used to get around not being able to ensure callbacks are placed
18
- * at the end of the chain.
19
- *
20
- * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our
21
- * own events and placing ourselves at the end of the chain.
22
- */
23
- triggerAndReturn: function (name, data) {
24
- var event = new $.Event(name);
25
- this.trigger(event, data);
26
-
27
- return event.result !== false;
28
- },
29
-
30
- /**
31
- * Handles execution of remote calls. Provides following callbacks:
32
- *
33
- * - ajax:before - is execute before the whole thing begings
34
- * - ajax:loading - is executed before firing ajax call
35
- * - ajax:success - is executed when status is success
36
- * - ajax:complete - is execute when status is complete
37
- * - ajax:failure - is execute in case of error
38
- * - ajax:after - is execute every single time at the end of ajax call
39
- */
40
- callRemote: function () {
41
- var el = this,
42
- method = el.attr('method') || el.attr('data-method') || 'GET',
43
- url = el.attr('action') || el.attr('href'),
44
- dataType = el.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
45
-
46
- if (url === undefined) {
47
- throw "No URL specified for remote call (action or href must be present).";
48
- } else {
49
- if (el.triggerAndReturn('ajax:before')) {
50
- var data = el.is('form') ? el.serializeArray() : [];
51
- $.ajax({
52
- url: url,
53
- data: data,
54
- dataType: dataType,
55
- type: method.toUpperCase(),
56
- beforeSend: function (xhr) {
57
- el.trigger('ajax:loading', xhr);
58
- },
59
- success: function (data, status, xhr) {
60
- el.trigger('ajax:success', [data, status, xhr]);
61
- },
62
- complete: function (xhr) {
63
- el.trigger('ajax:complete', xhr);
64
- },
65
- error: function (xhr, status, error) {
66
- el.trigger('ajax:failure', [xhr, status, error]);
67
- }
68
- });
69
- }
70
-
71
- el.trigger('ajax:after');
72
- }
73
- }
74
- });
75
-
76
- /**
77
- * confirmation handler
78
- */
79
-
80
- $('body').delegate('a[data-confirm], button[data-confirm], input[data-confirm]', 'click.rails', function () {
81
- var el = $(this);
82
- if (el.triggerAndReturn('confirm')) {
83
- if (!confirm(el.attr('data-confirm'))) {
84
- return false;
85
- }
86
- }
87
- });
88
-
89
-
90
-
91
- /**
92
- * remote handlers
93
- */
94
- $('form[data-remote]').live('submit.rails', function (e) {
95
- $(this).callRemote();
96
- e.preventDefault();
97
- });
98
-
99
- $('a[data-remote],input[data-remote]').live('click.rails', function (e) {
100
- $(this).callRemote();
101
- e.preventDefault();
102
- });
103
-
104
- $('a[data-method]:not([data-remote])').live('click.rails', function (e){
105
- var link = $(this),
106
- href = link.attr('href'),
107
- method = link.attr('data-method'),
108
- form = $('<form method="post" action="'+href+'"></form>'),
109
- metadata_input = '<input name="_method" value="'+method+'" type="hidden" />';
110
-
111
- if (csrf_param !== undefined && csrf_token !== undefined) {
112
- metadata_input += '<input name="'+csrf_param+'" value="'+csrf_token+'" type="hidden" />';
113
- }
114
-
115
- form.hide()
116
- .append(metadata_input)
117
- .appendTo('body');
118
-
119
- e.preventDefault();
120
- form.submit();
121
- });
122
-
123
- /**
124
- * disable-with handlers
125
- */
126
- var disable_with_input_selector = 'input[data-disable-with]',
127
- disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')',
128
- disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')';
129
-
130
- var disable_with_input_function = function () {
131
- $(this).find(disable_with_input_selector).each(function () {
132
- var input = $(this);
133
- input.data('enable-with', input.val())
134
- .attr('value', input.attr('data-disable-with'))
135
- .attr('disabled', 'disabled');
136
- });
137
- };
138
-
139
- $(disable_with_form_remote_selector).live('ajax:before.rails', disable_with_input_function);
140
- $(disable_with_form_not_remote_selector).live('submit.rails', disable_with_input_function);
141
-
142
- $(disable_with_form_remote_selector).live('ajax:complete.rails', function () {
143
- $(this).find(disable_with_input_selector).each(function () {
144
- var input = $(this);
145
- input.removeAttr('disabled')
146
- .val(input.data('enable-with'));
147
- });
148
- });
149
-
150
- var jqueryVersion = $().jquery;
151
-
152
- if ( (jqueryVersion === '1.4') || (jqueryVersion === '1.4.1') || (jqueryVersion === '1.4.2') ){
153
- alert('This rails.js does not support the jQuery version you are using. Please read documentation.');
154
- }
155
-
156
- });
1
+ /**
2
+ * Unobtrusive scripting adapter for jQuery
3
+ *
4
+ * Requires jQuery 1.4.3 or later.
5
+ * https://github.com/rails/jquery-ujs
6
+ */
7
+
8
+ (function($) {
9
+ // Triggers an event on an element and returns the event result
10
+ function fire(obj, name, data) {
11
+ var event = new $.Event(name);
12
+ obj.trigger(event, data);
13
+ return event.result !== false;
14
+ }
15
+
16
+ // Submits "remote" forms and links with ajax
17
+ function handleRemote(element) {
18
+ var method, url, data,
19
+ dataType = element.attr('data-type') || ($.ajaxSettings && $.ajaxSettings.dataType);
20
+
21
+ if (element.is('form')) {
22
+ method = element.attr('method');
23
+ url = element.attr('action');
24
+ data = element.serializeArray();
25
+ // memoized value from clicked submit button
26
+ var button = element.data('ujs:submit-button');
27
+ if (button) {
28
+ data.push(button);
29
+ element.data('ujs:submit-button', null);
30
+ }
31
+ } else {
32
+ method = element.attr('data-method');
33
+ url = element.attr('href');
34
+ data = null;
35
+ }
36
+
37
+ $.ajax({
38
+ url: url, type: method || 'GET', data: data, dataType: dataType,
39
+ // stopping the "ajax:beforeSend" event will cancel the ajax request
40
+ beforeSend: function(xhr, settings) {
41
+ if (settings.dataType === undefined) {
42
+ xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
43
+ }
44
+ return fire(element, 'ajax:beforeSend', [xhr, settings]);
45
+ },
46
+ success: function(data, status, xhr) {
47
+ element.trigger('ajax:success', [data, status, xhr]);
48
+ },
49
+ complete: function(xhr, status) {
50
+ element.trigger('ajax:complete', [xhr, status]);
51
+ },
52
+ error: function(xhr, status, error) {
53
+ element.trigger('ajax:error', [xhr, status, error]);
54
+ }
55
+ });
56
+ }
57
+
58
+ // Handles "data-method" on links such as:
59
+ // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
60
+ function handleMethod(link) {
61
+ var href = link.attr('href'),
62
+ method = link.attr('data-method'),
63
+ csrf_token = $('meta[name=csrf-token]').attr('content'),
64
+ csrf_param = $('meta[name=csrf-param]').attr('content'),
65
+ form = $('<form method="post" action="' + href + '"></form>'),
66
+ metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
67
+
68
+ if (csrf_param !== undefined && csrf_token !== undefined) {
69
+ metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
70
+ }
71
+
72
+ form.hide().append(metadata_input).appendTo('body');
73
+ form.submit();
74
+ }
75
+
76
+ function disableFormElements(form) {
77
+ form.find('input[data-disable-with]').each(function() {
78
+ var input = $(this);
79
+ input.data('ujs:enable-with', input.val())
80
+ .val(input.attr('data-disable-with'))
81
+ .attr('disabled', 'disabled');
82
+ });
83
+ }
84
+
85
+ function enableFormElements(form) {
86
+ form.find('input[data-disable-with]').each(function() {
87
+ var input = $(this);
88
+ input.val(input.data('ujs:enable-with')).removeAttr('disabled');
89
+ });
90
+ }
91
+
92
+ function allowAction(element) {
93
+ var message = element.attr('data-confirm');
94
+ return !message || (fire(element, 'confirm') && confirm(message));
95
+ }
96
+
97
+ $('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
98
+ var link = $(this);
99
+ if (!allowAction(link)) return false;
100
+
101
+ if (link.attr('data-remote')) {
102
+ handleRemote(link);
103
+ return false;
104
+ } else if (link.attr('data-method')) {
105
+ handleMethod(link);
106
+ return false;
107
+ }
108
+ });
109
+
110
+ $('form').live('submit.rails', function(e) {
111
+ var form = $(this);
112
+ if (!allowAction(form)) return false;
113
+
114
+ if (form.attr('data-remote')) {
115
+ handleRemote(form);
116
+ return false;
117
+ } else {
118
+ disableFormElements(form);
119
+ }
120
+ });
121
+
122
+ $('form input[type=submit], form button[type=submit], form button:not([type])').live('click.rails', function() {
123
+ var button = $(this);
124
+ if (!allowAction(button)) return false;
125
+ // register the pressed submit button
126
+ var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
127
+ button.closest('form').data('ujs:submit-button', data);
128
+ });
129
+
130
+ $('form').live('ajax:beforeSend.rails', function(event) {
131
+ if (this == event.target) disableFormElements($(this));
132
+ });
133
+
134
+ $('form').live('ajax:complete.rails', function(event) {
135
+ if (this == event.target) enableFormElements($(this));
136
+ });
137
+ })( jQuery );