comfortable_mexican_loveseat 0.0.12 → 0.0.13

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: 15b3119762be0e76fcddd50c19d3f28b0eed88bb
4
- data.tar.gz: 9c519962fae4a23c4c14cb104ce0b61135b832cb
3
+ metadata.gz: ecc16467331f51889d0f6b7d64863f17b5f5b09e
4
+ data.tar.gz: 9c77cefafe59c0d1d5ea37d8152b3e520db07f4e
5
5
  SHA512:
6
- metadata.gz: ac08c834572f0c10708f227f911c296f3a394f594dc6b4df49878fb36f929db486ee5e8e359ec9cd2e1a2d026c7a1be2b82c8a0e4fbfb507c3e328dc93f1e331
7
- data.tar.gz: 4e4e7bf33c72a5b66c38702ac27d36076818eb59b0b8264d0cea863e79dbc914232e75daf4a31c0d442a8646fd2278f14c15e4afdead035531c0871c9f940212
6
+ metadata.gz: 5e5e71a3474bcb3bd081afe6de9295bef193c4bff4a293240790e761225f16c1c272f62d587a9635b2b491b0d755037daafa8b21e66a4add3de1b7b6b70c6ad1
7
+ data.tar.gz: c0fa3ccfb753a5ddd44cdcf6136e4697c332834a661342b3fb5d3c590aa27aeb8dc714618a5fe696e2927a9a042992794122ef9101a07f0702c6761fd60b6bb7
data/README.rdoc CHANGED
@@ -4,9 +4,7 @@ The Comfortable Mexican Loveseat is an expansion pack to the Comfortable Mexican
4
4
 
5
5
  The Loveseat references a fixed version of the CMS (currently 1.12.8) and latest releases are pulled in occasionally.
6
6
 
7
- == SEO Features
8
-
9
- === Simplified Fixture Import/Export
7
+ == Simplified Fixture Import/Export
10
8
 
11
9
  When you want to import fixtures you can now use the following commands:
12
10
 
@@ -18,6 +16,8 @@ When you want to import fixtures you can now use the following commands:
18
16
  rake cms:export FROM=somewhere
19
17
  rake cms:export FROM=somewhere TO=something LOCALE=de
20
18
 
19
+ == SEO Features
20
+
21
21
  === Custom Sitemaps
22
22
 
23
23
  Building on the Sofa's sitemap functionality, the Loveseat lets you add Rails model show pages and custom routes to the sitemap.
@@ -39,6 +39,8 @@ By default when you create an application, it comes with meta description; page
39
39
  <title><%= comfy_page_title %></title>
40
40
  <%= comfy_seo_tags %>
41
41
 
42
+ Tags are set on a per-page basis, except for canonical links, which default to the page URL if none has been entered manually.
43
+
42
44
  === File Upload helper text
43
45
 
44
46
  The Loveseat provides some helpful hints to admins when they're uploading images (choose an SEO-friendly name, add an alt-tag), which you can add to your locale files.
@@ -58,7 +58,8 @@ protected
58
58
  if page.present?
59
59
  @cms_page = page
60
60
  else
61
- old_page = Comfy::Cms::Block.where(identifier: "seo.old_page_url", content: params[:cms_path].to_s).pluck(:content, :blockable_id, :blockable_type).first
61
+
62
+ old_page = Comfy::Cms::Block.where(identifier: 'seo.old_page_url').where('content LIKE ?', "%#{params[:cms_path].to_s}%").pluck(:content, :blockable_id, :blockable_type).first
62
63
 
63
64
  if old_page.present?
64
65
  if old_page.last == "Comfy::Cms::Page"
@@ -3,8 +3,11 @@ module Comfy::CmsHelper
3
3
  def comfy_seo_tags
4
4
  tags = []
5
5
  tags << tag('meta', name: 'description', content: cms_block_content('seo.meta_description')) if cms_block_content('seo.meta_description').present?
6
- tags << tag('meta', name: 'robots', content: cms_block_content('seo.meta_index')) if cms_block_content('seo.meta_index').present?
7
- tags << tag('link', rel: 'canonical', href: cms_block_content('seo.canonical_href')) if cms_block_content('seo.canonical_href').present?
6
+ tags << tag('meta', name: 'robots', content: 'NOINDEX, FOLLOW') if cms_block_content('seo.meta_index').present? && cms_block_content('seo.meta_index')
7
+
8
+ # if no canonical is set, default to URL without any parameters
9
+ href = cms_block_content('seo.canonical_href').present? ? cms_block_content('seo.canonical_href') : request.url.split('?').first
10
+ tags << tag('link', rel: 'canonical', href: href)
8
11
  #Google plus
9
12
  tags << tag('meta', itemprop: "name", content: cms_block_content('google_plus.name')) if cms_block_content('google_plus.name').present?
10
13
  tags << tag('meta', itemprop: "description", content: cms_block_content('google_plus.description')) if cms_block_content('google_plus.description').present?
@@ -0,0 +1,32 @@
1
+ - namespace = { }
2
+ - cms_object = @page || cms_object
3
+ - tags = cms_object.tags(true).select{|t| t.is_cms_block?}.uniq{|t| t.identifier}
4
+ - tags.each do |tag|
5
+ - namespace[tag.namespace || 'default'] ||= []
6
+ - namespace[tag.namespace || 'default'] << tag
7
+
8
+ #form-blocks
9
+ - if tags.empty?
10
+ .no-tags
11
+ = link_to cms_object.layout.label, edit_comfy_admin_cms_site_layout_path(@site, cms_object.layout)
12
+ = t('.no_tags').html_safe
13
+
14
+ - else
15
+ = fields_for :blocks, nil, :builder => ComfortableMexicanLoveseat::FormBuilder, :layout => :horizontal do |cms_blocks|
16
+
17
+ .tabbable
18
+ - if namespace.size > 1
19
+ %ul.nav.nav-tabs
20
+ - namespace.each_with_index do |(name, tags), index|
21
+ %li{:class => index == 0 ? 'active' : nil}
22
+ = link_to name.humanize, "#ns-#{name}", :data => {:toggle => 'tab'}
23
+ .tab-content
24
+ - block_index = 0
25
+ - namespace.each_with_index do |(name, tags), index|
26
+ .tab-pane{:id => "ns-#{name}", :class => index == 0 ? 'active' : nil}
27
+ - tags.each do |tag|
28
+ - begin
29
+ = cms_blocks.send(tag.class.to_s.demodulize.underscore, tag, block_index)
30
+ - rescue
31
+ - Rails.env.production?? nil : raise
32
+ - block_index += 1
@@ -0,0 +1,29 @@
1
+ de:
2
+ seo:
3
+ old_page_url: URLs die auf dieser Seite gehen
4
+ meta_description: Meta Beschreibung
5
+ page_title: Seiten Titel
6
+ canonical_href: kanonischer Link
7
+ google_plus:
8
+ name: Name
9
+ description: Beschreibung
10
+ image: Bild
11
+ twitter:
12
+ card: Card
13
+ site: Seite
14
+ title: Titel
15
+ description: Beschreibung
16
+ creator: Autor
17
+ image_src: Bildquelle
18
+ facebook:
19
+ title: Titel
20
+ type: Art
21
+ url: URL
22
+ image: Bild
23
+ description: Beschreibung
24
+ site_name: Seiten Name
25
+ published_time: Veröffentlicht Zeit
26
+ modified_time: Änderungszeit
27
+ section: Abteilung
28
+ tag: Tag
29
+ admins: Admins
@@ -0,0 +1,6 @@
1
+ en:
2
+ seo:
3
+ old_page_url: URLs that redirect here (takes slugs in a comma-separated list)
4
+ meta_description: Meta Description
5
+ page_title: Page Title
6
+ canonical_href: Canonical link
@@ -0,0 +1,118 @@
1
+ # class ComfortableMexicanSofa::FormBuilder < BootstrapForm::FormBuilder
2
+ module ComfortableMexicanLoveseat
3
+ class FormBuilder < ComfortableMexicanSofa::FormBuilder
4
+
5
+ def field_name_for(tag)
6
+ tag.blockable.class.name.demodulize.underscore.gsub(/\//,'_')
7
+ end
8
+
9
+ # -- Tag Field Fields -----------------------------------------------------
10
+ def default_tag_field(tag, index, method = :text_field_tag, options = {})
11
+ label = I18n.t(tag.identifier.to_s).include?(tag.identifier.to_s) ? tag.blockable.class.human_attribute_name(tag.identifier.to_s) : I18n.t(tag.identifier.to_s)
12
+ css_class = tag.class.to_s.demodulize.underscore
13
+ content = ''
14
+ fieldname = field_name_for(tag)
15
+ case method
16
+ when :file_field_tag
17
+ input_params = {:id => nil}
18
+ name = "#{fieldname}[blocks_attributes][#{index}][content]"
19
+
20
+ if options.delete(:multiple)
21
+ input_params.merge!(:multiple => true)
22
+ name << '[]'
23
+ end
24
+
25
+ content << @template.send(method, name, input_params)
26
+ content << @template.render(:partial => 'comfy/admin/cms/files/page_form', :object => tag.block)
27
+ else
28
+ options[:class] = ' form-control'
29
+ content << @template.send(method, "#{fieldname}[blocks_attributes][#{index}][content]", tag.content, options)
30
+ end
31
+ content << @template.hidden_field_tag("#{fieldname}[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
32
+
33
+ form_group :label => {:text => label} do
34
+ content.html_safe
35
+ end
36
+ end
37
+
38
+ def field_date_time(tag, index)
39
+ default_tag_field(tag, index, :text_field_tag, :data => {'cms-datetime' => true})
40
+ end
41
+
42
+ def field_integer(tag, index)
43
+ default_tag_field(tag, index, :number_field_tag)
44
+ end
45
+
46
+ def field_string(tag, index)
47
+ default_tag_field(tag, index)
48
+ end
49
+
50
+ def field_text(tag, index)
51
+ default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/html'})
52
+ end
53
+
54
+ def field_rich_text(tag, index)
55
+ default_tag_field(tag, index, :text_area_tag, :data => {'cms-rich-text' => true})
56
+ end
57
+
58
+ def field_boolean(tag, index)
59
+ fieldname = field_name_for(tag)
60
+ content = @template.hidden_field_tag("#{fieldname}[blocks_attributes][#{index}][content]", '', :id => nil)
61
+ content << @template.check_box_tag("#{fieldname}[blocks_attributes][#{index}][content]", '1', tag.content.present?, :id => nil)
62
+ content << @template.hidden_field_tag("#{fieldname}[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
63
+ form_group :label => {:text => (tag.blockable.class.human_attribute_name(tag.identifier.to_s) || tag.identifier.titleize + "?")} do
64
+ content
65
+ end
66
+ end
67
+
68
+ def page_date_time(tag, index)
69
+ default_tag_field(tag, index, :text_field_tag, :data => {'cms-datetime' => true})
70
+ end
71
+
72
+ def page_integer(tag, index)
73
+ default_tag_field(tag, index, :number_field_tag)
74
+ end
75
+
76
+ def page_string(tag, index)
77
+ default_tag_field(tag, index)
78
+ end
79
+
80
+ def page_text(tag, index)
81
+ default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/html'})
82
+ end
83
+
84
+ def page_rich_text(tag, index)
85
+ default_tag_field(tag, index, :text_area_tag, :data => {'cms-rich-text' => true})
86
+ end
87
+
88
+ def page_file(tag, index)
89
+ default_tag_field(tag, index, :file_field_tag)
90
+ end
91
+
92
+ def page_files(tag, index)
93
+ default_tag_field(tag, index, :file_field_tag, :multiple => true)
94
+ end
95
+
96
+ def page_markdown(tag, index)
97
+ default_tag_field(tag, index, :text_area_tag, :data => {'cms-cm-mode' => 'text/x-markdown'})
98
+ end
99
+
100
+ def collection(tag, index)
101
+ options = [["---- Select #{tag.collection_class.titleize} ----", nil]] +
102
+ tag.collection_objects.collect do |m|
103
+ [m.send(tag.collection_title), m.send(tag.collection_identifier)]
104
+ end
105
+
106
+ fieldname = field_name_for(tag)
107
+ content = @template.select_tag(
108
+ "#{fieldname}[blocks_attributes][#{index}][content]",
109
+ @template.options_for_select(options, :selected => tag.content),
110
+ :id => nil
111
+ )
112
+ content << @template.hidden_field_tag("#{fieldname}[blocks_attributes][#{index}][identifier]", tag.identifier, :id => nil)
113
+ form_group :label => {:text => tag.identifier.titleize}, :class => tag.class.to_s.demodulize.underscore do
114
+ content
115
+ end
116
+ end
117
+ end
118
+ end
@@ -2,6 +2,7 @@ require 'comfortable_mexican_sofa'
2
2
  require 'rack-rewrite'
3
3
  require 'comfortable_mexican_loveseat/engine'
4
4
  require 'comfortable_mexican_loveseat/fixture'
5
+ require 'comfortable_mexican_loveseat/form_builder'
5
6
 
6
7
  module ComfortableMexicanLoveseat
7
8
  mattr_accessor :seo_custom_paths
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.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bahlke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-18 00:00:00.000000000 Z
12
+ date: 2015-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -119,11 +119,15 @@ files:
119
119
  - app/models/comfy/cms/snippet.rb
120
120
  - app/views/comfy/admin/cms/files/_form.html.haml
121
121
  - app/views/comfy/admin/cms/files/index.html.haml
122
+ - app/views/comfy/admin/cms/pages/_form_blocks.html.haml
122
123
  - app/views/comfy/cms/content/render_sitemap.xml.builder
123
124
  - app/views/layouts/comfy/admin/cms/_flash.html.haml
125
+ - config/locales/de.yml
126
+ - config/locales/en.yml
124
127
  - lib/comfortable_mexican_loveseat.rb
125
128
  - lib/comfortable_mexican_loveseat/engine.rb
126
129
  - lib/comfortable_mexican_loveseat/fixture.rb
130
+ - lib/comfortable_mexican_loveseat/form_builder.rb
127
131
  - lib/tasks/comfortable_mexican_loveseat.rake
128
132
  - test/comfortable_mexican_loveseat_test.rb
129
133
  - test/dummy/README.rdoc