rails_admin_sitemap 0.1.0
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +21 -0
- data/app/views/layouts/rails_admin/_secondary_navigation.html.slim +19 -0
- data/config/locales/sitemap.en.yml +15 -0
- data/config/locales/sitemap.ru.yml +14 -0
- data/lib/rails_admin_sitemap/action.rb +84 -0
- data/lib/rails_admin_sitemap/config.rb +31 -0
- data/lib/rails_admin_sitemap/engine.rb +4 -0
- data/lib/rails_admin_sitemap/version.rb +3 -0
- data/lib/rails_admin_sitemap.rb +8 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dfe44916b38c67824950142afb4c72bc0e624470
|
4
|
+
data.tar.gz: 2853ab38fd6a9c843f4274864cb4d3e3e6a4873b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2d9c94c50ab91759efe270c9b58a120f3f5f552027c66071eb1a937bdb1d9ccef3d105096f51abf5320cba42bbcfa718f4eedf17650ea80f9a8f6e4b94ea180c
|
7
|
+
data.tar.gz: 84449a3079e092cb790ee5f3e281721ad493e5dff0dc8465ab68f2d7951eeca86a9fb50aba4cf66576005d25f0072ffbff6dc2aa215566a70035641d5106733a
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 ack43
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsAdminSitemap'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
ul.nav.pull-right.root_links
|
2
|
+
- actions(:root).each do |action|
|
3
|
+
- data_method = nil if action.http_methods.include?(:get)
|
4
|
+
- data_method = "post" if action.http_methods.include?(:post)
|
5
|
+
- data_method = "put" if action.http_methods.include?(:put)
|
6
|
+
- data_method = "delete" if action.http_methods.include?(:delete)
|
7
|
+
|
8
|
+
li{class="#{action.action_name}_root_link"}= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: (action.pjax? ? "pjax" : ""), data: data_method ? {method: data_method, confirm: t("admin.actions.#{action.action_name}.confirm")} : nil
|
9
|
+
|
10
|
+
|
11
|
+
- if main_app_root_path = (main_app.root_path rescue false)
|
12
|
+
li= link_to t('admin.home.name').capitalize, main_app_root_path
|
13
|
+
- if _current_user
|
14
|
+
- if user_link = edit_user_link
|
15
|
+
li= user_link
|
16
|
+
- if logout_path.present?
|
17
|
+
li= link_to content_tag('span', t('admin.misc.log_out'), class: 'label label-important'), logout_path, method: logout_method
|
18
|
+
- if _current_user.respond_to?(:email) && _current_user.email.present?
|
19
|
+
li= image_tag "#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest _current_user.email}?s=30", style: 'padding-top:5px'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
en:
|
3
|
+
admin:
|
4
|
+
actions:
|
5
|
+
sitemap:
|
6
|
+
title: "Sitemap"
|
7
|
+
menu: "Sitemap for %{model_label} '%{object_label}'"
|
8
|
+
breadcrumb: "Sitemap"
|
9
|
+
link: "Sitemap"
|
10
|
+
bulk_link: "Sitemap selected %{model_label_plural}"
|
11
|
+
done: "Sitemaped"
|
12
|
+
confirm: "Are you sure, you want to regenerate Sitemap?"
|
13
|
+
|
14
|
+
incorrect_generator: "Incorrect Sitemap generator"
|
15
|
+
unknown_error: "Unknown error"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ru:
|
2
|
+
admin:
|
3
|
+
actions:
|
4
|
+
sitemap:
|
5
|
+
title: "Перегенерить Sitemap"
|
6
|
+
menu: "Перегенерить Sitemap"
|
7
|
+
breadcrumb: "Sitemap"
|
8
|
+
link: "Перегенерить Sitemap"
|
9
|
+
bulk_link: "Перегенерить Sitemap"
|
10
|
+
done: "Sitemap сгенерен"
|
11
|
+
confirm: "Вы уверены, что хотите перегенерить Sitemap?"
|
12
|
+
|
13
|
+
incorrect_generator: "Неверно указан генератор Sitemap"
|
14
|
+
unknown_error: "Неизвестная ошибка"
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'rails_admin/config/actions'
|
2
|
+
require 'rails_admin/config/actions/base'
|
3
|
+
|
4
|
+
module RailsAdmin
|
5
|
+
module Config
|
6
|
+
module Actions
|
7
|
+
class Sitemap < RailsAdmin::Config::Actions::Base
|
8
|
+
RailsAdmin::Config::Actions.register(self)
|
9
|
+
|
10
|
+
register_instance_option :root? do
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
# register_instance_option :breadcrumb_parent do
|
15
|
+
# nil
|
16
|
+
# end
|
17
|
+
|
18
|
+
register_instance_option :controller do
|
19
|
+
Proc.new do
|
20
|
+
|
21
|
+
error = nil
|
22
|
+
|
23
|
+
begin
|
24
|
+
|
25
|
+
case RailsAdminSitemap.configuration.generator
|
26
|
+
|
27
|
+
#https://github.com/kjvarga/sitemap_generator
|
28
|
+
when :sitemap_generator then
|
29
|
+
::SitemapGenerator::Interpreter.run(:config_file => RailsAdminSitemap.configuration.config_file)
|
30
|
+
|
31
|
+
#https://github.com/lassebunk/dynamic_sitemaps
|
32
|
+
when :dynamic_sitemaps
|
33
|
+
require 'dynamic_sitemaps'
|
34
|
+
DynamicSitemaps.configure do |config|
|
35
|
+
config.path = RailsAdminSitemap.configuration.dynamic_sitemaps_conf[:path]
|
36
|
+
config.folder = RailsAdminSitemap.configuration.dynamic_sitemaps_conf[:folder]
|
37
|
+
config.index_file_name = RailsAdminSitemap.configuration.dynamic_sitemaps_conf[:index_file_name]
|
38
|
+
|
39
|
+
config.config_path = RailsAdminSitemap.configuration.config_file
|
40
|
+
end
|
41
|
+
DynamicSitemaps.generate_sitemap
|
42
|
+
|
43
|
+
#https://github.com/viseztrance/rails-sitemap
|
44
|
+
when :rails_sitemap
|
45
|
+
require "sitemap"
|
46
|
+
require RailsAdminSitemap.configuration.config_file
|
47
|
+
path = RailsAdminSitemap.configuration.output_file
|
48
|
+
::Sitemap::Generator.instance.build!
|
49
|
+
::Sitemap::Generator.instance.save path
|
50
|
+
|
51
|
+
else
|
52
|
+
error = t("admin.actions.sitemap.incorrect_generator")
|
53
|
+
end
|
54
|
+
|
55
|
+
rescue Exception => ex
|
56
|
+
error = ex.message
|
57
|
+
error ||= t("admin.actions.sitemap.unknown_error")
|
58
|
+
end
|
59
|
+
|
60
|
+
if error.blank?
|
61
|
+
flash[:notice] = t("admin.actions.sitemap.done")
|
62
|
+
else
|
63
|
+
flash[:error] = error
|
64
|
+
end
|
65
|
+
|
66
|
+
redirect_to dashboard_path
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
register_instance_option :statistics? do
|
71
|
+
false
|
72
|
+
end
|
73
|
+
|
74
|
+
register_instance_option :pjax? do
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
register_instance_option :http_methods do
|
79
|
+
[:post]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RailsAdminSitemap
|
2
|
+
def self.configuration
|
3
|
+
@configuration ||= Configuration.new
|
4
|
+
end
|
5
|
+
def self.config
|
6
|
+
@configuration ||= Configuration.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.configure
|
10
|
+
yield configuration
|
11
|
+
end
|
12
|
+
|
13
|
+
class Configuration
|
14
|
+
attr_accessor :generator
|
15
|
+
attr_accessor :config_file
|
16
|
+
attr_accessor :output_file
|
17
|
+
attr_accessor :dynamic_sitemaps_conf
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@generator = :sitemap_generator
|
21
|
+
@config_file = Rails.root.join("config", "sitemap.rb")
|
22
|
+
@output_file = Rails.root.join("public", "sitemap.xml")
|
23
|
+
|
24
|
+
@dynamic_sitemaps_conf = {
|
25
|
+
path: Rails.root.join("public"),
|
26
|
+
folder: "sitemaps",
|
27
|
+
index_file_name: "sitemap.xml"
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_admin_sitemap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Kiseliev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: gem sitemap_generator integration in rails_admin
|
28
|
+
email:
|
29
|
+
- i43ack@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- Rakefile
|
36
|
+
- app/views/layouts/rails_admin/_secondary_navigation.html.slim
|
37
|
+
- config/locales/sitemap.en.yml
|
38
|
+
- config/locales/sitemap.ru.yml
|
39
|
+
- lib/rails_admin_sitemap.rb
|
40
|
+
- lib/rails_admin_sitemap/action.rb
|
41
|
+
- lib/rails_admin_sitemap/config.rb
|
42
|
+
- lib/rails_admin_sitemap/engine.rb
|
43
|
+
- lib/rails_admin_sitemap/version.rb
|
44
|
+
homepage: https://github.com/ack43/rails_admin_sitemap
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.2.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: gem sitemap_generator integration in rails_admin
|
68
|
+
test_files: []
|