refinerycms 0.9.6.7 → 0.9.6.8
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.
- data/Gemfile +13 -0
- data/VERSION +1 -1
- data/config/application.rb +92 -0
- data/config/environment.rb +4 -74
- data/config/preinitializer.rb +7 -4
- data/db/schema.rb +1 -1
- data/lib/attachment_fu_patch.rb +16 -0
- data/public/.htaccess +3 -3
- data/public/javascripts/refinery/admin.js +6 -1
- data/test/files/teng.pdf +0 -0
- data/test/fixtures/inquiries.yml +22 -0
- data/test/fixtures/news_items.yml +14 -0
- data/test/fixtures/pages.yml +10 -4
- data/test/fixtures/refinery_settings.yml +3 -0
- data/test/fixtures/resources.yml +4 -0
- data/test/fixtures/themes.yml +5 -0
- data/test/unit/image_test.rb +4 -2
- data/test/unit/inquiry_test.rb +41 -0
- data/test/unit/news_items_test.rb +33 -0
- data/test/unit/page_test.rb +12 -9
- data/test/unit/refinery_setting_test.rb +57 -0
- data/test/unit/resource_test.rb +33 -0
- data/test/unit/theme_test.rb +19 -0
- data/todo.md +9 -0
- data/vendor/cache/aasm-2.1.3.gem +0 -0
- data/vendor/cache/actionmailer-2.3.5.gem +0 -0
- data/vendor/cache/actionpack-2.3.5.gem +0 -0
- data/vendor/cache/activerecord-2.3.5.gem +0 -0
- data/vendor/cache/activeresource-2.3.5.gem +0 -0
- data/vendor/cache/activesupport-2.3.5.gem +0 -0
- data/vendor/cache/friendly_id-2.3.1.gem +0 -0
- data/vendor/cache/hpricot-0.8.2.gem +0 -0
- data/vendor/cache/rack-1.0.1.gem +0 -0
- data/vendor/cache/rails-2.3.5.gem +0 -0
- data/vendor/cache/rake-0.8.7.gem +0 -0
- data/vendor/cache/rubyzip-0.9.1.gem +0 -0
- data/vendor/cache/slim_scrooge-1.0.3.gem +0 -0
- data/vendor/cache/will_paginate-2.3.11.gem +0 -0
- data/vendor/plugins/authentication/app/models/user.rb +1 -0
- data/vendor/plugins/images/app/models/image.rb +23 -15
- data/vendor/plugins/images/rails/init.rb +1 -1
- data/vendor/plugins/inquiries/app/controllers/admin/inquiries_controller.rb +1 -1
- data/vendor/plugins/inquiries/app/models/inquiry.rb +6 -9
- data/vendor/plugins/inquiries/rails/init.rb +1 -1
- data/vendor/plugins/news/app/controllers/admin/news_items_controller.rb +1 -1
- data/vendor/plugins/news/app/controllers/news_items_controller.rb +3 -3
- data/vendor/plugins/news/app/models/news_item.rb +6 -8
- data/vendor/plugins/news/app/views/admin/news_items/_form.html.erb +4 -4
- data/vendor/plugins/news/app/views/admin/news_items/_news_item.html.erb +5 -4
- data/vendor/plugins/news/app/views/admin/news_items/edit.html.erb +1 -1
- data/vendor/plugins/news/rails/init.rb +1 -1
- data/vendor/plugins/pages/app/models/page.rb +2 -2
- data/vendor/plugins/pages/rails/init.rb +1 -1
- data/vendor/plugins/refinery/app/views/admin/_head.html.erb +2 -9
- data/vendor/plugins/refinery/app/views/shared/_content_page.html.erb +7 -6
- data/vendor/plugins/refinery/app/views/shared/_head.html.erb +1 -0
- data/vendor/plugins/refinery/app/views/shared/_menu_branch.html.erb +1 -1
- data/vendor/plugins/refinery/lib/crud.rb +2 -2
- data/vendor/plugins/refinery/lib/refinery/application_controller.rb +15 -15
- data/vendor/plugins/refinery/lib/refinery/application_helper.rb +12 -0
- data/vendor/plugins/refinery/lib/refinery/plugin.rb +1 -1
- data/vendor/plugins/refinery/plugins.md +2 -2
- data/vendor/plugins/refinery_settings/app/models/refinery_setting.rb +40 -18
- data/vendor/plugins/refinery_settings/rails/init.rb +1 -2
- data/vendor/plugins/resources/app/models/resource.rb +10 -2
- data/vendor/plugins/themes/app/models/theme.rb +1 -1
- data/vendor/plugins/themes/lib/theme_server.rb +13 -4
- data/vendor/plugins/themes/rails/init.rb +12 -1
- metadata +36 -2
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Please add your gems above the Refinery required gems here:
|
2
|
+
|
3
|
+
#===REFINERY REQUIRED GEMS===
|
4
|
+
source "http://gemcutter.org"
|
5
|
+
gem "aasm", ">= 2.1.3", :require => "aasm"
|
6
|
+
gem "friendly_id", ">= 2.2.2", :require => "friendly_id"
|
7
|
+
gem "hpricot", ">= 0.8.1", :require => "hpricot"
|
8
|
+
gem "slim_scrooge", ">= 1.0.3", :require => "slim_scrooge" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem requirement when windows is running.
|
9
|
+
gem "will_paginate", ">= 2.3.11", :require => "will_paginate"
|
10
|
+
gem "rails", ">= 2.3.5", :require => "rails"
|
11
|
+
gem "rubyzip", ">= 0.9.1", :require => "zip/zip"
|
12
|
+
gem "rake", ">= 0.8.3", :require => "rake"
|
13
|
+
#===REFINERY END OF REQUIRED GEMS===
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.6.
|
1
|
+
0.9.6.8
|
@@ -0,0 +1,92 @@
|
|
1
|
+
if defined?(Rails::Application)
|
2
|
+
module Refinery
|
3
|
+
class Application < Rails::Application
|
4
|
+
config.action_controller.session = {
|
5
|
+
:session_key => '_refinery_session',
|
6
|
+
:secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
|
7
|
+
}
|
8
|
+
end
|
9
|
+
|
10
|
+
def gem_version
|
11
|
+
#0.9.6
|
12
|
+
end
|
13
|
+
end
|
14
|
+
else
|
15
|
+
# Be sure to restart your server when you modify this file
|
16
|
+
|
17
|
+
# Uncomment below to force Rails into production mode when
|
18
|
+
# you don't control web/app server and can't set it the proper way
|
19
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
20
|
+
|
21
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
22
|
+
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
23
|
+
# Freeze to a specific version of refinerycms when running as a gem
|
24
|
+
# REFINERY_GEM_VERSION = '0.9.6' unless defined? REFINERY_GEM_VERSION
|
25
|
+
|
26
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
27
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
28
|
+
|
29
|
+
eval("#{(defined? Refinery::Initializer) ? Refinery : Rails}::Initializer").run do |config|
|
30
|
+
# Settings in config/environments/* take precedence over those specified here.
|
31
|
+
# Application configuration should go into files in config/initializers
|
32
|
+
# -- all .rb files in that directory are automatically loaded.
|
33
|
+
# See Rails::Configuration for more options.
|
34
|
+
|
35
|
+
# Skip frameworks you're not going to use (only works if using vendor/rails).
|
36
|
+
# To use Rails without a database, you must remove the Active Record framework
|
37
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
38
|
+
|
39
|
+
# Only load the plugins named here, in the order given. By default, all plugins
|
40
|
+
# in vendor/plugins are loaded in alphabetical order.
|
41
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
42
|
+
# config.plugins = [ :authentication, :acts_as_tree, :attachment_fu, :all ]
|
43
|
+
|
44
|
+
# Add additional load paths for your own custom dirs
|
45
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
46
|
+
|
47
|
+
# Force all environments to use the same logger level
|
48
|
+
# (by default production uses :info, the others :debug)
|
49
|
+
# config.log_level = :debug
|
50
|
+
|
51
|
+
# Your secret key for verifying cookie session data integrity.
|
52
|
+
# If you change this key, all old sessions will become invalid!
|
53
|
+
# Make sure the secret is at least 30 characters and all random,
|
54
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
55
|
+
config.action_controller.session = {
|
56
|
+
:session_key => '_refinery_session',
|
57
|
+
:secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
|
58
|
+
}
|
59
|
+
|
60
|
+
# Use the database for sessions instead of the cookie-based default,
|
61
|
+
# which shouldn't be used to store highly confidential information
|
62
|
+
# (create the session table with 'rake db:sessions:create')
|
63
|
+
# config.action_controller.session_store = :active_record_store
|
64
|
+
|
65
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
66
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
67
|
+
# like if you have constraints or database-specific column types
|
68
|
+
# config.active_record.schema_format = :sql
|
69
|
+
|
70
|
+
# Activate observers that should always be running
|
71
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
72
|
+
|
73
|
+
# Make Active Record use UTC-base instead of local time
|
74
|
+
# config.active_record.default_timezone = :utc
|
75
|
+
#
|
76
|
+
|
77
|
+
#===REFINERY REQUIRED GEMS===
|
78
|
+
config.gem "bundler", :version => ">= 0.9.4"
|
79
|
+
config.gem "rake", :version => ">= 0.8.3", :lib => "rake"
|
80
|
+
config.gem "rubyzip", :version => ">= 0.9.1", :lib => "zip/zip"
|
81
|
+
config.gem "friendly_id", :version => ">= 2.2.2", :lib => "friendly_id"
|
82
|
+
config.gem "will_paginate", :version => ">= 2.3.11", :lib => "will_paginate", :source => "http://gemcutter.org"
|
83
|
+
config.gem "rails", :version => ">= 2.3.5", :lib => "rails"
|
84
|
+
config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm", :source => "http://gemcutter.org"
|
85
|
+
config.gem "slim_scrooge", :version => ">= 1.0.3", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
|
86
|
+
config.gem "hpricot", :version => ">= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
|
87
|
+
#===REFINERY END OF REQUIRED GEMS===
|
88
|
+
|
89
|
+
# Pull in attachment_fu patch for windows
|
90
|
+
require 'attachment_fu_patch' if RUBY_PLATFORM =~ /mswin/
|
91
|
+
end
|
92
|
+
end
|
data/config/environment.rb
CHANGED
@@ -1,75 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# Load the rails application
|
2
|
+
require File.expand_path('../application', __FILE__)
|
2
3
|
|
3
|
-
#
|
4
|
-
|
5
|
-
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
-
|
7
|
-
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
-
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
|
9
|
-
# Freeze to a specific version of refinerycms when running as a gem
|
10
|
-
# REFINERY_GEM_VERSION = '0.9.6' unless defined? REFINERY_GEM_VERSION
|
11
|
-
|
12
|
-
# Bootstrap the Rails environment, frameworks, and default configuration
|
13
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
14
|
-
|
15
|
-
eval("#{(defined? Refinery::Initializer) ? Refinery : Rails}::Initializer").run do |config|
|
16
|
-
# Settings in config/environments/* take precedence over those specified here.
|
17
|
-
# Application configuration should go into files in config/initializers
|
18
|
-
# -- all .rb files in that directory are automatically loaded.
|
19
|
-
# See Rails::Configuration for more options.
|
20
|
-
|
21
|
-
# Skip frameworks you're not going to use (only works if using vendor/rails).
|
22
|
-
# To use Rails without a database, you must remove the Active Record framework
|
23
|
-
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
24
|
-
|
25
|
-
# Only load the plugins named here, in the order given. By default, all plugins
|
26
|
-
# in vendor/plugins are loaded in alphabetical order.
|
27
|
-
# :all can be used as a placeholder for all plugins not explicitly named
|
28
|
-
# config.plugins = [ :authentication, :acts_as_tree, :attachment_fu, :all ]
|
29
|
-
|
30
|
-
# Add additional load paths for your own custom dirs
|
31
|
-
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
32
|
-
|
33
|
-
# Force all environments to use the same logger level
|
34
|
-
# (by default production uses :info, the others :debug)
|
35
|
-
# config.log_level = :debug
|
36
|
-
|
37
|
-
# Your secret key for verifying cookie session data integrity.
|
38
|
-
# If you change this key, all old sessions will become invalid!
|
39
|
-
# Make sure the secret is at least 30 characters and all random,
|
40
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
41
|
-
config.action_controller.session = {
|
42
|
-
:session_key => '_refinery_session',
|
43
|
-
:secret => 'eec8fffc3637c05895f8e6a355179eaad0003ac5617e5368955baf7989e1faca4d8ab37140d690c20b05d5815609b7c680c644277b6a892be316a85c6596d75c'
|
44
|
-
}
|
45
|
-
|
46
|
-
# Use the database for sessions instead of the cookie-based default,
|
47
|
-
# which shouldn't be used to store highly confidential information
|
48
|
-
# (create the session table with 'rake db:sessions:create')
|
49
|
-
# config.action_controller.session_store = :active_record_store
|
50
|
-
|
51
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
52
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
53
|
-
# like if you have constraints or database-specific column types
|
54
|
-
# config.active_record.schema_format = :sql
|
55
|
-
|
56
|
-
# Activate observers that should always be running
|
57
|
-
# config.active_record.observers = :cacher, :garbage_collector
|
58
|
-
|
59
|
-
# Make Active Record use UTC-base instead of local time
|
60
|
-
# config.active_record.default_timezone = :utc
|
61
|
-
#
|
62
|
-
|
63
|
-
# Please add your gems above the Refinery required gems here:
|
64
|
-
|
65
|
-
#===REFINERY REQUIRED GEMS===
|
66
|
-
config.gem "rake", :version => ">= 0.8.3", :lib => "rake"
|
67
|
-
config.gem "rubyzip", :version => ">= 0.9.1", :lib => "zip/zip"
|
68
|
-
config.gem "friendly_id", :version => ">= 2.2.2", :lib => "friendly_id"
|
69
|
-
config.gem "will_paginate", :version => ">= 2.3.11", :lib => "will_paginate", :source => "http://gemcutter.org"
|
70
|
-
config.gem "rails", :version => ">= 2.3.5", :lib => "rails"
|
71
|
-
config.gem "aasm", :version => ">= 2.1.3", :lib => "aasm", :source => "http://gemcutter.org"
|
72
|
-
config.gem "slim_scrooge", :version => ">= 1.0.3", :lib => "slim_scrooge", :source => "http://gemcutter.org" unless RUBY_PLATFORM =~ /mswin|mingw/ # kill gem when windows is running.
|
73
|
-
config.gem "hpricot", :version => ">= 0.8.1", :lib => "hpricot", :source => "http://gemcutter.org"
|
74
|
-
#===REFINERY END OF REQUIRED GEMS===
|
75
|
-
end
|
4
|
+
# Initialize the rails application
|
5
|
+
Refinery::Application.initialize! if Rails.version.to_f >= 3.0
|
data/config/preinitializer.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
# until Rails 3
|
2
|
+
ENV["GEM_HOME"] = File.expand_path('../../vendor/bundler_gems', __FILE__)
|
3
|
+
|
1
4
|
# pick the refinery root path
|
2
|
-
if File.exist?(File.join(%W(#{RAILS_ROOT} lib refinery_initializer.rb)))
|
3
|
-
require
|
5
|
+
if File.exist?(non_gem_path=File.join(%W(#{RAILS_ROOT} lib refinery_initializer.rb)))
|
6
|
+
require non_gem_path
|
4
7
|
else
|
5
8
|
require 'rubygems'
|
6
9
|
version = if defined? REFINERY_GEM_VERSION
|
@@ -8,7 +11,7 @@ else
|
|
8
11
|
elsif ENV.include?("REFINERY_GEM_VERSION")
|
9
12
|
ENV["REFINERY_GEM_VERSION"]
|
10
13
|
else
|
11
|
-
$1 if File.read(
|
14
|
+
$1 if File.read(File.join(%W(#{RAILS_ROOT} config environment.rb))) =~ /^[^#]*REFINERY_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
12
15
|
end
|
13
16
|
|
14
17
|
if version
|
@@ -21,7 +24,7 @@ else
|
|
21
24
|
end
|
22
25
|
|
23
26
|
|
24
|
-
REFINERY_ROOT =
|
27
|
+
REFINERY_ROOT = RAILS_ROOT unless defined? REFINERY_ROOT
|
25
28
|
|
26
29
|
# Set to true in your environment specific file (e.g. production.rb) to use Amazon's Simple
|
27
30
|
# Storage Service instead of the default file system for resources and images
|
data/db/schema.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
# This patches the windows tempfile problem that attachment_fu depends on. See:
|
2
|
+
# http://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-like.html
|
3
|
+
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
class Tempfile
|
7
|
+
def size
|
8
|
+
if @tmpfile
|
9
|
+
@tmpfile.fsync # added this line
|
10
|
+
@tmpfile.flush
|
11
|
+
@tmpfile.stat.size
|
12
|
+
else
|
13
|
+
0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/public/.htaccess
CHANGED
@@ -5,14 +5,14 @@ Options +FollowSymLinks +ExecCGI
|
|
5
5
|
|
6
6
|
# If you don't want Rails to look in certain directories,
|
7
7
|
# use the following rewrite rules so that Apache won't rewrite certain requests
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# Example:
|
10
10
|
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
11
11
|
# RewriteRule .* - [L]
|
12
12
|
|
13
13
|
# Redirect all requests not available on the filesystem to Rails
|
14
14
|
# By default the cgi dispatcher is used which is very slow
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# For better performance replace the dispatcher with the fastcgi one
|
17
17
|
#
|
18
18
|
# Example:
|
@@ -33,7 +33,7 @@ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
|
33
33
|
|
34
34
|
# In case Rails experiences terminal errors
|
35
35
|
# Instead of displaying this message you can supply a file here which will be rendered instead
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# Example:
|
38
38
|
# ErrorDocument 500 /500.html
|
39
39
|
|
@@ -580,7 +580,12 @@ var list_reorder = {
|
|
580
580
|
|
581
581
|
serialized = "";
|
582
582
|
list_reorder.sortable_list.find('> li[id]').each(function(index, li) {
|
583
|
-
|
583
|
+
if (list_reorder.tree) {
|
584
|
+
serialized += list_reorder.parse_branch([index], li);
|
585
|
+
}
|
586
|
+
else {
|
587
|
+
serialized += "&sortable_list[]=" + $($(li).attr('id').split('_')).last().get(0);
|
588
|
+
}
|
584
589
|
});
|
585
590
|
serialized += "&tree=" + list_reorder.tree + "&authenticity_token=" + encodeURIComponent($('#reorder_authenticity_token').val() + "&continue_reordering=false");
|
586
591
|
|
data/test/files/teng.pdf
ADDED
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
dave:
|
2
|
+
name: Dave
|
3
|
+
email: dave@test.com
|
4
|
+
phone: 955 955555
|
5
|
+
message: Hi - I would like to buy stuff. Please call me
|
6
|
+
open: true
|
7
|
+
created_at: <%= Date.today - 3.days %>
|
8
|
+
|
9
|
+
phil:
|
10
|
+
name: Phil
|
11
|
+
email: phil@test.com
|
12
|
+
phone: 188 8181812
|
13
|
+
message: Call me. Cheers.
|
14
|
+
open: true
|
15
|
+
created_at: <%= Date.today - 1.day %>
|
16
|
+
|
17
|
+
barry:
|
18
|
+
name: Barry
|
19
|
+
email: barryl@test.com
|
20
|
+
phone: 92393332
|
21
|
+
message: Hey I found a problem with your website. Email me to find out what is the problem.
|
22
|
+
open: false
|
@@ -0,0 +1,14 @@
|
|
1
|
+
website_launched:
|
2
|
+
title: New website launched!
|
3
|
+
body: Oh yes our brand new website is here and it is running on Refinery CMS.
|
4
|
+
publish_date: <%= Date.today - 4.days %>
|
5
|
+
|
6
|
+
new_team_member:
|
7
|
+
title: Amanda joins Resolve Digital
|
8
|
+
body: Welcome Amanda to the Resolve Digital team.
|
9
|
+
publish_date: <%= Date.today - 2.days %>
|
10
|
+
|
11
|
+
product_launch:
|
12
|
+
title: Secret new product launched
|
13
|
+
body: Oh yes our brand new website is here and it is running on Refinery CMS.
|
14
|
+
publish_date: <%= Date.today.tomorrow %>
|
data/test/fixtures/pages.yml
CHANGED
@@ -23,7 +23,7 @@ draft_page:
|
|
23
23
|
show_in_menu: true
|
24
24
|
deletable: true
|
25
25
|
draft: true
|
26
|
-
|
26
|
+
|
27
27
|
# page inside draft_page
|
28
28
|
draft_page_child:
|
29
29
|
title: Secret information about secret product
|
@@ -44,6 +44,12 @@ services:
|
|
44
44
|
custom_title_type: text
|
45
45
|
custom_title: Programming Services
|
46
46
|
|
47
|
+
# this page links to an external URL
|
48
|
+
resolve_digital_page:
|
49
|
+
title: "Resolve Digital Ltd"
|
50
|
+
position: 6
|
51
|
+
link_url: "http://www.resolvedigital.co.nz"
|
52
|
+
|
47
53
|
# this page is the home page
|
48
54
|
home_page:
|
49
55
|
title: Home Page
|
@@ -51,21 +57,21 @@ home_page:
|
|
51
57
|
show_in_menu: true
|
52
58
|
deletable: false
|
53
59
|
link_url: /
|
54
|
-
|
60
|
+
|
55
61
|
# this is a products page that has 3 children, 1 that is hidden from the menu
|
56
62
|
products:
|
57
63
|
title: Products
|
58
64
|
position: 1
|
59
65
|
show_in_menu: true
|
60
66
|
deletable: true
|
61
|
-
|
67
|
+
|
62
68
|
blue_jelly:
|
63
69
|
title: Blue Jelly
|
64
70
|
position: 0
|
65
71
|
show_in_menu: true
|
66
72
|
deletable: true
|
67
73
|
parent: products
|
68
|
-
|
74
|
+
|
69
75
|
green_jelly:
|
70
76
|
title: Green Jelly
|
71
77
|
position: 1
|
data/test/unit/image_test.rb
CHANGED
@@ -18,8 +18,10 @@ class ImageTest < ActiveSupport::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_attachment_fu_options
|
21
|
-
assert_equal
|
21
|
+
assert_equal 20.megabytes, Image.attachment_options[:max_size]
|
22
|
+
|
23
|
+
# want to change this to ImageScience at some point. Rmagick sucks.
|
22
24
|
assert_equal 'Rmagick', Image.attachment_options[:processor]
|
23
25
|
end
|
24
26
|
|
25
|
-
end
|
27
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class InquiryTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
fixtures :inquiries
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@new_inquiry = Inquiry.new
|
9
|
+
@bad_email_inquiry = Inquiry.new(:email => "foo.bar.com", :name => "Dave")
|
10
|
+
@valid_inquiry = Inquiry.new(:email => "foo@bar.com", :name => "Dave")
|
11
|
+
@full_valid_inquiry = Inquiry.new(:email => "foo@bar.com", :name => "Dave", :phone => "3232332", :message => "message")
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_force_name_and_email_to_be_valid
|
15
|
+
assert !@new_inquiry.save
|
16
|
+
|
17
|
+
assert_equal "can't be blank", @new_inquiry.errors.on('name')
|
18
|
+
assert_equal "must be valid", @new_inquiry.errors.on('email')
|
19
|
+
|
20
|
+
assert_nil @new_inquiry.errors.on('phone')
|
21
|
+
assert_nil @new_inquiry.errors.on('message')
|
22
|
+
|
23
|
+
assert !@bad_email_inquiry.save
|
24
|
+
assert_equal "must be valid", @bad_email_inquiry.errors.on('email')
|
25
|
+
assert_nil @bad_email_inquiry.errors.on('phone')
|
26
|
+
assert_nil @bad_email_inquiry.errors.on('message')
|
27
|
+
assert_nil @bad_email_inquiry.errors.on('name')
|
28
|
+
|
29
|
+
assert @valid_inquiry.save
|
30
|
+
assert @full_valid_inquiry.save
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_named_scopes
|
34
|
+
assert_equal 2, Inquiry.open.size
|
35
|
+
assert_equal 1, Inquiry.closed.size
|
36
|
+
|
37
|
+
# check the order. Phil is the newest person to inquire
|
38
|
+
assert_equal inquiries(:phil), Inquiry.open.first
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|