cardboard_cms 0.1.8 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -5
- data/README.md +14 -14
- data/app/assets/javascripts/cardboard/admin.js +3 -24
- data/app/assets/javascripts/cardboard/datepicker.js +1 -5
- data/app/assets/javascripts/cardboard/rich_text.js +1 -1
- data/app/assets/javascripts/cardboard/search_filter.js +1 -1
- data/app/assets/stylesheets/cardboard/_bootstrap-select.css.scss +1 -1
- data/app/assets/stylesheets/cardboard/_framework.css.scss +1 -1
- data/app/assets/stylesheets/cardboard/_main_topbar.css.scss +1 -1
- data/app/controllers/cardboard/pages_controller.rb +25 -1
- data/app/controllers/pages_controller.rb +12 -11
- data/app/helpers/cardboard/resource_helper.rb +1 -1
- data/app/models/cardboard/field/boolean.rb +1 -1
- data/app/models/cardboard/field.rb +21 -9
- data/app/models/cardboard/page.rb +19 -30
- data/app/models/cardboard/page_part.rb +13 -46
- data/app/models/cardboard/setting.rb +3 -0
- data/app/models/cardboard/template.rb +15 -0
- data/app/views/cardboard/fields/_base_input.html.slim +1 -1
- data/app/views/cardboard/fields/_boolean.html.slim +2 -2
- data/app/views/cardboard/fields/_date.html.slim +1 -1
- data/app/views/cardboard/fields/_external_link.html.slim +2 -2
- data/app/views/cardboard/fields/_file.html.slim +4 -4
- data/app/views/cardboard/fields/_image.html.slim +2 -2
- data/app/views/cardboard/fields/_resource_link.html.slim +2 -2
- data/app/views/cardboard/fields/_rich_text.html.slim +1 -1
- data/app/views/cardboard/fields/_string.html.slim +1 -1
- data/app/views/cardboard/pages/_error.html.slim +1 -1
- data/app/views/cardboard/pages/_part_fields.html.slim +19 -0
- data/app/views/cardboard/pages/_sidebar.html.slim +8 -4
- data/app/views/cardboard/pages/_url_field.html.slim +6 -8
- data/app/views/cardboard/pages/edit.html.slim +24 -15
- data/app/views/cardboard/pages/new.html.slim +7 -0
- data/app/views/cardboard/pages/show.html.slim +3 -3
- data/app/views/cardboard/resources/_advanced_search.html.slim +1 -1
- data/app/views/cardboard/resources/_search_helper.html.slim +3 -3
- data/app/views/cardboard/resources/_simple_search.html.slim +1 -1
- data/app/views/cardboard/settings/index.html.slim +12 -3
- data/app/views/cardboard/super_user/index.html.slim +1 -1
- data/app/views/layouts/cardboard/_main_sidebar.html.slim +1 -1
- data/app/views/layouts/cardboard/_main_topbar.html.slim +1 -1
- data/app/views/layouts/cardboard/application.html.slim +1 -1
- data/cardboard.gemspec +1 -1
- data/config/routes.rb +2 -0
- data/db/migrate/1_create_cardboard.rb +63 -0
- data/lib/cardboard/engine.rb +1 -11
- data/lib/cardboard/helpers/seed.rb +31 -30
- data/lib/cardboard/version.rb +1 -1
- data/lib/cardboard_cms.rb +6 -2
- data/lib/generators/cardboard/install/install_generator.rb +5 -13
- data/lib/tasks/cardboard_tasks.rake +5 -3
- data/test/dummy/app/views/{pages → templates}/about-us.html.slim +0 -0
- data/test/dummy/app/views/templates/home.html.slim +5 -0
- data/test/dummy/config/cardboard.yml +1 -1
- data/test/dummy/db/schema.rb +7 -39
- data/test/dummy/db/seeds.rb +1 -1
- data/test/factories.rb +40 -1
- data/test/integration/page_editing_test.rb +2 -1
- data/test/integration/seeding_test.rb +16 -31
- data/test/models/field_test.rb +42 -28
- data/test/models/page_test.rb +1 -1
- data/test/models/template_test.rb +11 -0
- data/test/test_helper.rb +5 -1
- metadata +13 -29
- data/app/views/cardboard/pages/_subpart_fields.html.slim +0 -20
- data/lib/generators/cardboard/install/templates/migrations/1_create_cardboard_fields.rb +0 -21
- data/lib/generators/cardboard/install/templates/migrations/2_create_cardboard_page_parts.rb +0 -17
- data/lib/generators/cardboard/install/templates/migrations/3_create_cardboard_pages.rb +0 -18
- data/lib/generators/cardboard/install/templates/migrations/4_create_cardboard_settings.rb +0 -14
- data/test/dummy/app/views/pages/home.html.slim +0 -3
- data/test/dummy/db/migrate/20130426021522_create_news_posts.rb +0 -10
- data/test/dummy/db/migrate/20130501195423_create_icescreams.rb +0 -10
- data/test/dummy/db/migrate/20130502165540_create_beans.rb +0 -12
- data/test/dummy/db/migrate/20130522151358_create_cardboard_fields.rb +0 -21
- data/test/dummy/db/migrate/20130522151359_create_cardboard_page_parts.rb +0 -17
- data/test/dummy/db/migrate/20130522151400_create_cardboard_pages.rb +0 -18
- data/test/dummy/db/migrate/20130522151401_create_cardboard_settings.rb +0 -14
- data/test/dummy/db/migrate/20130607132558_create_admins.rb +0 -9
- data/vendor/assets/javascripts/cardboard/jquery.pjax.js +0 -840
data/test/dummy/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20130417134832) do
|
15
15
|
|
16
16
|
create_table "admin_users", force: true do |t|
|
17
17
|
t.string "email", default: "", null: false
|
@@ -29,31 +29,10 @@ ActiveRecord::Schema.define(version: 20130607132558) do
|
|
29
29
|
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
|
30
30
|
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
31
31
|
|
32
|
-
create_table "admins", force: true do |t|
|
33
|
-
t.string "name"
|
34
|
-
t.datetime "created_at"
|
35
|
-
t.datetime "updated_at"
|
36
|
-
end
|
37
|
-
|
38
|
-
create_table "beans", force: true do |t|
|
39
|
-
t.string "color"
|
40
|
-
t.string "flavor"
|
41
|
-
t.boolean "from_mexico"
|
42
|
-
t.integer "size"
|
43
|
-
t.datetime "created_at"
|
44
|
-
t.datetime "updated_at"
|
45
|
-
end
|
46
|
-
|
47
32
|
create_table "cardboard_fields", force: true do |t|
|
48
33
|
t.string "identifier"
|
49
|
-
t.string "label"
|
50
34
|
t.string "type"
|
51
|
-
t.boolean "required", default: true
|
52
|
-
t.integer "page_part_id"
|
53
|
-
t.integer "position"
|
54
35
|
t.text "value_uid"
|
55
|
-
t.string "hint"
|
56
|
-
t.string "placeholder"
|
57
36
|
t.integer "object_with_field_id"
|
58
37
|
t.string "object_with_field_type"
|
59
38
|
t.datetime "created_at"
|
@@ -66,9 +45,6 @@ ActiveRecord::Schema.define(version: 20130607132558) do
|
|
66
45
|
create_table "cardboard_page_parts", force: true do |t|
|
67
46
|
t.string "identifier"
|
68
47
|
t.integer "position"
|
69
|
-
t.integer "parent_part_id"
|
70
|
-
t.boolean "repeatable"
|
71
|
-
t.string "label"
|
72
48
|
t.integer "page_id"
|
73
49
|
t.datetime "created_at"
|
74
50
|
t.datetime "updated_at"
|
@@ -76,7 +52,6 @@ ActiveRecord::Schema.define(version: 20130607132558) do
|
|
76
52
|
|
77
53
|
add_index "cardboard_page_parts", ["identifier"], name: "index_cardboard_page_parts_on_identifier"
|
78
54
|
add_index "cardboard_page_parts", ["page_id"], name: "index_cardboard_page_parts_on_page_id"
|
79
|
-
add_index "cardboard_page_parts", ["parent_part_id"], name: "index_cardboard_page_parts_on_parent_part_id"
|
80
55
|
|
81
56
|
create_table "cardboard_pages", force: true do |t|
|
82
57
|
t.string "title"
|
@@ -87,6 +62,7 @@ ActiveRecord::Schema.define(version: 20130607132558) do
|
|
87
62
|
t.text "meta_seo"
|
88
63
|
t.boolean "in_menu", default: true
|
89
64
|
t.string "identifier"
|
65
|
+
t.integer "template_id"
|
90
66
|
t.datetime "created_at"
|
91
67
|
t.datetime "updated_at"
|
92
68
|
end
|
@@ -98,23 +74,15 @@ ActiveRecord::Schema.define(version: 20130607132558) do
|
|
98
74
|
t.string "name"
|
99
75
|
t.text "value"
|
100
76
|
t.text "default_value"
|
101
|
-
t.text "
|
102
|
-
t.string "hint"
|
103
|
-
t.string "format", default: "string"
|
77
|
+
t.text "template"
|
104
78
|
end
|
105
79
|
|
106
80
|
add_index "cardboard_settings", ["name"], name: "index_cardboard_settings_on_name"
|
107
81
|
|
108
|
-
create_table "
|
109
|
-
t.string "
|
110
|
-
t.
|
111
|
-
t.
|
112
|
-
t.datetime "updated_at"
|
113
|
-
end
|
114
|
-
|
115
|
-
create_table "news_posts", force: true do |t|
|
116
|
-
t.string "title"
|
117
|
-
t.string "link"
|
82
|
+
create_table "cardboard_templates", force: true do |t|
|
83
|
+
t.string "name"
|
84
|
+
t.text "fields"
|
85
|
+
t.string "identifier"
|
118
86
|
t.datetime "created_at"
|
119
87
|
t.datetime "updated_at"
|
120
88
|
end
|
data/test/dummy/db/seeds.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
puts "Generating Admin User"
|
2
|
-
AdminUser.create(email: "michael@smashingboxes.com", password: "
|
2
|
+
AdminUser.create(email: "michael@smashingboxes.com", password: "password") if AdminUser.first.nil?
|
data/test/factories.rb
CHANGED
@@ -8,10 +8,49 @@ FactoryGirl.define do
|
|
8
8
|
|
9
9
|
factory :page, class: Cardboard::Page do
|
10
10
|
sequence(:identifier) { |n| "page#{n}" }
|
11
|
+
template
|
12
|
+
end
|
13
|
+
|
14
|
+
factory :template, class: Cardboard::Template do
|
15
|
+
sequence(:identifier) { |n| "template#{n}" }
|
16
|
+
fields {
|
17
|
+
{
|
18
|
+
intro:{
|
19
|
+
fields:{
|
20
|
+
text:{
|
21
|
+
type: "string",
|
22
|
+
default: "default text",
|
23
|
+
label: "ok",
|
24
|
+
required: "true",
|
25
|
+
hint: "this is a hint",
|
26
|
+
placeholder: "Text"
|
27
|
+
},
|
28
|
+
image:{
|
29
|
+
type: "image",
|
30
|
+
default: "CrashTest.jpg"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
},
|
34
|
+
slideshow:{
|
35
|
+
repeatable: true,
|
36
|
+
fields:{
|
37
|
+
image:{
|
38
|
+
type: "image",
|
39
|
+
required: "true"
|
40
|
+
},
|
41
|
+
desc:{
|
42
|
+
required: "true",
|
43
|
+
type: "string"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}.with_indifferent_access
|
48
|
+
}
|
11
49
|
end
|
12
50
|
|
13
51
|
factory :page_part, class: Cardboard::PagePart do
|
14
|
-
|
52
|
+
identifier { "slideshow" }
|
53
|
+
page
|
15
54
|
end
|
16
55
|
|
17
56
|
factory :boolean_field, class: Cardboard::Field::Boolean do
|
@@ -42,6 +42,7 @@ describe "Page editing integration" do
|
|
42
42
|
}
|
43
43
|
}.with_indifferent_access
|
44
44
|
Cardboard::Seed.populate_pages(@file_hash)
|
45
|
+
Cardboard::Page.create(template: Cardboard::Template.first, identifier: "home")
|
45
46
|
user = FactoryGirl.create(:admin_user)
|
46
47
|
login_as(user, :scope => :admin_user)
|
47
48
|
visit cardboard.edit_page_path(Cardboard::Page.root)
|
@@ -61,7 +62,7 @@ describe "Page editing integration" do
|
|
61
62
|
# end
|
62
63
|
|
63
64
|
it 'should see an error if a repeatable part is submitted with an empty required field' do
|
64
|
-
fill_in "
|
65
|
+
fill_in "page_parts_attributes_1_fields_attributes_1_value", with: "Hello"
|
65
66
|
find(".btn.add_fields").click
|
66
67
|
find_button('Save').click
|
67
68
|
assert page.has_css?(".alert-error"), "ERROR: Should have an error message"
|
@@ -4,7 +4,7 @@ describe "Seeding" do
|
|
4
4
|
before do
|
5
5
|
DatabaseCleaner.clean
|
6
6
|
@file_hash = {
|
7
|
-
|
7
|
+
templates: {
|
8
8
|
home:{
|
9
9
|
title: "Welcome",
|
10
10
|
position: 0,
|
@@ -53,41 +53,26 @@ describe "Seeding" do
|
|
53
53
|
end
|
54
54
|
describe 'Pages' do
|
55
55
|
before do
|
56
|
-
Cardboard::Seed.
|
57
|
-
@
|
58
|
-
@
|
59
|
-
@last_part = @page.parts.last
|
56
|
+
Cardboard::Seed.populate_templates(@file_hash)
|
57
|
+
@template = Cardboard::Template.first
|
58
|
+
@page = @template.pages.build
|
60
59
|
end
|
61
|
-
|
62
|
-
|
63
|
-
assert_equal
|
64
|
-
|
65
|
-
it 'Should add parts' do
|
66
|
-
assert_equal "slideshow", @part.identifier
|
67
|
-
assert_equal "intro", @last_part.identifier
|
68
|
-
end
|
69
|
-
it 'Should add fields' do
|
70
|
-
refute_nil @page.get("intro").fields.where(identifier: "text")
|
60
|
+
|
61
|
+
it "Should have a template" do
|
62
|
+
assert_equal @file_hash[:templates][:home][:parts], Cardboard::Template.find_by(:identifier => "home").fields
|
63
|
+
assert_equal @file_hash[:templates][:home][:title], Cardboard::Template.find_by(:identifier => "home").name
|
71
64
|
end
|
65
|
+
|
72
66
|
describe 'Modified yml file' do
|
73
67
|
before do
|
74
|
-
@file_hash[:
|
75
|
-
@file_hash[:
|
76
|
-
@file_hash[:
|
77
|
-
Cardboard::Seed.
|
78
|
-
@page = Cardboard::Page.root
|
79
|
-
@part = @page.parts.first
|
80
|
-
end
|
81
|
-
it 'Should remove old pages' do
|
82
|
-
assert_nil Cardboard::Page.where(:identifier => "about_us").first
|
83
|
-
assert_equal 1, Cardboard::Page.count
|
84
|
-
end
|
85
|
-
it 'Should remove old parts' do
|
86
|
-
assert_nil @page.get("slideshow")
|
87
|
-
refute_nil @page.get("intro")
|
68
|
+
@file_hash[:templates].delete(:about_us)
|
69
|
+
@file_hash[:templates][:home][:parts].delete(:slideshow)
|
70
|
+
@file_hash[:templates][:home][:parts][:intro][:fields].delete(:text)
|
71
|
+
Cardboard::Seed.populate_templates(@file_hash)
|
88
72
|
end
|
89
|
-
it 'Should remove old
|
90
|
-
assert_nil
|
73
|
+
it 'Should remove old templates' do
|
74
|
+
assert_nil Cardboard::Template.where(:identifier => "about_us").first
|
75
|
+
assert_equal 1, Cardboard::Template.count
|
91
76
|
end
|
92
77
|
end
|
93
78
|
end
|
data/test/models/field_test.rb
CHANGED
@@ -4,12 +4,25 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
describe Cardboard::Field do
|
6
6
|
before do
|
7
|
-
|
7
|
+
|
8
|
+
@template = build :template, fields: {slideshow:{ fields: {
|
9
|
+
boolean_field: {type: "boolean"},
|
10
|
+
date_field: {type: "date"},
|
11
|
+
decimal_field: {type: "decimal"},
|
12
|
+
file_field: {type: "file"},
|
13
|
+
image_field: {type: "image"},
|
14
|
+
integer_field: {type: "integer"},
|
15
|
+
rich_text_field: {type: "rich_text"},
|
16
|
+
string_field: {type: "string"}
|
17
|
+
}}
|
18
|
+
}
|
19
|
+
@page = build :page, template: @template
|
20
|
+
@part = build :page_part, page: @page, identifier: "slideshow"
|
8
21
|
end
|
9
22
|
|
10
23
|
it "should accept valid boolean values" do
|
11
|
-
@field = build :boolean_field
|
12
|
-
assert_equal true, @field.save
|
24
|
+
@field = build :boolean_field, object_with_field: @part, identifier: "boolean_field"
|
25
|
+
# assert_equal true, @field.save
|
13
26
|
assert_equal true, @field.update_attributes(:value => "")
|
14
27
|
["t", "1", "true", true].each do |val|
|
15
28
|
assert_equal true, @field.update_attributes(:value => val)
|
@@ -23,39 +36,40 @@ describe Cardboard::Field do
|
|
23
36
|
end
|
24
37
|
|
25
38
|
it "should accept valid date values" do
|
26
|
-
|
27
|
-
|
39
|
+
|
40
|
+
@field = build :date_field, object_with_field: @part, identifier: "date_field"
|
41
|
+
# assert_equal true, @field.save
|
28
42
|
assert_equal true, @field.update_attributes(value: "1900-01-01")
|
29
43
|
assert_equal Time.new('1900', '01', '01', '12', '00'), @field.value #chronic dates are at noon by default
|
30
44
|
end
|
31
45
|
it "should not accept invalid date values" do
|
32
|
-
@field = build :date_field
|
33
|
-
@field.required = true
|
34
|
-
assert_equal
|
46
|
+
@field = build :date_field, object_with_field: @part, identifier: "date_field"
|
47
|
+
# @field.required = true
|
48
|
+
assert_equal false, @field.save
|
35
49
|
assert_equal false, @field.update_attributes(:value => "")
|
36
50
|
assert_equal false, @field.update_attributes(:value => "something")
|
37
51
|
end
|
38
52
|
|
39
53
|
it "should accept valid decimal numbers" do
|
40
|
-
@field = build :decimal_field
|
41
|
-
assert_equal true, @field.save
|
54
|
+
@field = build :decimal_field, object_with_field: @part, identifier: "decimal_field"
|
55
|
+
# assert_equal true, @field.save
|
42
56
|
assert_equal true, @field.update_attributes(:value => 1.23)
|
43
57
|
assert_equal 1.23, @field.value
|
44
58
|
assert_equal true, @field.update_attributes(:value => "1.23")
|
45
59
|
assert_equal 1.23, @field.value
|
46
60
|
end
|
47
61
|
it "should not accept invalid decimal numbers" do
|
48
|
-
@field = build :decimal_field
|
49
|
-
@field.required = true
|
50
|
-
assert_equal true, @field.save
|
62
|
+
@field = build :decimal_field, object_with_field: @part, identifier: "decimal_field"
|
63
|
+
# @field.required = true
|
64
|
+
# assert_equal true, @field.save
|
51
65
|
assert_equal false, @field.update_attributes(:value => "")
|
52
66
|
assert_equal false, @field.update_attributes(:value => "something")
|
53
67
|
end
|
54
68
|
|
55
69
|
it "should not accept invalid files" do
|
56
|
-
@field = build :file_field
|
57
|
-
@field.required = true
|
58
|
-
assert_equal true, @field.save
|
70
|
+
@field = build :file_field, object_with_field: @part, identifier: "file_field"
|
71
|
+
# @field.required = true
|
72
|
+
# assert_equal true, @field.save
|
59
73
|
|
60
74
|
assert_equal false, @field.update_attributes(:value => "")
|
61
75
|
assert_equal nil, @field.value_uid
|
@@ -63,9 +77,9 @@ describe Cardboard::Field do
|
|
63
77
|
end
|
64
78
|
|
65
79
|
it "should not accept invalid images" do
|
66
|
-
@field = build :image_field
|
67
|
-
@field.required = true
|
68
|
-
assert_equal true, @field.save
|
80
|
+
@field = build :image_field, object_with_field: @part, identifier: "image_field"
|
81
|
+
# @field.required = true
|
82
|
+
# assert_equal true, @field.save
|
69
83
|
|
70
84
|
assert_equal false, @field.update_attributes(:value => "")
|
71
85
|
assert_equal nil, @field.value_uid
|
@@ -73,9 +87,9 @@ describe Cardboard::Field do
|
|
73
87
|
end
|
74
88
|
|
75
89
|
it "should accept valid integer numbers" do
|
76
|
-
@field = build :integer_field
|
77
|
-
assert_equal true, @field.save
|
78
|
-
@field.required = true
|
90
|
+
@field = build :integer_field, object_with_field: @part, identifier: "integer_field"
|
91
|
+
# assert_equal true, @field.save
|
92
|
+
# @field.required = true
|
79
93
|
assert_equal false, @field.update_attributes(:value => "")
|
80
94
|
assert_equal false, @field.update_attributes(:value => 1.23)
|
81
95
|
assert_equal true, @field.update_attributes(:value => "123")
|
@@ -83,17 +97,17 @@ describe Cardboard::Field do
|
|
83
97
|
end
|
84
98
|
|
85
99
|
it "should accept valid rich text" do
|
86
|
-
@field = build :rich_text_field
|
87
|
-
assert_equal true, @field.save
|
88
|
-
@field.required = true
|
100
|
+
@field = build :rich_text_field, object_with_field: @part, identifier: "rich_text_field"
|
101
|
+
# assert_equal true, @field.save
|
102
|
+
# @field.required = true
|
89
103
|
assert_equal true, @field.update_attributes(:value => "something<script>alert('bad')</script>")
|
90
104
|
assert_equal "something", @field.value
|
91
105
|
end
|
92
106
|
|
93
107
|
it "should accept valid string" do
|
94
|
-
@field = build :string_field
|
95
|
-
assert_equal true, @field.save
|
96
|
-
@field.required = true
|
108
|
+
@field = build :string_field, object_with_field: @part, identifier: "string_field"
|
109
|
+
# assert_equal true, @field.save
|
110
|
+
# @field.required = true
|
97
111
|
assert_equal true, @field.update_attributes(:value => "something")
|
98
112
|
assert_equal "something", @field.value
|
99
113
|
assert_equal false, @field.update_attributes(:value => "")
|
data/test/models/page_test.rb
CHANGED
@@ -78,7 +78,7 @@ describe Cardboard::Page do
|
|
78
78
|
|
79
79
|
it 'Preorder of results' do
|
80
80
|
DatabaseCleaner.clean
|
81
|
-
|
81
|
+
Cardboard::Page.clear_arranged_pages
|
82
82
|
page1 = create :page, position_position: 1
|
83
83
|
page2 = create :page, position_position: 2
|
84
84
|
subpage1 = create :page, parent: page1, position_position: 1
|
data/test/test_helper.rb
CHANGED
@@ -2,7 +2,11 @@ require 'simplecov'
|
|
2
2
|
SimpleCov.start 'rails'
|
3
3
|
|
4
4
|
ENV["RAILS_ENV"] = "test"
|
5
|
-
require File.expand_path('../dummy/config/environment', __FILE__)
|
5
|
+
require File.expand_path('../dummy/config/environment', __FILE__ )
|
6
|
+
|
7
|
+
Dir[Cardboard::Engine.root.join("app", "models","cardboard", "field", "*.rb").to_s].each {|file| require file }
|
8
|
+
|
9
|
+
|
6
10
|
require "rails/test_help"
|
7
11
|
|
8
12
|
require 'faker'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardboard_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Elfassy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -306,7 +306,7 @@ dependencies:
|
|
306
306
|
- !ruby/object:Gem::Version
|
307
307
|
version: 1.0.0
|
308
308
|
- !ruby/object:Gem::Dependency
|
309
|
-
name:
|
309
|
+
name: turbolinks
|
310
310
|
requirement: !ruby/object:Gem::Requirement
|
311
311
|
requirements:
|
312
312
|
- - '>='
|
@@ -549,6 +549,7 @@ files:
|
|
549
549
|
- app/models/cardboard/page.rb
|
550
550
|
- app/models/cardboard/page_part.rb
|
551
551
|
- app/models/cardboard/setting.rb
|
552
|
+
- app/models/cardboard/template.rb
|
552
553
|
- app/views/cardboard/dashboard/index.html.slim
|
553
554
|
- app/views/cardboard/fields/_base_input.html.slim
|
554
555
|
- app/views/cardboard/fields/_boolean.html.slim
|
@@ -561,12 +562,13 @@ files:
|
|
561
562
|
- app/views/cardboard/fields/_string.html.slim
|
562
563
|
- app/views/cardboard/my_account/edit.html.slim
|
563
564
|
- app/views/cardboard/pages/_error.html.slim
|
565
|
+
- app/views/cardboard/pages/_part_fields.html.slim
|
564
566
|
- app/views/cardboard/pages/_seo.html.slim
|
565
567
|
- app/views/cardboard/pages/_sidebar.html.slim
|
566
|
-
- app/views/cardboard/pages/_subpart_fields.html.slim
|
567
568
|
- app/views/cardboard/pages/_url_field.html.slim
|
568
569
|
- app/views/cardboard/pages/edit.html.slim
|
569
570
|
- app/views/cardboard/pages/index.html.slim
|
571
|
+
- app/views/cardboard/pages/new.html.slim
|
570
572
|
- app/views/cardboard/pages/show.html.slim
|
571
573
|
- app/views/cardboard/resources/_advanced_search.html.slim
|
572
574
|
- app/views/cardboard/resources/_search_button.html.slim
|
@@ -587,6 +589,7 @@ files:
|
|
587
589
|
- config/initializers/simple_form_bootstrap.rb
|
588
590
|
- config/locales/simple_form.en.yml
|
589
591
|
- config/routes.rb
|
592
|
+
- db/migrate/1_create_cardboard.rb
|
590
593
|
- doc/apple-touch-icon.png
|
591
594
|
- doc/classes/Cardboard.html
|
592
595
|
- doc/classes/Cardboard/AdminController.html
|
@@ -680,10 +683,6 @@ files:
|
|
680
683
|
- lib/generators/cardboard/install/templates/cardboard.rb.erb
|
681
684
|
- lib/generators/cardboard/install/templates/cardboard.yml
|
682
685
|
- lib/generators/cardboard/install/templates/index.html.erb
|
683
|
-
- lib/generators/cardboard/install/templates/migrations/1_create_cardboard_fields.rb
|
684
|
-
- lib/generators/cardboard/install/templates/migrations/2_create_cardboard_page_parts.rb
|
685
|
-
- lib/generators/cardboard/install/templates/migrations/3_create_cardboard_pages.rb
|
686
|
-
- lib/generators/cardboard/install/templates/migrations/4_create_cardboard_settings.rb
|
687
686
|
- lib/generators/cardboard/resource/resource_generator.rb
|
688
687
|
- lib/generators/cardboard/resource/templates/admin_controller.rb
|
689
688
|
- lib/generators/cardboard/resource/templates/slim/_fields.html.slim
|
@@ -729,13 +728,13 @@ files:
|
|
729
728
|
- test/dummy/app/views/cardboard/pianos/show.html.slim
|
730
729
|
- test/dummy/app/views/layouts/application.html.slim
|
731
730
|
- test/dummy/app/views/main/index.html.slim
|
732
|
-
- test/dummy/app/views/pages/about-us.html.slim
|
733
|
-
- test/dummy/app/views/pages/home.html.slim
|
734
731
|
- test/dummy/app/views/pianos/_form.html.erb
|
735
732
|
- test/dummy/app/views/pianos/edit.html.erb
|
736
733
|
- test/dummy/app/views/pianos/index.html.erb
|
737
734
|
- test/dummy/app/views/pianos/new.html.erb
|
738
735
|
- test/dummy/app/views/pianos/show.html.erb
|
736
|
+
- test/dummy/app/views/templates/about-us.html.slim
|
737
|
+
- test/dummy/app/views/templates/home.html.slim
|
739
738
|
- test/dummy/config.ru
|
740
739
|
- test/dummy/config/application.rb
|
741
740
|
- test/dummy/config/boot.rb
|
@@ -758,14 +757,6 @@ files:
|
|
758
757
|
- test/dummy/config/routes.rb
|
759
758
|
- test/dummy/db/migrate/20130403142235_create_pianos.rb
|
760
759
|
- test/dummy/db/migrate/20130417134832_add_devise_to_admin_users.rb
|
761
|
-
- test/dummy/db/migrate/20130426021522_create_news_posts.rb
|
762
|
-
- test/dummy/db/migrate/20130501195423_create_icescreams.rb
|
763
|
-
- test/dummy/db/migrate/20130502165540_create_beans.rb
|
764
|
-
- test/dummy/db/migrate/20130522151358_create_cardboard_fields.rb
|
765
|
-
- test/dummy/db/migrate/20130522151359_create_cardboard_page_parts.rb
|
766
|
-
- test/dummy/db/migrate/20130522151400_create_cardboard_pages.rb
|
767
|
-
- test/dummy/db/migrate/20130522151401_create_cardboard_settings.rb
|
768
|
-
- test/dummy/db/migrate/20130607132558_create_admins.rb
|
769
760
|
- test/dummy/db/schema.rb
|
770
761
|
- test/dummy/db/seeds.rb
|
771
762
|
- test/dummy/lib/assets/.gitkeep
|
@@ -838,10 +829,10 @@ files:
|
|
838
829
|
- test/integration/seeding_test.rb
|
839
830
|
- test/models/field_test.rb
|
840
831
|
- test/models/page_test.rb
|
832
|
+
- test/models/template_test.rb
|
841
833
|
- test/test_helper.rb
|
842
834
|
- vendor/assets/javascripts/cardboard/bootstrap-select.js
|
843
835
|
- vendor/assets/javascripts/cardboard/jquery.livesearch.js
|
844
|
-
- vendor/assets/javascripts/cardboard/jquery.pjax.js
|
845
836
|
- vendor/assets/javascripts/cardboard/jquery.wysihtml5_size_matters.js.coffee
|
846
837
|
- vendor/assets/javascripts/cardboard/jquery.wysihtml5imgresizer.js
|
847
838
|
- vendor/assets/javascripts/cardboard/wysihtml5-0.4.0pre.js
|
@@ -906,13 +897,13 @@ test_files:
|
|
906
897
|
- test/dummy/app/views/cardboard/pianos/show.html.slim
|
907
898
|
- test/dummy/app/views/layouts/application.html.slim
|
908
899
|
- test/dummy/app/views/main/index.html.slim
|
909
|
-
- test/dummy/app/views/pages/about-us.html.slim
|
910
|
-
- test/dummy/app/views/pages/home.html.slim
|
911
900
|
- test/dummy/app/views/pianos/_form.html.erb
|
912
901
|
- test/dummy/app/views/pianos/edit.html.erb
|
913
902
|
- test/dummy/app/views/pianos/index.html.erb
|
914
903
|
- test/dummy/app/views/pianos/new.html.erb
|
915
904
|
- test/dummy/app/views/pianos/show.html.erb
|
905
|
+
- test/dummy/app/views/templates/about-us.html.slim
|
906
|
+
- test/dummy/app/views/templates/home.html.slim
|
916
907
|
- test/dummy/config.ru
|
917
908
|
- test/dummy/config/application.rb
|
918
909
|
- test/dummy/config/boot.rb
|
@@ -935,14 +926,6 @@ test_files:
|
|
935
926
|
- test/dummy/config/routes.rb
|
936
927
|
- test/dummy/db/migrate/20130403142235_create_pianos.rb
|
937
928
|
- test/dummy/db/migrate/20130417134832_add_devise_to_admin_users.rb
|
938
|
-
- test/dummy/db/migrate/20130426021522_create_news_posts.rb
|
939
|
-
- test/dummy/db/migrate/20130501195423_create_icescreams.rb
|
940
|
-
- test/dummy/db/migrate/20130502165540_create_beans.rb
|
941
|
-
- test/dummy/db/migrate/20130522151358_create_cardboard_fields.rb
|
942
|
-
- test/dummy/db/migrate/20130522151359_create_cardboard_page_parts.rb
|
943
|
-
- test/dummy/db/migrate/20130522151400_create_cardboard_pages.rb
|
944
|
-
- test/dummy/db/migrate/20130522151401_create_cardboard_settings.rb
|
945
|
-
- test/dummy/db/migrate/20130607132558_create_admins.rb
|
946
929
|
- test/dummy/db/schema.rb
|
947
930
|
- test/dummy/db/seeds.rb
|
948
931
|
- test/dummy/lib/assets/.gitkeep
|
@@ -1015,4 +998,5 @@ test_files:
|
|
1015
998
|
- test/integration/seeding_test.rb
|
1016
999
|
- test/models/field_test.rb
|
1017
1000
|
- test/models/page_test.rb
|
1001
|
+
- test/models/template_test.rb
|
1018
1002
|
- test/test_helper.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
.nested-fields
|
2
|
-
|
3
|
-
- if subpart.repeatable?
|
4
|
-
.right= link_to_remove_association "x", f, class: "btn btn-danger"
|
5
|
-
|
6
|
-
- for field in subpart.fields.sort_by(&:position)
|
7
|
-
|
8
|
-
= f.simple_fields_for :fields, field do |w|
|
9
|
-
|
10
|
-
/ TODO: Refactor!
|
11
|
-
- if field.new_record?
|
12
|
-
|
13
|
-
- for attribute in [:identifier, :label, :type, :required, :position, :hint, :placeholder]
|
14
|
-
= w.input attribute, as: :hidden unless field.send(attribute).nil?
|
15
|
-
|
16
|
-
- begin
|
17
|
-
= render "cardboard/fields/#{field.type}", f: w
|
18
|
-
- rescue ActionView::MissingTemplate => e
|
19
|
-
= render "cardboard/fields/base_input", f: w
|
20
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class CreateCardboardFields < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :cardboard_fields do |t|
|
4
|
-
t.string :identifier
|
5
|
-
t.string :label
|
6
|
-
t.string :type
|
7
|
-
t.boolean :required, default: true
|
8
|
-
t.belongs_to :page_part
|
9
|
-
t.integer :position
|
10
|
-
t.text :value_uid
|
11
|
-
t.string :hint
|
12
|
-
t.string :placeholder
|
13
|
-
t.integer :object_with_field_id
|
14
|
-
t.string :object_with_field_type
|
15
|
-
|
16
|
-
t.timestamps
|
17
|
-
end
|
18
|
-
add_index :cardboard_fields, :identifier
|
19
|
-
add_index :cardboard_fields, [:object_with_field_id, :object_with_field_type], :name => 'parent_object'
|
20
|
-
end
|
21
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
class CreateCardboardPageParts < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :cardboard_page_parts do |t|
|
4
|
-
t.string :identifier
|
5
|
-
t.integer :position
|
6
|
-
t.integer :parent_part_id
|
7
|
-
t.boolean :repeatable
|
8
|
-
t.string :label
|
9
|
-
t.belongs_to :page
|
10
|
-
|
11
|
-
t.timestamps
|
12
|
-
end
|
13
|
-
add_index :cardboard_page_parts, :page_id
|
14
|
-
add_index :cardboard_page_parts, :identifier
|
15
|
-
add_index :cardboard_page_parts, :parent_part_id
|
16
|
-
end
|
17
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class CreateCardboardPages < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :cardboard_pages do |t|
|
4
|
-
t.string :title
|
5
|
-
t.string :path
|
6
|
-
t.string :slug
|
7
|
-
t.text :slugs_backup
|
8
|
-
t.integer :position
|
9
|
-
t.text :meta_seo
|
10
|
-
t.boolean :in_menu, default: true
|
11
|
-
t.string :identifier, unique: true
|
12
|
-
|
13
|
-
t.timestamps
|
14
|
-
end
|
15
|
-
add_index :cardboard_pages, [:path, :slug], :unique => true
|
16
|
-
add_index :cardboard_pages, :identifier, :unique => true
|
17
|
-
end
|
18
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateCardboardSettings < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table :cardboard_settings do |t|
|
4
|
-
t.string :name
|
5
|
-
t.text :value
|
6
|
-
t.text :default_value
|
7
|
-
t.text :description
|
8
|
-
t.string :hint
|
9
|
-
t.string :format, default: "string"
|
10
|
-
|
11
|
-
end
|
12
|
-
add_index :cardboard_settings, :name
|
13
|
-
end
|
14
|
-
end
|