para-seo_tools 0.5.0 → 0.5.1

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: 7897b0a3299f5d4e457e8eba6b499c24e7a0b2c0
4
- data.tar.gz: d5356532cdaeb00740c523d945665a5f945fcf56
3
+ metadata.gz: 643b353c0fa9c0e3131ddba099cd9a504c8c9ef0
4
+ data.tar.gz: f093c06c3e3d67ce755a466e6b1315c72e5bac84
5
5
  SHA512:
6
- metadata.gz: 2f21f538ce3f45348d99cbc0936bda4f9699f8bf8bf137cffb368ccfb8b18aaedb3484e565a194ad03f09a2bfb0de4ea37dfce2b7527f8cf24cfe885006c2480
7
- data.tar.gz: a79fb1e83edf1f3c587d109910ec1af1ffc8beabeb683ae3637139eb34da1c7c47f6133bc75d13668906e27f383b8b1375a22c41d04c1b20bc93e5cefc696f30
6
+ metadata.gz: fb81cfeecc187846a350ed8e969502b4acbd66e9d407c241343f19175f3e21ff45e655c442063ca7e9eea0288cf9a5e3f02a83b9b3c15de642da1b4c03abd666
7
+ data.tar.gz: 92d4e04d035aa5dabdf30f5481eab43e9668c59c46277c1e043e1fbd0383c0059e409338e6834324e13fb588ead3370185c95e8be4c41ed4dbce46d85504982f
@@ -1,10 +1,10 @@
1
- %ul.actions-control
1
+ %ul.panel-controls
2
2
  %li
3
- = link_to run_admin_skeleton_refresh_path, class: 'btn btn-default btn-shadow', remote: true, data: { :'job-tracker-button' => true } do
3
+ = link_to run_admin_skeleton_refresh_path, class: 'btn btn-default', remote: true, data: { :'job-tracker-button' => true } do
4
4
  = fa_icon 'refresh'
5
5
  = t('para.seo_tools.pages.refresh_skeleton')
6
6
 
7
7
  %li
8
- = link_to ping_admin_skeleton_refresh_path, class: 'btn btn-default btn-shadow', remote: true, data: { :'job-tracker-button' => true } do
8
+ = link_to ping_admin_skeleton_refresh_path, class: 'btn btn-default', remote: true, data: { :'job-tracker-button' => true } do
9
9
  = fa_icon 'cloud-upload'
10
10
  = t('para.seo_tools.pages.ping_search_engines')
@@ -1,16 +1,18 @@
1
1
  = search_form_for @q, builder: SimpleForm::FormBuilder, url: @component.path, html: { data: { :'filters-form' => true } } do |form|
2
-
3
- - if Para::SeoTools.handle_subdomain
4
- .flextable-item
5
- = form.input_field :subdomain_eq, as: :selectize, collection: Para::SeoTools::Page.available_subdomains, class: 'form-control', placeholder: t('para.seo_tools.pages.subdomain')
6
-
7
- - if @available_locales.length > 1
8
- .flextable-item
9
- = form.input_field :locale_eq, as: :selectize, collection: @available_locales, class: 'form-control', placeholder: t('para.seo_tools.pages.choose_locale')
10
-
11
- .flextable-item.flextable-primary
12
- .input-group.filter-form
13
- = form.input_field :identifier_or_path_or_title_or_description_or_keywords_or_canonical_cont, as: :string, placeholder: t('para.shared.search'), class: 'form-control'
14
- .input-group-btn
15
- %button.btn{ type: 'submit' }
16
- = fa_icon 'search'
2
+ %table
3
+ %tbody
4
+ %tr
5
+ - if Para::SeoTools.handle_subdomain
6
+ %td{ width: '15%', style: 'padding-right: 10px;' }
7
+ = form.input_field :subdomain_eq, as: :selectize, collection: Para::SeoTools::Page.available_subdomains, class: 'form-control', placeholder: t('para.seo_tools.pages.subdomain')
8
+ - if @available_locales.length > 1
9
+ %td{ width: '15%', style: 'padding-right: 10px;' }
10
+ = form.input_field :locale_eq, as: :selectize, collection: @available_locales, class: 'form-control', placeholder: t('para.seo_tools.pages.choose_locale')
11
+ %td{ width: '80%' }
12
+ .col-sm-12
13
+ .input-group
14
+ %span.input-group-addon
15
+ %i.fa.fa-search
16
+ = form.input_field :identifier_or_path_or_title_or_description_or_keywords_or_canonical_cont, as: :string, placeholder: t('para.shared.search'), class: 'form-control'
17
+ %td{ width: '20%' }
18
+ = form.submit t('para.shared.search'), class: 'btn btn-default btn-block'
@@ -1,14 +1,13 @@
1
1
  = para_form_for(resource) do |form|
2
- = form.tabs do |tabs|
3
- = tabs.tab :informations, icon: 'info-circle' do
4
- = form.input :path, disabled: true
2
+ = form.fieldset do
3
+ = form.input :path, disabled: true
5
4
 
6
- = meta_tag_input form, :title
7
- = meta_tag_input form, :description
8
- = meta_tag_input form, :keywords
5
+ = meta_tag_input form, :title
6
+ = meta_tag_input form, :description
7
+ = meta_tag_input form, :keywords
9
8
 
10
- = tabs.tab :additional_meta_tags, icon: 'cog' do
11
- = meta_tag_input form, :image, as: :image, hint: t('para.seo_tools.pages.image_hint')
12
- = meta_tag_input form, :canonical, hint: t('para.seo_tools.pages.canonical_hint')
9
+ = form.fieldset title: t('para.seo_tools.pages.additional_meta_tags') do
10
+ = meta_tag_input form, :image, as: :image
11
+ = meta_tag_input form, :canonical
13
12
 
14
13
  = form.actions
@@ -5,7 +5,7 @@
5
5
  = table.header_for(:title)
6
6
  = table.header_for(:description)
7
7
  = table.header_for(:locale) if @available_locales.length > 1
8
- %th.table-row-actions
8
+ %th
9
9
 
10
10
  = table.rows(resources) do |resource|
11
11
  = table.data_for(resource.subdomain) if Para::SeoTools.handle_subdomain
@@ -14,8 +14,9 @@
14
14
  = table.data_for(resource.meta_tag(:description))
15
15
  = table.data_for(resource, :locale) if @available_locales.length > 1
16
16
 
17
- %td.table-row-actions
18
- = table.edit_button(resource)
17
+ %td
18
+ .pull-right.btn-group
19
+ = table.edit_button(resource)
19
20
 
20
- = link_to resource.path, target: '_blank', class: 'btn btn-sm btn-icon-default btn-shadow hint--left', aria: { label: t('para.seo_tools.pages.see_in_app') } do
21
- = fa_icon 'eye'
21
+ = link_to resource.path, target: '_blank', class: 'btn btn-default hint--left', data: { hint: t('para.seo_tools.pages.see_in_app') } do
22
+ = fa_icon 'eye'
@@ -4,16 +4,11 @@ fr:
4
4
  pages:
5
5
  see_in_app: "Voir la page"
6
6
  default_meta_tag_value: "Valeur par défaut : <b>%{value}</b>"
7
+ additional_meta_tags: "Meta-données avancées"
7
8
  refresh_skeleton: "Mettre à jour"
8
9
  ping_search_engines: "Envoyer le sitemap aux moteurs de recherche"
9
10
  choose_locale: "Choisissez une langue"
10
11
  subdomain: Sous-domaine
11
- image_hint: |
12
- Cette image sera utilisée par défaut comme prévisualisation de la page
13
- lors de son partage sur les réseaux sociaux.
14
- canonical_hint: |
15
- Si la page ne doit pas être référencée au profit d'une autre page,
16
- collez ici l'adresse de la page à référencer à la place.
17
12
 
18
13
  jobs:
19
14
  para/seo_tools/skeleton/job:
@@ -23,16 +18,6 @@ fr:
23
18
  progressing: "Le plan du site est actuellement envoyé aux différents moteurs de recherche ..."
24
19
  success: "Le plan du site a bien été transmis aux moteurs de recherche !"
25
20
 
26
- components:
27
- component:
28
- sitemap: "Gestion SEO / Plan du site"
29
-
30
- forms:
31
- tabs:
32
- para/seo_tools/page:
33
- informations: "Informations"
34
- additional_meta_tags: "Meta-données avancées"
35
-
36
21
  activemodel:
37
22
  models:
38
23
  para/seo_tools/skeleton/job: "Mise à jour du plan du site"
@@ -46,8 +31,8 @@ fr:
46
31
  title: "Titre"
47
32
  description: "Description"
48
33
  keywords: "Mots-clés de la page"
49
- image: "Image pour le partage"
50
- canonical: "URL canonique (Canonical)"
34
+ image: "Image pour le partage sur les réseaux sociaux"
35
+ canonical: "URL canonique"
51
36
  locale: "Langue"
52
37
  subdomain: "Sous-domaine"
53
38
 
@@ -1,11 +1,11 @@
1
1
  # Use `lazy: true` to avoid generating the pages skeleton on server run
2
2
  #
3
- # You'll then have to run `rake para:seo_tools:skeleton:build` to refresh it or
4
- # use the `Para::SeoTools::Skeleton::Job.perform` method in some worker to
3
+ # You'll then have to run `rake seo_tools:skeleton:build` to refresh it or use
4
+ # the `Para::SeoTools::Skeleton::Job.perform` method in some worker to
5
5
  # refresh it periodically
6
6
  #
7
7
  # Note that you also have to always refresh the sitemap manually with the
8
- # following task : `rake para:seo_tools:sitemap:generate`
8
+ # following task : `rake seo_tools:sitemap:generate`
9
9
  #
10
10
  Para::SeoTools::Skeleton.draw(lazy: false) do
11
11
  # Define your website SEO targetted structure here.
@@ -16,13 +16,11 @@ Para::SeoTools::Skeleton.draw(lazy: false) do
16
16
  #
17
17
  # page :posts
18
18
  #
19
- #
20
19
  # If you want to define the page path yourself, just add the `:path` option
21
20
  # to the `page` call
22
21
  #
23
22
  # page :home, path: root_path
24
23
  #
25
- #
26
24
  # When the page is linked to a resource : often, a #show page, you'll need to
27
25
  # pass the `:resource` option
28
26
  #
@@ -30,36 +28,10 @@ Para::SeoTools::Skeleton.draw(lazy: false) do
30
28
  # page :post, resource: post
31
29
  # end
32
30
  #
33
- #
34
31
  # Also, you can pass options for the sitemap generation tool.
35
32
  # The options are `:priority`, `:change_frequency` which are left blank
36
33
  # by default.
37
34
  #
38
35
  # page :posts, priority: 1, change_frequency: 'weekly'
39
36
  #
40
- #
41
- # By default, when you pass a resource to a route, it will try to find
42
- # default a title and description from your resource, using the method
43
- # configured in the seo_tools.rb initializer at `config.title_methods` and
44
- # `config.description_methods`.
45
- #
46
- # For non-resource pages or if you need to add your own defaults, you can
47
- # pass them to the `#page` method the following way :
48
- #
49
- # page :posts, defaults: { title: 'Blog index', description: 'Read our blog ...' }
50
- # page :post, resource: post, defaults: { description: post.excerpt }
51
- #
52
- #
53
- # By default, every page that is not referenced in the skeleton will not be
54
- # indexed by search engines.
55
- #
56
- # But if some of your skeleton pages shouldn't be
57
- # indexed or links shouldn't be followed on that page, you can explicitly pass
58
- # the `:noindex` and `:nofollow` options to the `#page` method.
59
- #
60
- # It allows to let the admins edit the page title but avoids it to be indexed.
61
- #
62
- # page :posts, noindex: true
63
- # page :report_abuse, noindex: true, nofollow: true
64
- #
65
37
  end
@@ -16,7 +16,7 @@ module Para
16
16
  protected
17
17
 
18
18
  def meta_tags_from(resource)
19
- @resource = resource
19
+ @instance = resource
20
20
  end
21
21
 
22
22
  def set_meta_tags_from_page(page)
@@ -5,7 +5,6 @@ module Para
5
5
 
6
6
  autoload :PageHelper
7
7
  autoload :ViewHelper
8
- autoload :DefaultDataMethodsHelper
9
8
  end
10
9
  end
11
10
  end
@@ -34,9 +34,9 @@ module Para
34
34
  key.join(".")
35
35
  end
36
36
 
37
- # TODO : Define if we'll still support resource meta tags and refactor
37
+ # TODO : Define if we'll still support instance meta tags and refactor
38
38
  # accordingly
39
- def resource
39
+ def instance
40
40
  end
41
41
 
42
42
  def model_name
@@ -3,11 +3,9 @@ module Para
3
3
  module MetaTags
4
4
  module Tags
5
5
  class Description < Base
6
- include Para::SeoTools::Helpers::DefaultDataMethodsHelper
7
-
8
6
  def value
9
7
  self.class.process(
10
- meta_taggable_description || resource_description || action_name
8
+ meta_taggable_description || instance_description || action_name
11
9
  )
12
10
  end
13
11
 
@@ -18,12 +16,22 @@ module Para
18
16
  private
19
17
 
20
18
  def meta_taggable_description
21
- resource && resource.meta_tagged? &&
22
- resource.meta_tags_list.meta_description.presence
19
+ instance && instance.meta_tagged? &&
20
+ instance.meta_tags_list.meta_description.presence
23
21
  end
24
22
 
25
- def resource_description
26
- default_description_for(resource)
23
+ def instance_description
24
+ if instance
25
+ Para::SeoTools.description_methods.each do |method|
26
+ if instance.respond_to?(method)
27
+ if (description = instance.send(method).presence)
28
+ return description
29
+ end
30
+ end
31
+ end
32
+
33
+ return nil
34
+ end
27
35
  end
28
36
 
29
37
  def action_name
@@ -4,7 +4,7 @@ module Para
4
4
  module Tags
5
5
  class Image < Base
6
6
  def value
7
- self.class.process(resource_image)
7
+ self.class.process(instance_image)
8
8
  end
9
9
 
10
10
  def self.process(value)
@@ -23,8 +23,16 @@ module Para
23
23
 
24
24
  private
25
25
 
26
- def resource_image
27
- default_image_for(resource).try(:url)
26
+ def instance_image
27
+ if member_action?
28
+ Para::SeoTools.image_methods.each do |method|
29
+ if instance.respond_to?(method) && instance.send(method)
30
+ return instance.send(method).url
31
+ end
32
+ end
33
+
34
+ nil
35
+ end
28
36
  end
29
37
 
30
38
  def self.url_from(value)
@@ -10,8 +10,8 @@ module Para
10
10
  private
11
11
 
12
12
  def meta_taggable_keywords
13
- resource && resource.meta_tagged? &&
14
- resource.meta_tags_list.meta_keywords.presence
13
+ instance && instance.meta_tagged? &&
14
+ instance.meta_tags_list.meta_keywords.presence
15
15
  end
16
16
  end
17
17
  end
@@ -3,21 +3,26 @@ module Para
3
3
  module MetaTags
4
4
  module Tags
5
5
  class Title < Base
6
- include Para::SeoTools::Helpers::DefaultDataMethodsHelper
7
-
8
6
  def value
9
- meta_taggable_title || resource_title || action_name || model_name_translation
7
+ meta_taggable_title || instance_title || action_name || model_name_translation
10
8
  end
11
9
 
12
10
  private
13
11
 
14
12
  def meta_taggable_title
15
- resource && resource.meta_tagged? &&
16
- resource.meta_tags_list.meta_title.presence
13
+ instance && instance.meta_tagged? &&
14
+ instance.meta_tags_list.meta_title.presence
17
15
  end
18
16
 
19
- def resource_title
20
- default_title_for(resource)
17
+ def instance_title
18
+ if instance
19
+ Para::SeoTools.title_methods.each do |method|
20
+ if instance.respond_to?(method) && (title = instance.send(method)).presence
21
+ return title
22
+ end
23
+ end
24
+ return nil
25
+ end
21
26
  end
22
27
 
23
28
  def action_name
@@ -54,8 +54,13 @@ module Para
54
54
  end
55
55
  end
56
56
 
57
+ # Handle Rails 4 and 5
57
58
  def self.migrating?
58
- ActiveRecord::Migrator.needs_migration?
59
+ if ActiveRecord::Migrator.respond_to?(:needs_migration?)
60
+ ActiveRecord::Migrator.needs_migration?
61
+ else
62
+ ActiveRecord::Base.connection.migration_context.needs_migration?
63
+ end
59
64
  end
60
65
 
61
66
  def self.destroy_deleted_pages!
@@ -5,7 +5,6 @@ module Para
5
5
 
6
6
  class PageBuilder
7
7
  include Rails.application.routes.url_helpers
8
- include Para::SeoTools::Helpers::DefaultDataMethodsHelper
9
8
 
10
9
  attr_reader :name, :resource, :locale, :defaults, :config
11
10
 
@@ -61,7 +60,7 @@ module Para
61
60
  page.locale = locale
62
61
 
63
62
  # Do not override meta tags if already present
64
- page.defaults = process_defaults
63
+ page.defaults = defaults
65
64
  page.config = config
66
65
  end
67
66
  end
@@ -76,15 +75,6 @@ module Para
76
75
  end
77
76
  end
78
77
 
79
- def process_defaults
80
- return {} if defaults == false
81
-
82
- defaults[:title] ||= default_title_for(resource)
83
- defaults[:description] ||= default_description_for(resource)
84
-
85
- defaults
86
- end
87
-
88
78
  def self.model_for(page)
89
79
  models[unique_identifier_for(page)] ||= ::Para::SeoTools::Page.new(
90
80
  identifier: page.identifier
@@ -1,5 +1,5 @@
1
1
  module Para
2
2
  module SeoTools
3
- VERSION = "0.5.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
@@ -3,7 +3,6 @@ namespace :para do
3
3
  namespace :skeleton do
4
4
  desc "Builds or refreshes the app skeleton."
5
5
  task build: :environment do
6
- puts " * Build app skeleton ..."
7
6
  Para::SeoTools::Skeleton.build(load_skeleton: true)
8
7
  end
9
8
  end
@@ -11,9 +10,6 @@ namespace :para do
11
10
  namespace :sitemap do
12
11
  desc "Generates a new sitemap."
13
12
  task generate: :environment do
14
- Rake.application.invoke_task('para:seo_tools:skeleton:build')
15
-
16
- puts " * Generate sitemap ..."
17
13
  Para::SeoTools::Sitemap.generate!
18
14
  end
19
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para-seo_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2018-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -125,7 +125,6 @@ files:
125
125
  - lib/para/seo_tools/controller.rb
126
126
  - lib/para/seo_tools/engine.rb
127
127
  - lib/para/seo_tools/helpers.rb
128
- - lib/para/seo_tools/helpers/default_data_methods_helper.rb
129
128
  - lib/para/seo_tools/helpers/page_helper.rb
130
129
  - lib/para/seo_tools/helpers/view_helper.rb
131
130
  - lib/para/seo_tools/meta_tags.rb
@@ -176,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
175
  version: '0'
177
176
  requirements: []
178
177
  rubyforge_project:
179
- rubygems_version: 2.6.8
178
+ rubygems_version: 2.6.11
180
179
  signing_key:
181
180
  specification_version: 4
182
181
  summary: SEO tools for the Para CMS
@@ -1,31 +0,0 @@
1
- module Para
2
- module SeoTools
3
- module Helpers
4
- module DefaultDataMethodsHelper
5
- def default_title_for(resource)
6
- default_data_from_method_for(:title, resource)
7
- end
8
-
9
- def default_description_for(resource)
10
- default_data_from_method_for(:description, resource)
11
- end
12
-
13
- def default_image_for(resource)
14
- default_data_from_method_for(:image, resource)
15
- end
16
-
17
- # Try all default methods on resource
18
- def default_data_from_method_for(method, resource)
19
- return unless resource
20
-
21
- Para::SeoTools.send(:"#{ method }_methods").each do |method|
22
- data = resource.try(method)
23
- return data if data.present?
24
- end
25
- # Avoid returning the methods enumerable returned by the #each call
26
- nil
27
- end
28
- end
29
- end
30
- end
31
- end