comfortable_mexican_loveseat 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97771fb4fb8a050fe53a43bf55299c91778051cb
4
- data.tar.gz: 5a333d0f257fc6c19f3b7783ecfab97e2ba908c8
3
+ metadata.gz: 332bc3120460c5f93d0e97d867e3fcc6c87c3a15
4
+ data.tar.gz: 432d34365de812dc8e5b3cb3d0d70a9dc7c82a6d
5
5
  SHA512:
6
- metadata.gz: 88ab506863654118d8990d71ba831f67a6997b9c71e164c1793ef0f8a28eeaf54632ee084e82d3e9fe5ded195bdd6ea1278774398aeac3ba3cc8438bc54ae9ea
7
- data.tar.gz: 7e5159b924934d915c3e509bf1d2d6e8e4e57a5f6f4757908a5039cf2d59ceaa57d8b37e21ce246025a05f3ab185532f412251cf03cd82df00476d9ef08ee322
6
+ metadata.gz: cf7ec2cc026c81b0e0a16830e69d97749c30e6f85702b2701a669dd697fe564b08087c7223c648932ff8c255fd16f177d1baa8c363cbaf986126a1d5a2140fdb
7
+ data.tar.gz: e16edba7286c3a9cf6905570b0952dee933def012a2f8214fff7e64ff652028b0d8f7b179b6f400699d2859aed7363a15d2f23789105c73517f81a84638e0550
data/README.rdoc CHANGED
@@ -1,14 +1,26 @@
1
+ {HitFox Logo}[http://www.hitfoxgroup.com/downloads/hitfox_logo_with_tag_two_colors_WEB.png]
2
+
1
3
  = ComfortableMexicanLoveseat
2
4
 
3
5
  The Comfortable Mexican Loveseat is an expansion pack to the Comfortable Mexican Sofa. It currently contains minor modifications to the <tt>snippet.rb</tt> and <tt>base_controller.rb</tt> files, improved sitemap functionality, and SEO-enhancing modifications.
4
6
 
5
7
  The Loveseat references a fixed version of the CMS (currently 1.12.8) and latest releases are pulled in occasionally.
6
8
 
7
- == CMS Usage Notes
8
- ====== When you are adding new models and/or controllers and links are not showing up, do not forget to click the "Sync" button!
9
+ == Installation
10
+
11
+ The Loveseat is currently installed through the {foxinator-generator}[https://github.com/HitFox/foxinator-generator]
12
+
13
+ == Features
14
+ ====== NOTE: When you are adding new models and/or controllers and links are not showing up, do not forget to click the "Sync" button!
15
+
16
+ === Comment Mailer
9
17
 
18
+ To configure the comment mailer, add this line to <tt>config/initializers/comfortable_mexican_sofa.rb</tt>
10
19
 
11
- == Simplified Fixture Import/Export
20
+ config.from_email = an@example.com
21
+
22
+
23
+ === Simplified Fixture Import/Export
12
24
 
13
25
  When you want to import fixtures you can now use the following commands:
14
26
 
@@ -20,9 +32,9 @@ When you want to import fixtures you can now use the following commands:
20
32
  rake cms:export FROM=somewhere
21
33
  rake cms:export FROM=somewhere TO=something LOCALE=de
22
34
 
23
- == SEO Features
35
+ === SEO Features
24
36
 
25
- === Custom Sitemaps
37
+ ==== Custom Sitemaps
26
38
 
27
39
  Building on the Sofa's sitemap functionality, the Loveseat lets you add Rails model show pages and custom routes to the sitemap.
28
40
 
@@ -32,11 +44,11 @@ To use it, please copy and customize the demo initializer located in <tt>templat
32
44
 
33
45
  Then replace your <tt>robots.txt</tt> file with the one in the templates folder.
34
46
 
35
- === URL Redirection
47
+ ==== URL Redirection
36
48
 
37
49
  By default when using the Loveseat, all trailing slash URLs ('myapp.com/example/') are redirected to a non-trailing slash URL.
38
50
 
39
- === Page Meta Tags
51
+ ==== Page Meta Tags
40
52
 
41
53
  By default when you create an application, it comes with meta description; page title; index; canonical link; and Social Media (Google+, Facebook, and Twitter) fields that can be filled in on a per-page basis. To display these tags, add this to your <tt>application.html.erb</tt>:
42
54
 
@@ -56,3 +68,7 @@ The Loveseat provides some helpful hints to admins when they're uploading images
56
68
 
57
69
  There is a more styled version of the CMS login page in the templates/devise folder.
58
70
 
71
+ = Changelog
72
+
73
+ - 01/12/2016 - Updated cms_block_content() to be faster. You can still use the old code (which can have slightly different functionality) by passing in an overwrite flag. See the <tt>cms_helper.rb</tt> for source code. Improved the speed with which SEO tags get loaded in the header.
74
+
@@ -1,33 +1,34 @@
1
1
  module Comfy::CmsHelper
2
2
 
3
3
  def comfy_seo_tags
4
- meta_description = pluck_page_block_content('seo.meta_description')
5
- meta_index = pluck_page_block_content('seo.meta_index')
6
- page_title = pluck_page_block_content('seo.page_title')
4
+ page_block_contents = Comfy::Cms::Block.where(blockable_type: 'Comfy::Cms::Page', blockable_id: @cms_page.id).pluck(:identifier, :content)
5
+ meta_description = search_page_block_contents('seo.meta_description', page_block_contents)
6
+ meta_index = search_page_block_contents('seo.meta_index', page_block_contents)
7
+ page_title = search_page_block_contents('seo.page_title', page_block_contents)
7
8
  parent_page = @cms_page.parent_id.present? ? @cms_page.parent_id : false
8
9
  tags = []
9
10
  tags << tag('meta', name: 'description', content: meta_description) if meta_description.present?
10
11
  tags << tag('meta', name: 'robots', content: 'NOINDEX, FOLLOW') if meta_index.present? && meta_index
11
12
 
12
13
  # if no canonical is set, default to URL without any parameters
13
- href = pluck_page_block_content('seo.canonical_href')
14
+ href = search_page_block_contents('seo.canonical_href')
14
15
  href = href.present? ? href : request.url.split('?').first
15
16
  tags << tag('link', rel: 'canonical', href: href)
16
17
 
17
18
  ### Google plus: use meta_description and page title as defaults
18
- gplus_name = self_or_inherit_metadata('google_plus.name', page_title)
19
- gplus_description = self_or_inherit_metadata('google_plus.description', meta_description)
20
- gplus_image = self_or_parent_metafield('google_plus.image')
19
+ gplus_name = self_or_inherit_metadata('google_plus.name', page_title, page_block_contents)
20
+ gplus_description = self_or_inherit_metadata('google_plus.description', meta_description, page_block_contents)
21
+ gplus_image = self_or_parent_metafield('google_plus.image', @cms_page, page_block_contents)
21
22
  tags << tag('meta', itemprop: "name", content: gplus_name) if gplus_name.present?
22
23
  tags << tag('meta', itemprop: "description", content: gplus_description) if gplus_description.present?
23
24
  tags << tag('meta', itemprop: "image", content: gplus_image) if gplus_image.present?
24
25
 
25
26
  ### Twitter Card
26
- twitter_site = self_or_parent_metafield('twitter.site')
27
- twitter_creator = self_or_parent_metafield('twitter.creator')
28
- twitter_image_src = self_or_parent_metafield('twitter.image_src')
29
- twitter_title = self_or_inherit_metadata('twitter.title', page_title)
30
- twitter_description = self_or_inherit_metadata('twitter.description', meta_description)
27
+ twitter_site = self_or_parent_metafield('twitter.site', @cms_page, page_block_contents)
28
+ twitter_creator = self_or_parent_metafield('twitter.creator', @cms_page, page_block_contents)
29
+ twitter_image_src = self_or_parent_metafield('twitter.image_src', @cms_page, page_block_contents)
30
+ twitter_title = self_or_inherit_metadata('twitter.title', page_title, page_block_contents)
31
+ twitter_description = self_or_inherit_metadata('twitter.description', meta_description, page_block_contents)
31
32
  tags << tag('meta', name: 'twitter:card', content: 'summary_large_image')
32
33
  tags << tag('meta', name: 'twitter:site', content: twitter_site) if twitter_site.present?
33
34
  tags << tag('meta', name: 'twitter:creator', content: twitter_creator) if twitter_creator.present?
@@ -36,11 +37,11 @@ module Comfy::CmsHelper
36
37
  tags << tag('meta', name: 'twitter:description', content: twitter_description) if twitter_description.present?
37
38
 
38
39
  ### Facebook
39
- fb_description = self_or_inherit_metadata('facebook.description', meta_description)
40
- fb_title = self_or_inherit_metadata('facebook.title', page_title)
41
- fb_type = self_or_parent_metafield('facebook.type')
42
- fb_image = self_or_parent_metafield('facebook.image')
43
- fb_admins = self_or_parent_metafield('facebook.admins')
40
+ fb_description = self_or_inherit_metadata('facebook.description', meta_description, page_block_contents)
41
+ fb_title = self_or_inherit_metadata('facebook.title', page_title, page_block_contents)
42
+ fb_type = self_or_parent_metafield('facebook.type', @cms_page, page_block_contents)
43
+ fb_image = self_or_parent_metafield('facebook.image', @cms_page, page_block_contents)
44
+ fb_admins = self_or_parent_metafield('facebook.admins', @cms_page, page_block_contents)
44
45
  tags << tag('meta', property: 'og:description', content: fb_description) if fb_description.present?
45
46
  tags << tag('meta', property: 'og:title', content: fb_title) if fb_title.present?
46
47
  tags << tag('meta', property: 'og:type', content: fb_type) if fb_type.present?
@@ -58,8 +59,8 @@ module Comfy::CmsHelper
58
59
  pluck_page_block_content('seo.page_title')
59
60
  end
60
61
 
61
- def self_or_inherit_metadata(block_identifier, metadata)
62
- content = pluck_page_block_content(block_identifier)
62
+ def self_or_inherit_metadata(block_identifier, metadata, page_block_contents = [])
63
+ content = search_page_block_contents(block_identifier, page_block_contents)
63
64
  if content.present?
64
65
  return content
65
66
  else
@@ -67,8 +68,8 @@ module Comfy::CmsHelper
67
68
  end
68
69
  end
69
70
 
70
- def self_or_parent_metafield(block_identifier, page = @cms_page)
71
- content = pluck_page_block_content(block_identifier, page)
71
+ def self_or_parent_metafield(block_identifier, page = @cms_page, page_block_contents = [])
72
+ content = search_page_block_contents(block_identifier, page_block_contents)
72
73
  if content.present?
73
74
  return content
74
75
  else
@@ -78,6 +79,11 @@ module Comfy::CmsHelper
78
79
  end
79
80
  end
80
81
 
82
+ def search_page_block_contents(identifier, page_block_contents = [])
83
+ result = page_block_contents.select { |a| a.first == identifier }
84
+ result.empty? ? '' : result.first.last
85
+ end
86
+
81
87
  def pluck_page_block_content(tag, page = @cms_page)
82
88
  content = Comfy::Cms::Block.where(identifier: tag, blockable_type: 'Comfy::Cms::Page', blockable_id: page.id).pluck(:content).first
83
89
  return (content.present?) ? content : ''
@@ -140,10 +146,14 @@ module Comfy::CmsHelper
140
146
  # Example:
141
147
  # cms_block_content(:left_column, CmsPage.first)
142
148
  # cms_block_content(:left_column) # if @cms_page is present
143
- def cms_block_content(identifier, blockable = @cms_page)
144
- tag = blockable && (block = blockable.blocks.find_by_identifier(identifier)) && block.tag
145
- return '' unless tag
146
- tag.content
149
+ def cms_block_content(identifier, blockable = @cms_page, use_old_code = false)
150
+ if use_old_code
151
+ tag = blockable && (block = blockable.blocks.find_by_identifier(identifier)) && block.tag
152
+ return '' unless tag
153
+ tag.content
154
+ else
155
+ pluck_page_block_content(identifier, blockable)
156
+ end
147
157
  end
148
158
 
149
159
  # For those times when we need to render content that shouldn't be renderable
@@ -1,4 +1,5 @@
1
- class CommentMailer < ApplicationMailer
1
+ class CommentMailer < ActionMailer::Base
2
+ default from: ComfortableMexicanSofa.config.from_email
2
3
 
3
4
  def admin_mention(comment)
4
5
  @comment = comment
@@ -0,0 +1,3 @@
1
+ %pre= @comment.message.html_safe
2
+ %br
3
+ = link_to t('.comment_link'), admin_admin_url(@comment.commentable, locale: I18n.locale), target: :blank
@@ -1,4 +1,8 @@
1
1
  en:
2
+ comment_mailer:
3
+ admin_mention:
4
+ comment_link: Take me to the comment
5
+ subject: You were mentioned in a comment
2
6
  seo:
3
7
  old_page_url: URLs that redirect here (takes slugs in a comma-separated list)
4
8
  meta_description: Meta Description
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comfortable_mexican_loveseat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bahlke
@@ -9,104 +9,104 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-03 00:00:00.000000000 Z
12
+ date: 2016-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: comfortable_mexican_sofa
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: 1.12.8
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.12.8
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rack-rewrite
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 1.5.1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.5.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rubyzip
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.1'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.1'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: sqlite3
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: bundler
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: '1.9'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '1.9'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rake
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - ~>
102
+ - - "~>"
103
103
  - !ruby/object:Gem::Version
104
104
  version: '10.0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - ~>
109
+ - - "~>"
110
110
  - !ruby/object:Gem::Version
111
111
  version: '10.0'
112
112
  description: Comfortable Mexican Loveseat expands the Comfortable Mexican Sofa with
@@ -137,6 +137,7 @@ files:
137
137
  - app/views/comfy/admin/cms/files/index.html.haml
138
138
  - app/views/comfy/admin/cms/pages/_form_blocks.html.haml
139
139
  - app/views/comfy/cms/content/render_sitemap.xml.builder
140
+ - app/views/comment_mailer/admin_mention.html.haml
140
141
  - app/views/layouts/comfy/admin/cms/_flash.html.haml
141
142
  - app/views/layouts/devise.html.haml
142
143
  - config/locales/de.yml
@@ -971,17 +972,17 @@ require_paths:
971
972
  - lib
972
973
  required_ruby_version: !ruby/object:Gem::Requirement
973
974
  requirements:
974
- - - '>='
975
+ - - ">="
975
976
  - !ruby/object:Gem::Version
976
977
  version: '0'
977
978
  required_rubygems_version: !ruby/object:Gem::Requirement
978
979
  requirements:
979
- - - '>='
980
+ - - ">="
980
981
  - !ruby/object:Gem::Version
981
982
  version: '0'
982
983
  requirements: []
983
984
  rubyforge_project:
984
- rubygems_version: 2.4.5
985
+ rubygems_version: 2.4.5.1
985
986
  signing_key:
986
987
  specification_version: 4
987
988
  summary: An expansion of the Comfortable Mexican Sofa, to make your living room comfier.