html5-rails 0.0.7 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/README.md +23 -22
  2. data/app/assets/javascripts/application.js +1 -1
  3. data/app/assets/javascripts/polyfills.js +1 -1
  4. data/app/views/application/_flashes.html.erb +2 -4
  5. data/app/views/application/_footer.html.erb +1 -1
  6. data/app/views/application/_head.html.erb +3 -11
  7. data/app/views/application/_header.html.erb +1 -1
  8. data/app/views/application/_javascripts.html.erb +2 -2
  9. data/app/views/application/_stylesheets.html.erb +1 -1
  10. data/app/views/layouts/application.html.erb +4 -7
  11. data/html5-rails.gemspec +1 -1
  12. data/lib/generators/html5/assets/USAGE +7 -4
  13. data/lib/generators/html5/assets/assets_generator.rb +26 -25
  14. data/lib/generators/html5/assets/templates/javascripts/application.js +1 -1
  15. data/lib/generators/html5/assets/templates/javascripts/polyfills.js +1 -1
  16. data/lib/generators/html5/assets/templates/stylesheets/{application.css.scss → application/index.css.scss} +12 -16
  17. data/lib/generators/html5/assets/templates/stylesheets/application/{document.css.scss → layout.css.scss} +2 -2
  18. data/lib/generators/html5/assets/templates/stylesheets/application/media_queries.css.scss +15 -1
  19. data/lib/generators/html5/assets/templates/stylesheets/{_variables.css.scss → application/variables.css.scss} +1 -1
  20. data/lib/generators/html5/install/USAGE +14 -0
  21. data/lib/generators/html5/install/install_generator.rb +1 -1
  22. data/lib/generators/html5/install/templates/README +2 -2
  23. data/lib/generators/html5/install/templates/config/compass.rb +1 -1
  24. data/lib/generators/html5/install/templates/config/html5_rails.yml +2 -2
  25. data/lib/generators/html5/layout/USAGE +3 -3
  26. data/lib/generators/html5/layout/layout_generator.rb +5 -5
  27. data/lib/generators/html5/layout/templates/application.html.erb +3 -6
  28. data/lib/generators/html5/layout/templates/application.html.haml +8 -10
  29. data/lib/generators/html5/layout/templates/application.html.slim +18 -11
  30. data/lib/generators/html5/partial/USAGE +13 -3
  31. data/lib/generators/html5/partial/partial_generator.rb +9 -9
  32. data/lib/generators/html5/partial/templates/_chromeframe.html.haml +1 -1
  33. data/lib/generators/html5/partial/templates/_chromeframe.html.slim +1 -1
  34. data/lib/generators/html5/partial/templates/_flashes.html.erb +2 -4
  35. data/lib/generators/html5/partial/templates/_flashes.html.haml +2 -3
  36. data/lib/generators/html5/partial/templates/_flashes.html.slim +2 -3
  37. data/lib/generators/html5/partial/templates/_footer.html.erb +1 -1
  38. data/lib/generators/html5/partial/templates/_footer.html.haml +1 -1
  39. data/lib/generators/html5/partial/templates/_footer.html.slim +1 -1
  40. data/lib/generators/html5/partial/templates/_head.html.erb +3 -11
  41. data/lib/generators/html5/partial/templates/_head.html.haml +6 -17
  42. data/lib/generators/html5/partial/templates/_head.html.slim +6 -17
  43. data/lib/generators/html5/partial/templates/_header.html.erb +1 -1
  44. data/lib/generators/html5/partial/templates/_header.html.haml +1 -1
  45. data/lib/generators/html5/partial/templates/_javascripts.html.erb +2 -2
  46. data/lib/generators/html5/partial/templates/_javascripts.html.haml +3 -3
  47. data/lib/generators/html5/partial/templates/_javascripts.html.slim +4 -4
  48. data/lib/generators/html5/partial/templates/_stylesheets.html.erb +1 -1
  49. data/lib/generators/html5/partial/templates/_stylesheets.html.haml +1 -1
  50. data/lib/html5-rails.rb +1 -1
  51. data/lib/html5/rails/helpers.rb +1 -7
  52. data/lib/html5/rails/version.rb +2 -2
  53. data/test/generators/assets_generator_test.rb +18 -22
  54. data/test/generators/install_generator_test.rb +6 -7
  55. data/test/generators/layout_generator_test.rb +1 -2
  56. data/test/generators/partial_generator_test.rb +2 -3
  57. data/test/html5_rails_test.rb +1 -1
  58. data/test/test_helper.rb +1 -1
  59. data/vendor/assets/javascripts/h5bp.js +22 -0
  60. data/vendor/assets/javascripts/modernizr.min.js +3 -3
  61. metadata +16 -12
  62. data/lib/generators/html5/assets/templates/stylesheets/application/chromeframe.css.scss +0 -14
  63. data/vendor/assets/javascripts/h5bp/index.js +0 -1
  64. data/vendor/assets/javascripts/h5bp/plugins.js +0 -7
@@ -1,4 +1,4 @@
1
1
  # Require any additional compass plugins here.
2
2
  require 'compass/h5bp'
3
3
 
4
- project_type = :rails
4
+ project_type = :rails
@@ -10,8 +10,8 @@
10
10
  # e.g. ENV['google_account_id'] || yml[:google_account_id]
11
11
 
12
12
  defaults: &defaults
13
- :google_account_id: "" # Google Analytics
14
- :google_api_key: "" # Google APIs
13
+ :google_account_id: '' # Google Analytics
14
+ :google_api_key: '' # Google APIs
15
15
 
16
16
  :development:
17
17
  <<: *defaults
@@ -1,8 +1,8 @@
1
1
  Description:
2
- Removes Erb layout and installs a html5-rails Haml layout.
2
+ Installs a new html5-rails layout in /app/views/layouts
3
3
 
4
4
  Example:
5
- rails generate html5:layout layout_name
5
+ rails generate html5:layout my_new_layout
6
6
 
7
7
  This will create:
8
- app/views/layouts/layout_name.html.haml
8
+ app/views/layouts/my_new_layout.html.(erb|haml|slim)
@@ -9,21 +9,21 @@ module Html5
9
9
 
10
10
  argument :name, :type => :string,
11
11
  :required => false,
12
- :default => "application"
12
+ :default => 'application'
13
13
 
14
14
  class_option :all_partials, :type => :boolean,
15
15
  :default => false,
16
- :desc => "Generate all partials for this layout"
16
+ :desc => 'Generate all partials for this layout'
17
17
 
18
18
  class_option :minimal_partials, :type => :boolean,
19
19
  :default => false,
20
- :desc => "Generate minimal partials for this layout"
20
+ :desc => 'Generate minimal partials for this layout'
21
21
 
22
22
  class_option :template_engine
23
23
 
24
24
  def generate_layout
25
- if file_path == "application" && options[:template_engine].to_s != "erb"
26
- remove_file File.join("app/views/layouts/application.html.erb")
25
+ if file_path == 'application' && options[:template_engine].to_s != 'erb'
26
+ remove_file "app/views/layouts/application.html.erb"
27
27
  end
28
28
  template filename_with_extensions("application"), File.join("app/views/layouts", class_path, filename_with_extensions(file_name))
29
29
  end
@@ -1,20 +1,17 @@
1
1
  <!DOCTYPE html>
2
- <%%# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither %>
3
2
  <%%= html_tag :class => "no-js" %>
4
3
  <%%= render "head" %>
5
4
 
6
5
  <body class="<%%= controller.controller_name %>">
7
6
  <%%= render "chromeframe" %>
8
7
  <%%= render "header" %>
8
+ <%%= render "flashes" %>
9
9
 
10
- <div id="main" role="main">
11
- <%%= render "flashes" %>
12
- <%%= yield %>
13
- </div>
10
+ <%%= yield %>
14
11
 
15
12
  <%%= render "footer" %>
16
13
 
17
14
  <%%# Javascript at the bottom for fast page loading %>
18
15
  <%%= render "javascripts" %>
19
16
  </body>
20
- </html>
17
+ </html>
@@ -1,17 +1,15 @@
1
1
  !!! 5
2
- -# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
3
- - html_tag :class => "no-js" do
4
- = render "head"
2
+ - html_tag :class => 'no-js' do
3
+ = render 'head'
5
4
 
6
5
  %body{ :class => "#{ controller.controller_name }" }
7
- = render "chromeframe"
8
- = render "header"
6
+ = render 'chromeframe'
7
+ = render 'header'
8
+ = render 'flashes'
9
9
 
10
- #main{ :role => "main" }
11
- = render "flashes"
12
- = yield
10
+ = yield
13
11
 
14
- = render "footer"
12
+ = render 'footer'
15
13
 
16
14
  -# Javascript at the bottom for fast page loading
17
- = render "javascripts"
15
+ = render 'javascripts'
@@ -1,17 +1,24 @@
1
- doctype 5
2
- / http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
3
- - html_tag :class => "no-js" do
4
- = render "head"
1
+ doctype html
2
+ /[if lt IE 7]
3
+ |<html class='no-js lt-ie9 lt-ie8 lt-ie7'>
4
+ /[if IE 7]
5
+ |<html class='no-js lt-ie9 lt-ie8'>
6
+ /[if IE 8]
7
+ |<html class='no-js lt-ie9'>
8
+ /![if gt IE 8]><!
9
+ html.no-js
10
+ /!<![endif]
11
+
12
+ = render 'head'
5
13
 
6
14
  body class=controller.controller_name
7
- = render "chromeframe"
8
- = render "header"
15
+ = render 'chromeframe'
16
+ = render 'header'
9
17
 
10
- #main role="main"
11
- = render "flashes"
12
- = yield
18
+ = render 'flashes'
19
+ = yield
13
20
 
14
- = render "footer"
21
+ = render 'footer'
15
22
 
16
23
  / Javascript at the bottom for fast page loading
17
- = render "javascripts"
24
+ = render 'javascripts'
@@ -1,8 +1,18 @@
1
1
  Description:
2
- Generates a partial
2
+ Copies an existing html5-rails partial to the views folder so it can be editied.
3
3
 
4
4
  Example:
5
- rails generate html5:partial _partial_name
5
+ rails generate html5:partial _javascripts
6
6
 
7
7
  This will create:
8
- app/views/application/_partial_name.html.haml
8
+ app/views/application/_partial_name.html.(erb|haml|slim)
9
+
10
+ Choices include:
11
+ _head
12
+ _chromeframe
13
+ _flashes
14
+ _header
15
+ _footer
16
+ _javascripts
17
+ _stylesheets
18
+
@@ -9,27 +9,27 @@ module Html5
9
9
 
10
10
  argument :name, :type => :string,
11
11
  :required => false,
12
- :default => ""
12
+ :default => ''
13
13
 
14
14
  class_option :all, :type => :boolean,
15
15
  :default => false,
16
- :desc => "Generate all partials"
16
+ :desc => 'Generate all partials'
17
17
 
18
18
  class_option :minimal, :type => :boolean,
19
19
  :default => false,
20
- :desc => "Generate minimal partials (_head, _header, _footer)"
20
+ :desc => 'Generate minimal partials (_head, _header, _footer)'
21
21
 
22
22
  class_option :path, :type => :string,
23
23
  :default => nil,
24
24
  :required => false,
25
- :desc => "resource path to generate partials in"
25
+ :desc => 'resource path to generate partials in'
26
26
 
27
27
  class_option :template_engine
28
28
 
29
29
  # def validate_name
30
30
  # if options[:all] || options[:minimal]
31
31
  # if partials.include?(file_name)
32
- # path = class_path.join("/")
32
+ # path = class_path.join('/')
33
33
  # message = "Argument '#{ file_path }' not allowed with --all or --minimal options."
34
34
  # message << " Try using '#{ path }' instead." if !path.blank?
35
35
  # raise Error, message
@@ -39,7 +39,7 @@ module Html5
39
39
 
40
40
  def generate_partials
41
41
  if partials.any?
42
- empty_directory File.join("app/views", partial_path)
42
+ empty_directory File.join('app/views', partial_path)
43
43
  end
44
44
  partials.each do |partial|
45
45
  generate_partial(partial)
@@ -64,13 +64,13 @@ module Html5
64
64
  if !options.path.blank?
65
65
  path = options.path
66
66
  else
67
- path = class_path.join("/")
67
+ path = File.join(class_path)
68
68
  end
69
- path.blank? ? "application" : path
69
+ path.blank? ? 'application' : path
70
70
  end
71
71
 
72
72
  def generate_partial(partial_name)
73
- template filename_with_extensions(partial_name), File.join("app/views", partial_path, filename_with_extensions(partial_name))
73
+ template filename_with_extensions(partial_name), File.join('app/views', partial_path, filename_with_extensions(partial_name))
74
74
  end
75
75
  end
76
76
  end
@@ -1,4 +1,4 @@
1
1
  /[if lt IE 7 ]
2
2
  %p.chromeframe
3
3
  You are using an <strong>outdated</strong> browser.
4
- Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
4
+ Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.
@@ -1,4 +1,4 @@
1
1
  /[if lt IE 7 ]
2
2
  p.chromeframe
3
3
  | You are using an <strong>outdated</strong> browser.
4
- | Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
4
+ | Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.
@@ -1,9 +1,7 @@
1
1
  <div id="flash">
2
2
  <%% flash.each do |key, value| %>
3
- <div class="wrapper">
4
- <div title="<%%= key.to_s.humanize %>" class="<%%= key %>">
5
- <p><%%= value %></p>
6
- </div>
3
+ <div title="<%%= key.to_s.humanize %>" class="<%%= key %>">
4
+ <p><%%= value %></p>
7
5
  </div>
8
6
  <%% end %>
9
7
  </div>
@@ -1,5 +1,4 @@
1
1
  #flash
2
2
  - flash.each do |key, value|
3
- .wrapper
4
- %div{ :title => key.to_s.humanize, :class => key }
5
- %p= value
3
+ %div{ :title => key.to_s.humanize, :class => key }
4
+ %p= value
@@ -1,5 +1,4 @@
1
1
  #flash
2
2
  - flash.each do |key, value|
3
- .wrapper
4
- div title=key.to_s.humanize class=key
5
- p= value
3
+ div title=key.to_s.humanize class=key
4
+ p= value
@@ -2,4 +2,4 @@
2
2
  <small class="copyright">
3
3
  <%= application_title %>, Copyright &copy; <%%= Date.today.year %>
4
4
  </small>
5
- </footer>
5
+ </footer>
@@ -1,3 +1,3 @@
1
1
  %footer#footer
2
2
  %small.copyright
3
- <%= application_title %>, Copyright &copy; #{ Date.today.year }
3
+ <%= application_title %>, Copyright &copy; #{ Date.today.year }
@@ -1,3 +1,3 @@
1
1
  footer#footer
2
2
  small.copyright
3
- | <%=application_title%>, Copyright &copy; #{Date.today.year}
3
+ | <%= application_title %>, Copyright &copy; #{ Date.today.year }
@@ -1,22 +1,14 @@
1
1
  <head>
2
2
  <meta charset="utf-8">
3
-
4
- <%%# Use the .htaccess and remove these lines to avoid edge case issues. %>
5
- <%%# More info: h5bp.com/b/378 %>
6
3
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7
4
 
8
- <title></title>
9
- <meta name="description" content="">
5
+ <title><%%= "#{ controller.controller_name.titleize } - #{ controller.action_name.titleize }" %></title>
10
6
 
11
- <%%# Mobile viewport optimized: h5bp.com/viewport %>
7
+ <meta name="description" content="">
12
8
  <meta name="viewport" content="width=device-width">
13
9
 
14
10
  <%%= render "stylesheets" %>
15
-
16
- <%%# More ideas for your <head> here: h5bp.com/d/head-Tips %>
17
-
18
- <%%# All JavaScript at the bottom, except polyfills %>
19
11
  <%%= javascript_include_tag "polyfills" %>
20
12
 
21
13
  <%%= csrf_meta_tag %>
22
- </head>
14
+ </head>
@@ -1,25 +1,14 @@
1
1
  %head
2
- %meta{ :charset => "utf-8" }/
3
-
4
- -# Use the .htaccess and remove these lines to avoid edge case issues.
5
- -# More info: h5bp.com/b/378
2
+ %meta{ :charset => 'utf-8' }/
6
3
  %meta{ 'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1' }/
7
4
 
8
5
  %title
9
6
  == #{ controller.controller_name.titleize } - #{ controller.action_name.titleize }
10
7
 
11
- %meta{ :name => "description", :content => "" }/
12
-
13
- -# Mobile viewport optimized: h5bp.com/viewport
14
- %meta{ :name => "viewport", :content => "width=device-width" }/
15
-
16
- -# Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons
17
-
18
- = render "stylesheets"
19
-
20
- -# More ideas for your <head> here: h5bp.com/d/head-Tips
8
+ %meta{ :name => 'description', :content => '' }/
9
+ %meta{ :name => 'viewport', :content => 'width=device-width' }/
21
10
 
22
- -# All JavaScript at the bottom, except polyfills
23
- = javascript_include_tag "polyfills"
11
+ = render 'stylesheets'
12
+ = javascript_include_tag 'polyfills'
24
13
 
25
- = csrf_meta_tag
14
+ = csrf_meta_tag
@@ -1,25 +1,14 @@
1
1
  head
2
- meta charset="utf-8"
3
-
4
- / Use the .htaccess and remove these lines to avoid edge case issues.
5
- / More info: h5bp.com/b/378
6
- meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'
7
-
2
+ meta charset='utf-8'
3
+ meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'
8
4
  title
9
5
  | #{ controller.controller_name.titleize } - #{ controller.action_name.titleize }
6
+ meta content='' name='description'
7
+ meta content='width=device-width' name='viewport'
10
8
 
11
- meta name="description" content=""
12
-
13
- / Mobile viewport optimized: h5bp.com/viewport
14
- meta name="viewport" content="width=device-width"
15
-
16
- / Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons
17
-
18
- = render "stylesheets"
19
-
20
- / More ideas for your <head> here: h5bp.com/d/head-Tips
9
+ = render 'stylesheets'
21
10
 
22
11
  / All JavaScript at the bottom, except polyfills
23
- = javascript_include_tag "polyfills"
12
+ = javascript_include_tag 'polyfills'
24
13
 
25
14
  = csrf_meta_tag
@@ -1,3 +1,3 @@
1
1
  <header id="header">
2
2
  <h1><%= application_name %></h1>
3
- </header>
3
+ </header>
@@ -1,2 +1,2 @@
1
1
  %header#header
2
- %h1 <%= application_title %>
2
+ %h1 <%= application_title %>
@@ -3,7 +3,7 @@
3
3
  <%%# Append your own using content_for :javascripts %>
4
4
  <%%= yield :javascripts %>
5
5
 
6
- <%%# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet %>
6
+ <%%# Google Analytics %>
7
7
  <%%# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml %>
8
8
  <%% if !google_account_id.blank? %>
9
9
  <script>
@@ -14,4 +14,4 @@
14
14
  s.parentNode.insertBefore(g,s)}(document,'script'));
15
15
  //]]>
16
16
  </script>
17
- <%% end %>
17
+ <%% end %>
@@ -1,13 +1,13 @@
1
- = javascript_include_tag "application"
1
+ = javascript_include_tag 'application'
2
2
 
3
3
  -# Append your own using content_for :javascripts
4
4
  = yield :javascripts
5
5
 
6
- -# asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
6
+ -# Google Analytics
7
7
  -# Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml
8
8
  - if !google_account_id.blank?
9
9
  :javascript
10
10
  var _gaq=[['_setAccount','#{ google_account_id }'],['_trackPageview']];
11
11
  (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
12
12
  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
13
- s.parentNode.insertBefore(g,s)}(document,'script'));
13
+ s.parentNode.insertBefore(g,s)}(document,'script'));
@@ -1,13 +1,13 @@
1
- = javascript_include_tag "application"
1
+ = javascript_include_tag 'application'
2
2
 
3
3
  / Append your own using content_for :javascripts
4
4
  = yield :javascripts
5
5
 
6
- / asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet
6
+ / Google Analytics
7
7
  / Looks for google_account_id first in ENV['GOOGLE_ACCOUNT_ID'] then in config/html5_rails.yml
8
8
  - if !google_account_id.blank?
9
- :javascript
10
- var _gaq=[['_setAccount','\#{ google_account_id }'],['_trackPageview']];
9
+ javascript:
10
+ var _gaq=[['_setAccount','#{ google_account_id }'],['_trackPageview']];
11
11
  (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
12
12
  g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
13
13
  s.parentNode.insertBefore(g,s)}(document,'script'));
@@ -1,4 +1,4 @@
1
1
  <%%= stylesheet_link_tag 'application', :media => nil %>
2
2
 
3
3
  <%%# Append your own using content_for :stylesheets %>
4
- <%%= yield :stylesheets %>
4
+ <%%= yield :stylesheets %>