rocket_cms 0.5.0.rc.5 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7da577b51fe66c871846e58b226479bd09a1f37d
4
- data.tar.gz: 0990b9639aaf7b6fe4ef5c8ebe11877af15d19c1
3
+ metadata.gz: 5b8709251c82acb1bc17445e64b7d6ac54fb4b87
4
+ data.tar.gz: d6d8ccf7202bd05d40d8312265a82cc0e4867d79
5
5
  SHA512:
6
- metadata.gz: b78d0a2c66702c223803b6f36b92d644cfdee5c9587bc01e630e60daaeb48beba5cc1be42ae9cac83142226477d57ead33c2cf38e876665959aafd06dd8b0db2
7
- data.tar.gz: 0113a511582f28b88ef53436e1368fa9bc7e46592e1acd15a5f1ddf5312fe06e2716972c24c94f2aad00fffd4a8d07f302bd9d894a577b89689373c0745a5ef1
6
+ metadata.gz: 90ed8de9874f2145c3639afe3080d278cf27643a4bb9b10387adf2e63d3952b3a4211cf00d87b2ee7d9b7c3835a90de55c0543fc4656f14df4b15a3accdbd0b4
7
+ data.tar.gz: dc6a5e731021e5e57aad14ddf26c635650bd21f603494a566ceb144c165da9e7a2aacc6e1ed77418ed4da24165744bf575d388842423368024795eb6389c63d8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rocket_cms (0.5.0.rc.5)
4
+ rocket_cms (0.5.0)
5
5
  addressable
6
6
  coffee-rails
7
7
  devise
@@ -30,7 +30,7 @@ module RsMenu
30
30
  Proc.new do |primary|
31
31
  SimpleNavigation.config.autogenerate_item_ids = false
32
32
  begin
33
- items = ::Menu.find(type.to_s).pages.asc(:lft).to_a
33
+ items = ::Menu.find(type.to_s).pages.enabled.sorted.to_a
34
34
  items.select { |i| i.parent_id.nil? && !i.name.blank? && i.enabled }.each do |item|
35
35
  render_with_subs(items, primary, item)
36
36
  end
@@ -16,11 +16,10 @@ module Seoable
16
16
 
17
17
  field :og_title, type: String, localize: RocketCMS.configuration.localize
18
18
  has_mongoid_attached_file :og_image, styles: {thumb: "800x600>"}
19
- end
20
-
21
- if RocketCMS.active_record?
19
+ elsif RocketCMS.active_record?
22
20
  has_attached_file :og_image, styles: {thumb: "800x600>"}
23
21
  end
22
+ validates_attachment_content_type :og_image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :image?
24
23
  end
25
24
 
26
25
  def page_title
@@ -1,7 +1,7 @@
1
1
  .rs-news-show
2
2
  %h1.rs-news-title= @news.name
3
3
  .rs-news-date= @news.time.strftime('%Y-%m-%d')
4
- .rs-news-text = @news.excerpt
4
+ .rs-news-text= @news.excerpt
5
5
  - unless RocketCMS.configuration.news_image_styles.nil?
6
6
  .rs-news-image= image_tag @news.image.url(:full)
7
7
  .rs-news-content
@@ -8,7 +8,12 @@ class RocketCmsCreatePages < ActiveRecord::Migration
8
8
  add_index :menus, :slug, unique: true
9
9
 
10
10
  create_table :pages do |t|
11
- t.boolean :enabled, default: false
11
+ t.boolean :enabled, default: true, null: false
12
+ t.integer :parent_id
13
+ t.integer :lft
14
+ t.integer :rgt
15
+ t.integer :depth
16
+
12
17
  t.string :slug, null: false
13
18
  t.attachment :image
14
19
 
@@ -20,6 +25,7 @@ class RocketCmsCreatePages < ActiveRecord::Migration
20
25
  t.timestamps
21
26
  end
22
27
  add_index :pages, :slug, unique: true
28
+ add_index :pages, [:enabled, :lft]
23
29
 
24
30
  create_join_table :menus, :pages
25
31
 
@@ -3,12 +3,12 @@ module RocketCMS
3
3
  module Contacts
4
4
  extend ActiveSupport::Concern
5
5
  def new
6
- @contact_message = ContactMessage.new
6
+ @contact_message = model.new
7
7
  after_initialize
8
8
  end
9
9
 
10
10
  def create
11
- @contact_message = ContactMessage.new(message_params)
11
+ @contact_message = model.new(message_params)
12
12
  after_initialize
13
13
  if RocketCMS.configuration.contacts_captcha
14
14
  meth = :save_with_captcha
@@ -34,6 +34,9 @@ module RocketCMS
34
34
  def after_create
35
35
  # overrideable hook for updating message
36
36
  end
37
+ def model
38
+ ContactMessage
39
+ end
37
40
  def message_params
38
41
  params.require(:contact_message).permit(RocketCMS.configuration.contacts_fields.keys + [:name, :email, :phone, :content, :captcha, :captcha_key])
39
42
  end
@@ -5,10 +5,14 @@ module RocketCMS
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
+ acts_as_nested_set
9
+
8
10
  extend FriendlyId
9
11
  friendly_id :name, use: [:slugged, :finders]
10
12
  has_paper_trail
11
13
  validates_lengths_from_database only: [:name, :title, :content, :excerpt, :h1, :keywords, :robots, :og_title, :regexp, :redirect, :fullpath]
14
+
15
+ scope :sorted, -> { order(lft: :asc) }
12
16
  end
13
17
  end
14
18
  end
@@ -12,7 +12,7 @@ module RocketCMS
12
12
  index({enabled: 1, time: 1})
13
13
  unless RocketCMS.configuration.news_image_styles.nil?
14
14
  has_mongoid_attached_file :image, styles: RocketCMS.configuration.news_image_styles
15
- validates_attachment_content_type :image, :content_type => ['image/gif', 'image/jpeg', 'image/jpg', 'image/png'], if: :image?
15
+ validates_attachment_content_type :image, content_type: %w(image/gif image/jpeg image/jpg image/png), if: :image?
16
16
  end
17
17
 
18
18
  field :excerpt, type: String, localize: RocketCMS.configuration.localize
@@ -12,6 +12,7 @@ module RocketCMS
12
12
  has_and_belongs_to_many :menus, inverse_of: :pages
13
13
  acts_as_nested_set
14
14
  manual_slug :name
15
+ scope :sorted, -> { asc(:lft) }
15
16
  end
16
17
  end
17
18
  end
@@ -13,8 +13,6 @@ module RocketCMS
13
13
  end
14
14
 
15
15
  included do
16
- scope :sorted, -> { order_by([:lft, :asc]) }
17
- scope :menu, ->(menu_id) { enabled.sorted.where(menu_ids: menu_id) }
18
16
  has_and_belongs_to_many :menus, inverse_of: :pages
19
17
  before_validation do
20
18
  self.fullpath = "/pages/#{slug}" if self.fullpath.blank?
@@ -1,3 +1,3 @@
1
1
  module RocketCMS
2
- VERSION = "0.5.0.rc.5"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rocket_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.rc.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebtv
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -476,9 +476,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
476
476
  version: '0'
477
477
  required_rubygems_version: !ruby/object:Gem::Requirement
478
478
  requirements:
479
- - - ">"
479
+ - - ">="
480
480
  - !ruby/object:Gem::Version
481
- version: 1.3.1
481
+ version: '0'
482
482
  requirements: []
483
483
  rubyforge_project:
484
484
  rubygems_version: 2.2.2