frontend-helpers 0.0.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +18 -0
- data/Gemfile.lock +108 -0
- data/LICENSE.txt +20 -0
- data/MIT-LICENSE +20 -0
- data/README.md +97 -0
- data/Rakefile +53 -0
- data/config/services.yml +95 -0
- data/config/settings.yml +24 -0
- data/frontend-helpers.gemspec +117 -0
- data/lib/.DS_Store +0 -0
- data/lib/asset-helpers/rails.rb +4 -0
- data/lib/frontend-helpers/html5_helper.rb +19 -0
- data/lib/frontend-helpers/metatag_helper.rb +58 -0
- data/lib/frontend-helpers/services_helper.rb +89 -0
- data/lib/frontend-helpers.rb +16 -0
- data/lib/generators/frontend/install/install_generator.rb +27 -0
- data/lib/tasks/frontend-helpers_tasks.rake +4 -0
- data/script/rails +6 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +54 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/frontend-helpers_test.rb +11 -0
- data/test/test_helper.rb +10 -0
- data/vendor/assets/javascripts/backbone/backbone.js +1149 -0
- data/vendor/assets/javascripts/backbone/index.js +2 -0
- data/vendor/assets/javascripts/backbone/underscore.js +807 -0
- data/vendor/assets/javascripts/ie/dd_belatedpng.js +13 -0
- data/vendor/assets/javascripts/ie/index.js +2 -0
- data/vendor/assets/javascripts/ie/reverse_zindex.js +1 -0
- data/vendor/assets/javascripts/jquery.async.js +77 -0
- data/vendor/assets/javascripts/jquery.cookie.js +89 -0
- data/vendor/assets/javascripts/jquery.lifestream.js +1516 -0
- data/vendor/assets/javascripts/jquery.validate.js +1166 -0
- data/vendor/assets/javascripts/log.js +8 -0
- data/vendor/assets/javascripts/modernizr.js +1116 -0
- data/vendor/assets/javascripts/shortcut.js +223 -0
- data/vendor/assets/javascripts/swfobject.js +4 -0
- data/vendor/assets/stylesheets/reset.css.sass +183 -0
- data/vendor/assets/stylesheets/variables.css.sass +21 -0
- metadata +175 -0
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Rails so we can extend it
|
4
|
+
gem "rails", "~> 3.1.0.rc4"
|
5
|
+
|
6
|
+
gem "haml-rails", "~> 0.3.4"
|
7
|
+
gem "sass-rails", "~> 3.1.0.rc"
|
8
|
+
|
9
|
+
gem "sprockets", "~> 2.0.0.beta.10"
|
10
|
+
|
11
|
+
if RUBY_VERSION < "1.9"
|
12
|
+
gem "ruby-debug", ">= 0.10.3"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development do
|
16
|
+
# Using jeweler because it's just so easy
|
17
|
+
gem "jeweler", "~> 1.6.4"
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
actionmailer (3.1.0.rc4)
|
5
|
+
actionpack (= 3.1.0.rc4)
|
6
|
+
mail (~> 2.3.0)
|
7
|
+
actionpack (3.1.0.rc4)
|
8
|
+
activemodel (= 3.1.0.rc4)
|
9
|
+
activesupport (= 3.1.0.rc4)
|
10
|
+
builder (~> 3.0.0)
|
11
|
+
erubis (~> 2.7.0)
|
12
|
+
i18n (~> 0.6)
|
13
|
+
rack (~> 1.3.0)
|
14
|
+
rack-cache (~> 1.0.1)
|
15
|
+
rack-mount (~> 0.8.1)
|
16
|
+
rack-test (~> 0.6.0)
|
17
|
+
sprockets (~> 2.0.0.beta.10)
|
18
|
+
tzinfo (~> 0.3.27)
|
19
|
+
activemodel (3.1.0.rc4)
|
20
|
+
activesupport (= 3.1.0.rc4)
|
21
|
+
bcrypt-ruby (~> 2.1.4)
|
22
|
+
builder (~> 3.0.0)
|
23
|
+
i18n (~> 0.6)
|
24
|
+
activerecord (3.1.0.rc4)
|
25
|
+
activemodel (= 3.1.0.rc4)
|
26
|
+
activesupport (= 3.1.0.rc4)
|
27
|
+
arel (~> 2.1.1)
|
28
|
+
tzinfo (~> 0.3.27)
|
29
|
+
activeresource (3.1.0.rc4)
|
30
|
+
activemodel (= 3.1.0.rc4)
|
31
|
+
activesupport (= 3.1.0.rc4)
|
32
|
+
activesupport (3.1.0.rc4)
|
33
|
+
multi_json (~> 1.0)
|
34
|
+
arel (2.1.3)
|
35
|
+
bcrypt-ruby (2.1.4)
|
36
|
+
builder (3.0.0)
|
37
|
+
erubis (2.7.0)
|
38
|
+
git (1.2.5)
|
39
|
+
haml (3.1.2)
|
40
|
+
haml-rails (0.3.4)
|
41
|
+
actionpack (~> 3.0)
|
42
|
+
activesupport (~> 3.0)
|
43
|
+
haml (~> 3.0)
|
44
|
+
railties (~> 3.0)
|
45
|
+
hike (1.1.0)
|
46
|
+
i18n (0.6.0)
|
47
|
+
jeweler (1.6.4)
|
48
|
+
bundler (~> 1.0)
|
49
|
+
git (>= 1.2.5)
|
50
|
+
rake
|
51
|
+
mail (2.3.0)
|
52
|
+
i18n (>= 0.4.0)
|
53
|
+
mime-types (~> 1.16)
|
54
|
+
treetop (~> 1.4.8)
|
55
|
+
mime-types (1.16)
|
56
|
+
multi_json (1.0.3)
|
57
|
+
polyglot (0.3.1)
|
58
|
+
rack (1.3.0)
|
59
|
+
rack-cache (1.0.2)
|
60
|
+
rack (>= 0.4)
|
61
|
+
rack-mount (0.8.1)
|
62
|
+
rack (>= 1.0.0)
|
63
|
+
rack-ssl (1.3.2)
|
64
|
+
rack
|
65
|
+
rack-test (0.6.0)
|
66
|
+
rack (>= 1.0)
|
67
|
+
rails (3.1.0.rc4)
|
68
|
+
actionmailer (= 3.1.0.rc4)
|
69
|
+
actionpack (= 3.1.0.rc4)
|
70
|
+
activerecord (= 3.1.0.rc4)
|
71
|
+
activeresource (= 3.1.0.rc4)
|
72
|
+
activesupport (= 3.1.0.rc4)
|
73
|
+
bundler (~> 1.0)
|
74
|
+
railties (= 3.1.0.rc4)
|
75
|
+
railties (3.1.0.rc4)
|
76
|
+
actionpack (= 3.1.0.rc4)
|
77
|
+
activesupport (= 3.1.0.rc4)
|
78
|
+
rack-ssl (~> 1.3.2)
|
79
|
+
rake (>= 0.8.7)
|
80
|
+
rdoc (~> 3.4)
|
81
|
+
thor (~> 0.14.6)
|
82
|
+
rake (0.9.2)
|
83
|
+
rdoc (3.8)
|
84
|
+
sass (3.1.4)
|
85
|
+
sass-rails (3.1.0.rc.4)
|
86
|
+
actionpack (~> 3.1.0.rc1)
|
87
|
+
railties (~> 3.1.0.rc1)
|
88
|
+
sass (>= 3.1.4)
|
89
|
+
sprockets (>= 2.0.0.beta.9)
|
90
|
+
sprockets (2.0.0.beta.10)
|
91
|
+
hike (~> 1.0)
|
92
|
+
rack (~> 1.0)
|
93
|
+
tilt (!= 1.3.0, ~> 1.1)
|
94
|
+
thor (0.14.6)
|
95
|
+
tilt (1.3.2)
|
96
|
+
treetop (1.4.9)
|
97
|
+
polyglot (>= 0.3.1)
|
98
|
+
tzinfo (0.3.29)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
haml-rails (~> 0.3.4)
|
105
|
+
jeweler (~> 1.6.4)
|
106
|
+
rails (~> 3.1.0.rc4)
|
107
|
+
sass-rails (~> 3.1.0.rc)
|
108
|
+
sprockets (~> 2.0.0.beta.10)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Christopher Hein
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2011 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# Frontend Helpers #
|
2
|
+
|
3
|
+
This is a collection of Rails 3.1 Helpers that I have compiled together into one nice neat special little gem... it'll handle doing things such as Meta tag creation, Facebook Open Graph Tag Creation, javascript integration for, Google Analytics, Chartbeat, Inspectlet, Mixpanel, Woopra, Kissmetrics, Quantcast, and Olark, as well I've packaged in a few of my favorite/most used javascript libraries for building amazing web apps, and last but not least, added a great `reset.css.sass` file that goes really nicely with my `variables.css.sass` file, for a basic clean view.
|
4
|
+
|
5
|
+
Try it on your next project, I'm sure you'll like it.
|
6
|
+
|
7
|
+
## Getting Started ##
|
8
|
+
|
9
|
+
First in your Rails 3.1 Project start by adding this to your Gemfile:
|
10
|
+
|
11
|
+
gem "frontend-helpers"
|
12
|
+
|
13
|
+
Then run `bundle install` to install the gem from RubyGems
|
14
|
+
|
15
|
+
## Next Steps ##
|
16
|
+
|
17
|
+
If you plan on using the gem for the Rails Helpers, keep reading if you'd only like to use it for the access to the javascript assets & css assets you can skip ahead...
|
18
|
+
|
19
|
+
Anyways for the helpers your going to need to generate a few files first to do so run:
|
20
|
+
|
21
|
+
$ rails g frontend:install
|
22
|
+
|
23
|
+
This should come up and tell you that it's copying `config/settings.yml`, `config/services.yml` & `app/assets/stylesheets/variables.css.sass`
|
24
|
+
|
25
|
+
Then you can start editing them:
|
26
|
+
|
27
|
+
### Settings.yml ###
|
28
|
+
|
29
|
+
Before you start adding your content to the `settings.yml` you should probably start by including the helper in your `application_controller.rb` add:
|
30
|
+
|
31
|
+
include FrontendHelpers::MetatagHelper
|
32
|
+
|
33
|
+
Next where ever you want the metatags to appear use:
|
34
|
+
|
35
|
+
- meta_tags
|
36
|
+
|
37
|
+
In the `settings.yml` you'll find a list of tags that can be filled out with your applications information all of these tags will get replicated into meta tags, if you choose not to use one you can either leave it blank or remove it.
|
38
|
+
|
39
|
+
Of course just because they are set in this file does not mean you can't change them per page this is how you would do that....
|
40
|
+
|
41
|
+
Say for instance you set the key `title`
|
42
|
+
|
43
|
+
:title: "Chris Hein's Site"
|
44
|
+
|
45
|
+
And on the homepage you liked that, but maybe on the about page you would like it to say `About Chris Hein` with this plugin that's really simple, in your action for your about page simple add:
|
46
|
+
|
47
|
+
@meta_title = "About Chris Hein"
|
48
|
+
|
49
|
+
This will overwrite the current title with whatever you'd like. This is the list of available tags and how to overwrite them:
|
50
|
+
|
51
|
+
title: @meta_title,
|
52
|
+
keywords: @meta_keywords,
|
53
|
+
description: @meta_description,
|
54
|
+
author: @meta_author,
|
55
|
+
email: @meta_email,
|
56
|
+
copyright: @meta_copyright,
|
57
|
+
generator: @meta_generator,
|
58
|
+
rating: @meta_rating,
|
59
|
+
language: @meta_language,
|
60
|
+
distribution: @meta_distribution,
|
61
|
+
robots: @robots,
|
62
|
+
:"fb:app_id" => @meta_fb_app_id,
|
63
|
+
:"og:title" => @meta_og_title,
|
64
|
+
:"og:description" => @meta_og_description,
|
65
|
+
:"og:url" => request.url,
|
66
|
+
:"og:site_name" => @meta_og_site_name,
|
67
|
+
:"og:type" => @meta_og_type,
|
68
|
+
:"og:image" => @meta_og_image,
|
69
|
+
:"og:locality" => @meta_og_locality,
|
70
|
+
:"og:region" => @meta_og_region,
|
71
|
+
:"og:country_name" => @meta_og_country_name,
|
72
|
+
:"og:phone_number" => @meta_og_phone_number
|
73
|
+
|
74
|
+
### Services.yml ###
|
75
|
+
|
76
|
+
TODO: Write how to use this
|
77
|
+
|
78
|
+
|
79
|
+
### Assets ###
|
80
|
+
|
81
|
+
TODO: Write how to use this
|
82
|
+
|
83
|
+
|
84
|
+
## Contributing to Frontend Helpers ##
|
85
|
+
|
86
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
87
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
88
|
+
* Fork the project
|
89
|
+
* Start a feature/bugfix branch
|
90
|
+
* Commit and push until you are happy with your contribution
|
91
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
92
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
93
|
+
|
94
|
+
## Copyright ##
|
95
|
+
|
96
|
+
Copyright (c) 2011 Christopher Hein. See LICENSE.txt for
|
97
|
+
further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "frontend-helpers"
|
16
|
+
gem.homepage = "http://github.com/christopherhein/frontend-helpers"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Collection of useful frontend helpers for Rails 3.1 applications.}
|
19
|
+
gem.description = %Q{Large collection of useful Rails 3.1 helpers for SEO, Metatags, Facebook OG tags, integration for analytics services like google, woopra, olark, mixpanel and much much more...}
|
20
|
+
gem.email = "me@christopherhein.com"
|
21
|
+
gem.authors = ["Christopher Hein"]
|
22
|
+
gem.version = "0.0.1.beta.1"
|
23
|
+
# dependencies defined in Gemfile
|
24
|
+
end
|
25
|
+
Jeweler::RubygemsDotOrgTasks.new
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'rake/testtask'
|
35
|
+
|
36
|
+
Rake::TestTask.new(:test) do |t|
|
37
|
+
t.libs << 'lib'
|
38
|
+
t.libs << 'test'
|
39
|
+
t.pattern = 'test/**/*_test.rb'
|
40
|
+
t.verbose = false
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "testing-gem #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/config/services.yml
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
:google:
|
2
|
+
:development:
|
3
|
+
:account_id: ""
|
4
|
+
:site_name: ""
|
5
|
+
:maps_api_key: ""
|
6
|
+
|
7
|
+
:test:
|
8
|
+
:account_id: ""
|
9
|
+
:site_name: ""
|
10
|
+
:maps_api_key: ""
|
11
|
+
|
12
|
+
:production:
|
13
|
+
:account_id: ""
|
14
|
+
:site_name: ""
|
15
|
+
:maps_api_key: ""
|
16
|
+
|
17
|
+
|
18
|
+
:chartbeat:
|
19
|
+
:development:
|
20
|
+
:uid: ""
|
21
|
+
:domain: ""
|
22
|
+
|
23
|
+
:test:
|
24
|
+
:uid: ""
|
25
|
+
:domain: ""
|
26
|
+
|
27
|
+
:production:
|
28
|
+
:uid: ""
|
29
|
+
:domain: ""
|
30
|
+
|
31
|
+
|
32
|
+
:inspectlet:
|
33
|
+
:development:
|
34
|
+
:setup: false
|
35
|
+
|
36
|
+
:test:
|
37
|
+
:setup: false
|
38
|
+
|
39
|
+
:production:
|
40
|
+
:setup: false
|
41
|
+
|
42
|
+
|
43
|
+
:mixpanel:
|
44
|
+
:development:
|
45
|
+
:init: ""
|
46
|
+
|
47
|
+
:test:
|
48
|
+
:init: ""
|
49
|
+
|
50
|
+
:production:
|
51
|
+
:init: ""
|
52
|
+
|
53
|
+
|
54
|
+
:woopra:
|
55
|
+
:development:
|
56
|
+
:domain: ""
|
57
|
+
|
58
|
+
:test:
|
59
|
+
:domain: ""
|
60
|
+
|
61
|
+
:production:
|
62
|
+
:domain: ""
|
63
|
+
|
64
|
+
|
65
|
+
:kissmetrics:
|
66
|
+
:development:
|
67
|
+
:setup: false
|
68
|
+
|
69
|
+
:test:
|
70
|
+
:setup: false
|
71
|
+
|
72
|
+
:production:
|
73
|
+
:setup: false
|
74
|
+
|
75
|
+
|
76
|
+
:quantcast:
|
77
|
+
:development:
|
78
|
+
:qacct: ""
|
79
|
+
|
80
|
+
:test:
|
81
|
+
:qacct: ""
|
82
|
+
|
83
|
+
:production:
|
84
|
+
:qacct: ""
|
85
|
+
|
86
|
+
|
87
|
+
:olark:
|
88
|
+
:development:
|
89
|
+
:identify: ""
|
90
|
+
|
91
|
+
:test:
|
92
|
+
:identify: ""
|
93
|
+
|
94
|
+
:production:
|
95
|
+
:identify: ""
|
data/config/settings.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
:site:
|
2
|
+
:title: ""
|
3
|
+
:keywords: ""
|
4
|
+
:description: ""
|
5
|
+
:author: ""
|
6
|
+
:email: ""
|
7
|
+
:copyright: ""
|
8
|
+
:generator: ""
|
9
|
+
:rating: ""
|
10
|
+
:language: ""
|
11
|
+
:distribution: ""
|
12
|
+
:robots: ""
|
13
|
+
:"fb:app_id": ""
|
14
|
+
:"og:title": ""
|
15
|
+
:"og:description": ""
|
16
|
+
:"og:url": ""
|
17
|
+
:"og:site_name": ""
|
18
|
+
:"og:type": ""
|
19
|
+
:"og:image": ""
|
20
|
+
:"og:locality": ""
|
21
|
+
:"og:region": ""
|
22
|
+
:"og:country_name": ""
|
23
|
+
:"og:phone_number": ""
|
24
|
+
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{frontend-helpers}
|
8
|
+
s.version = "0.0.1.beta.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Christopher Hein"]
|
12
|
+
s.date = %q{2011-07-10}
|
13
|
+
s.description = %q{Large collection of useful Rails 3.1 helpers for SEO, Metatags, Facebook OG tags, integration for analytics services like google, woopra, olark, mixpanel and much much more...}
|
14
|
+
s.email = %q{me@christopherhein.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
22
|
+
"LICENSE.txt",
|
23
|
+
"MIT-LICENSE",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"config/services.yml",
|
27
|
+
"config/settings.yml",
|
28
|
+
"frontend-helpers.gemspec",
|
29
|
+
"lib/.DS_Store",
|
30
|
+
"lib/asset-helpers/rails.rb",
|
31
|
+
"lib/frontend-helpers.rb",
|
32
|
+
"lib/frontend-helpers/html5_helper.rb",
|
33
|
+
"lib/frontend-helpers/metatag_helper.rb",
|
34
|
+
"lib/frontend-helpers/services_helper.rb",
|
35
|
+
"lib/generators/frontend/install/install_generator.rb",
|
36
|
+
"lib/tasks/frontend-helpers_tasks.rake",
|
37
|
+
"script/rails",
|
38
|
+
"test/dummy/Rakefile",
|
39
|
+
"test/dummy/app/assets/javascripts/application.js",
|
40
|
+
"test/dummy/app/assets/stylesheets/application.css",
|
41
|
+
"test/dummy/app/controllers/application_controller.rb",
|
42
|
+
"test/dummy/app/helpers/application_helper.rb",
|
43
|
+
"test/dummy/app/mailers/.gitkeep",
|
44
|
+
"test/dummy/app/models/.gitkeep",
|
45
|
+
"test/dummy/app/views/layouts/application.html.erb",
|
46
|
+
"test/dummy/config.ru",
|
47
|
+
"test/dummy/config/application.rb",
|
48
|
+
"test/dummy/config/boot.rb",
|
49
|
+
"test/dummy/config/database.yml",
|
50
|
+
"test/dummy/config/environment.rb",
|
51
|
+
"test/dummy/config/environments/development.rb",
|
52
|
+
"test/dummy/config/environments/production.rb",
|
53
|
+
"test/dummy/config/environments/test.rb",
|
54
|
+
"test/dummy/config/initializers/backtrace_silencers.rb",
|
55
|
+
"test/dummy/config/initializers/inflections.rb",
|
56
|
+
"test/dummy/config/initializers/mime_types.rb",
|
57
|
+
"test/dummy/config/initializers/secret_token.rb",
|
58
|
+
"test/dummy/config/initializers/session_store.rb",
|
59
|
+
"test/dummy/config/initializers/wrap_parameters.rb",
|
60
|
+
"test/dummy/config/locales/en.yml",
|
61
|
+
"test/dummy/config/routes.rb",
|
62
|
+
"test/dummy/log/.gitkeep",
|
63
|
+
"test/dummy/public/404.html",
|
64
|
+
"test/dummy/public/422.html",
|
65
|
+
"test/dummy/public/500.html",
|
66
|
+
"test/dummy/public/favicon.ico",
|
67
|
+
"test/dummy/script/rails",
|
68
|
+
"test/frontend-helpers_test.rb",
|
69
|
+
"test/test_helper.rb",
|
70
|
+
"vendor/assets/javascripts/backbone/backbone.js",
|
71
|
+
"vendor/assets/javascripts/backbone/index.js",
|
72
|
+
"vendor/assets/javascripts/backbone/underscore.js",
|
73
|
+
"vendor/assets/javascripts/ie/dd_belatedpng.js",
|
74
|
+
"vendor/assets/javascripts/ie/index.js",
|
75
|
+
"vendor/assets/javascripts/ie/reverse_zindex.js",
|
76
|
+
"vendor/assets/javascripts/jquery.async.js",
|
77
|
+
"vendor/assets/javascripts/jquery.cookie.js",
|
78
|
+
"vendor/assets/javascripts/jquery.lifestream.js",
|
79
|
+
"vendor/assets/javascripts/jquery.validate.js",
|
80
|
+
"vendor/assets/javascripts/log.js",
|
81
|
+
"vendor/assets/javascripts/modernizr.js",
|
82
|
+
"vendor/assets/javascripts/shortcut.js",
|
83
|
+
"vendor/assets/javascripts/swfobject.js",
|
84
|
+
"vendor/assets/stylesheets/reset.css.sass",
|
85
|
+
"vendor/assets/stylesheets/variables.css.sass"
|
86
|
+
]
|
87
|
+
s.homepage = %q{http://github.com/christopherhein/frontend-helpers}
|
88
|
+
s.licenses = ["MIT"]
|
89
|
+
s.require_paths = ["lib"]
|
90
|
+
s.rubygems_version = %q{1.6.2}
|
91
|
+
s.summary = %q{Collection of useful frontend helpers for Rails 3.1 applications.}
|
92
|
+
|
93
|
+
if s.respond_to? :specification_version then
|
94
|
+
s.specification_version = 3
|
95
|
+
|
96
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
97
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.1.0.rc4"])
|
98
|
+
s.add_runtime_dependency(%q<haml-rails>, ["~> 0.3.4"])
|
99
|
+
s.add_runtime_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
100
|
+
s.add_runtime_dependency(%q<sprockets>, ["~> 2.0.0.beta.10"])
|
101
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
102
|
+
else
|
103
|
+
s.add_dependency(%q<rails>, ["~> 3.1.0.rc4"])
|
104
|
+
s.add_dependency(%q<haml-rails>, ["~> 0.3.4"])
|
105
|
+
s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
106
|
+
s.add_dependency(%q<sprockets>, ["~> 2.0.0.beta.10"])
|
107
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
108
|
+
end
|
109
|
+
else
|
110
|
+
s.add_dependency(%q<rails>, ["~> 3.1.0.rc4"])
|
111
|
+
s.add_dependency(%q<haml-rails>, ["~> 0.3.4"])
|
112
|
+
s.add_dependency(%q<sass-rails>, ["~> 3.1.0.rc"])
|
113
|
+
s.add_dependency(%q<sprockets>, ["~> 2.0.0.beta.10"])
|
114
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module FrontendHelpers
|
2
|
+
module Html5Helper
|
3
|
+
|
4
|
+
def html_tag(attrs = {}, &block)
|
5
|
+
attrs.symbolize_keys!
|
6
|
+
haml_concat "<!--[if lt IE 7]><html class='ie6 no-js'><![endif]-->".html_safe
|
7
|
+
haml_concat "<!--[if IE 7]><html class='ie7 no-js'><![endif]-->".html_safe
|
8
|
+
haml_concat "<!--[if IE 8]><html class='ie8 no-js'><![endif]-->".html_safe
|
9
|
+
haml_concat "<!--[if gt IE 8]><!-->".html_safe
|
10
|
+
haml_tag :html, attrs do
|
11
|
+
haml_concat "<!--<![endif]-->".html_safe
|
12
|
+
block.call
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ActionView::Base.send :include, FrontendHelpers::Html5Helper
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module FrontendHelpers
|
2
|
+
module MetatagHelper
|
3
|
+
|
4
|
+
def meta_tags
|
5
|
+
options = opts
|
6
|
+
settings[:site].each do |s, k|
|
7
|
+
meta(s, options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
private ##########
|
12
|
+
|
13
|
+
def settings
|
14
|
+
YAML.load_file(File.join(Rails.root, 'config', 'settings.yml')) rescue {}
|
15
|
+
end
|
16
|
+
|
17
|
+
def setting(setting)
|
18
|
+
ENV["SITE_#{setting.to_s.upcase}"] || settings[:site][setting]
|
19
|
+
end
|
20
|
+
|
21
|
+
def meta(name, options)
|
22
|
+
if !name.blank? && !setting(name).blank? || options.include?(name) && options[name]
|
23
|
+
options[:title] = ( options[name].present? ) ? "#{options[name]} #{setting(:title)}" : ""
|
24
|
+
desc = (options.include?(name)) ? options[name] : setting(name)
|
25
|
+
haml_concat "<meta content='#{desc}' name='#{name.to_s}' />"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def opts
|
30
|
+
{
|
31
|
+
title: @meta_title,
|
32
|
+
keywords: @meta_keywords,
|
33
|
+
description: @meta_description,
|
34
|
+
author: @meta_author,
|
35
|
+
email: @meta_email,
|
36
|
+
copyright: @meta_copyright,
|
37
|
+
generator: @meta_generator,
|
38
|
+
rating: @meta_rating,
|
39
|
+
language: @meta_language,
|
40
|
+
distribution: @meta_distribution,
|
41
|
+
robots: @robots,
|
42
|
+
:"fb:app_id" => @meta_fb_app_id,
|
43
|
+
:"og:title" => @meta_og_title,
|
44
|
+
:"og:description" => @meta_og_description,
|
45
|
+
:"og:url" => request.url,
|
46
|
+
:"og:site_name" => @meta_og_site_name,
|
47
|
+
:"og:type" => @meta_og_type,
|
48
|
+
:"og:image" => @meta_og_image,
|
49
|
+
:"og:locality" => @meta_og_locality,
|
50
|
+
:"og:region" => @meta_og_region,
|
51
|
+
:"og:country_name" => @meta_og_country_name,
|
52
|
+
:"og:phone_number" => @meta_og_phone_number
|
53
|
+
}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
ActionView::Base.send :include, FrontendHelpers::MetatagHelper
|