alchemy_cms 3.2.0 → 3.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +7 -0
- data/.rubocop.yml +164 -799
- data/app/assets/javascripts/alchemy/alchemy.datepicker.js.coffee +1 -0
- data/app/controllers/alchemy/admin/contents_controller.rb +4 -3
- data/app/controllers/alchemy/admin/pages_controller.rb +7 -6
- data/app/helpers/alchemy/elements_helper.rb +13 -5
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/page/page_scopes.rb +8 -0
- data/app/views/alchemy/essences/_essence_select_editor.html.erb +2 -4
- data/lib/alchemy/controller_actions.rb +2 -0
- data/lib/alchemy/version.rb +1 -1
- data/spec/controllers/admin/contents_controller_spec.rb +9 -3
- data/spec/controllers/admin/pages_controller_spec.rb +26 -8
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +1 -0
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +1 -0
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +1 -0
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +1 -0
- data/spec/dummy/spec/javascripts +1 -0
- data/spec/helpers/elements_helper_spec.rb +18 -2
- data/spec/spec_helper.rb +1 -1
- metadata +5 -5
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -380
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +0 -5
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +0 -5
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +0 -5
- data/spec/support/rspec-activemodel-mocks_patch.rb +0 -8
@@ -17,6 +17,7 @@ $.extend Alchemy,
|
|
17
17
|
if Alchemy.locale is "de"
|
18
18
|
$.extend datepicker_options,
|
19
19
|
dateFormat: "dd.mm.yy"
|
20
|
+
firstDay: 1
|
20
21
|
dayNames: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
|
21
22
|
dayNamesMin: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
|
22
23
|
monthNames: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
|
@@ -33,9 +33,10 @@ module Alchemy
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def order
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
Content.transaction do
|
37
|
+
params[:content_ids].each_with_index do |id, idx|
|
38
|
+
Content.where(id: id).update_all(position: idx + 1)
|
39
|
+
end
|
39
40
|
end
|
40
41
|
@notice = _t("Successfully saved content position")
|
41
42
|
end
|
@@ -198,12 +198,13 @@ module Alchemy
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def flush
|
201
|
-
Language.current.pages.flushables.
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
201
|
+
Language.current.pages.flushables.update_all(published_at: Time.current)
|
202
|
+
# We need to ensure, that also all layoutpages get the +published_at+ timestamp set,
|
203
|
+
# but not set to public true, because the cache_key for an element is +published_at+
|
204
|
+
# and we don't want the layout pages to be present in +Page.published+ scope.
|
205
|
+
# Not the greatest solution, but ¯\_(ツ)_/¯
|
206
|
+
Language.current.pages.flushable_layoutpages.update_all(published_at: Time.current)
|
207
|
+
respond_to { |format| format.js }
|
207
208
|
end
|
208
209
|
|
209
210
|
private
|
@@ -76,7 +76,8 @@ module Alchemy
|
|
76
76
|
def render_elements(options = {})
|
77
77
|
options = {
|
78
78
|
from_page: @page,
|
79
|
-
render_format: 'html'
|
79
|
+
render_format: 'html',
|
80
|
+
reverse: false
|
80
81
|
}.update(options)
|
81
82
|
|
82
83
|
pages = pages_holding_elements(options.delete(:from_page))
|
@@ -89,7 +90,11 @@ module Alchemy
|
|
89
90
|
elements = collect_elements_from_pages(pages, options)
|
90
91
|
|
91
92
|
if options[:sort_by].present?
|
92
|
-
elements = sort_elements_by_content(
|
93
|
+
elements = sort_elements_by_content(
|
94
|
+
elements,
|
95
|
+
options.delete(:sort_by),
|
96
|
+
options[:reverse]
|
97
|
+
)
|
93
98
|
end
|
94
99
|
|
95
100
|
render_element_view_partials(elements, options)
|
@@ -224,14 +229,17 @@ module Alchemy
|
|
224
229
|
#
|
225
230
|
# @param [Array] elements - The elements you want to sort
|
226
231
|
# @param [String] content_name - The name of the content you want to sort by
|
232
|
+
# @param [Boolean] reverse - Reverse the sorted elements order
|
227
233
|
#
|
228
234
|
# @return [Array]
|
229
235
|
#
|
230
|
-
def sort_elements_by_content(elements, content_name)
|
231
|
-
elements.sort_by do |element|
|
236
|
+
def sort_elements_by_content(elements, content_name, reverse = false)
|
237
|
+
sorted_elements = elements.sort_by do |element|
|
232
238
|
content = element.content_by_name(content_name)
|
233
239
|
content ? content.ingredient.to_s : ''
|
234
240
|
end
|
241
|
+
|
242
|
+
reverse ? sorted_elements.reverse : sorted_elements
|
235
243
|
end
|
236
244
|
|
237
245
|
private
|
@@ -276,7 +284,7 @@ module Alchemy
|
|
276
284
|
page = fallback_options[:from]
|
277
285
|
end
|
278
286
|
return [] if page.blank?
|
279
|
-
page.elements.named(fallback_options[:with].
|
287
|
+
page.elements.not_trashed.named(fallback_options[:with].presence || fallback_options[:for])
|
280
288
|
end
|
281
289
|
|
282
290
|
def render_element_view_partials(elements, options = {})
|
@@ -446,7 +446,7 @@ module Alchemy
|
|
446
446
|
# If the page is the current preview it uses the element's updated_at value as cache key.
|
447
447
|
#
|
448
448
|
def cache_key
|
449
|
-
if Page.current_preview ==
|
449
|
+
if Page.current_preview == page
|
450
450
|
"alchemy/elements/#{id}-#{updated_at}"
|
451
451
|
else
|
452
452
|
"alchemy/elements/#{id}-#{page.published_at}"
|
@@ -76,6 +76,14 @@ module Alchemy
|
|
76
76
|
#
|
77
77
|
scope :flushables, -> { not_locked.published.contentpages }
|
78
78
|
|
79
|
+
# Returns all layoutpages that are not locked.
|
80
|
+
#
|
81
|
+
# Used for flushing all pages caches at once.
|
82
|
+
#
|
83
|
+
scope :flushable_layoutpages, -> {
|
84
|
+
not_locked.layoutpages.where.not(parent_id: Page.unscoped.root.id)
|
85
|
+
}
|
86
|
+
|
79
87
|
# All searchable pages
|
80
88
|
#
|
81
89
|
scope :searchables, -> { not_restricted.published.contentpages }
|
@@ -9,11 +9,9 @@
|
|
9
9
|
<%= warning(':select_values is nil', "<strong>No select values given.</strong><br>Please provide :<code>select_values</code> either as argument to <code>render_essence_editor</code> helper or as setting on the content definition in <code>elements.yml</code>.".html_safe) %>
|
10
10
|
<% else %>
|
11
11
|
<% if select_values.is_a?(Hash)
|
12
|
-
options_tags = grouped_options_for_select
|
13
|
-
content.ingredient, ''
|
12
|
+
options_tags = grouped_options_for_select(select_values, content.ingredient)
|
14
13
|
else
|
15
|
-
options_tags = options_for_select
|
16
|
-
content.ingredient
|
14
|
+
options_tags = options_for_select(select_values, content.ingredient)
|
17
15
|
end %>
|
18
16
|
|
19
17
|
<%= select_tag content.form_field_name, options_tags, {
|
@@ -73,6 +73,8 @@ module Alchemy
|
|
73
73
|
@current_ability ||= begin
|
74
74
|
alchemy_permissions = Alchemy::Permissions.new(current_alchemy_user)
|
75
75
|
Alchemy.registered_abilities.each do |klass|
|
76
|
+
# Ensure to avoid issues with Rails constant lookup.
|
77
|
+
klass = "::#{klass}".constantize
|
76
78
|
alchemy_permissions.merge(klass.new(current_alchemy_user))
|
77
79
|
end
|
78
80
|
if (Object.const_get('::Ability') rescue false)
|
data/lib/alchemy/version.rb
CHANGED
@@ -60,11 +60,17 @@ module Alchemy
|
|
60
60
|
|
61
61
|
describe "#order" do
|
62
62
|
context "with content_ids in params" do
|
63
|
+
let(:element) do
|
64
|
+
create(:element, name: 'all_you_can_eat', create_contents_after_create: true)
|
65
|
+
end
|
66
|
+
|
67
|
+
let(:content_ids) { element.contents.pluck(:id).shuffle }
|
68
|
+
|
63
69
|
it "should reorder the contents" do
|
64
|
-
|
65
|
-
|
70
|
+
alchemy_xhr :post, :order, {content_ids: content_ids}
|
71
|
+
|
66
72
|
expect(response.status).to eq(200)
|
67
|
-
expect(element.contents.
|
73
|
+
expect(element.contents(true).pluck(:id)).to eq(content_ids)
|
68
74
|
end
|
69
75
|
end
|
70
76
|
end
|
@@ -56,18 +56,36 @@ module Alchemy
|
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "#flush" do
|
59
|
-
let(:
|
60
|
-
let(:
|
61
|
-
let(:
|
59
|
+
let(:content_page_1) { create(:public_page, name: "content page 1", published_at: Time.current - 5.days) }
|
60
|
+
let(:content_page_2) { create(:public_page, name: "content page 2", published_at: Time.current - 8.days) }
|
61
|
+
let(:layout_page_1) { create(:page, layoutpage: true, name: "layout_page 1", published_at: Time.current - 5.days) }
|
62
|
+
let(:layout_page_2) { create(:page, layoutpage: true, name: "layout_page 2", published_at: Time.current - 8.days) }
|
63
|
+
let(:content_pages) { [content_page_1, content_page_2] }
|
64
|
+
let(:layout_pages) { [layout_page_1, layout_page_2] }
|
62
65
|
|
63
66
|
before do
|
64
|
-
|
67
|
+
content_pages
|
68
|
+
layout_pages
|
65
69
|
end
|
66
70
|
|
67
|
-
it "should
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
it "should update the published_at field of content pages" do
|
72
|
+
travel_to(Time.current) do
|
73
|
+
alchemy_xhr :post, :flush
|
74
|
+
content_pages.map(&:reload) # Reloading because published_at was directly updated in the database.
|
75
|
+
content_pages.each do |page|
|
76
|
+
expect(page.published_at).to eq(Time.current)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should update the published_at field of layout pages" do
|
82
|
+
travel_to(Time.current) do
|
83
|
+
alchemy_xhr :post, :flush
|
84
|
+
layout_pages.map(&:reload) # Reloading because published_at was directly updated in the database.
|
85
|
+
layout_pages.each do |page|
|
86
|
+
expect(page.published_at).to eq(Time.current)
|
87
|
+
end
|
88
|
+
end
|
71
89
|
end
|
72
90
|
end
|
73
91
|
|
@@ -0,0 +1 @@
|
|
1
|
+
../../../../db/migrate/20130827094554_alchemy_two_point_six.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
../../../../db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb
|
data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
../../../../db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
../../../../db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb
|
@@ -0,0 +1 @@
|
|
1
|
+
../../../spec/javascripts
|
@@ -136,12 +136,28 @@ module Alchemy
|
|
136
136
|
it { is_expected.to be_blank }
|
137
137
|
end
|
138
138
|
|
139
|
+
context 'with sort_by and reverse option given' do
|
140
|
+
let(:options) { {sort_by: true, reverse: true} }
|
141
|
+
let(:sorted_elements) { [another_element, element] }
|
142
|
+
|
143
|
+
before do
|
144
|
+
expect(elements).to receive(:sort_by).and_return(sorted_elements)
|
145
|
+
expect(sorted_elements).to receive(:reverse).and_return(elements)
|
146
|
+
expect(page).to receive(:find_elements).and_return(elements)
|
147
|
+
end
|
148
|
+
|
149
|
+
it "renders the sorted elements in reverse order" do
|
150
|
+
is_expected.not_to be_blank
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
139
154
|
context 'with sort_by option given' do
|
140
155
|
let(:options) { {sort_by: 'title'} }
|
141
156
|
let(:sorted_elements) { [another_element, element] }
|
142
157
|
|
143
158
|
before do
|
144
159
|
expect(elements).to receive(:sort_by).and_return(sorted_elements)
|
160
|
+
expect(elements).not_to receive(:reverse)
|
145
161
|
expect(page).to receive(:find_elements).and_return(elements)
|
146
162
|
end
|
147
163
|
|
@@ -160,7 +176,7 @@ module Alchemy
|
|
160
176
|
|
161
177
|
before do
|
162
178
|
allow(Language).to receive(:current).and_return double(pages: double(find_by: another_page))
|
163
|
-
allow(another_page).to receive(:elements).and_return double(named: elements)
|
179
|
+
allow(another_page).to receive(:elements).and_return double(not_trashed: double(named: elements))
|
164
180
|
end
|
165
181
|
|
166
182
|
it "renders the fallback element" do
|
@@ -172,7 +188,7 @@ module Alchemy
|
|
172
188
|
let(:options) { {fallback: {for: 'higgs', with: 'news', from: another_page}} }
|
173
189
|
|
174
190
|
before do
|
175
|
-
allow(another_page).to receive(:elements).and_return double(named: elements)
|
191
|
+
allow(another_page).to receive(:elements).and_return double(not_trashed: double(named: elements))
|
176
192
|
end
|
177
193
|
|
178
194
|
it "renders the fallback element" do
|
data/spec/spec_helper.rb
CHANGED
@@ -26,7 +26,6 @@ require 'alchemy/test_support/factories'
|
|
26
26
|
|
27
27
|
require_relative "support/hint_examples.rb"
|
28
28
|
require_relative "support/transformation_examples.rb"
|
29
|
-
require_relative "support/rspec-activemodel-mocks_patch.rb"
|
30
29
|
|
31
30
|
ActionMailer::Base.delivery_method = :test
|
32
31
|
ActionMailer::Base.perform_deliveries = true
|
@@ -50,6 +49,7 @@ RSpec.configure do |config|
|
|
50
49
|
config.raise_errors_for_deprecations!
|
51
50
|
config.run_all_when_everything_filtered = true
|
52
51
|
config.filter_run :focus
|
52
|
+
config.include ActiveSupport::Testing::TimeHelpers
|
53
53
|
config.include Alchemy::Engine.routes.url_helpers
|
54
54
|
config.include Alchemy::TestSupport::ControllerRequests, type: :controller
|
55
55
|
[:controller, :feature].each do |type|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alchemy_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas von Deyen
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: actionpack-page_caching
|
@@ -1060,6 +1060,7 @@ files:
|
|
1060
1060
|
- spec/dummy/public/422.html
|
1061
1061
|
- spec/dummy/public/500.html
|
1062
1062
|
- spec/dummy/public/favicon.ico
|
1063
|
+
- spec/dummy/spec/javascripts
|
1063
1064
|
- spec/features/admin/dashboard_spec.rb
|
1064
1065
|
- spec/features/admin/language_tree_feature_spec.rb
|
1065
1066
|
- spec/features/admin/legacy_page_url_management_spec.rb
|
@@ -1151,7 +1152,6 @@ files:
|
|
1151
1152
|
- spec/spec_helper.rb
|
1152
1153
|
- spec/support/ci/install_phantomjs
|
1153
1154
|
- spec/support/hint_examples.rb
|
1154
|
-
- spec/support/rspec-activemodel-mocks_patch.rb
|
1155
1155
|
- spec/support/test_tweaks.rb
|
1156
1156
|
- spec/support/transformation_examples.rb
|
1157
1157
|
- spec/tasks/helpers_spec.rb
|
@@ -1245,7 +1245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1245
1245
|
requirements:
|
1246
1246
|
- ImageMagick (libmagick), v6.6 or greater.
|
1247
1247
|
rubyforge_project:
|
1248
|
-
rubygems_version: 2.
|
1248
|
+
rubygems_version: 2.6.2
|
1249
1249
|
signing_key:
|
1250
1250
|
specification_version: 4
|
1251
1251
|
summary: A powerful, userfriendly and flexible CMS for Rails 4
|
@@ -1340,6 +1340,7 @@ test_files:
|
|
1340
1340
|
- spec/dummy/public/422.html
|
1341
1341
|
- spec/dummy/public/500.html
|
1342
1342
|
- spec/dummy/public/favicon.ico
|
1343
|
+
- spec/dummy/spec/javascripts
|
1343
1344
|
- spec/features/admin/dashboard_spec.rb
|
1344
1345
|
- spec/features/admin/language_tree_feature_spec.rb
|
1345
1346
|
- spec/features/admin/legacy_page_url_management_spec.rb
|
@@ -1431,7 +1432,6 @@ test_files:
|
|
1431
1432
|
- spec/spec_helper.rb
|
1432
1433
|
- spec/support/ci/install_phantomjs
|
1433
1434
|
- spec/support/hint_examples.rb
|
1434
|
-
- spec/support/rspec-activemodel-mocks_patch.rb
|
1435
1435
|
- spec/support/test_tweaks.rb
|
1436
1436
|
- spec/support/transformation_examples.rb
|
1437
1437
|
- spec/tasks/helpers_spec.rb
|
@@ -1,380 +0,0 @@
|
|
1
|
-
# This is a compressed migration for creating all Alchemy 2.6 tables at once.
|
2
|
-
#
|
3
|
-
# === Notice
|
4
|
-
#
|
5
|
-
# In order to upgrade from an old version of Alchemy, you have to run all migrations from
|
6
|
-
# each version you missed up to the version you want to upgrade to, before running this migration.
|
7
|
-
#
|
8
|
-
class AlchemyTwoPointSix < ActiveRecord::Migration
|
9
|
-
def up
|
10
|
-
|
11
|
-
unless table_exists?('alchemy_attachments')
|
12
|
-
create_table "alchemy_attachments" do |t|
|
13
|
-
t.string "name"
|
14
|
-
t.string "file_name"
|
15
|
-
t.string "file_mime_type"
|
16
|
-
t.integer "file_size"
|
17
|
-
t.integer "creator_id"
|
18
|
-
t.integer "updater_id"
|
19
|
-
t.datetime "created_at", null: false
|
20
|
-
t.datetime "updated_at", null: false
|
21
|
-
t.text "cached_tag_list"
|
22
|
-
t.string "file_uid"
|
23
|
-
end
|
24
|
-
add_index "alchemy_attachments", ["file_uid"], name: "index_alchemy_attachments_on_file_uid"
|
25
|
-
end
|
26
|
-
|
27
|
-
unless table_exists?('alchemy_cells')
|
28
|
-
create_table "alchemy_cells" do |t|
|
29
|
-
t.integer "page_id"
|
30
|
-
t.string "name"
|
31
|
-
t.datetime "created_at", null: false
|
32
|
-
t.datetime "updated_at", null: false
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
unless table_exists?('alchemy_contents')
|
37
|
-
create_table "alchemy_contents" do |t|
|
38
|
-
t.string "name"
|
39
|
-
t.string "essence_type"
|
40
|
-
t.integer "essence_id"
|
41
|
-
t.integer "element_id"
|
42
|
-
t.integer "position"
|
43
|
-
t.datetime "created_at", null: false
|
44
|
-
t.datetime "updated_at", null: false
|
45
|
-
t.integer "creator_id"
|
46
|
-
t.integer "updater_id"
|
47
|
-
end
|
48
|
-
add_index "alchemy_contents", ["element_id", "position"], name: "index_contents_on_element_id_and_position"
|
49
|
-
end
|
50
|
-
|
51
|
-
unless table_exists?('alchemy_elements')
|
52
|
-
create_table "alchemy_elements" do |t|
|
53
|
-
t.string "name"
|
54
|
-
t.integer "position"
|
55
|
-
t.integer "page_id"
|
56
|
-
t.boolean "public", default: true
|
57
|
-
t.boolean "folded", default: false
|
58
|
-
t.boolean "unique", default: false
|
59
|
-
t.datetime "created_at", null: false
|
60
|
-
t.datetime "updated_at", null: false
|
61
|
-
t.integer "creator_id"
|
62
|
-
t.integer "updater_id"
|
63
|
-
t.integer "cell_id"
|
64
|
-
t.text "cached_tag_list"
|
65
|
-
end
|
66
|
-
add_index "alchemy_elements", ["page_id", "position"], name: "index_elements_on_page_id_and_position"
|
67
|
-
end
|
68
|
-
|
69
|
-
unless table_exists?('alchemy_elements_alchemy_pages')
|
70
|
-
create_table "alchemy_elements_alchemy_pages", id: false do |t|
|
71
|
-
t.integer "element_id"
|
72
|
-
t.integer "page_id"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
unless table_exists?('alchemy_essence_booleans')
|
77
|
-
create_table "alchemy_essence_booleans" do |t|
|
78
|
-
t.boolean "value"
|
79
|
-
t.datetime "created_at", null: false
|
80
|
-
t.datetime "updated_at", null: false
|
81
|
-
t.integer "creator_id"
|
82
|
-
t.integer "updater_id"
|
83
|
-
end
|
84
|
-
add_index "alchemy_essence_booleans", ["value"], name: "index_alchemy_essence_booleans_on_value"
|
85
|
-
end
|
86
|
-
|
87
|
-
unless table_exists?('alchemy_essence_dates')
|
88
|
-
create_table "alchemy_essence_dates" do |t|
|
89
|
-
t.datetime "date"
|
90
|
-
t.integer "creator_id"
|
91
|
-
t.integer "updater_id"
|
92
|
-
t.datetime "created_at", null: false
|
93
|
-
t.datetime "updated_at", null: false
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
unless table_exists?('alchemy_essence_files')
|
98
|
-
create_table "alchemy_essence_files" do |t|
|
99
|
-
t.integer "attachment_id"
|
100
|
-
t.string "title"
|
101
|
-
t.string "css_class"
|
102
|
-
t.integer "creator_id"
|
103
|
-
t.integer "updater_id"
|
104
|
-
t.datetime "created_at", null: false
|
105
|
-
t.datetime "updated_at", null: false
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
unless table_exists?('alchemy_essence_htmls')
|
110
|
-
create_table "alchemy_essence_htmls" do |t|
|
111
|
-
t.text "source"
|
112
|
-
t.integer "creator_id"
|
113
|
-
t.integer "updater_id"
|
114
|
-
t.datetime "created_at", null: false
|
115
|
-
t.datetime "updated_at", null: false
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
unless table_exists?('alchemy_essence_links')
|
120
|
-
create_table "alchemy_essence_links" do |t|
|
121
|
-
t.string "link"
|
122
|
-
t.string "link_title"
|
123
|
-
t.string "link_target"
|
124
|
-
t.string "link_class_name"
|
125
|
-
t.datetime "created_at", null: false
|
126
|
-
t.datetime "updated_at", null: false
|
127
|
-
t.integer "creator_id"
|
128
|
-
t.integer "updater_id"
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
unless table_exists?('alchemy_essence_pictures')
|
133
|
-
create_table "alchemy_essence_pictures" do |t|
|
134
|
-
t.integer "picture_id"
|
135
|
-
t.string "caption"
|
136
|
-
t.string "title"
|
137
|
-
t.string "alt_tag"
|
138
|
-
t.string "link"
|
139
|
-
t.string "link_class_name"
|
140
|
-
t.string "link_title"
|
141
|
-
t.string "css_class"
|
142
|
-
t.string "link_target"
|
143
|
-
t.integer "creator_id"
|
144
|
-
t.integer "updater_id"
|
145
|
-
t.datetime "created_at", null: false
|
146
|
-
t.datetime "updated_at", null: false
|
147
|
-
t.string "crop_from"
|
148
|
-
t.string "crop_size"
|
149
|
-
t.string "render_size"
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
unless table_exists?('alchemy_essence_richtexts')
|
154
|
-
create_table "alchemy_essence_richtexts" do |t|
|
155
|
-
t.text "body"
|
156
|
-
t.text "stripped_body"
|
157
|
-
t.boolean "do_not_index", default: false
|
158
|
-
t.boolean "public"
|
159
|
-
t.integer "creator_id"
|
160
|
-
t.integer "updater_id"
|
161
|
-
t.datetime "created_at", null: false
|
162
|
-
t.datetime "updated_at", null: false
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
unless table_exists?('alchemy_essence_selects')
|
167
|
-
create_table "alchemy_essence_selects" do |t|
|
168
|
-
t.string "value"
|
169
|
-
t.datetime "created_at", null: false
|
170
|
-
t.datetime "updated_at", null: false
|
171
|
-
t.integer "creator_id"
|
172
|
-
t.integer "updater_id"
|
173
|
-
end
|
174
|
-
add_index "alchemy_essence_selects", ["value"], name: "index_alchemy_essence_selects_on_value"
|
175
|
-
end
|
176
|
-
|
177
|
-
unless table_exists?('alchemy_essence_texts')
|
178
|
-
create_table "alchemy_essence_texts" do |t|
|
179
|
-
t.text "body"
|
180
|
-
t.string "link"
|
181
|
-
t.string "link_title"
|
182
|
-
t.string "link_class_name"
|
183
|
-
t.boolean "public", default: false
|
184
|
-
t.boolean "do_not_index", default: false
|
185
|
-
t.string "link_target"
|
186
|
-
t.integer "creator_id"
|
187
|
-
t.integer "updater_id"
|
188
|
-
t.datetime "created_at", null: false
|
189
|
-
t.datetime "updated_at", null: false
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
unless table_exists?('alchemy_folded_pages')
|
194
|
-
create_table "alchemy_folded_pages" do |t|
|
195
|
-
t.integer "page_id"
|
196
|
-
t.integer "user_id"
|
197
|
-
t.boolean "folded", default: false
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
unless table_exists?('alchemy_languages')
|
202
|
-
create_table "alchemy_languages" do |t|
|
203
|
-
t.string "name"
|
204
|
-
t.string "language_code"
|
205
|
-
t.string "frontpage_name"
|
206
|
-
t.string "page_layout", default: "intro"
|
207
|
-
t.boolean "public", default: false
|
208
|
-
t.datetime "created_at", null: false
|
209
|
-
t.datetime "updated_at", null: false
|
210
|
-
t.integer "creator_id"
|
211
|
-
t.integer "updater_id"
|
212
|
-
t.boolean "default", default: false
|
213
|
-
t.string "country_code", default: "", null: false
|
214
|
-
t.integer "site_id"
|
215
|
-
end
|
216
|
-
add_index "alchemy_languages", ["language_code", "country_code"], name: "index_alchemy_languages_on_language_code_and_country_code"
|
217
|
-
add_index "alchemy_languages", ["language_code"], name: "index_alchemy_languages_on_language_code"
|
218
|
-
add_index "alchemy_languages", ["site_id"], name: "index_alchemy_languages_on_site_id"
|
219
|
-
end
|
220
|
-
|
221
|
-
unless table_exists?('alchemy_legacy_page_urls')
|
222
|
-
create_table "alchemy_legacy_page_urls" do |t|
|
223
|
-
t.string "urlname", null: false
|
224
|
-
t.integer "page_id", null: false
|
225
|
-
t.datetime "created_at", null: false
|
226
|
-
t.datetime "updated_at", null: false
|
227
|
-
end
|
228
|
-
add_index "alchemy_legacy_page_urls", ["urlname"], name: "index_alchemy_legacy_page_urls_on_urlname"
|
229
|
-
end
|
230
|
-
|
231
|
-
unless table_exists?('alchemy_pages')
|
232
|
-
create_table "alchemy_pages" do |t|
|
233
|
-
t.string "name"
|
234
|
-
t.string "urlname"
|
235
|
-
t.string "title"
|
236
|
-
t.string "language_code"
|
237
|
-
t.boolean "language_root"
|
238
|
-
t.string "page_layout"
|
239
|
-
t.text "meta_keywords"
|
240
|
-
t.text "meta_description"
|
241
|
-
t.integer "lft"
|
242
|
-
t.integer "rgt"
|
243
|
-
t.integer "parent_id"
|
244
|
-
t.integer "depth"
|
245
|
-
t.boolean "visible", default: false
|
246
|
-
t.boolean "public", default: false
|
247
|
-
t.boolean "locked", default: false
|
248
|
-
t.integer "locked_by"
|
249
|
-
t.boolean "restricted", default: false
|
250
|
-
t.boolean "robot_index", default: true
|
251
|
-
t.boolean "robot_follow", default: true
|
252
|
-
t.boolean "sitemap", default: true
|
253
|
-
t.boolean "layoutpage", default: false
|
254
|
-
t.datetime "created_at", null: false
|
255
|
-
t.datetime "updated_at", null: false
|
256
|
-
t.integer "creator_id"
|
257
|
-
t.integer "updater_id"
|
258
|
-
t.integer "language_id"
|
259
|
-
t.text "cached_tag_list"
|
260
|
-
end
|
261
|
-
add_index "alchemy_pages", ["language_id"], name: "index_pages_on_language_id"
|
262
|
-
add_index "alchemy_pages", ["parent_id", "lft"], name: "index_pages_on_parent_id_and_lft"
|
263
|
-
add_index "alchemy_pages", ["urlname"], name: "index_pages_on_urlname"
|
264
|
-
end
|
265
|
-
|
266
|
-
unless table_exists?('alchemy_pictures')
|
267
|
-
create_table "alchemy_pictures" do |t|
|
268
|
-
t.string "name"
|
269
|
-
t.string "image_file_name"
|
270
|
-
t.integer "image_file_width"
|
271
|
-
t.integer "image_file_height"
|
272
|
-
t.datetime "created_at", null: false
|
273
|
-
t.datetime "updated_at", null: false
|
274
|
-
t.integer "creator_id"
|
275
|
-
t.integer "updater_id"
|
276
|
-
t.string "upload_hash"
|
277
|
-
t.text "cached_tag_list"
|
278
|
-
t.string "image_file_uid"
|
279
|
-
t.integer "image_file_size"
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
unless table_exists?('alchemy_sites')
|
284
|
-
create_table "alchemy_sites" do |t|
|
285
|
-
t.string "host"
|
286
|
-
t.string "name"
|
287
|
-
t.datetime "created_at", null: false
|
288
|
-
t.datetime "updated_at", null: false
|
289
|
-
t.boolean "public", default: false
|
290
|
-
t.text "aliases"
|
291
|
-
t.boolean "redirect_to_primary_host"
|
292
|
-
end
|
293
|
-
add_index "alchemy_sites", ["host", "public"], name: "alchemy_sites_public_hosts_idx"
|
294
|
-
add_index "alchemy_sites", ["host"], name: "index_alchemy_sites_on_host"
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
def down
|
299
|
-
if table_exists?('alchemy_attachments')
|
300
|
-
drop_table "alchemy_attachments"
|
301
|
-
end
|
302
|
-
|
303
|
-
if table_exists?('alchemy_cells')
|
304
|
-
drop_table "alchemy_cells"
|
305
|
-
end
|
306
|
-
|
307
|
-
if table_exists?('alchemy_contents')
|
308
|
-
drop_table "alchemy_contents"
|
309
|
-
end
|
310
|
-
|
311
|
-
if table_exists?('alchemy_elements')
|
312
|
-
drop_table "alchemy_elements"
|
313
|
-
end
|
314
|
-
|
315
|
-
if table_exists?('alchemy_elements_alchemy_pages')
|
316
|
-
drop_table "alchemy_elements_alchemy_pages"
|
317
|
-
end
|
318
|
-
|
319
|
-
if table_exists?('alchemy_essence_booleans')
|
320
|
-
drop_table "alchemy_essence_booleans"
|
321
|
-
end
|
322
|
-
|
323
|
-
if table_exists?('alchemy_essence_dates')
|
324
|
-
drop_table "alchemy_essence_dates"
|
325
|
-
end
|
326
|
-
|
327
|
-
if table_exists?('alchemy_essence_files')
|
328
|
-
drop_table "alchemy_essence_files"
|
329
|
-
end
|
330
|
-
|
331
|
-
if table_exists?('alchemy_essence_htmls')
|
332
|
-
drop_table "alchemy_essence_htmls"
|
333
|
-
end
|
334
|
-
|
335
|
-
if table_exists?('alchemy_essence_links')
|
336
|
-
drop_table "alchemy_essence_links"
|
337
|
-
end
|
338
|
-
|
339
|
-
if table_exists?('alchemy_essence_pictures')
|
340
|
-
drop_table "alchemy_essence_pictures"
|
341
|
-
end
|
342
|
-
|
343
|
-
if table_exists?('alchemy_essence_richtexts')
|
344
|
-
drop_table "alchemy_essence_richtexts"
|
345
|
-
end
|
346
|
-
|
347
|
-
if table_exists?('alchemy_essence_selects')
|
348
|
-
drop_table "alchemy_essence_selects"
|
349
|
-
end
|
350
|
-
|
351
|
-
if table_exists?('alchemy_essence_texts')
|
352
|
-
drop_table "alchemy_essence_texts"
|
353
|
-
end
|
354
|
-
|
355
|
-
if table_exists?('alchemy_folded_pages')
|
356
|
-
drop_table "alchemy_folded_pages"
|
357
|
-
end
|
358
|
-
|
359
|
-
if table_exists?('alchemy_languages')
|
360
|
-
drop_table "alchemy_languages"
|
361
|
-
end
|
362
|
-
|
363
|
-
if table_exists?('alchemy_legacy_page_urls')
|
364
|
-
drop_table "alchemy_legacy_page_urls"
|
365
|
-
end
|
366
|
-
|
367
|
-
if table_exists?('alchemy_pages')
|
368
|
-
drop_table "alchemy_pages"
|
369
|
-
end
|
370
|
-
|
371
|
-
if table_exists?('alchemy_pictures')
|
372
|
-
drop_table "alchemy_pictures"
|
373
|
-
end
|
374
|
-
|
375
|
-
if table_exists?('alchemy_sites')
|
376
|
-
drop_table "alchemy_sites"
|
377
|
-
end
|
378
|
-
|
379
|
-
end
|
380
|
-
end
|