smithycms 0.7.0 → 0.7.1
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/app/controllers/smithy/pages_controller.rb +4 -8
- data/app/models/smithy/page.rb +24 -13
- data/app/models/smithy/page_content.rb +4 -0
- data/app/models/smithy/permitted_params.rb +1 -1
- data/app/views/smithy/pages/_content_tab.html.erb +2 -2
- data/app/views/smithy/pages/_page_related.html.erb +4 -3
- data/lib/smithy/content_blocks/model.rb +5 -0
- data/lib/smithy/dependencies.rb +1 -0
- data/lib/smithy/version.rb +1 -1
- data/vendor/cache/amoeba-3.0.0.gem +0 -0
- data/vendor/cache/autoprefixer-rails-6.3.6.1.gem +0 -0
- data/vendor/cache/{aws-sdk-2.2.31.gem → aws-sdk-2.3.4.gem} +0 -0
- data/vendor/cache/aws-sdk-core-2.3.4.gem +0 -0
- data/vendor/cache/aws-sdk-resources-2.3.4.gem +0 -0
- data/vendor/cache/concurrent-ruby-1.0.2.gem +0 -0
- data/vendor/cache/fog-core-1.39.0.gem +0 -0
- data/vendor/cache/fog-openstack-0.1.5.gem +0 -0
- data/vendor/cache/fog-softlayer-1.1.1.gem +0 -0
- data/vendor/cache/fog-vsphere-0.7.0.gem +0 -0
- data/vendor/cache/font-awesome-sass-4.6.2.gem +0 -0
- data/vendor/cache/jmespath-1.2.4.gem +0 -0
- data/vendor/cache/json_pure-1.8.3.gem +0 -0
- data/vendor/cache/kramdown-1.11.1.gem +0 -0
- data/vendor/cache/sprockets-3.6.0.gem +0 -0
- data/vendor/cache/tilt-2.0.4.gem +0 -0
- metadata +32 -16
- data/vendor/cache/autoprefixer-rails-6.3.5.gem +0 -0
- data/vendor/cache/aws-sdk-core-2.2.31.gem +0 -0
- data/vendor/cache/aws-sdk-resources-2.2.31.gem +0 -0
- data/vendor/cache/concurrent-ruby-1.0.1.gem +0 -0
- data/vendor/cache/fog-core-1.36.0.gem +0 -0
- data/vendor/cache/fog-openstack-0.1.2.gem +0 -0
- data/vendor/cache/fog-softlayer-1.1.0.gem +0 -0
- data/vendor/cache/fog-vsphere-0.6.3.gem +0 -0
- data/vendor/cache/font-awesome-sass-4.5.0.gem +0 -0
- data/vendor/cache/jmespath-1.1.3.gem +0 -0
- data/vendor/cache/kramdown-1.10.0.gem +0 -0
- data/vendor/cache/sprockets-3.5.2.gem +0 -0
- data/vendor/cache/tilt-2.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48c2bf0cb616167e95c7ff8a531ecdf5e3ede173
|
4
|
+
data.tar.gz: a152a575809aa47063b903a5d3e193bda06aa24b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69b3055518a5aa13e82b8602388443f8f9425072bc7238c23ed34a4f0b9d125fb044edb59cc47c3871da77562d5d915fa8faf9e4d22943a7c95a904b7a090466
|
7
|
+
data.tar.gz: 2268cd87caa8ab7a80b1d55116188c235d9a03f66a945d6ae7726679d9f72eb6971e92fd53f98700a4f3a72633ec668ae395b4c8ca5da35c0051d00ddb635f49
|
@@ -27,6 +27,7 @@ module Smithy
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def create
|
30
|
+
@page.duplicate_content_from(params[:page][:copy_content_from]) if params[:page][:copy_content_from].present? && @page.valid?
|
30
31
|
@page.save
|
31
32
|
flash.notice = "Your page was created #{@page.published? ? 'and published' : 'as a draft'}" if @page.persisted?
|
32
33
|
respond_with @page do |format|
|
@@ -52,13 +53,8 @@ module Smithy
|
|
52
53
|
|
53
54
|
def duplicate
|
54
55
|
old_page = @page
|
55
|
-
@page =
|
56
|
-
@page.
|
57
|
-
@page.title << " (Copy)"
|
58
|
-
@page.permalink.clear
|
59
|
-
@page.browser_title.clear
|
60
|
-
@page.keywords.clear
|
61
|
-
@page.description.clear
|
56
|
+
@page = @page.shallow_copy
|
57
|
+
@page.copy_content_from = old_page.id
|
62
58
|
respond_with @page do |format|
|
63
59
|
format.html { render(action: :new) }
|
64
60
|
end
|
@@ -92,7 +88,7 @@ module Smithy
|
|
92
88
|
end
|
93
89
|
|
94
90
|
def load_page
|
95
|
-
@page = Page.includes(:
|
91
|
+
@page = Page.includes(contents: [:content_block, :content_block_template]).find(params[:id])
|
96
92
|
@root = @page if Page.root == @page
|
97
93
|
set_publish
|
98
94
|
end
|
data/app/models/smithy/page.rb
CHANGED
@@ -3,7 +3,7 @@ module Smithy
|
|
3
3
|
validates_presence_of :template, :title
|
4
4
|
validate :validate_one_root
|
5
5
|
validate :validate_exclusion_of_reserved_words
|
6
|
-
validate :
|
6
|
+
validate :validate_page_to_copy_exists
|
7
7
|
|
8
8
|
belongs_to :template
|
9
9
|
has_many :containers, :through => :template
|
@@ -15,14 +15,13 @@ module Smithy
|
|
15
15
|
|
16
16
|
before_save :build_permalink
|
17
17
|
before_save :set_published_at
|
18
|
-
before_save :copy_content_from_duplicate, on: :create, if: -> { self.duplicate_page.present? }
|
19
18
|
|
20
|
-
accepts_nested_attributes_for :contents, :reject_if => lambda {|a| a['label'].blank? || a['container'].blank? || a['
|
19
|
+
accepts_nested_attributes_for :contents, :reject_if => lambda {|a| a['label'].blank? || a['container'].blank? || a['content_block_type'].blank? }, :allow_destroy => true
|
21
20
|
|
22
21
|
scope :included_in_navigation, -> { where("show_in_navigation=? AND published_at <= ?", true, Time.now) }
|
23
22
|
scope :published, -> { where('published_at <= ?', Time.now) }
|
24
23
|
|
25
|
-
attr_accessor :publish, :
|
24
|
+
attr_accessor :publish, :copy_content_from
|
26
25
|
attr_reader :liquid_context
|
27
26
|
|
28
27
|
def self.page_selector_options
|
@@ -44,6 +43,15 @@ module Smithy
|
|
44
43
|
self.contents.publishable.for_container(container_name)
|
45
44
|
end
|
46
45
|
|
46
|
+
def duplicate_content_from(page_id)
|
47
|
+
page = Page.find(page_id)
|
48
|
+
self.contents = page.contents.map(&:amoeba_dup)
|
49
|
+
self.contents.each do |content|
|
50
|
+
content.content_block = content.content_block.amoeba_dup
|
51
|
+
end
|
52
|
+
self
|
53
|
+
end
|
54
|
+
|
47
55
|
def normalize_friendly_id(value) # normalize_friendly_id overrides the default creator for friendly_id
|
48
56
|
return "/" if self.parent.blank?
|
49
57
|
value = self.permalink? ? self.permalink.parameterize : value.to_s.parameterize
|
@@ -70,6 +78,16 @@ module Smithy
|
|
70
78
|
end
|
71
79
|
end
|
72
80
|
|
81
|
+
def shallow_copy
|
82
|
+
self.dup.tap do |p|
|
83
|
+
p.title << " (Copy)"
|
84
|
+
p.permalink.clear
|
85
|
+
p.browser_title.clear
|
86
|
+
p.keywords.clear
|
87
|
+
p.description.clear
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
73
91
|
def site
|
74
92
|
@site ||= Smithy::Site.instance
|
75
93
|
end
|
@@ -98,20 +116,13 @@ module Smithy
|
|
98
116
|
self.permalink = self.root? ? title.parameterize : path.split('/').last unless self.permalink?
|
99
117
|
end
|
100
118
|
|
101
|
-
def copy_content_from_duplicate
|
102
|
-
duplicate_page = Page.find(self.duplicate_page)
|
103
|
-
duplicate_page.contents.each do |content|
|
104
|
-
self.contents << content.dup
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
119
|
def set_published_at
|
109
120
|
self.published_at = Time.now if self.publish.present?
|
110
121
|
self.published_at = nil if self.publish == false
|
111
122
|
end
|
112
123
|
|
113
|
-
def
|
114
|
-
errors.add(:
|
124
|
+
def validate_page_to_copy_exists
|
125
|
+
errors.add(:copy_content_from, "this page could not be found. Please choose another and try again.") if self.copy_content_from.present? && Page.find_by(id: self.copy_content_from).blank?
|
115
126
|
end
|
116
127
|
|
117
128
|
def validate_exclusion_of_reserved_words
|
@@ -11,6 +11,10 @@ module Smithy
|
|
11
11
|
before_update :set_publishable
|
12
12
|
|
13
13
|
accepts_nested_attributes_for :content_block, :allow_destroy => true
|
14
|
+
amoeba do
|
15
|
+
enable
|
16
|
+
include_association :content_block
|
17
|
+
end
|
14
18
|
|
15
19
|
default_scope -> { order(:position).order(:id) }
|
16
20
|
scope :for_container, ->(container) { where(:container => container) }
|
@@ -38,7 +38,7 @@ module Smithy
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def page_attributes
|
41
|
-
[ :browser_title, :cache_length, :description, :external_link, :keywords, :permalink, :publish, :published_at, :show_in_navigation, :title, :parent_id, :template_id, :
|
41
|
+
[ :browser_title, :cache_length, :description, :external_link, :keywords, :permalink, :publish, :published_at, :show_in_navigation, :title, :parent_id, :template_id, :copy_content_from ]
|
42
42
|
end
|
43
43
|
|
44
44
|
def page_content_attributes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= f.input :title %>
|
2
|
-
<%= f.input :parent, :include_blank => false, :collection => tree_for_select unless !@page.parent_id? %>
|
2
|
+
<%= f.input :parent, :include_blank => false, :collection => tree_for_select unless !@page.parent_id? && @page.persisted? %>
|
3
3
|
<%= f.input :show_in_navigation, :label => "Show page in site navigation" %>
|
4
4
|
<%= f.input :template, :as => :select, :collection => Smithy::Template.templates, :include_blank => false %>
|
5
5
|
|
@@ -10,5 +10,5 @@
|
|
10
10
|
<%= f.input :external_link, :hint => "This page is currently being redirected to #{link_to @page.external_link, @page.external_link}".html_safe %>
|
11
11
|
<% end %>
|
12
12
|
<% else %>
|
13
|
-
<%= f.input :
|
13
|
+
<%= f.input :copy_content_from, as: :select, label: "Copy Content From", collection: tree_for_select %>
|
14
14
|
<% end %>
|
@@ -17,7 +17,8 @@
|
|
17
17
|
</dl>
|
18
18
|
</div>
|
19
19
|
|
20
|
-
|
21
|
-
<%=
|
22
|
-
<%=
|
20
|
+
|
21
|
+
<%= link_to("View Page", @page.path, class: 'btn btn-primary btn-block') if @page.persisted? && @page.published? %>
|
22
|
+
<%= link_to("Duplicate Page", duplicate_page_path(@page.id), method: :post, class: 'btn btn-info btn-block') if @page.persisted? %>
|
23
|
+
<%= link_to("Delete Page", page_path(@page.id), method: :delete, data: { confirm: "Are you sure you want to delete this page?" }, class: 'btn btn-danger btn-block') if @page.persisted? %>
|
23
24
|
<% end %>
|
@@ -6,6 +6,11 @@ module Smithy
|
|
6
6
|
has_many :page_contents, :as => :content_block, class_name: '::Smithy::PageContent'
|
7
7
|
has_many :pages, through: :page_contents, class_name: '::Smithy::Page'
|
8
8
|
Smithy::ContentBlocks::Registry.register self
|
9
|
+
amoeba do
|
10
|
+
enable
|
11
|
+
exclude_association :pages
|
12
|
+
exclude_association :page_contents
|
13
|
+
end
|
9
14
|
end
|
10
15
|
|
11
16
|
module ClassMethods
|
data/lib/smithy/dependencies.rb
CHANGED
data/lib/smithy/version.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smithycms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Glen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -44,6 +44,20 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: amoeba
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
47
61
|
- !ruby/object:Gem::Dependency
|
48
62
|
name: autoprefixer-rails
|
49
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1181,12 +1195,13 @@ files:
|
|
1181
1195
|
- vendor/cache/activerecord-4.1.10.gem
|
1182
1196
|
- vendor/cache/activesupport-4.1.10.gem
|
1183
1197
|
- vendor/cache/addressable-2.3.8.gem
|
1198
|
+
- vendor/cache/amoeba-3.0.0.gem
|
1184
1199
|
- vendor/cache/arel-5.0.1.20140414130214.gem
|
1185
|
-
- vendor/cache/autoprefixer-rails-6.3.
|
1200
|
+
- vendor/cache/autoprefixer-rails-6.3.6.1.gem
|
1186
1201
|
- vendor/cache/awesome_nested_set-3.0.3.gem
|
1187
|
-
- vendor/cache/aws-sdk-2.
|
1188
|
-
- vendor/cache/aws-sdk-core-2.
|
1189
|
-
- vendor/cache/aws-sdk-resources-2.
|
1202
|
+
- vendor/cache/aws-sdk-2.3.4.gem
|
1203
|
+
- vendor/cache/aws-sdk-core-2.3.4.gem
|
1204
|
+
- vendor/cache/aws-sdk-resources-2.3.4.gem
|
1190
1205
|
- vendor/cache/bcrypt-3.1.10.gem
|
1191
1206
|
- vendor/cache/bootstrap-sass-3.2.0.2.gem
|
1192
1207
|
- vendor/cache/builder-3.2.2.gem
|
@@ -1198,7 +1213,7 @@ files:
|
|
1198
1213
|
- vendor/cache/coffee-script-2.4.1.gem
|
1199
1214
|
- vendor/cache/coffee-script-source-1.10.0.gem
|
1200
1215
|
- vendor/cache/columnize-0.9.0.gem
|
1201
|
-
- vendor/cache/concurrent-ruby-1.0.
|
1216
|
+
- vendor/cache/concurrent-ruby-1.0.2.gem
|
1202
1217
|
- vendor/cache/coveralls-0.7.12.gem
|
1203
1218
|
- vendor/cache/crass-1.0.2.gem
|
1204
1219
|
- vendor/cache/database_cleaner-1.4.1.gem
|
@@ -1224,13 +1239,13 @@ files:
|
|
1224
1239
|
- vendor/cache/fog-aws-0.9.2.gem
|
1225
1240
|
- vendor/cache/fog-brightbox-0.10.1.gem
|
1226
1241
|
- vendor/cache/fog-cloudatcost-0.1.2.gem
|
1227
|
-
- vendor/cache/fog-core-1.
|
1242
|
+
- vendor/cache/fog-core-1.39.0.gem
|
1228
1243
|
- vendor/cache/fog-dynect-0.0.3.gem
|
1229
1244
|
- vendor/cache/fog-ecloud-0.3.0.gem
|
1230
1245
|
- vendor/cache/fog-google-0.1.0.gem
|
1231
1246
|
- vendor/cache/fog-json-1.0.2.gem
|
1232
1247
|
- vendor/cache/fog-local-0.3.0.gem
|
1233
|
-
- vendor/cache/fog-openstack-0.1.
|
1248
|
+
- vendor/cache/fog-openstack-0.1.5.gem
|
1234
1249
|
- vendor/cache/fog-powerdns-0.1.1.gem
|
1235
1250
|
- vendor/cache/fog-profitbricks-0.0.5.gem
|
1236
1251
|
- vendor/cache/fog-rackspace-0.1.1.gem
|
@@ -1238,15 +1253,15 @@ files:
|
|
1238
1253
|
- vendor/cache/fog-riakcs-0.1.0.gem
|
1239
1254
|
- vendor/cache/fog-sakuracloud-1.7.5.gem
|
1240
1255
|
- vendor/cache/fog-serverlove-0.1.2.gem
|
1241
|
-
- vendor/cache/fog-softlayer-1.1.
|
1256
|
+
- vendor/cache/fog-softlayer-1.1.1.gem
|
1242
1257
|
- vendor/cache/fog-storm_on_demand-0.1.1.gem
|
1243
1258
|
- vendor/cache/fog-terremark-0.1.0.gem
|
1244
1259
|
- vendor/cache/fog-vmfusion-0.1.0.gem
|
1245
1260
|
- vendor/cache/fog-voxel-0.1.0.gem
|
1246
|
-
- vendor/cache/fog-vsphere-0.
|
1261
|
+
- vendor/cache/fog-vsphere-0.7.0.gem
|
1247
1262
|
- vendor/cache/fog-xenserver-0.2.3.gem
|
1248
1263
|
- vendor/cache/fog-xml-0.1.2.gem
|
1249
|
-
- vendor/cache/font-awesome-sass-4.
|
1264
|
+
- vendor/cache/font-awesome-sass-4.6.2.gem
|
1250
1265
|
- vendor/cache/formatador-0.2.5.gem
|
1251
1266
|
- vendor/cache/formtastic-3.1.4.gem
|
1252
1267
|
- vendor/cache/formtastic-bootstrap-3.1.1.gem
|
@@ -1263,11 +1278,12 @@ files:
|
|
1263
1278
|
- vendor/cache/i18n-0.7.0.gem
|
1264
1279
|
- vendor/cache/inflecto-0.0.2.gem
|
1265
1280
|
- vendor/cache/ipaddress-0.8.3.gem
|
1266
|
-
- vendor/cache/jmespath-1.
|
1281
|
+
- vendor/cache/jmespath-1.2.4.gem
|
1267
1282
|
- vendor/cache/jquery-rails-3.1.4.gem
|
1268
1283
|
- vendor/cache/json-1.8.2.gem
|
1284
|
+
- vendor/cache/json_pure-1.8.3.gem
|
1269
1285
|
- vendor/cache/kaminari-0.16.3.gem
|
1270
|
-
- vendor/cache/kramdown-1.
|
1286
|
+
- vendor/cache/kramdown-1.11.1.gem
|
1271
1287
|
- vendor/cache/launchy-2.4.3.gem
|
1272
1288
|
- vendor/cache/letter_opener-1.3.0.gem
|
1273
1289
|
- vendor/cache/liquid-2.6.3.gem
|
@@ -1325,14 +1341,14 @@ files:
|
|
1325
1341
|
- vendor/cache/slodown-0.1.3.gem
|
1326
1342
|
- vendor/cache/slop-3.6.0.gem
|
1327
1343
|
- vendor/cache/smithycms-auth-0.4.2.gem
|
1328
|
-
- vendor/cache/sprockets-3.
|
1344
|
+
- vendor/cache/sprockets-3.6.0.gem
|
1329
1345
|
- vendor/cache/sprockets-rails-2.3.3.gem
|
1330
1346
|
- vendor/cache/sqlite3-1.3.10.gem
|
1331
1347
|
- vendor/cache/term-ansicolor-1.3.0.gem
|
1332
1348
|
- vendor/cache/terminal-notifier-guard-1.6.4.gem
|
1333
1349
|
- vendor/cache/thor-0.19.1.gem
|
1334
1350
|
- vendor/cache/thread_safe-0.3.5.gem
|
1335
|
-
- vendor/cache/tilt-2.0.
|
1351
|
+
- vendor/cache/tilt-2.0.4.gem
|
1336
1352
|
- vendor/cache/timers-4.0.1.gem
|
1337
1353
|
- vendor/cache/tins-1.3.5.gem
|
1338
1354
|
- vendor/cache/trollop-2.1.2.gem
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/vendor/cache/tilt-2.0.2.gem
DELETED
Binary file
|