slices 1.0.5 → 2.0.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +85 -17
- data/app/assets/images/slices/i18n.png +0 -0
- data/app/assets/images/slices/icon_collapse.png +0 -0
- data/app/assets/javascripts/slices/app/helpers/apply_defaults.js +9 -0
- data/app/assets/javascripts/slices/app/helpers/composer.js +2 -0
- data/app/assets/javascripts/slices/app/helpers/i18n.js +7 -0
- data/app/assets/javascripts/slices/app/helpers/markdown_cheat_sheet.js +50 -0
- data/app/assets/javascripts/slices/app/helpers/radio_field.js +21 -0
- data/app/assets/javascripts/slices/app/helpers/sitemap.js +82 -1
- data/app/assets/javascripts/slices/app/helpers/uploader.js +1 -1
- data/app/assets/javascripts/slices/app/helpers/url_field.js +17 -0
- data/app/assets/javascripts/slices/app/slices.js +14 -11
- data/app/assets/javascripts/slices/app/views/composer_view.js +16 -0
- data/app/assets/javascripts/slices/app/views/radio_field_view.js +67 -0
- data/app/assets/javascripts/slices/app/views/token_field_view.js +81 -24
- data/app/assets/javascripts/slices/app/views/url_field_view.js +44 -0
- data/app/assets/javascripts/slices/slices.js +1 -0
- data/app/assets/javascripts/slices/vendor/jquery.js +4 -2
- data/app/assets/stylesheets/slices/admin.css.erb +156 -31
- data/app/controllers/admin/admin_controller.rb +16 -1
- data/app/controllers/admin/assets_controller.rb +1 -1
- data/app/controllers/admin/entries_controller.rb +1 -1
- data/app/controllers/admin/pages_controller.rb +4 -13
- data/app/controllers/admin/site_maps_controller.rb +1 -2
- data/app/controllers/slices_controller.rb +12 -1
- data/app/helpers/admin/admin_helper.rb +8 -0
- data/app/helpers/admin/site_maps_helper.rb +41 -6
- data/app/helpers/navigation_helper.rb +8 -3
- data/app/helpers/pages_helper.rb +2 -2
- data/app/helpers/snippets_helper.rb +26 -0
- data/app/models/admin.rb +2 -3
- data/app/models/asset.rb +9 -20
- data/app/models/attachment.rb +10 -1
- data/app/models/page.rb +45 -34
- data/app/models/site_map.rb +1 -2
- data/app/models/slice.rb +46 -1
- data/app/models/snippet.rb +13 -4
- data/app/presenters/page_presenter.rb +8 -13
- data/app/views/admin/auth/sessions/_form.html.erb +3 -0
- data/app/views/admin/pages/_fields.html.erb +1 -0
- data/app/views/admin/pages/_slices.html.erb +8 -4
- data/app/views/admin/pages/new.html.erb +5 -1
- data/app/views/admin/pages/show.html.erb +30 -14
- data/app/views/admin/site_maps/_page_actions.html.erb +2 -0
- data/app/views/admin/site_maps/_page_li.html.erb +18 -7
- data/app/views/admin/site_maps/_set_page_li.html.erb +5 -5
- data/app/views/layouts/admin.html.erb +0 -17
- data/config/routes.rb +13 -16
- data/lib/generators/slice/templates/presenter.rb +11 -12
- data/lib/generators/slice/templates/set.html.erb +2 -2
- data/lib/generators/slices/install_generator.rb +13 -3
- data/lib/generators/slices/templates/slices.rb +3 -4
- data/lib/mongo_search.rb +1 -1
- data/lib/slices.rb +2 -9
- data/lib/slices/asset/maker.rb +2 -3
- data/lib/slices/available_slices.rb +8 -1
- data/lib/slices/config.rb +49 -8
- data/lib/slices/engine.rb +0 -4
- data/lib/slices/has_attachments.rb +25 -37
- data/lib/slices/has_slices.rb +15 -8
- data/lib/slices/localized_fields.rb +9 -0
- data/lib/slices/page_as_json.rb +7 -1
- data/lib/slices/renderer.rb +2 -2
- data/lib/slices/tree.rb +12 -3
- data/lib/slices/version.rb +1 -1
- data/lib/tasks/db.rake +6 -10
- data/lib/tasks/seeds.rake +1 -1
- data/public/slices/templates/page_main.hbs +1 -1
- data/public/slices/templates/page_meta.hbs +2 -2
- metadata +56 -84
- data/app/views/admin/shared/_custom_links.html.erb +0 -1
- data/app/views/admin/shared/_custom_navigation.html.erb +0 -1
- data/app/views/layouts/slices/application.html.erb +0 -14
- data/lib/ext/file_store_cache.rb +0 -18
- data/lib/generators/slices/templates/mongoid.yml +0 -12
- data/lib/generators/templates/slices.rb +0 -209
- data/lib/rack_utf8_fix.rb +0 -10
- data/lib/set_link_renderer.rb +0 -31
- data/lib/slices/i18n.rb +0 -6
- data/lib/slices/i18n/backend.rb +0 -32
- data/lib/slices/will_paginate_mongoid.rb +0 -45
- data/lib/standard_tree.rb +0 -193
@@ -1,209 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../slices/version'
|
2
|
-
|
3
|
-
# Remove files
|
4
|
-
remove_file "README.rdoc"
|
5
|
-
remove_file "public/index.html"
|
6
|
-
remove_file "public/404.html"
|
7
|
-
remove_file "public/422.html"
|
8
|
-
remove_file "public/500.html"
|
9
|
-
remove_file "public/favicon.ico"
|
10
|
-
remove_dir "doc"
|
11
|
-
|
12
|
-
create_file "public/favicon.ico"
|
13
|
-
|
14
|
-
file "README.md", <<-END
|
15
|
-
# #{app_const_base}
|
16
|
-
|
17
|
-
Built with [Slices](http://slices.withassociates.com).
|
18
|
-
|
19
|
-
Need help? See the [Slices wiki](https://github.com/withassociates/slices/wiki).
|
20
|
-
END
|
21
|
-
|
22
|
-
# Set up .gitignore files
|
23
|
-
remove_file ".gitignore"
|
24
|
-
file ".gitignore", <<-END
|
25
|
-
.DS_Store
|
26
|
-
*.swp
|
27
|
-
.bundle
|
28
|
-
.sass-cache
|
29
|
-
coverage
|
30
|
-
db/*.sqlite3
|
31
|
-
db/*development*
|
32
|
-
db/*production*
|
33
|
-
db/*test*
|
34
|
-
db/mongod.lock
|
35
|
-
log/*.log
|
36
|
-
public/assets
|
37
|
-
public/cache
|
38
|
-
public/system
|
39
|
-
tmp
|
40
|
-
END
|
41
|
-
|
42
|
-
# mongoid.yml
|
43
|
-
file "config/mongoid.yml", <<-END
|
44
|
-
development:
|
45
|
-
host: localhost
|
46
|
-
database: #{app_name}_development
|
47
|
-
|
48
|
-
test:
|
49
|
-
host: localhost
|
50
|
-
database: #{app_name}_test
|
51
|
-
|
52
|
-
production:
|
53
|
-
host: localhost
|
54
|
-
database: #{app_name}_development
|
55
|
-
END
|
56
|
-
|
57
|
-
initializer "slices.rb", <<-END
|
58
|
-
# Slices::Config.add_asset_styles(
|
59
|
-
# slice_full_width: '945x496>',
|
60
|
-
# avatar: '30x30#',
|
61
|
-
# )
|
62
|
-
|
63
|
-
# Configure the Google Apps domain to use for quick auth.
|
64
|
-
# Press the '=' key on the admin sign-in screen to authenticate via
|
65
|
-
# a Google Apps account within the domain configured here.
|
66
|
-
# Slices::Config.google_apps_domain = 'example.com'
|
67
|
-
|
68
|
-
ActionView::Base.send(:include, AssetsHelper)
|
69
|
-
|
70
|
-
END
|
71
|
-
|
72
|
-
# Gemfile
|
73
|
-
run "rm Gemfile"
|
74
|
-
file "Gemfile", <<-END
|
75
|
-
source 'https://rubygems.org'
|
76
|
-
|
77
|
-
gem 'slices', '~> #{Slices::VERSION}'
|
78
|
-
|
79
|
-
group :assets do
|
80
|
-
gem 'sass-rails'
|
81
|
-
gem 'therubyracer'
|
82
|
-
gem 'uglifier'
|
83
|
-
end
|
84
|
-
|
85
|
-
group :development do
|
86
|
-
gem 'capistrano', require: false
|
87
|
-
gem 'foreman', require: false
|
88
|
-
gem 'unicorn', require: false
|
89
|
-
end
|
90
|
-
|
91
|
-
group :test do
|
92
|
-
gem 'capybara'
|
93
|
-
gem 'database_cleaner'
|
94
|
-
gem 'launchy'
|
95
|
-
gem 'rspec-rails'
|
96
|
-
end
|
97
|
-
|
98
|
-
END
|
99
|
-
|
100
|
-
# Generate example slices
|
101
|
-
generate("slice text text:text")
|
102
|
-
generate("slice images images:attachments")
|
103
|
-
|
104
|
-
# Default layout
|
105
|
-
remove_file "app/views/layouts/application.html.erb"
|
106
|
-
|
107
|
-
file "app/views/layouts/default.html.erb", <<-END
|
108
|
-
<!doctype html>
|
109
|
-
<html>
|
110
|
-
<head>
|
111
|
-
<%= render "shared/head" %>
|
112
|
-
</head>
|
113
|
-
<body class="layout-default">
|
114
|
-
<section id="main" role="main">
|
115
|
-
<%= container "content" %>
|
116
|
-
</section>
|
117
|
-
</body>
|
118
|
-
</html>
|
119
|
-
END
|
120
|
-
|
121
|
-
file "app/views/shared/_head.html.erb", <<-END
|
122
|
-
<meta charset="utf-8">
|
123
|
-
<%= csrf_meta_tags %>
|
124
|
-
|
125
|
-
<title>#{app_const_base}</title>
|
126
|
-
|
127
|
-
<!-- <meta name="description" content=""> -->
|
128
|
-
|
129
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
130
|
-
|
131
|
-
<%= stylesheet_link_tag *%w[
|
132
|
-
application
|
133
|
-
] %>
|
134
|
-
|
135
|
-
<%= javascript_include_tag *%w[
|
136
|
-
//cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js
|
137
|
-
application
|
138
|
-
] %>
|
139
|
-
|
140
|
-
<!--[if lt IE 9]>
|
141
|
-
<%= javascript_include_tag *%w[
|
142
|
-
//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.min.js
|
143
|
-
] %>
|
144
|
-
<![endif]-->
|
145
|
-
|
146
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
147
|
-
END
|
148
|
-
|
149
|
-
# Assets directory structure
|
150
|
-
remove_file "app/assets/images/rails.png"
|
151
|
-
create_file "app/assets/images/.gitkeep"
|
152
|
-
|
153
|
-
# Rspec
|
154
|
-
generate("rspec:install")
|
155
|
-
|
156
|
-
file ".rspec", <<-END, force: true
|
157
|
-
--colour
|
158
|
-
--format=documentation
|
159
|
-
END
|
160
|
-
|
161
|
-
file "spec/spec_helper.rb", <<-END, force: true
|
162
|
-
ENV['RAILS_ENV'] ||= 'test'
|
163
|
-
|
164
|
-
require File.expand_path '../../config/environment', __FILE__
|
165
|
-
require 'rspec/rails'
|
166
|
-
require 'rspec/autorun'
|
167
|
-
|
168
|
-
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
169
|
-
|
170
|
-
RSpec.configure do |config|
|
171
|
-
config.order = 'random'
|
172
|
-
|
173
|
-
config.before :suite do
|
174
|
-
DatabaseCleaner.orm = 'mongoid'
|
175
|
-
DatabaseCleaner.strategy = :truncation
|
176
|
-
end
|
177
|
-
|
178
|
-
config.before do
|
179
|
-
DatabaseCleaner.start
|
180
|
-
end
|
181
|
-
|
182
|
-
config.after do
|
183
|
-
DatabaseCleaner.clean
|
184
|
-
end
|
185
|
-
end
|
186
|
-
END
|
187
|
-
|
188
|
-
# Admin nav partials
|
189
|
-
file "app/views/admin/shared/_custom_navigation.html.erb", <<-END
|
190
|
-
<%# Place custom navbar controls here i.e. %>
|
191
|
-
<%#= admin_nav_link 'Example', example_path %>
|
192
|
-
END
|
193
|
-
|
194
|
-
file "app/views/admin/shared/_custom_links.html.erb", <<-END
|
195
|
-
<%# Place custom navbar links here i.e. %>
|
196
|
-
<%#= content_tag :li, link_to('Example', example_path) %>
|
197
|
-
END
|
198
|
-
|
199
|
-
# Procfile
|
200
|
-
file "Procfile", "web: bundle exec unicorn -p $PORT"
|
201
|
-
git add: "--all"
|
202
|
-
git commit: "-m 'Add Procfile'"
|
203
|
-
|
204
|
-
# Seed the database
|
205
|
-
rake "slices:seed"
|
206
|
-
|
207
|
-
say "All done!", :green
|
208
|
-
say "Remember to run `bundle install` when you first cd into the project", :green
|
209
|
-
|
data/lib/rack_utf8_fix.rb
DELETED
data/lib/set_link_renderer.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'will_paginate/view_helpers/action_view'
|
2
|
-
|
3
|
-
class SetLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer
|
4
|
-
protected
|
5
|
-
# This method has been largely robbed from will_paginate's
|
6
|
-
# lib/will_paginate/view_helpers/action_view.rb file, whose
|
7
|
-
# implementation only differs in that it assumes that you're using
|
8
|
-
# controller: 'foo', action: 'bar' compatible routes.
|
9
|
-
#
|
10
|
-
def url(page)
|
11
|
-
@base_url_params ||= begin
|
12
|
-
url_params = base_url_params
|
13
|
-
merge_optional_params(url_params)
|
14
|
-
url_params
|
15
|
-
end
|
16
|
-
|
17
|
-
url_params = @base_url_params.dup
|
18
|
-
path = url_params.delete(:path)
|
19
|
-
add_current_page_param(url_params, page)
|
20
|
-
remove_unwanted_params(url_params)
|
21
|
-
if url_params.empty?
|
22
|
-
"/#{path}"
|
23
|
-
else
|
24
|
-
"/#{path}?" + url_params.map { |k, v| "#{k}=#{v}" }.join('&')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def remove_unwanted_params(url_params)
|
29
|
-
[:controller, :action, :escape].each { |p| url_params.delete(p) }
|
30
|
-
end
|
31
|
-
end
|
data/lib/slices/i18n.rb
DELETED
data/lib/slices/i18n/backend.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
module Slices
|
2
|
-
module I18n
|
3
|
-
|
4
|
-
class Backend
|
5
|
-
module Implementation
|
6
|
-
include ::I18n::Backend::Base, ::I18n::Backend::Flatten
|
7
|
-
|
8
|
-
# This method receives a locale, a data hash and options for storing translations.
|
9
|
-
# Should be implemented
|
10
|
-
def store_translations(locale, data, options = {})
|
11
|
-
raise NotImplementedError
|
12
|
-
end
|
13
|
-
|
14
|
-
def available_locales
|
15
|
-
raise NotImplementedError
|
16
|
-
end
|
17
|
-
|
18
|
-
protected
|
19
|
-
|
20
|
-
def lookup(locale, key, scope = [], options = {})
|
21
|
-
key = normalize_flat_keys(locale, key, scope, options[:separator])
|
22
|
-
Snippet.find_value_by_key("#{locale}.#{key}")
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
include Implementation
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Due to a bit of dependency-hell, we can't include will_paginate_mongoid
|
2
|
-
# in the gemspec, so this is just the content of that Gem.
|
3
|
-
|
4
|
-
require 'mongoid'
|
5
|
-
require 'will_paginate'
|
6
|
-
|
7
|
-
unless defined? WillPaginateMongoid
|
8
|
-
module WillPaginateMongoid
|
9
|
-
DEFAULT_PER_PAGE = 10
|
10
|
-
|
11
|
-
module MongoidPaginator
|
12
|
-
extend ActiveSupport::Concern
|
13
|
-
|
14
|
-
included do
|
15
|
-
def self.paginate(options = {})
|
16
|
-
options = base_options options
|
17
|
-
page = options[:page].to_i
|
18
|
-
per_page = options[:per_page].to_i
|
19
|
-
offset = options[:offset].to_i
|
20
|
-
|
21
|
-
WillPaginate::Collection.create(page, per_page) do |pager|
|
22
|
-
fill_pager_with self.skip(offset).limit(per_page), self.count, pager
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
def self.base_options(options)
|
29
|
-
options[:page] ||= 1
|
30
|
-
options[:per_page] ||= 10
|
31
|
-
options[:offset] = (options[:page].to_i - 1) * options[:per_page].to_i
|
32
|
-
options
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.fill_pager_with(medias, size, pager)
|
36
|
-
pager.replace medias.to_a
|
37
|
-
pager.total_entries = size
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
::Mongoid::Document.send :include, WillPaginateMongoid::MongoidPaginator
|
44
|
-
::Mongoid::Criteria.send :include, WillPaginateMongoid::MongoidPaginator
|
45
|
-
end
|
data/lib/standard_tree.rb
DELETED
@@ -1,193 +0,0 @@
|
|
1
|
-
class StandardTree
|
2
|
-
|
3
|
-
def self.build_virtual
|
4
|
-
not_found = Page.make(
|
5
|
-
role: 'not_found',
|
6
|
-
name: 'Page not found',
|
7
|
-
active: true
|
8
|
-
)
|
9
|
-
error = Page.make(
|
10
|
-
role: 'error',
|
11
|
-
name: 'Something went wrong',
|
12
|
-
active: true
|
13
|
-
)
|
14
|
-
[not_found, error]
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.build_home
|
18
|
-
Page.make(
|
19
|
-
name: 'Home',
|
20
|
-
permalink: '',
|
21
|
-
active: true,
|
22
|
-
show_in_nav: true
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.build_minimal
|
27
|
-
home = build_home
|
28
|
-
parent = Page.make(
|
29
|
-
parent: home,
|
30
|
-
name: 'Parent',
|
31
|
-
permalink: 'parent',
|
32
|
-
active: true,
|
33
|
-
show_in_nav: true
|
34
|
-
)
|
35
|
-
[home, parent]
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.build_minimal_with_slices
|
39
|
-
home, parent = build_minimal
|
40
|
-
|
41
|
-
parent.slices.build({
|
42
|
-
title: 'Title',
|
43
|
-
container: 'container_one',
|
44
|
-
position: 0
|
45
|
-
}, TitleSlice)
|
46
|
-
parent.slices.build({
|
47
|
-
textile: 'h2. Textile',
|
48
|
-
container: 'container_two',
|
49
|
-
position: 0
|
50
|
-
}, TextileSlice)
|
51
|
-
|
52
|
-
parent.save!
|
53
|
-
|
54
|
-
[home, parent]
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.add_complex(home, parent)
|
58
|
-
child = Page.make(
|
59
|
-
parent: parent,
|
60
|
-
name: 'Child',
|
61
|
-
permalink: 'child',
|
62
|
-
active: true,
|
63
|
-
show_in_nav: true
|
64
|
-
)
|
65
|
-
grand_child = Page.make(
|
66
|
-
parent: child,
|
67
|
-
name: 'Grand child',
|
68
|
-
permalink: 'grand-child',
|
69
|
-
active: true,
|
70
|
-
show_in_nav: true
|
71
|
-
)
|
72
|
-
Page.make(
|
73
|
-
parent: parent,
|
74
|
-
name: 'Sibling',
|
75
|
-
permalink: 'sibling',
|
76
|
-
active: true,
|
77
|
-
show_in_nav: true
|
78
|
-
)
|
79
|
-
Page.make(
|
80
|
-
parent: parent,
|
81
|
-
name: 'Youngest',
|
82
|
-
permalink: 'youngest',
|
83
|
-
active: true,
|
84
|
-
show_in_nav: true
|
85
|
-
)
|
86
|
-
Page.make(
|
87
|
-
parent: home,
|
88
|
-
name: 'Aunt',
|
89
|
-
permalink: 'aunt',
|
90
|
-
active: true,
|
91
|
-
show_in_nav: true
|
92
|
-
)
|
93
|
-
Page.make(
|
94
|
-
parent: home,
|
95
|
-
name: 'Uncle',
|
96
|
-
permalink: 'uncle',
|
97
|
-
active: true,
|
98
|
-
show_in_nav: true
|
99
|
-
)
|
100
|
-
[child, grand_child]
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.build_complex
|
104
|
-
home, parent = build_minimal
|
105
|
-
add_complex(home, parent)
|
106
|
-
[home, parent]
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.add_cousins(uncle)
|
110
|
-
cousin = Page.make(
|
111
|
-
parent: uncle,
|
112
|
-
name: 'Cousin',
|
113
|
-
permalink: 'cousin',
|
114
|
-
active: true,
|
115
|
-
show_in_nav: true
|
116
|
-
)
|
117
|
-
Page.make(
|
118
|
-
parent: cousin,
|
119
|
-
name: 'Once Removed',
|
120
|
-
permalink: 'once-removed',
|
121
|
-
active: true,
|
122
|
-
show_in_nav: true
|
123
|
-
)
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.add_slices_beneath(page, container = nil)
|
127
|
-
page.slices << TitleSlice.new(title: page.name, container: container)
|
128
|
-
page.save!
|
129
|
-
page.children.each { |child| add_slices_beneath(child, container) }
|
130
|
-
end
|
131
|
-
|
132
|
-
def self.add_admin(attrs = {})
|
133
|
-
Admin.create!({
|
134
|
-
name: 'Admin',
|
135
|
-
email: 'hello@withassociates.com',
|
136
|
-
password: '123456',
|
137
|
-
password_confirmation: '123456',
|
138
|
-
}.merge(attrs))
|
139
|
-
end
|
140
|
-
|
141
|
-
# /
|
142
|
-
# /parent
|
143
|
-
# /parent/articles
|
144
|
-
# /parent/articles/article-1
|
145
|
-
# /parent/articles/article-2
|
146
|
-
def self.add_article_set(parent, options={})
|
147
|
-
set_page = SetPage.make({
|
148
|
-
parent: parent,
|
149
|
-
name: 'Articles',
|
150
|
-
permalink: 'articles',
|
151
|
-
active: true,
|
152
|
-
show_in_nav: true
|
153
|
-
}.merge(options))
|
154
|
-
|
155
|
-
set_page.slices << ArticleSetSlice.new(
|
156
|
-
container: 'container_one'
|
157
|
-
)
|
158
|
-
set_page.set_slices << TextileSlice.new(
|
159
|
-
textile: 'I appear above every article.',
|
160
|
-
container: 'container_one'
|
161
|
-
)
|
162
|
-
set_page.set_slices << PlaceholderSlice.new(
|
163
|
-
container: 'container_one'
|
164
|
-
)
|
165
|
-
set_page.set_slices << TextileSlice.new(
|
166
|
-
textile: 'I appear below every article.',
|
167
|
-
container: 'container_one'
|
168
|
-
)
|
169
|
-
|
170
|
-
set_page.save!
|
171
|
-
|
172
|
-
articles = (1..2).collect { self.add_article(set_page) }
|
173
|
-
[set_page, articles]
|
174
|
-
end
|
175
|
-
|
176
|
-
def self.add_article(set_page)
|
177
|
-
i = Article.count + 1
|
178
|
-
Article.make(
|
179
|
-
parent: set_page,
|
180
|
-
name: "Article #{i}",
|
181
|
-
permalink: "article-#{i}",
|
182
|
-
published_at: i.weeks.ago,
|
183
|
-
active: true
|
184
|
-
).tap do |page|
|
185
|
-
page.slices << TitleSlice.new(
|
186
|
-
title: "Article #{i}",
|
187
|
-
container: 'container_one'
|
188
|
-
)
|
189
|
-
page.save!
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
end
|