jabe 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. data/{LICENSE.txt → MIT-LICENSE} +1 -1
  2. data/README.textile +46 -31
  3. data/Rakefile +30 -47
  4. data/app/assets/images/jabe/delete.png +0 -0
  5. data/{public/images → app/assets/images/jabe}/delete_page.png +0 -0
  6. data/{public/images → app/assets/images/jabe}/full_page.png +0 -0
  7. data/{public/images → app/assets/images/jabe}/gravatar.gif +0 -0
  8. data/{public/javascripts → app/assets/javascripts/jabe}/application.js +15 -0
  9. data/{public/javascripts → app/assets/javascripts/jabe}/libs/dd_belatedpng.js +0 -0
  10. data/{public/javascripts → app/assets/javascripts/jabe}/libs/modernizr-1.6.min.js +0 -0
  11. data/{public/javascripts → app/assets/javascripts/jabe}/plugins.js +0 -0
  12. data/app/assets/stylesheets/jabe/application.css +3 -0
  13. data/app/{stylesheets → assets/stylesheets/jabe}/boilerplate.scss +0 -0
  14. data/app/{stylesheets → assets/stylesheets/jabe}/jabe.scss +47 -8
  15. data/app/controllers/jabe/admin/base_controller.rb +7 -0
  16. data/app/controllers/jabe/admin/entries_controller.rb +49 -0
  17. data/app/controllers/jabe/admin/settings_controller.rb +13 -0
  18. data/app/controllers/jabe/application_controller.rb +5 -0
  19. data/app/controllers/jabe/comments_controller.rb +34 -0
  20. data/app/controllers/jabe/entries_controller.rb +30 -0
  21. data/app/controllers/jabe/feed_controller.rb +8 -0
  22. data/app/controllers/jabe/sessions_controller.rb +4 -0
  23. data/app/helpers/jabe/application_helper.rb +25 -0
  24. data/app/mailers/jabe/comment_mailer.rb +12 -0
  25. data/app/models/jabe/admin.rb +11 -0
  26. data/app/models/jabe/comment.rb +35 -0
  27. data/app/models/jabe/entry.rb +22 -0
  28. data/app/models/jabe/settings.rb +14 -0
  29. data/app/views/{admin → jabe/admin}/entries/_form.html.haml +1 -1
  30. data/app/views/{admin → jabe/admin}/entries/edit.html.haml +0 -0
  31. data/app/views/{admin → jabe/admin}/entries/index.html.haml +9 -7
  32. data/app/views/{admin → jabe/admin}/entries/new.html.haml +0 -0
  33. data/app/views/{admin → jabe/admin}/settings/edit.html.haml +2 -1
  34. data/app/views/jabe/comment_mailer/notification.html.erb +19 -0
  35. data/app/views/jabe/confirmations/new.html.erb +15 -0
  36. data/app/views/{entries → jabe/entries}/index.html.haml +4 -3
  37. data/app/views/jabe/entries/show.html.haml +49 -0
  38. data/app/views/{feed → jabe/feed}/index.xml.builder +3 -3
  39. data/app/views/jabe/mailer/confirmation_instructions.html.erb +5 -0
  40. data/app/views/jabe/mailer/reset_password_instructions.html.erb +8 -0
  41. data/app/views/jabe/mailer/unlock_instructions.html.erb +7 -0
  42. data/app/views/jabe/passwords/edit.html.erb +19 -0
  43. data/app/views/jabe/passwords/new.html.erb +15 -0
  44. data/app/views/jabe/registrations/edit.html.erb +22 -0
  45. data/app/views/jabe/registrations/new.html.erb +17 -0
  46. data/app/views/jabe/sessions/new.html.erb +15 -0
  47. data/app/views/jabe/shared/_links.erb +25 -0
  48. data/app/views/jabe/unlocks/new.html.erb +15 -0
  49. data/app/views/layouts/jabe/_flashes.html.haml +3 -0
  50. data/app/views/layouts/{_footer.html.haml → jabe/_footer.html.haml} +0 -0
  51. data/app/views/layouts/jabe/_header.html.haml +4 -0
  52. data/app/views/layouts/jabe/_sidebar.html.haml +21 -0
  53. data/app/views/layouts/jabe/application.html.haml +63 -0
  54. data/{test/dummy/vendor/plugins/acts_as_textiled/init.rb → config/initializers/acts_as_textiled.rb} +2 -1
  55. data/config/initializers/devise.rb +3 -0
  56. data/config/initializers/settings.rb +5 -5
  57. data/config/initializers/simple_form.rb +93 -0
  58. data/config/initializers/time_formats.rb +1 -2
  59. data/config/locales/simple_form.en.yml +24 -0
  60. data/config/routes.rb +10 -5
  61. data/{test/dummy/db/migrate/20101229224027_create_settings.rb → db/migrate/20101230010434_create_settings.rb} +7 -2
  62. data/{lib/generators/jabe/templates/migrations/devise_create_admins.rb → db/migrate/20101230010436_devise_create_admins.rb} +6 -6
  63. data/{test/dummy/db/migrate/20101229224030_create_entries.rb → db/migrate/20101230010437_create_entries.rb} +2 -2
  64. data/{test/dummy/db/migrate/20101229224031_create_comments.rb → db/migrate/20101230010438_create_comments.rb} +3 -4
  65. data/{test/dummy/vendor/plugins/acts_as_textiled/lib/acts_as_textiled.rb → lib/acts_as_textiled/base.rb} +0 -0
  66. data/lib/jabe.rb +7 -15
  67. data/lib/jabe/engine.rb +5 -0
  68. data/lib/jabe/version.rb +3 -0
  69. data/lib/tasks/jabe_tasks.rake +4 -0
  70. metadata +187 -601
  71. data/Gemfile +0 -35
  72. data/Gemfile.lock +0 -214
  73. data/VERSION +0 -1
  74. data/app/controllers/admin/base_controller.rb +0 -3
  75. data/app/controllers/admin/entries_controller.rb +0 -42
  76. data/app/controllers/admin/settings_controller.rb +0 -11
  77. data/app/controllers/comments_controller.rb +0 -25
  78. data/app/controllers/entries_controller.rb +0 -26
  79. data/app/controllers/feed_controller.rb +0 -8
  80. data/app/helpers/jabe_helper.rb +0 -13
  81. data/app/models/admin.rb +0 -9
  82. data/app/models/comment.rb +0 -22
  83. data/app/models/entry.rb +0 -17
  84. data/app/models/settings.rb +0 -7
  85. data/app/stylesheets/_will_paginate.scss +0 -102
  86. data/app/stylesheets/handheld.scss +0 -7
  87. data/app/views/entries/_comment_form.html.haml +0 -3
  88. data/app/views/entries/show.html.haml +0 -38
  89. data/app/views/layouts/_header.html.haml +0 -4
  90. data/app/views/layouts/_sidebar.html.haml +0 -21
  91. data/app/views/layouts/application.html.haml +0 -59
  92. data/config/initializers/sass.rb +0 -5
  93. data/lib/generators/jabe/migrations/migrations_generator.rb +0 -38
  94. data/lib/generators/jabe/stylesheets/stylesheets_generator.rb +0 -9
  95. data/lib/generators/jabe/templates/migrations/add_new_settings.rb +0 -17
  96. data/lib/generators/jabe/templates/migrations/create_comments.rb +0 -20
  97. data/lib/generators/jabe/templates/migrations/create_entries.rb +0 -16
  98. data/lib/generators/jabe/templates/migrations/create_settings.rb +0 -21
  99. data/lib/generators/jabe/templates/migrations/create_slugs.rb +0 -18
  100. data/public/.htaccess +0 -220
  101. data/public/apple-touch-icon.png +0 -0
  102. data/public/blackbird/blackbird.css +0 -80
  103. data/public/blackbird/blackbird.js +0 -365
  104. data/public/blackbird/blackbird.png +0 -0
  105. data/public/crossdomain.xml +0 -25
  106. data/public/javascripts/jquery-ui.js +0 -11511
  107. data/public/javascripts/jquery-ui.min.js +0 -404
  108. data/public/javascripts/jquery.js +0 -7179
  109. data/public/javascripts/jquery.min.js +0 -167
  110. data/public/javascripts/libs/profiling/charts.swf +0 -0
  111. data/public/javascripts/libs/profiling/config.js +0 -59
  112. data/public/javascripts/libs/profiling/yahoo-profiling.css +0 -7
  113. data/public/javascripts/libs/profiling/yahoo-profiling.min.js +0 -39
  114. data/public/javascripts/rails.js +0 -154
  115. data/public/nginx.conf +0 -108
  116. data/public/robots.txt +0 -5
  117. data/test/dummy/app/controllers/application_controller.rb +0 -3
  118. data/test/dummy/app/helpers/application_helper.rb +0 -2
  119. data/test/dummy/config/application.rb +0 -52
  120. data/test/dummy/config/boot.rb +0 -10
  121. data/test/dummy/config/environment.rb +0 -5
  122. data/test/dummy/config/environments/development.rb +0 -26
  123. data/test/dummy/config/environments/production.rb +0 -49
  124. data/test/dummy/config/environments/test.rb +0 -35
  125. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  126. data/test/dummy/config/initializers/devise.rb +0 -142
  127. data/test/dummy/config/initializers/inflections.rb +0 -10
  128. data/test/dummy/config/initializers/mime_types.rb +0 -5
  129. data/test/dummy/config/initializers/secret_token.rb +0 -7
  130. data/test/dummy/config/initializers/session_store.rb +0 -8
  131. data/test/dummy/config/routes.rb +0 -58
  132. data/test/dummy/db/migrate/20101229224028_create_slugs.rb +0 -18
  133. data/test/dummy/db/migrate/20101229224029_devise_create_admins.rb +0 -26
  134. data/test/dummy/db/migrate/20110104004400_add_new_settings.rb +0 -17
  135. data/test/dummy/db/schema.rb +0 -110
  136. data/test/dummy/features/step_definitions/admin_steps.rb +0 -14
  137. data/test/dummy/features/step_definitions/email_steps.rb +0 -194
  138. data/test/dummy/features/step_definitions/entry_steps.rb +0 -54
  139. data/test/dummy/features/step_definitions/support_steps.rb +0 -3
  140. data/test/dummy/features/step_definitions/web_steps.rb +0 -219
  141. data/test/dummy/features/support/blueprints.rb +0 -37
  142. data/test/dummy/features/support/env.rb +0 -59
  143. data/test/dummy/features/support/paths.rb +0 -39
  144. data/test/dummy/spec/spec_helper.rb +0 -0
  145. data/test/dummy/spec/support/blueprints.rb +0 -9
  146. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/author.rb +0 -4
  147. data/test/dummy/vendor/plugins/acts_as_textiled/test/fixtures/story.rb +0 -4
  148. data/test/dummy/vendor/plugins/acts_as_textiled/test/helper.rb +0 -87
  149. data/test/dummy/vendor/plugins/acts_as_textiled/test/textiled_test.rb +0 -145
@@ -1,7 +0,0 @@
1
- class Settings < ActiveRecord::Base
2
-
3
- def do_updates
4
- Time.zone = self.time_zone
5
- ActionMailer::Base.default_url_options[:host] = self.host_name
6
- end
7
- end
@@ -1,102 +0,0 @@
1
- .digg_pagination {
2
- background: white;
3
- /* self-clearing method: */
4
- a, span, em {
5
- padding: .2em .5em;
6
- display: block;
7
- float: left;
8
- margin-right: 1px; }
9
- span.disabled {
10
- color: #999;
11
- border: 1px solid #DDD; }
12
- em {
13
- font-weight: bold;
14
- background: #2E6AB1;
15
- color: white;
16
- border: 1px solid #2E6AB1; }
17
- a {
18
- text-decoration: none;
19
- color: #105CB6;
20
- border: 1px solid #9AAFE5;
21
- &:hover, &:focus {
22
- color: #003;
23
- border-color: #003; } }
24
- .page_info {
25
- background: #2E6AB1;
26
- color: white;
27
- padding: .4em .6em;
28
- width: 22em;
29
- margin-bottom: .3em;
30
- text-align: center;
31
- b {
32
- color: #003;
33
- background: #6aa6ed;
34
- padding: .1em .25em; } }
35
- &:after {
36
- content: ".";
37
- display: block;
38
- height: 0;
39
- clear: both;
40
- visibility: hidden; } }
41
-
42
- * {
43
- html .digg_pagination {
44
- height: 1%; }
45
- &:first-child+html .digg_pagination {
46
- overflow: hidden; } }
47
-
48
- .apple_pagination {
49
- // background: #F1F1F1;
50
- // border: 1px solid #E5E5E5;
51
- text-align: center;
52
- padding: 1em;
53
- a, span {
54
- padding: .2em .3em; } }
55
-
56
- .digg_pagination em {
57
- padding: .2em .3em; }
58
-
59
- .apple_pagination {
60
- span.disabled {
61
- color: #AAA; }
62
- em {
63
- font-weight: bold;
64
- background: transparent url(apple-circle.gif) no-repeat 50% 50%; }
65
- a {
66
- text-decoration: none;
67
- // color: black;
68
- &:hover, &:focus {
69
- text-decoration: underline; } } }
70
-
71
- .flickr_pagination {
72
- text-align: center;
73
- padding: .3em;
74
- a, span {
75
- padding: .2em .5em; } }
76
-
77
- .digg_pagination em {
78
- padding: .2em .5em; }
79
-
80
- .flickr_pagination {
81
- span.disabled {
82
- color: #AAA; }
83
- em {
84
- font-weight: bold;
85
- color: #FF0084; }
86
- a {
87
- border: 1px solid #DDDDDD;
88
- color: #0063DC;
89
- text-decoration: none;
90
- &:hover, &:focus {
91
- border-color: #003366;
92
- background: #0063DC;
93
- color: white; } }
94
- .page_info {
95
- color: #aaa;
96
- padding-top: .8em; }
97
- .prev_page, .next_page {
98
- border-width: 2px; }
99
- .prev_page {
100
- margin-right: 1em; }
101
- .next_page {
102
- margin-left: 1em; } }
@@ -1,7 +0,0 @@
1
- * {
2
- float: none;
3
- background: #fff;
4
- color: #000; }
5
-
6
- body {
7
- font-size: 80%; }
@@ -1,3 +0,0 @@
1
- = semantic_form_for [entry, Comment.new] do |form|
2
- = form.inputs
3
- = form.submit 'Submit comment'
@@ -1,38 +0,0 @@
1
- #entries.grid_8
2
- .entry.last
3
- .title
4
- = entry.title
5
- .date
6
- = entry.published_at.to_s(:long)
7
- .content
8
- ~ entry.body.html_safe
9
-
10
- %a{ :name => 'comments' }
11
- #comments
12
- %h2 Comments
13
- - if entry.comments.any?
14
- - entry.comments.each do |comment|
15
- .comment
16
- .gravatar
17
- = image_tag comment.gravatar_url(:default => default_gravatar_url)
18
- .author
19
- = comment.name
20
- %span.when
21
- = comment.created_at.to_s(:long)
22
- .body
23
- = comment.body
24
- - else
25
- .comment
26
- .author
27
- None yet...
28
-
29
- %a{ :name => 'add-comment' }
30
- #new_comment
31
- %h2 Add a comment
32
- = semantic_form_for [entry, comment] do |form|
33
- = form.input :name
34
- = form.input :nickname
35
- = form.input :email, :label => 'Email (not shown to the public)'
36
- = form.input :url, :label => 'Website'
37
- = form.input :body, :label => 'Comment'
38
- = form.submit 'Add comment'
@@ -1,4 +0,0 @@
1
- %h1#site-title
2
- = link_to SETTINGS.site_name, '/'
3
- %h1#site-tagline
4
- = SETTINGS.tagline
@@ -1,21 +0,0 @@
1
- %h2
2
- = SETTINGS.sidebar_heading
3
-
4
- - if SETTINGS.github_username
5
- .link
6
- = link_to 'Github', SETTINGS.github_username
7
-
8
- - if SETTINGS.twitter_username
9
- .link
10
- = link_to 'Twitter', SETTINGS.twitter_username
11
-
12
- - if SETTINGS.facebook_url
13
- .link
14
- = link_to 'Facebook', SETTINGS.facebook_url
15
-
16
- - if SETTINGS.show_github_badge
17
- #github-badge
18
-
19
- :javascript
20
- GITHUB_USERNAME="#{SETTINGS.github_username}";
21
- = javascript_include_tag 'http://drnicjavascript.rubyforge.org/github_badge/dist/github-badge-launcher.js'
@@ -1,59 +0,0 @@
1
- <!doctype html>
2
- /[if lt IE 7 ] <html lang="en" class="no-js ie6">
3
- /[if IE 7 ] <html lang="en" class="no-js ie7">
4
- /[if IE 8 ] <html lang="en" class="no-js ie8">
5
- /[if IE 9 ] <html lang="en" class="no-js ie9">
6
- / [if (gt IE 9)|!(IE)]><!
7
- %html.no-js{:lang => "en"}
8
- / <![endif]
9
- %head
10
- %meta{:charset => "utf-8"}/
11
- %meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}/
12
- %title= SETTINGS.site_name
13
- %meta{:content => "", :name => "description"}/
14
- %meta{:content => "", :name => "author"}/
15
- %meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/
16
- %link{:href => "/favicon.ico", :rel => "shortcut icon"}/
17
- %link{:href => "/apple-touch-icon.png", :rel => "apple-touch-icon"}/
18
- = auto_discovery_link_tag :atom, feed_path
19
- = stylesheet_link_tag 'boilerplate', 'jabe', 'application'
20
- = javascript_include_tag 'libs/modernizr-1.6.min.js'
21
- %body
22
- #container
23
- %header
24
- = render 'layouts/header'
25
- - if admin_signed_in?
26
- %nav.nav.admin
27
- %ul
28
- %li= link_to 'Entries', admin_entries_path
29
- %li= link_to 'Settings', edit_admin_settings_path
30
- %li= link_to 'Logout', destroy_admin_session_path
31
- #main
32
- #content
33
- = yield
34
- #sidebar
35
- = render 'layouts/sidebar'
36
- %footer
37
- = render 'layouts/footer'
38
- %script{:src => "//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"}
39
- :javascript
40
- !window.jQuery && document.write(unescape('%3Cscript src="/javascripts/libs/jquery-min.js"%3E%3C/script%3E'))
41
- = javascript_include_tag 'plugins'
42
- = javascript_include_tag 'application'
43
- /[if lt IE 7 ]
44
- <script src="/javascripts/libs/dd_belatedpng.js"></script>
45
- <script> DD_belatedPNG.fix('img, .png_bg'); </script>
46
- - unless Rails.env.production?
47
- / yui profiler and profileviewer - remove for production
48
- = javascript_include_tag 'libs/profiling/yahoo-profiling.min.js'
49
- = javascript_include_tag 'libs/profiling/config.js'
50
- / change the UA-XXXXX-X to be your site's ID
51
- :javascript
52
- var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
53
- (function(d, t) {
54
- var g = d.createElement(t),
55
- s = d.getElementsByTagName(t)[0];
56
- g.async = true;
57
- g.src = ('https:' == location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
58
- s.parentNode.insertBefore(g, s);
59
- })(document, 'script');
@@ -1,5 +0,0 @@
1
- Sass::Plugin.options[:style] = :expanded
2
- Sass::Plugin.options[:property_syntax] = :new
3
- Sass::Plugin.options[:template_location] = {
4
- File.expand_path(File.join(__FILE__, '../../../app/stylesheets')) => 'public/stylesheets'
5
- }
@@ -1,38 +0,0 @@
1
- module Jabe
2
- module Generators
3
- class MigrationsGenerator < Rails::Generators::Base
4
- include Rails::Generators::Migration
5
-
6
- self.source_root(File.expand_path(File.join(Jabe::Engine.root, 'lib', 'generators', 'jabe', 'templates', 'migrations')))
7
-
8
- desc "run this generator to create the necessary migrations"
9
-
10
- def create_migrations
11
- existing_migrations = Dir["db/migrate/*.rb"]
12
- migrations = %w(
13
- create_settings.rb
14
- create_slugs.rb
15
- devise_create_admins.rb
16
- create_entries.rb
17
- create_comments.rb
18
- add_new_settings.rb
19
- ).reject { |file|
20
- existing_migrations.any? { |migration|
21
- match = migration.match(/#{file}$/)
22
- puts "skipping #{file}, exists." if match
23
- match
24
- }
25
- }
26
-
27
- migrations.each do |migration|
28
- migration_template migration, "db/migrate/#{migration}"
29
- sleep 1 # timestamps...
30
- end
31
- end
32
-
33
- def self.next_migration_number(dirname)
34
- Time.now.utc.strftime("%Y%m%d%H%M%S")
35
- end
36
- end
37
- end
38
- end
@@ -1,9 +0,0 @@
1
- module Jabe
2
- module Generators
3
- class StylesheetsGenerator < Rails::Generators::Base
4
- %w( boilerplate handheld jabe ).each do |sheet|
5
- system("bundle exec sass #{Jabe::Engine.root}/app/stylesheets/#{sheet}.scss public/stylesheets/#{sheet}.css")
6
- end
7
- end
8
- end
9
- end
@@ -1,17 +0,0 @@
1
- class AddNewSettings < ActiveRecord::Migration
2
- def self.up
3
- add_column :settings, :sidebar_heading, :string
4
- add_column :settings, :github_username, :string
5
- add_column :settings, :twitter_username, :string
6
- add_column :settings, :show_github_badge, :boolean
7
- add_column :settings, :facebook_url, :string
8
- end
9
-
10
- def self.down
11
- remove_column :settings, :sidebar_heading
12
- remove_column :settings, :facebook_url
13
- remove_column :settings, :show_github_badge
14
- remove_column :settings, :twitter_username
15
- remove_column :settings, :github_username
16
- end
17
- end
@@ -1,20 +0,0 @@
1
- class CreateComments < ActiveRecord::Migration
2
- def self.up
3
- create_table :comments do |t|
4
- t.integer :entry_id
5
- t.string :name
6
- t.string :email
7
- t.string :url
8
- t.text :body
9
-
10
- t.timestamps
11
- end
12
-
13
- add_index :comments, :entry_id
14
- end
15
-
16
- def self.down
17
- remove_index :comments, :entry_id
18
- drop_table :comments
19
- end
20
- end
@@ -1,16 +0,0 @@
1
- class CreateEntries < ActiveRecord::Migration
2
- def self.up
3
- create_table :entries do |t|
4
- t.string :cached_slug
5
- t.string :title
6
- t.text :body
7
- t.boolean :draft
8
- t.datetime :published_at
9
- t.timestamps
10
- end
11
- end
12
-
13
- def self.down
14
- drop_table :entries
15
- end
16
- end
@@ -1,21 +0,0 @@
1
- class CreateSettings < ActiveRecord::Migration
2
- def self.up
3
- create_table :settings do |t|
4
- t.string :site_url
5
- t.string :host_name
6
- t.string :mail_from
7
- t.string :site_name
8
- t.string :tagline
9
- t.string :time_zone
10
- t.string :google_tracker_id
11
- t.boolean :blackbird_enabled
12
- t.integer :entries_per_page
13
-
14
- t.timestamps
15
- end
16
- end
17
-
18
- def self.down
19
- drop_table :settings
20
- end
21
- end
@@ -1,18 +0,0 @@
1
- class CreateSlugs < ActiveRecord::Migration
2
- def self.up
3
- create_table :slugs do |t|
4
- t.string :name
5
- t.integer :sluggable_id
6
- t.integer :sequence, :null => false, :default => 1
7
- t.string :sluggable_type, :limit => 40
8
- t.string :scope
9
- t.datetime :created_at
10
- end
11
- add_index :slugs, :sluggable_id
12
- add_index :slugs, [:name, :sluggable_type, :sequence, :scope], :name => "index_slugs_on_n_s_s_and_s", :unique => true
13
- end
14
-
15
- def self.down
16
- drop_table :slugs
17
- end
18
- end
data/public/.htaccess DELETED
@@ -1,220 +0,0 @@
1
- # Apache configuration file
2
- # httpd.apache.org/docs/2.2/mod/quickreference.html
3
-
4
- # Techniques in here adapted from all over, including:
5
- # Kroc Camen: camendesign.com/.htaccess
6
- # perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
7
-
8
-
9
- # Force the latest IE version, in various cases when it may fall back to IE7 mode
10
- # github.com/rails/rails/commit/123eb25#commitcomment-118920
11
- # Use ChromeFrame if it's installed for a better experience for the poor IE folk
12
- <IfModule mod_setenvif.c>
13
- <IfModule mod_headers.c>
14
- BrowserMatch MSIE ie
15
- Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
16
- </IfModule>
17
- </IfModule>
18
-
19
- <IfModule mod_headers.c>
20
- # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
21
- # We need to inform proxies that content changes based on UA
22
- Header append Vary User-Agent
23
- # Cache control is set only if mod_headers is enabled, so that's unncessary to declare
24
- </IfModule>
25
-
26
- # hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/
27
- # Disabled. Uncomment to serve cross-domain ajax requests
28
- #<IfModule mod_headers.c>
29
- # Header set Access-Control-Allow-Origin "*"
30
- #</IfModule>
31
-
32
-
33
-
34
-
35
- # allow access from all domains for webfonts
36
- # alternatively you could only whitelist
37
- # your subdomains like "sub.domain.com"
38
-
39
- <FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
40
- <IfModule mod_headers.c>
41
- Header set Access-Control-Allow-Origin "*"
42
- </IfModule>
43
- </FilesMatch>
44
-
45
-
46
- # video
47
- AddType video/ogg ogg ogv
48
- AddType video/mp4 mp4
49
- AddType video/webm webm
50
-
51
- # Proper svg serving. Required for svg webfonts on iPad
52
- # twitter.com/FontSquirrel/status/14855840545
53
- AddType image/svg+xml svg svgz
54
- AddEncoding gzip svgz
55
-
56
- # webfonts
57
- AddType application/vnd.ms-fontobject eot
58
- AddType font/truetype ttf
59
- AddType font/opentype otf
60
- AddType font/woff woff
61
-
62
- # assorted types
63
- AddType image/vnd.microsoft.icon ico
64
- AddType image/webp webp
65
- AddType text/cache-manifest manifest
66
- AddType text/x-component htc
67
- AddType application/x-chrome-extension crx
68
-
69
-
70
-
71
-
72
- # allow concatenation from within specific js and css files
73
-
74
- # e.g. Inside of script.combined.js you could have
75
- # <!--#include file="jquery-1.4.2.js" -->
76
- # <!--#include file="jquery.idletimer.js" -->
77
- # and they would be included into this single file
78
-
79
- # this is not in use in the boilerplate as it stands. you may
80
- # choose to name your files in this way for this advantage
81
- # or concatenate and minify them manually.
82
- # Disabled by default.
83
-
84
- # <FilesMatch "\.combined\.(js|css)$">
85
- # Options +Includes
86
- # SetOutputFilter INCLUDES
87
- # </FilesMatch>
88
-
89
-
90
-
91
-
92
-
93
- # gzip compression.
94
- <IfModule mod_deflate.c>
95
-
96
- # html, txt, css, js, json, xml, htc:
97
- AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
98
- AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
99
- AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
100
-
101
- # webfonts and svg:
102
- <FilesMatch "\.(ttf|otf|eot|svg)$" >
103
- SetOutputFilter DEFLATE
104
- </FilesMatch>
105
- </IfModule>
106
-
107
-
108
-
109
- # these are pretty far-future expires headers
110
- # they assume you control versioning with cachebusting query params like
111
- # <script src="application.js?20100608">
112
- # additionally, consider that outdated proxies may miscache
113
- # www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
114
-
115
- # if you don't use filenames to version, lower the css and js to something like
116
- # "access plus 1 week" or so
117
-
118
- <IfModule mod_expires.c>
119
- Header set Cache-Control "public"
120
- ExpiresActive on
121
-
122
- # Perhaps better to whitelist expires rules? Perhaps.
123
- ExpiresDefault "access plus 1 month"
124
-
125
- # cache.manifest needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
126
- ExpiresByType text/cache-manifest "access plus 0 seconds"
127
-
128
- # your document html
129
- ExpiresByType text/html "access plus 0 seconds"
130
-
131
- # data
132
- ExpiresByType text/xml "access plus 0 seconds"
133
- ExpiresByType application/xml "access plus 0 seconds"
134
- ExpiresByType application/json "access plus 0 seconds"
135
-
136
-
137
- # rss feed
138
- ExpiresByType application/rss+xml "access plus 1 hour"
139
-
140
- # favicon (cannot be renamed)
141
- ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
142
-
143
- # media: images, video, audio
144
- ExpiresByType image/gif "access plus 1 month"
145
- ExpiresByType image/png "access plus 1 month"
146
- ExpiresByType image/jpg "access plus 1 month"
147
- ExpiresByType image/jpeg "access plus 1 month"
148
- ExpiresByType video/ogg "access plus 1 month"
149
- ExpiresByType audio/ogg "access plus 1 month"
150
- ExpiresByType video/mp4 "access plus 1 month"
151
- ExpiresByType video/webm "access plus 1 month"
152
-
153
- # webfonts
154
- ExpiresByType font/truetype "access plus 1 month"
155
- ExpiresByType font/opentype "access plus 1 month"
156
- ExpiresByType font/woff "access plus 1 month"
157
- ExpiresByType image/svg+xml "access plus 1 month"
158
- ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
159
-
160
- # css and javascript
161
- ExpiresByType text/css "access plus 1 month"
162
- ExpiresByType application/javascript "access plus 1 month"
163
- ExpiresByType text/javascript "access plus 1 month"
164
- </IfModule>
165
-
166
-
167
-
168
-
169
- # Since we're sending far-future expires, we don't need ETags for
170
- # static content.
171
- # developer.yahoo.com/performance/rules.html#etags
172
- FileETag None
173
-
174
-
175
-
176
-
177
- # Allow cookies to be set from iframes (for IE only)
178
- # If needed, uncomment and specify a path or regex in the Location directive
179
-
180
- # <IfModule mod_headers.c>
181
- # <Location />
182
- # Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""
183
- # </Location>
184
- # </IfModule>
185
-
186
-
187
- # you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
188
- # no-www.org/faq.php?q=class_b
189
- <IfModule mod_rewrite.c>
190
- RewriteEngine On
191
- RewriteCond %{HTTPS} !=on
192
- RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
193
- RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
194
- </IfModule>
195
-
196
- # without -MultiViews, Apache will give a 404 for a rewrite if a folder of the same name does not exist
197
- # e.g. /blog/hello : webmasterworld.com/apache/3808792.htm
198
- Options -MultiViews
199
- # -Indexes will have Apache block users from browsing folders without a default document
200
- # Options -Indexes
201
-
202
-
203
-
204
- # custom 404 page
205
- ErrorDocument 404 /404.html
206
-
207
-
208
-
209
- # use utf-8 encoding for anything served text/plain or text/html
210
- AddDefaultCharset utf-8
211
- # force utf-8 for a number of file formats
212
- AddCharset utf-8 .html .css .js .xml .json .rss
213
-
214
-
215
-
216
- # We don't need to tell everyone we're apache.
217
- ServerSignature Off
218
-
219
-
220
-