camaleon_cms 1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e69367fceac8dd2ca7e29de702eb29905911505
4
- data.tar.gz: cbc634628dbce5af53bcc9aebdb10c464dfd811b
3
+ metadata.gz: 8f67ae45b2071c931c9ed2a907215b401e13de8c
4
+ data.tar.gz: 9dbcdc4eaf771c3d187f7dee1bf13dc09a53049b
5
5
  SHA512:
6
- metadata.gz: 19395c1a52bd313b6e4741a4a7ca6450f2da54fbb486be7b44c26a7153310daf72a386394c0a0348e0b1d2542a891226941c17e29a9bad8fc04d782dd4527b7b
7
- data.tar.gz: f9589b0bf5a8e05f870eac03813db2c8c6cb208db52c0d4780c59b56c5f8f8524ed011f00d8fac62946dfd0fe626d0e3de14dc218551a0502dd406c43ac9ee0f
6
+ metadata.gz: a8fabb6d2a79d05c95dca7dbc26b21eaac211a00d60082b313328a0f4fffdb5c8e0b8f8ccf9a9a2fbb84d17d82ad6c0efcf048754bc2caaab4709518038285ef
7
+ data.tar.gz: 8ae1b1be332e46aa4b1e017f84badcb76e224425a127dc7650d0d771906d190be4eea9348c223d3b3de3e644db38d70bce3555faea3128c5482a58646d13fb90
@@ -9,6 +9,59 @@
9
9
  module FrontendConcern extend ActiveSupport::Concern
10
10
  # visiting sitemap.xml
11
11
  def sitemap
12
+ # create sitemap directory
13
+ sitemaps_dir = Rails.root.join("public", "sitemaps").to_s
14
+ FileUtils.mkdir(sitemaps_dir) unless Dir.exist?(sitemaps_dir)
15
+
16
+ site = current_site
17
+ folder "sitemaps/#{site.slug}"
18
+ host site.the_url.to_s.parse_domain
19
+ langs = site.get_languages
20
+
21
+ sitemap :site do
22
+ url root_url, priority: 1.0, change_freq: "daily"
23
+
24
+ langs.each_with_index{|l, index| url site.the_url(locale: index==0?nil:l), last_mod: site.updated_at, priority: 0.9 }
25
+ url sitemap_url
26
+ end
27
+
28
+
29
+ sitemap_for site.posts.public_posts, name: :published_posts do |post|
30
+ post = post.decorate
31
+ langs.each_with_index{|l, index| url post.the_url(locale: index==0?nil:l), last_mod: post.updated_at, priority: 0.7 }
32
+ end
33
+
34
+ sitemap_for site.full_categories.no_empty, name: :categories do |cat|
35
+ cat = cat.decorate
36
+ langs.each_with_index{|l, index| url cat.the_url(locale: index==0?nil:l), last_mod: cat.updated_at, priority: 0.5 }
37
+ end
38
+
39
+ sitemap_for site.post_types, name: :groups do |ptype|
40
+ ptype = ptype.decorate
41
+ langs.each_with_index{|l, index| url ptype.the_url(locale: index==0?nil:l), last_mod: ptype.updated_at, priority: 0.3 }
42
+ end
43
+
44
+ sitemap_for site.post_tags, name: :tags do |ptag|
45
+ ptag = ptag.decorate
46
+ langs.each_with_index{|l, index| url ptag.the_url(locale: index==0?nil:l), last_mod: ptag.updated_at, priority: 0.2 }
47
+ end
48
+
49
+ # hooks
50
+ c = CamaleonController.new
51
+ c.instance_eval do
52
+ @current_site = site
53
+ @_hooks_skip = []
54
+ end
55
+
56
+ # sample: sitemap :site2 do \n url root_url \n end
57
+ r = {site: site, eval: ""}; c.hooks_run("sitemap", r)
58
+ instance_eval(r[:eval]) if r[:eval].present?
59
+
60
+ ping_with "http://#{host}/sitemap.xml"
61
+ end
62
+
63
+
64
+ def sitemap2
12
65
  path = Rails.root.join("public", "sitemaps", current_site.slug, "sitemap.xml")
13
66
  if File.exists?(path)
14
67
  respond_to do |format|
@@ -49,6 +49,7 @@ module HtmlHelper
49
49
  # return all js libraries added [aa.js, bb,js, ..]
50
50
  # def get_assets_js
51
51
  def draw_custom_assets
52
+ html_helpers_init unless @_assets_libraries.present?
52
53
  libs = []
53
54
  @_assets_libraries.each do |key, assets|
54
55
  libs += assets[:css] if assets[:css].present?
data/config/sitemap.rb CHANGED
@@ -15,7 +15,6 @@ Site.all.each do |site|
15
15
 
16
16
  sitemap :site do
17
17
  url root_url, priority: 1.0, change_freq: "daily"
18
-
19
18
  langs.each_with_index{|l, index| url site.the_url(locale: index==0?nil:l), last_mod: site.updated_at, priority: 0.9 }
20
19
  url sitemap_url
21
20
  end
@@ -1,3 +1,3 @@
1
1
  module CamaleonCms
2
- VERSION = "1.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camaleon_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen Peredo Diaz