tenon 1.0.54 → 1.0.55

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: 1bbdf1cfb7234497e600ba4d2733a20f3b3c8cfe
4
- data.tar.gz: 0093e9f22e73bb6ef664146f0437dbbb6d87ff5e
3
+ metadata.gz: a595eb9d310c421bc5d80fda47abfb6a8ca62b4c
4
+ data.tar.gz: 5bdcfec5911797f26b3cd85f02a0838fe2914f60
5
5
  SHA512:
6
- metadata.gz: 73a24e69d4367da9803e562dfb1dde85ffcdb7791b204a937b788ffb179e31af54eda46c61156e6cb084983f2b975d5f1886a77492740cf6aea3d522d11d36dd
7
- data.tar.gz: c7ddfdafeb1b28101c0b638b0115b3c7895671f0cea4f755ad9d8a78da624fc0b01ab9eb14a852976ab5a48426494f03a22257e7656a6ac07546881420fe8e0b
6
+ metadata.gz: 365e07dd906fa410d382c951ff1cb55dae626af53e34d7a134dbd19ce8cf3846df79171c15c700c0b972dd075afe43d17bf0cf1fec1aca8a9b33cf25c5bdf35a
7
+ data.tar.gz: 8bb06bea0ff9c4992b52a72de04065235366f665335ff6a03cb77dea10d03cf3dfe4736f6b21d26a70f37afd423a0a4d2214495f87c25e1bd591faa258641fee
@@ -7,8 +7,10 @@ module Tenon
7
7
  tenon_content :content, i18n: true
8
8
  default_scope { order('tenon_pages.lft, tenon_pages.list_order') }
9
9
  scope :published, -> { where('publish_at <= ?', Time.now) }
10
- scope :find_for_menu, -> { published.where('parent_id IS NULL AND show_in_menu = ?', true).includes(:subpages) }
10
+ scope :for_menu, -> { published.where(show_in_menu: true) }
11
11
  scope :top, -> { where(parent_id: nil) }
12
+ scope :find_for_menu, -> { top.for_menu } # Backwards compatibility
13
+
12
14
 
13
15
  # Relationships
14
16
  belongs_to :parent, class_name: 'Page', foreign_key: 'parent_id'
@@ -30,12 +32,16 @@ module Tenon
30
32
  if subpages.blank?
31
33
  siblings_for_menu
32
34
  else
33
- subpages.where(published: true, show_in_menu: true)
35
+ subpages.for_menu
34
36
  end
35
37
  end
36
38
 
37
39
  def siblings_for_menu
38
- parent.subpages_for_menu if parent
40
+ if parent
41
+ parent.subpages_for_menu
42
+ else
43
+ []
44
+ end
39
45
  end
40
46
 
41
47
  def self.reorder!(list, parent_id)
@@ -2,8 +2,8 @@ json.records do
2
2
  json.array!(@contacts) do |contact|
3
3
  json.extract!(contact, :id, :name, :email, :phone, :content, :sent_date, :user_ip, :user_agent, :referrer)
4
4
  json.display_link action_link("View Contact Details", '#', 'eye', 'data-modal-target' => "#contact-#{contact.id}", 'data-modal-title' => 'Contact Details')
5
- json.read_link toggle_link(contact, 'read', toggle_read_contact_path(contact), ['folder-open-o', 'This is true'], ['folder-o', 'This is false'])
6
- json.reply_link toggle_link(contact, 'replied', toggle_replied_contact_path(contact), ['check', 'This is true'], ['reply', 'This is false'])
5
+ json.read_link toggle_link(contact, 'read', toggle_read_contact_path(contact), ['folder-open-o', 'Mark as Unread'], ['folder-o', 'Mark as Read'])
6
+ json.reply_link toggle_link(contact, 'replied', toggle_replied_contact_path(contact), ['check', 'Mark as Pending'], ['reply', 'Mark as Replied'])
7
7
  json.delete_link delete_link(contact)
8
8
  end
9
9
  end
data/lib/tenon/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tenon
2
- VERSION = '1.0.54'
2
+ VERSION = '1.0.55'
3
3
  end
@@ -23,8 +23,7 @@ describe Tenon::Page do
23
23
  end
24
24
 
25
25
  it 'should grab the subpages that are available for the menu' do
26
- args = { published: true, show_in_menu: true }
27
- expect(subpages).to receive(:where).with(args)
26
+ expect(subpages).to receive(:for_menu)
28
27
  page.subpages_for_menu
29
28
  end
30
29
  end
@@ -36,8 +35,8 @@ describe Tenon::Page do
36
35
  page.stub(:parent) { nil }
37
36
  end
38
37
 
39
- it 'should return nil' do
40
- expect(page.siblings_for_menu).to be_nil
38
+ it 'should return an empty array' do
39
+ expect(page.siblings_for_menu).to eq([])
41
40
  end
42
41
  end
43
42
 
data/spec/spec_helper.rb CHANGED
@@ -14,7 +14,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
14
14
  FactoryGirl.definition_file_paths += %W(lib/tenon/factories)
15
15
  FactoryGirl.reload
16
16
 
17
- ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
17
+ ActiveRecord::Migration.maintain_test_schema! if defined?(ActiveRecord::Migration)
18
18
 
19
19
  RSpec.configure do |config|
20
20
  config.include Tenon::Engine.routes.url_helpers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.54
4
+ version: 1.0.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2015-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: better_errors