cmor_seo_frontend 0.0.40.pre → 0.0.41.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +11 -9
- data/app/view_helpers/cmor/seo/frontend/application_view_helper.rb +29 -24
- data/lib/cmor/seo/frontend/configuration.rb +3 -1
- data/lib/cmor/seo/frontend/engine.rb +2 -0
- data/lib/cmor/seo/frontend/version.rb +3 -1
- data/lib/cmor_seo_frontend.rb +2 -0
- data/lib/generators/cmor/seo/frontend/install/install_generator.rb +8 -7
- data/lib/tasks/cmor/seo/frontend_tasks.rake +2 -0
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e440987702b42b302f8a9c9e17076579e276c47197b502962b5913f30ebb08
|
4
|
+
data.tar.gz: 96d993eb32e49abf58493de6fa27c079a67f4c16bda3982b97e793e11e761bf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7299eaebf921c172fb743893c4cb4ea7c0ee02751a929a6dbcae52786df9cc541ce190daf93eca4023758b0935ad7d3f48254c8b688a23d6d11f29ab20d6a7e
|
7
|
+
data.tar.gz: a6c576d11c64e2f943b1a8173ef680583c9a11b739c48253fab6a0202ac7f5d31b4cc6bc215acab4456658609c696f9018a8069402b59d2f5066e1c2511ec1e6
|
data/Rakefile
CHANGED
@@ -1,19 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
begin
|
2
|
-
require
|
4
|
+
require "bundler/setup"
|
3
5
|
rescue LoadError
|
4
|
-
puts
|
6
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
5
7
|
end
|
6
8
|
|
7
|
-
require
|
9
|
+
require "rdoc/task"
|
8
10
|
|
9
11
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir =
|
11
|
-
rdoc.title =
|
12
|
-
rdoc.options <<
|
13
|
-
rdoc.rdoc_files.include(
|
14
|
-
rdoc.rdoc_files.include(
|
12
|
+
rdoc.rdoc_dir = "rdoc"
|
13
|
+
rdoc.title = "Cmor::Seo::Frontend"
|
14
|
+
rdoc.options << "--line-numbers"
|
15
|
+
rdoc.rdoc_files.include("README.md")
|
16
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
17
|
end
|
16
18
|
|
17
19
|
Bundler::GemHelper.install_tasks
|
18
20
|
|
19
|
-
require
|
21
|
+
require "rails/dummy/tasks"
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cmor::Seo
|
2
4
|
module Frontend
|
3
5
|
# Example:
|
@@ -18,35 +20,38 @@ module Cmor::Seo
|
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def find_item
|
24
|
+
if item = find_item_by_path(c.request.path)
|
25
|
+
return item
|
26
|
+
end
|
27
|
+
|
28
|
+
if c.respond_to?(:resource_class) && c.instance_variable_get(:@resource).nil?
|
29
|
+
raise "not implemented"
|
30
|
+
return
|
31
|
+
end
|
32
|
+
|
33
|
+
if c.respond_to?(:resource_class) && c.instance_variable_get(:@resource).present?
|
34
|
+
resource = c.instance_variable_get(:@resource)
|
35
|
+
return Cmor::Seo::Item.where(resource_type: resource.class.name, resource_id: resource.id).published.first
|
36
|
+
end
|
37
|
+
|
38
|
+
if c.controller.class.name == "Cmor::Cms::PageController" && c.params.has_key?(:page)
|
39
|
+
return find_item_by_page(c.params[:page])
|
40
|
+
end
|
25
41
|
end
|
26
42
|
|
27
|
-
|
28
|
-
|
29
|
-
|
43
|
+
def find_item_by_page(page_name)
|
44
|
+
page = Cmor::Cms::Page.where(pathname: "/#{page_name.split('/')[0..-2].join('/')}", basename: page_name.split("/").last, locale: I18n.locale, format: :html).first
|
45
|
+
if page.present?
|
46
|
+
Cmor::Seo::Item.where(resource_type: page.class.name, resource_id: page.id).published.first
|
47
|
+
else
|
48
|
+
nil
|
49
|
+
end
|
30
50
|
end
|
31
51
|
|
32
|
-
|
33
|
-
|
34
|
-
return Cmor::Seo::Item.where(resource_type: resource.class.name, resource_id: resource.id).published.first
|
52
|
+
def find_item_by_path(path)
|
53
|
+
Cmor::Seo::Item.where(path: path).published.first
|
35
54
|
end
|
36
|
-
|
37
|
-
if c.controller.class.name == "Cmor::Cms::PageController" && c.params[:page]
|
38
|
-
return find_item_by_page(c.params[:page])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def find_item_by_page(page)
|
43
|
-
page = Cmor::Cms::Page.where(pathname: "/#{page.split('/')[0..-2].join('/')}", basename: page.split('/').last, locale: I18n.locale, format: :html).first
|
44
|
-
Cmor::Seo::Item.where(resource_type: page.class.name, resource_id: page.id).published.first
|
45
|
-
end
|
46
|
-
|
47
|
-
def find_item_by_path(path)
|
48
|
-
Cmor::Seo::Item.where(path: path).published.first
|
49
|
-
end
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cmor::Seo::Frontend
|
2
4
|
module Configuration
|
3
5
|
def configure
|
4
6
|
yield self
|
5
7
|
end
|
6
8
|
|
7
|
-
mattr_accessor(:base_controller) {
|
9
|
+
mattr_accessor(:base_controller) { "::FrontendController" }
|
8
10
|
end
|
9
11
|
end
|
data/lib/cmor_seo_frontend.rb
CHANGED
@@ -1,31 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Cmor::Seo::Frontend
|
2
4
|
module Generators
|
3
5
|
class InstallGenerator < Rails::Generators::Base
|
4
|
-
desc
|
6
|
+
desc "Generates the initializer"
|
5
7
|
|
6
|
-
source_root File.expand_path(
|
8
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
9
|
|
8
10
|
attr_reader :base_controller_class_name
|
9
11
|
|
10
12
|
def initialize(*args)
|
11
13
|
super
|
12
|
-
@base_controller_class_name = ENV.fetch(
|
14
|
+
@base_controller_class_name = ENV.fetch("BASE_CONTROLLER_CLASS_NAME") { "::ApplicationController" }
|
13
15
|
end
|
14
16
|
|
15
17
|
def generate_initializer
|
16
|
-
template
|
18
|
+
template "initializer.rb", "config/initializers/cmor_seo_frontend.rb"
|
17
19
|
end
|
18
20
|
|
19
21
|
def generate_routes
|
20
|
-
route File.read(File.join(File.expand_path(
|
22
|
+
route File.read(File.join(File.expand_path("../templates", __FILE__), "routes.source"))
|
21
23
|
end
|
22
24
|
|
23
25
|
def mount_application_view_helper
|
24
|
-
inject_into_file
|
26
|
+
inject_into_file "app/controllers/application_controller.rb", before: "end\n" do
|
25
27
|
" view_helper Cmor::Seo::Frontend::ApplicationViewHelper, as: :seo_helper\n"
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
31
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmor_seo_frontend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.41.pre
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.41.pre
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cmor_core_frontend
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.41.pre
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.0.
|
54
|
+
version: 0.0.41.pre
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +248,20 @@ dependencies:
|
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: rubocop-rails_config
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: shoulda-matchers
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -368,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
368
382
|
- !ruby/object:Gem::Version
|
369
383
|
version: 1.3.1
|
370
384
|
requirements: []
|
371
|
-
rubygems_version: 3.
|
385
|
+
rubygems_version: 3.1.2
|
372
386
|
signing_key:
|
373
387
|
specification_version: 4
|
374
388
|
summary: Cmor::Seo::Frontend Module.
|