ack_rocket_cms 0.7.6.4 → 0.7.7

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: 7f5c8755a70408ccb0e2018b820542c22e65ddf6
4
- data.tar.gz: 6cc2ed7e328c4b1af1f5a65fe98139bd85a06083
3
+ metadata.gz: b5194b48049e084862a58f444e8e66f69600a335
4
+ data.tar.gz: 75dcd990fe46e246a0feca826400db4d3271e2fb
5
5
  SHA512:
6
- metadata.gz: e76306c0c338b37f418859629dd85599b8f33fc90c3783f07ab19029649b2a12ccf4254219c5175d9634bf9c11acc5960b035e842c2124383c25b2034f1c91d1
7
- data.tar.gz: 51dd6019831bd6d4478470d211bde3eb818e41b497bc8b11030aa5f988bb79b3f8d88a97bbffb8467771a061ea1d50e1e8228c2c51c23b080f675ab23cf19cb6
6
+ metadata.gz: 32bbd4068cb4aa1635516aa9302d660c8e3dca1d6ea485d8c401b84d877136356c763f6a34177cfcbad1b4694ab4660661262283bbd90b416553b5c0ac526fcc
7
+ data.tar.gz: c95b294c7d82c475aaf5bcffc8de63d33772f28c71bf683707944a289aa337cd0e45185cd95405eece3119b194519fc85a851468570a98b75d9cfcea3949b115
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ack_rocket_cms (0.7.6.4)
4
+ ack_rocket_cms (0.7.7)
5
5
  ack_rails_admin_jcrop
6
6
  addressable
7
7
  ckeditor
@@ -15,7 +15,7 @@ PATH
15
15
  rails_admin
16
16
  rails_admin_mongoid_localize_field (~> 0.1.2)
17
17
  rails_admin_nested_set
18
- rails_admin_settings (~> 0.9.0)
18
+ rails_admin_settings
19
19
  rails_admin_toggleable
20
20
  simple-navigation
21
21
  simple_form
@@ -30,7 +30,7 @@ PATH
30
30
  GEM
31
31
  remote: https://rubygems.org/
32
32
  specs:
33
- ack_rails_admin_jcrop (0.0.4)
33
+ ack_rails_admin_jcrop (0.0.5)
34
34
  mini_magick
35
35
  rails (>= 3.0.0)
36
36
  rails_admin (>= 0.3.0)
@@ -187,7 +187,7 @@ GEM
187
187
  rails_admin (>= 0.5)
188
188
  rails_admin_nested_set (0.4.2)
189
189
  rails_admin (~> 0.6.6)
190
- rails_admin_settings (0.9.1)
190
+ rails_admin_settings (1.0.0)
191
191
  rails_admin_toggleable (0.5.0)
192
192
  rails_admin (~> 0.6.6)
193
193
  railties (4.2.1)
data/README.md CHANGED
@@ -50,11 +50,11 @@ If not, uninstall rails and install again
50
50
 
51
51
  Then, for mongoid:
52
52
 
53
- rails new my_app -T -O -m https://raw.github.com/ack43/rocket_cms/master/template.rb
53
+ rails new my_app -T -O -m https://raw.githubusercontent.com/ack43/rocket_cms/master/template.rb
54
54
 
55
55
  for ActiveRecord:
56
56
 
57
- rails new my_app -T --database=postgresql -m https://raw.github.com/ack43/rocket_cms/master/template.rb
57
+ rails new my_app -T --database=postgresql -m https://raw.githubusercontent.com/ack43/rocket_cms/master/template.rb
58
58
 
59
59
  generator creates a new RVM gemset, so after cd'ing to app dir, you should run `bundle install` again if you use rvm.
60
60
 
@@ -5,6 +5,7 @@ module RsErrors
5
5
  rescue_from Exception, with: :render_500
6
6
  rescue_from ActionController::RoutingError, with: :render_404
7
7
  rescue_from ActionController::UnknownController, with: :render_404
8
+ rescue_from ActionController::MissingFile, with: :render_404
8
9
  rescue_from AbstractController::ActionNotFound, with: :render_404
9
10
  if RocketCMS.mongoid?
10
11
  rescue_from Mongoid::Errors::DocumentNotFound, with: :render_404
@@ -32,10 +33,14 @@ module RsErrors
32
33
  #redirect_to scope.new_user_session_path, alert: "Необходимо авторизоваться"
33
34
  authenticate_user!
34
35
  else
35
- redirect_to '/', alert: "Доступ запрещен"
36
+ redirect_to '/', alert: t('rs.errors.access_denied')
36
37
  end
37
38
  end
38
39
  end
40
+
41
+ rescue_from ActionController::InvalidAuthenticityToken do |exception|
42
+ redirect_to '/', alert: t('rs.errors.form_expired')
43
+ end
39
44
  end
40
45
 
41
46
  protected
@@ -65,8 +70,8 @@ module RsErrors
65
70
  end
66
71
  Rails.logger.error "__________________________"
67
72
  begin
68
- if rails_admin_controller?
69
- render text: 'Внутренняя ошибка', status: 500
73
+ if rails_admin?
74
+ render text: t('rs.errors.internal_error'), status: 500
70
75
  return
71
76
  end
72
77
  rescue
@@ -79,6 +84,6 @@ module RsErrors
79
84
  end
80
85
 
81
86
  def rails_admin?
82
- self.is_a?(RailsAdmin::ApplicationController)
87
+ self.is_a?(RailsAdmin::ApplicationController) || self.is_a?(RailsAdmin::MainController)
83
88
  end
84
89
  end
@@ -30,10 +30,12 @@ module RsMenu
30
30
  Proc.new do |primary|
31
31
  SimpleNavigation.config.autogenerate_item_ids = false
32
32
  begin
33
+ nav_extra_data_before(type, primary)
33
34
  items = ::Menu.find(type.to_s).pages.enabled.sorted.to_a
34
35
  items.select { |i| i.parent_id.nil? && !i.name.blank? && i.enabled }.each do |item|
35
36
  render_with_subs(items, primary, item) if primary
36
37
  end
38
+ nav_extra_data_after(type, primary)
37
39
  rescue Exception => exception
38
40
  Rails.logger.error exception.message
39
41
  Rails.logger.error exception.backtrace.join("\n")
@@ -42,4 +44,12 @@ module RsMenu
42
44
  end
43
45
  end
44
46
  end
47
+
48
+ def nav_extra_data_before(type, primary)
49
+ # override for additional config or items
50
+ end
51
+ def nav_extra_data_after(type, primary)
52
+ # override for additional config or items
53
+ end
45
54
  end
55
+
@@ -7,6 +7,7 @@ module RsPages
7
7
  private
8
8
 
9
9
  def find_page
10
+ return if rails_admin?
10
11
  @seo_page = find_seo_page request.path
11
12
  if !@seo_page.nil? && !@seo_page.redirect.blank?
12
13
  redirect_to @seo_page.redirect, status: :moved_permanently
@@ -65,4 +66,7 @@ module RsPages
65
66
 
66
67
  end
67
68
 
69
+ def rails_admin?
70
+ self.is_a?(RailsAdmin::ApplicationController) || self.is_a?(RailsAdmin::MainController)
71
+ end
68
72
  end
@@ -6,5 +6,5 @@
6
6
  = f.input :email
7
7
  = f.input :phone
8
8
  = f.input :content
9
- = f.input :captcha
10
- = f.submit t('rs.send')
9
+ = f.input :captcha, as: :simple_captcha
10
+ = f.submit t('rs.send')
@@ -1,3 +1,3 @@
1
1
  #rocket_cms_error{class="error-#{code}"}
2
- h1= "Ошибка #{code}"
2
+ %h1= t('rs.errors.title', code: code)
3
3
  p= "#{text}"
@@ -1 +1 @@
1
- = render 'errors/base', code: 403, text: 'Доступ запрещен'
1
+ = render 'errors/base', code: 403, text: t('rs.errors.access_denied')
@@ -1 +1 @@
1
- = render 'errors/base', code: 404, text: 'Запрашиваемая страница была удалена, или введён некорректный адрес'
1
+ = render 'errors/base', code: 404, text: t('rs.errors.not_found')
@@ -1 +1 @@
1
- = render 'errors/base', code: 500, text: 'Внутренняя ошибка сервера'
1
+ = render 'errors/base', code: 500, text: t('rs.errors.internal_error')
@@ -19,4 +19,10 @@ en:
19
19
  enabled: 'added to menu "%{menu}"'
20
20
  disabled: 'deleted from menu "%{menu}"'
21
21
  error: "Error: %{err}"
22
- no_id: "No ID"
22
+ no_id: "No ID"
23
+ errors:
24
+ title: "Error %{code}"
25
+ form_expired: "Token expired"
26
+ internal_error: "Internal error"
27
+ access_denied: "Access denied"
28
+ not_found: 'The requested page was not found on this server'
@@ -20,3 +20,9 @@ ru:
20
20
  disabled: 'удалено из меню "%{menu}"'
21
21
  error: "Ошибка: %{err}"
22
22
  no_id: "Не указан ID"
23
+ errors:
24
+ title: "Ошибка %{code}"
25
+ form_expired: "Истекло время на заполение формы"
26
+ internal_error: "Внутренняя ошибка"
27
+ access_denied: "Доступ запрещен"
28
+ not_found: 'Запрашиваемая страница была удалена, или введён некорректный адрес'
@@ -15,7 +15,11 @@ module RailsAdmin
15
15
  register_instance_option :controller do
16
16
  Proc.new do
17
17
  if @object.class.name == 'Page'
18
- redirect_to main_app.page_url(@object)
18
+ if @object.fullpath.blank?
19
+ redirect_to main_app.page_url(@object)
20
+ else
21
+ redirect_to @object.fullpath
22
+ end
19
23
  elsif @object.class.name == 'News'
20
24
  redirect_to main_app.news_url(@object)
21
25
  elsif @object.class.name == 'Obj'
@@ -28,7 +28,7 @@ module RocketCMS
28
28
  redirect_after_done
29
29
  end
30
30
  else
31
- render_error
31
+ render_contacts_error
32
32
  end
33
33
  end
34
34
 
@@ -36,7 +36,7 @@ module RocketCMS
36
36
  end
37
37
 
38
38
  private
39
- def render_error
39
+ def render_contacts_error
40
40
  if request.xhr? && process_ajax
41
41
  render json: {errors: @contact_message.errors}, status: 422
42
42
  else
@@ -10,14 +10,13 @@ module RocketCMS
10
10
  #temp
11
11
  begin
12
12
  if Settings.table_exists?
13
- Settings.default_email_from(default: 'noreply@gpk-holding.ru')
14
- Settings.form_email(default: 'admin@gpk-holding.ru')
13
+ Settings.default_email_from(default: 'noreply@site.domain')
14
+ Settings.form_email(default: 'admin@site.domain')
15
15
  Settings.email_topic(default: 'с сайта')
16
16
  end
17
17
  rescue
18
18
  end
19
19
  end
20
-
21
20
  initializer 'rocket_cms.paperclip' do
22
21
  require 'paperclip/style'
23
22
  module ::Paperclip
@@ -33,6 +32,13 @@ module RocketCMS
33
32
  config.after_initialize do
34
33
  # trigger autoload so models are registered in Mongoid::Elasticearch
35
34
  RocketCMS.configuration.search_models.map(&:constantize)
35
+
36
+ # Write default email settings to DB so they can be changed.
37
+ if Settings.table_exists?
38
+ Settings.default_email_from(default: 'noreply@rscx.ru')
39
+ Settings.form_email(default: 'glebtv@ya.ru')
40
+ Settings.email_topic(default: 'с сайта')
41
+ end
36
42
  end
37
43
  end
38
44
  end
@@ -15,13 +15,13 @@ module RocketCMS
15
15
  end
16
16
 
17
17
  included do
18
-
19
- before_validation do
20
- self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
21
- end
18
+ has_and_belongs_to_many :menus, inverse_of: :pages
22
19
  validates_uniqueness_of :fullpath
23
20
  validates_presence_of :name
24
21
  manual_slug :name
22
+ before_validation do
23
+ self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
24
+ end
25
25
  end
26
26
 
27
27
  def get_fullpath
@@ -1,3 +1,3 @@
1
1
  module RocketCMS
2
- VERSION = "0.7.6.4"
2
+ VERSION = "0.7.7"
3
3
  end
data/rocket_cms.gemspec CHANGED
@@ -32,8 +32,10 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'rails_admin'
33
33
  spec.add_dependency 'rails_admin_nested_set'
34
34
  spec.add_dependency 'rails_admin_toggleable'
35
+
35
36
  spec.add_dependency 'ckeditor'
36
- spec.add_dependency 'rails_admin_settings', '~> 0.9.0'
37
+ spec.add_dependency 'rails_admin_settings'
38
+
37
39
  spec.add_dependency 'geocoder'
38
40
  spec.add_dependency 'simple-navigation'
39
41
  spec.add_dependency 'sitemap_generator'
@@ -49,7 +51,6 @@ Gem::Specification.new do |spec|
49
51
 
50
52
  spec.add_dependency 'stringex'
51
53
  spec.add_dependency 'thor'
52
-
53
54
  spec.add_dependency 'smart_excerpt'
54
55
  end
55
56
 
data/template.rb CHANGED
@@ -43,7 +43,8 @@ group :development do
43
43
  gem 'pry-rails'
44
44
  gem 'spring'
45
45
 
46
- gem 'capistrano', require: false
46
+ gem 'capistrano', '~> 3.4.0', require: false
47
+
47
48
  gem 'rvm1-capistrano3', require: false
48
49
  gem 'glebtv-capistrano-unicorn', require: false
49
50
  gem 'capistrano-bundler', require: false
@@ -61,7 +62,7 @@ group :test do
61
62
  gem 'rspec-rails'
62
63
  gem 'database_cleaner'
63
64
  gem 'email_spec'
64
- #{if mongoid then "gem 'glebtv-mongoid-rspec'" else "" end}
65
+ #{if mongoid then "gem 'mongoid-rspec'" else "" end}
65
66
  gem 'ffaker'
66
67
  gem 'factory_girl_rails'
67
68
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ack_rocket_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6.4
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kiseliev
@@ -217,16 +217,16 @@ dependencies:
217
217
  name: rails_admin_settings
218
218
  requirement: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - "~>"
220
+ - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 0.9.0
222
+ version: '0'
223
223
  type: :runtime
224
224
  prerelease: false
225
225
  version_requirements: !ruby/object:Gem::Requirement
226
226
  requirements:
227
- - - "~>"
227
+ - - ">="
228
228
  - !ruby/object:Gem::Version
229
- version: 0.9.0
229
+ version: '0'
230
230
  - !ruby/object:Gem::Dependency
231
231
  name: geocoder
232
232
  requirement: !ruby/object:Gem::Requirement