trusty-cms 2.0.23 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +8 -10
- data/app/controllers/admin/pages_controller.rb +7 -0
- data/app/controllers/application_controller.rb +0 -9
- data/app/helpers/admin/node_helper.rb +0 -20
- data/app/helpers/admin/pages_helper.rb +0 -4
- data/app/helpers/application_helper.rb +1 -27
- data/app/models/page.rb +2 -8
- data/app/models/page_context.rb +0 -6
- data/app/models/standard_tags.rb +0 -1
- data/app/models/text_filter.rb +0 -5
- data/app/models/trusty_cms/config.rb +0 -4
- data/db/migrate/20161027141250_add_position_to_pages.rb +26 -0
- data/db/schema.rb +1 -0
- data/lib/trusty_cms.rb +1 -1
- data/lib/trusty_cms/extension/script.rb +0 -19
- data/spec/dummy/db/schema.rb +17 -14
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 079b1b5601ad895b9a70dbe63fcd8b4cb5ec8cef
|
4
|
+
data.tar.gz: c494cd3eae5ecc44678b70b699bb0eb78a546e1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7fc84ccdc1bbf657111f33ed17ba3a687cfe0922bd1c46ce2af8c3201af2051852c8a72c189bffa0f5f36ee8894aec29e4a95268467174f66055cdab9cb4f2d
|
7
|
+
data.tar.gz: 7c1822cf7448a33477e9e9edda2cab6bc78d1420beeade56b266a3da335568715e02b9fdd62ca9b5c9805c839d5bc78ec6d88d918449e83aa6798ffb13d698bf
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trusty-cms (2.0.
|
4
|
+
trusty-cms (2.0.24)
|
5
5
|
RedCloth (~> 4.3.2)
|
6
6
|
acts_as_tree (~> 2.1)
|
7
7
|
bundler (~> 1.7)
|
@@ -66,19 +66,19 @@ GEM
|
|
66
66
|
minitest (~> 5.1)
|
67
67
|
thread_safe (~> 0.3, >= 0.3.4)
|
68
68
|
tzinfo (~> 1.1)
|
69
|
-
acts_as_tree (2.
|
69
|
+
acts_as_tree (2.6.0)
|
70
70
|
activerecord (>= 3.0.0)
|
71
71
|
addressable (2.4.0)
|
72
72
|
arel (6.0.3)
|
73
73
|
builder (3.2.2)
|
74
|
-
byebug (9.0.
|
74
|
+
byebug (9.0.6)
|
75
75
|
capybara (2.3.0)
|
76
76
|
mime-types (>= 1.16)
|
77
77
|
nokogiri (>= 1.3.3)
|
78
78
|
rack (>= 1.0.0)
|
79
79
|
rack-test (>= 0.5.4)
|
80
80
|
xpath (~> 2.0)
|
81
|
-
chunky_png (1.3.
|
81
|
+
chunky_png (1.3.7)
|
82
82
|
ckeditor (4.1.6)
|
83
83
|
cocaine
|
84
84
|
orm_adapter (~> 0.5.0)
|
@@ -155,14 +155,12 @@ GEM
|
|
155
155
|
mime-types-data (~> 3.2015)
|
156
156
|
mime-types-data (3.2016.0521)
|
157
157
|
mini_portile2 (2.1.0)
|
158
|
-
minitest (5.9.
|
158
|
+
minitest (5.9.1)
|
159
159
|
multi_json (1.12.1)
|
160
160
|
mysql2 (0.4.4)
|
161
|
-
nokogiri (1.6.8)
|
161
|
+
nokogiri (1.6.8.1)
|
162
162
|
mini_portile2 (~> 2.1.0)
|
163
|
-
pkg-config (~> 1.1.7)
|
164
163
|
orm_adapter (0.5.0)
|
165
|
-
pkg-config (1.1.7)
|
166
164
|
poltergeist (1.5.1)
|
167
165
|
capybara (~> 2.1)
|
168
166
|
cliver (~> 0.3.1)
|
@@ -234,7 +232,7 @@ GEM
|
|
234
232
|
rspec-mocks (~> 3.0.0)
|
235
233
|
rspec-support (~> 3.0.0)
|
236
234
|
rspec-support (3.0.4)
|
237
|
-
ruby_parser (3.8.
|
235
|
+
ruby_parser (3.8.3)
|
238
236
|
sexp_processor (~> 4.1)
|
239
237
|
sass (3.4.22)
|
240
238
|
sass-rails (5.0.6)
|
@@ -280,7 +278,7 @@ GEM
|
|
280
278
|
websocket-driver (0.6.4)
|
281
279
|
websocket-extensions (>= 0.1.0)
|
282
280
|
websocket-extensions (0.1.2)
|
283
|
-
will_paginate (3.1.
|
281
|
+
will_paginate (3.1.5)
|
284
282
|
xpath (2.0.0)
|
285
283
|
nokogiri (~> 1.3)
|
286
284
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class Admin::PagesController < Admin::ResourceController
|
2
2
|
before_filter :initialize_meta_rows_and_buttons, :only => [:new, :edit, :create, :update]
|
3
3
|
before_filter :count_deleted_pages, :only => [:destroy]
|
4
|
+
rescue_from ActiveRecord::RecordInvalid, :with => :validation_error
|
4
5
|
|
5
6
|
class PreviewStop < ActiveRecord::Rollback
|
6
7
|
def message
|
@@ -45,6 +46,12 @@ class Admin::PagesController < Admin::ResourceController
|
|
45
46
|
|
46
47
|
|
47
48
|
private
|
49
|
+
|
50
|
+
def validation_error(e)
|
51
|
+
flash[:error] = e.message
|
52
|
+
render :new
|
53
|
+
end
|
54
|
+
|
48
55
|
def assign_page_attributes
|
49
56
|
if params[:page_id].blank?
|
50
57
|
self.model.slug = '/'
|
@@ -42,15 +42,6 @@ class ApplicationController < ActionController::Base
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def rescue_action_in_public(exception)
|
46
|
-
case exception
|
47
|
-
when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::RoutingError
|
48
|
-
render :template => "site/not_found", :status => 404
|
49
|
-
else
|
50
|
-
super
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
45
|
private
|
55
46
|
|
56
47
|
def set_mailer
|
@@ -53,26 +53,6 @@ module Admin::NodeHelper
|
|
53
53
|
show_all? || expanded_rows.include?(@current_node.id)
|
54
54
|
end
|
55
55
|
|
56
|
-
def padding_left(level)
|
57
|
-
(level * 23) + 9
|
58
|
-
end
|
59
|
-
|
60
|
-
def children_class
|
61
|
-
unless @current_node.children.empty?
|
62
|
-
if expanded
|
63
|
-
" children_visible"
|
64
|
-
else
|
65
|
-
" children_hidden"
|
66
|
-
end
|
67
|
-
else
|
68
|
-
" no_children"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def virtual_class
|
73
|
-
@current_node.virtual? ? " virtual": ""
|
74
|
-
end
|
75
|
-
|
76
56
|
def expander(level)
|
77
57
|
unless @current_node.children.empty? or level == 0
|
78
58
|
image((expanded ? "collapse" : "expand"),
|
@@ -14,10 +14,6 @@ module Admin::PagesHelper
|
|
14
14
|
!!(@page.errors[:slug] or @page.errors[:breadcrumb])
|
15
15
|
end
|
16
16
|
|
17
|
-
def default_filter_name
|
18
|
-
@page.parts.empty? ? "" : @page.parts[0].filter_id
|
19
|
-
end
|
20
|
-
|
21
17
|
def status_to_display
|
22
18
|
@page.status_id = 100 if @page.status_id == 90
|
23
19
|
@display_status = Status.selectable.map{ |s| [I18n.translate(s.name.downcase), s.id] }
|
@@ -70,14 +70,6 @@ module ApplicationHelper
|
|
70
70
|
uri.path.gsub(%r{/+}, '/').gsub(%r{/$}, '')
|
71
71
|
end
|
72
72
|
|
73
|
-
def nav_link_to(name, options)
|
74
|
-
if current_url?(options)
|
75
|
-
%{<strong>#{ link_to translate_with_default(name), options }</strong>}
|
76
|
-
else
|
77
|
-
link_to translate_with_default(name), options
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
73
|
def admin?
|
82
74
|
current_user and current_user.admin?
|
83
75
|
end
|
@@ -106,16 +98,6 @@ module ApplicationHelper
|
|
106
98
|
I18n.localize(time, :format => :timestamp)
|
107
99
|
end
|
108
100
|
|
109
|
-
def meta_visible(symbol)
|
110
|
-
v = case symbol
|
111
|
-
when :meta_more
|
112
|
-
not meta_errors?
|
113
|
-
when :meta, :meta_less
|
114
|
-
meta_errors?
|
115
|
-
end
|
116
|
-
v ? {} : {:style => "display: none"}
|
117
|
-
end
|
118
|
-
|
119
101
|
def meta_errors?
|
120
102
|
false
|
121
103
|
end
|
@@ -128,18 +110,10 @@ module ApplicationHelper
|
|
128
110
|
image_tag(append_image_extension("admin/#{name}"), options)
|
129
111
|
end
|
130
112
|
|
131
|
-
def image_submit(name, options = {})
|
132
|
-
image_submit_tag(append_image_extension("admin/#{name}"), options)
|
133
|
-
end
|
134
|
-
|
135
113
|
def admin
|
136
114
|
TrustyCms::AdminUI.instance
|
137
115
|
end
|
138
116
|
|
139
|
-
def filter_options_for_select(selected=nil)
|
140
|
-
options_for_select([[t('select.none'), '']] + TextFilter.descendants_names, selected)
|
141
|
-
end
|
142
|
-
|
143
117
|
def body_classes
|
144
118
|
@body_classes ||= []
|
145
119
|
end
|
@@ -183,7 +157,7 @@ module ApplicationHelper
|
|
183
157
|
|
184
158
|
# Default image url to be used when no gravatar is found
|
185
159
|
# or when an image exceeds the rating parameter.
|
186
|
-
local_avatar_url = "/
|
160
|
+
local_avatar_url = "/assets/admin/avatar_#{([options[:size].to_i] * 2).join('x')}.png"
|
187
161
|
default_avatar_url = "#{request.protocol}#{request.host_with_port}#{ActionController::Base.relative_url_root}#{local_avatar_url}"
|
188
162
|
options[:default] ||= default_avatar_url
|
189
163
|
|
data/app/models/page.rb
CHANGED
@@ -30,6 +30,8 @@ class Page < ActiveRecord::Base
|
|
30
30
|
|
31
31
|
validate :valid_class_name
|
32
32
|
|
33
|
+
default_scope { order('position ASC') }
|
34
|
+
|
33
35
|
include TrustyCms::Taggable
|
34
36
|
include StandardTags
|
35
37
|
include DeprecatedTags
|
@@ -223,10 +225,6 @@ class Page < ActiveRecord::Base
|
|
223
225
|
true
|
224
226
|
end
|
225
227
|
|
226
|
-
def to_xml(options={}, &block)
|
227
|
-
super(options.reverse_merge(:include => :parts), &block)
|
228
|
-
end
|
229
|
-
|
230
228
|
def default_child
|
231
229
|
self.class.default_child
|
232
230
|
end
|
@@ -347,10 +345,6 @@ class Page < ActiveRecord::Base
|
|
347
345
|
end
|
348
346
|
end
|
349
347
|
|
350
|
-
def attributes_protected_by_default
|
351
|
-
super - [self.class.inheritance_column]
|
352
|
-
end
|
353
|
-
|
354
348
|
def update_virtual
|
355
349
|
unless self.class == Page.descendant_class(class_name)
|
356
350
|
self.virtual = Page.descendant_class(class_name).new.virtual?
|
data/app/models/page_context.rb
CHANGED
@@ -29,12 +29,6 @@ class PageContext < Radius::Context
|
|
29
29
|
render_error_message(e.message)
|
30
30
|
end
|
31
31
|
|
32
|
-
def tag_missing(name, attributes = {}, &block)
|
33
|
-
super
|
34
|
-
rescue Radius::UndefinedTagError => e
|
35
|
-
raise StandardTags::TagError.new(e.message)
|
36
|
-
end
|
37
|
-
|
38
32
|
private
|
39
33
|
|
40
34
|
def render_error_message(message)
|
data/app/models/standard_tags.rb
CHANGED
data/app/models/text_filter.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
class AddPositionToPages < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
unless column_exists? :pages, :position
|
4
|
+
add_column :pages, :position, :integer
|
5
|
+
Page.reset_column_information
|
6
|
+
say_with_time("Putting all pages in a default order...") do
|
7
|
+
ActiveRecord::Base.record_timestamps = false
|
8
|
+
Page.where(parent_id: nil).each do |p|
|
9
|
+
put_children_into_list(p)
|
10
|
+
end
|
11
|
+
ActiveRecord::Base.record_timestamps = true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
remove_column :pages, :position
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.put_children_into_list(page)
|
21
|
+
page.children.order("title asc").each_with_index do |pg, idx|
|
22
|
+
pg.update_attribute('position', idx + 1)
|
23
|
+
put_children_into_list(pg)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/db/schema.rb
CHANGED
@@ -70,6 +70,7 @@ ActiveRecord::Schema.define(:version => 20120209231801) do
|
|
70
70
|
t.boolean "virtual", :default => false, :null => false
|
71
71
|
t.integer "lock_version", :default => 0
|
72
72
|
t.text "allowed_children_cache"
|
73
|
+
t.integer "position", limit: 4
|
73
74
|
end
|
74
75
|
|
75
76
|
add_index "pages", ["class_name"], :name => "pages_class_name"
|
data/lib/trusty_cms.rb
CHANGED
@@ -230,25 +230,6 @@ Supports: TrustyCms #{supports_radiant_version}
|
|
230
230
|
end
|
231
231
|
end
|
232
232
|
|
233
|
-
class Bzip2 < Tarball
|
234
|
-
def filename
|
235
|
-
@unpacked ? super : "#{self.name}.tar.bz2"
|
236
|
-
end
|
237
|
-
|
238
|
-
def unpack
|
239
|
-
cd(Dir.tmpdir) { system "bunzip2 #{self.filename}" }
|
240
|
-
@unpacked = true
|
241
|
-
super
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
class Zip < Download
|
246
|
-
def unpack
|
247
|
-
output = nil
|
248
|
-
cd(Dir.tmpdir) { output = `unzip #{filename} -d #{name}` }
|
249
|
-
self.path = File.join(Dir.tmpdir, name)
|
250
|
-
end
|
251
|
-
end
|
252
233
|
end
|
253
234
|
|
254
235
|
module TrustyCms
|
data/spec/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: 20161027141250) do
|
15
15
|
|
16
16
|
create_table "config", force: :cascade do |t|
|
17
17
|
t.string "key", limit: 40, default: "", null: false
|
@@ -70,6 +70,7 @@ ActiveRecord::Schema.define(version: 20120209231801) do
|
|
70
70
|
t.boolean "virtual", default: false, null: false
|
71
71
|
t.integer "lock_version", limit: 4, default: 0
|
72
72
|
t.text "allowed_children_cache", limit: 65535
|
73
|
+
t.integer "position", limit: 4
|
73
74
|
end
|
74
75
|
|
75
76
|
add_index "pages", ["class_name"], name: "pages_class_name", using: :btree
|
@@ -100,21 +101,23 @@ ActiveRecord::Schema.define(version: 20120209231801) do
|
|
100
101
|
add_index "snippets", ["name"], name: "name", unique: true, using: :btree
|
101
102
|
|
102
103
|
create_table "users", force: :cascade do |t|
|
103
|
-
t.string "name",
|
104
|
-
t.string "email",
|
105
|
-
t.string "login",
|
106
|
-
t.string "password",
|
107
|
-
t.boolean "admin",
|
108
|
-
t.boolean "designer",
|
104
|
+
t.string "name", limit: 100
|
105
|
+
t.string "email", limit: 255
|
106
|
+
t.string "login", limit: 40, default: "", null: false
|
107
|
+
t.string "password", limit: 40
|
108
|
+
t.boolean "admin", default: false, null: false
|
109
|
+
t.boolean "designer", default: false, null: false
|
109
110
|
t.datetime "created_at"
|
110
111
|
t.datetime "updated_at"
|
111
|
-
t.integer "created_by_id",
|
112
|
-
t.integer "updated_by_id",
|
113
|
-
t.string "salt",
|
114
|
-
t.text "notes",
|
115
|
-
t.integer "lock_version",
|
116
|
-
t.string "session_token",
|
117
|
-
t.string "locale",
|
112
|
+
t.integer "created_by_id", limit: 4
|
113
|
+
t.integer "updated_by_id", limit: 4
|
114
|
+
t.string "salt", limit: 255
|
115
|
+
t.text "notes", limit: 65535
|
116
|
+
t.integer "lock_version", limit: 4, default: 0
|
117
|
+
t.string "session_token", limit: 255
|
118
|
+
t.string "locale", limit: 255
|
119
|
+
t.string "password_reset_token", limit: 255
|
120
|
+
t.datetime "password_reset_sent_at"
|
118
121
|
end
|
119
122
|
|
120
123
|
add_index "users", ["login"], name: "login", unique: true, using: :btree
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trusty-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrustyCms CMS dev team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tzinfo
|
@@ -1386,6 +1386,7 @@ files:
|
|
1386
1386
|
- db/migrate/20111016150725_extend_page_part_content_limit.rb
|
1387
1387
|
- db/migrate/20120209231801_change_pages_allowed_children_cache_to_text.rb
|
1388
1388
|
- db/migrate/20160527141249_add_password_reset_to_users.rb
|
1389
|
+
- db/migrate/20161027141250_add_position_to_pages.rb
|
1389
1390
|
- db/schema.rb
|
1390
1391
|
- lib/active_record_extensions/active_record_extensions.rb
|
1391
1392
|
- lib/annotatable.rb
|
@@ -1644,7 +1645,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1644
1645
|
version: 1.3.1
|
1645
1646
|
requirements: []
|
1646
1647
|
rubyforge_project:
|
1647
|
-
rubygems_version: 2.
|
1648
|
+
rubygems_version: 2.5.1
|
1648
1649
|
signing_key:
|
1649
1650
|
specification_version: 4
|
1650
1651
|
summary: A no-fluff content management system designed for small teams.
|