seo_fuel 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/app/views/seo_tags/update.js.erb +1 -1
- data/config/seo_fuel_settings.yml +2 -1
- data/lib/seo_fuel/controller_helper.rb +10 -41
- data/lib/seo_fuel/version.rb +1 -1
- data/lib/seo_fuel/view_helper.rb +11 -6
- data/vendor/assets/stylesheets/seo_fuel.css +23 -6
- metadata +1 -1
data/README.md
CHANGED
@@ -59,7 +59,7 @@ or, if you wish to only let signed in users be able to see the form (using devse
|
|
59
59
|
<%= edit_seo_dialog if admin_signed_in? %>
|
60
60
|
|
61
61
|
### Setting default values
|
62
|
-
By default, all meta tags are blank. If a tag is blank, the one specified in `seo_fuel_settings.yml`
|
62
|
+
By default, all meta tags are blank. If a tag is blank, the one specified in `seo_fuel_settings.yml` will be used. Per template, you can specify a default value by adding a few lines of code to your view template. These values take precedence over the default values.
|
63
63
|
The 'in browser' added SEO settings take precedence over all default values.
|
64
64
|
|
65
65
|
<% default_title("Site Name | #{@article.title}") %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
hideSeoForm();
|
2
|
-
|
2
|
+
document.title = "<%= @tag.show_title %>";
|
@@ -1,48 +1,17 @@
|
|
1
1
|
module SeoFuel
|
2
2
|
# Contains methods to use in controllers.
|
3
|
-
#
|
4
|
-
# You can define several instance variables to set meta tags:
|
5
|
-
# @page_title = 'Member Login'
|
6
|
-
# @page_description = 'Member login page.'
|
7
|
-
# @page_keywords = 'Site, Login, Members'
|
8
|
-
#
|
9
|
-
# Also you can use {InstanceMethods#set_meta_tags} method, that have the same parameters
|
10
|
-
# as {ViewHelper#set_meta_tags}.
|
11
|
-
#
|
12
|
-
module ControllerHelper
|
13
|
-
def self.included(base)
|
14
|
-
base.send :include, InstanceMethods
|
15
|
-
base.alias_method_chain :render, :meta_tags
|
16
|
-
end
|
17
|
-
|
18
|
-
module InstanceMethods
|
19
|
-
# Processes the <tt>@page_title</tt>, <tt>@page_keywords</tt>, and
|
20
|
-
# <tt>@page_description</tt> instance variables and calls +render+.
|
21
|
-
def render_with_meta_tags(*args, &block)
|
22
|
-
meta_tags = {}
|
23
|
-
meta_tags[:title] = @page_title if @page_title
|
24
|
-
meta_tags[:keywords] = @page_keywords if @page_keywords
|
25
|
-
meta_tags[:description] = @page_description if @page_description
|
26
|
-
set_meta_tags(meta_tags)
|
27
3
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# Set meta tags for the page.
|
32
|
-
#
|
33
|
-
# See <tt>MetaTags.set_meta_tags</tt> for details.
|
34
|
-
def set_meta_tags(meta_tags)
|
35
|
-
meta_tags ||= {}
|
36
|
-
meta_tags[:open_graph] = meta_tags.delete(:og) if meta_tags.key?(:og)
|
37
|
-
self.meta_tags.deep_merge!(meta_tags || {})
|
38
|
-
end
|
39
|
-
protected :set_meta_tags
|
4
|
+
module ControllerHelper
|
5
|
+
extend ActiveSupport::Concern
|
40
6
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
7
|
+
included do
|
8
|
+
helper_method :testing
|
9
|
+
end
|
10
|
+
|
11
|
+
def testing
|
12
|
+
logger.info "TESTING: OK"
|
13
|
+
raise "ERROR!!!!!!!!!!!!!"
|
46
14
|
end
|
15
|
+
|
47
16
|
end
|
48
17
|
end
|
data/lib/seo_fuel/version.rb
CHANGED
data/lib/seo_fuel/view_helper.rb
CHANGED
@@ -3,6 +3,11 @@ module SeoFuel
|
|
3
3
|
|
4
4
|
module ViewHelper
|
5
5
|
|
6
|
+
# opens and reads the users options file
|
7
|
+
def default_settings_from_config_file
|
8
|
+
YAML::load(File.open("config/seo_fuel_settings.yml"))
|
9
|
+
end
|
10
|
+
|
6
11
|
# used in version < 0.0.4
|
7
12
|
def edit_seo_button(text=I18n.t('seo.button_text'), klass="")
|
8
13
|
link_to text, "#", class: "seo_fuel #{klass}", id: "edit_seo_btn"
|
@@ -32,8 +37,8 @@ module SeoFuel
|
|
32
37
|
current_page.description
|
33
38
|
elsif @default_description.present?
|
34
39
|
@default_description
|
35
|
-
|
36
|
-
|
40
|
+
elsif default_settings_from_config_file
|
41
|
+
default_settings_from_config_file['SEO_FUEL_SETTINGS']['default_description']
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
@@ -49,8 +54,8 @@ module SeoFuel
|
|
49
54
|
current_page.keywords
|
50
55
|
elsif @default_keywords.present?
|
51
56
|
@default_keywords
|
52
|
-
|
53
|
-
|
57
|
+
elsif default_settings_from_config_file
|
58
|
+
default_settings_from_config_file['SEO_FUEL_SETTINGS']['default_keywords']
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
@@ -60,8 +65,8 @@ module SeoFuel
|
|
60
65
|
current_page.title
|
61
66
|
elsif @default_title.present?
|
62
67
|
@default_title
|
63
|
-
|
64
|
-
|
68
|
+
elsif default_settings_from_config_file
|
69
|
+
default_settings_from_config_file['SEO_FUEL_SETTINGS']['default_title']
|
65
70
|
end
|
66
71
|
end
|
67
72
|
|
@@ -3,12 +3,13 @@
|
|
3
3
|
}
|
4
4
|
|
5
5
|
#edit_seo_btn {
|
6
|
+
font-size: 12px;
|
6
7
|
text-align: center;
|
7
8
|
position: fixed;
|
8
9
|
top: -5px;
|
9
10
|
left: 50%;
|
10
11
|
margin-left: -75px;
|
11
|
-
width: 150px;
|
12
|
+
min-width: 150px;
|
12
13
|
background: #fff;
|
13
14
|
border: 1px solid #dedede;
|
14
15
|
padding-bottom: 4px;
|
@@ -28,18 +29,18 @@
|
|
28
29
|
);
|
29
30
|
-webkit-border-radius: 3px;
|
30
31
|
-moz-border-radius: 3px;
|
31
|
-
border-radius: 3px;
|
32
|
+
/* border-radius: 3px;
|
32
33
|
-webkit-box-shadow: 0px 0px 2px 2px #dedede;
|
33
34
|
box-shadow: 0px 0px 2px 2px #dedede;
|
34
|
-
|
35
|
+
*/
|
35
36
|
border: 1px solid #aaa;
|
36
37
|
|
37
38
|
font-family: arial;
|
38
39
|
text-decoration: none;
|
39
|
-
color: #
|
40
|
+
color: #333;
|
40
41
|
|
41
|
-
text-shadow: 1px 1px 0px #
|
42
|
-
filter: dropshadow(color=#
|
42
|
+
text-shadow: 1px 1px 0px #dedede;
|
43
|
+
filter: dropshadow(color=#dedede, offx=1, offy=1);
|
43
44
|
}
|
44
45
|
|
45
46
|
#edit_seo_dialog {
|
@@ -85,7 +86,23 @@
|
|
85
86
|
.seo_form input[type=submit] {
|
86
87
|
float: right;
|
87
88
|
width: 150px;
|
89
|
+
margin-right: 20px;
|
90
|
+
background: #eee;
|
91
|
+
-webkit-border-radius: 3px;
|
92
|
+
-moz-border-radius: 3px;
|
93
|
+
border-radius: 3px;
|
94
|
+
text-shadow: 1px 1px 0px #dedede;
|
95
|
+
filter: dropshadow(color=#dedede, offx=1, offy=1);
|
96
|
+
}
|
97
|
+
|
98
|
+
.seo_form input[type=submit]:hover {
|
99
|
+
background: #ccc;
|
88
100
|
}
|
101
|
+
|
102
|
+
.seo_form input[type=submit]:active {
|
103
|
+
background: #bbb;
|
104
|
+
}
|
105
|
+
|
89
106
|
#cancel_seo_btn {
|
90
107
|
float: left;
|
91
108
|
text-decoration: none;
|