trusty-cms 4.0.1 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +106 -106
- data/Rakefile +7 -7
- data/app/assets/images/admin/spinner.gif +0 -0
- data/app/assets/javascripts/admin.js +3 -0
- data/app/assets/javascripts/admin/more-or-less.js +2 -2
- data/app/assets/javascripts/admin/tabcontrol.js.erb +1 -2
- data/app/assets/stylesheets/admin/_base.scss +22 -6
- data/app/assets/stylesheets/admin/_multi_site_main.scss +28 -29
- data/app/assets/stylesheets/admin/_reset.scss +5 -4
- data/app/assets/stylesheets/admin/_site_chooser.scss +44 -69
- data/app/assets/stylesheets/admin/assets.scss +138 -141
- data/app/assets/stylesheets/admin/main.scss +10 -12
- data/app/assets/stylesheets/admin/modules/_boxes.scss +0 -3
- data/app/assets/stylesheets/admin/modules/_buttons.scss +30 -0
- data/app/assets/stylesheets/admin/modules/_links.scss +1 -1
- data/app/assets/stylesheets/admin/partials/_actions.scss +29 -46
- data/app/assets/stylesheets/admin/partials/_avatars.scss +3 -2
- data/app/assets/stylesheets/admin/partials/_content.scss +15 -38
- data/app/assets/stylesheets/admin/partials/_dateinput.scss +23 -14
- data/app/assets/stylesheets/admin/partials/_drawer.scss +78 -0
- data/app/assets/stylesheets/admin/partials/_dropdown.scss +9 -12
- data/app/assets/stylesheets/admin/partials/_footer.scss +4 -3
- data/app/assets/stylesheets/admin/partials/_forms.scss +64 -491
- data/app/assets/stylesheets/admin/partials/_header.scss +9 -118
- data/app/assets/stylesheets/admin/partials/_layout.scss +26 -2
- data/app/assets/stylesheets/admin/partials/_login_form.scss +28 -0
- data/app/assets/stylesheets/admin/partials/_messages.scss +10 -5
- data/app/assets/stylesheets/admin/partials/_popup.scss +61 -50
- data/app/assets/stylesheets/admin/partials/_preferences.scss +37 -0
- data/app/assets/stylesheets/admin/partials/_sidebar.scss +55 -0
- data/app/assets/stylesheets/admin/partials/_tabcontrol.scss +24 -36
- data/app/assets/stylesheets/admin/partials/{_index.scss → _table.scss} +53 -84
- data/app/assets/stylesheets/admin/partials/_toolbar.scss +11 -6
- data/app/assets/stylesheets/admin/partials/_treetable.scss +1 -71
- data/app/assets/stylesheets/admin/partials/_typography.scss +30 -55
- data/app/assets/stylesheets/admin/partials/_validations.scss +6 -5
- data/app/assets/stylesheets/rad_social/rad_screen.scss +65 -64
- data/app/controllers/admin/assets_controller.rb +21 -31
- data/app/controllers/admin/configuration_controller.rb +9 -11
- data/app/controllers/admin/extensions_controller.rb +3 -3
- data/app/controllers/admin/layouts_controller.rb +3 -4
- data/app/controllers/admin/page_attachments_controller.rb +5 -5
- data/app/controllers/admin/page_fields_controller.rb +3 -4
- data/app/controllers/admin/page_parts_controller.rb +4 -5
- data/app/controllers/admin/pages_controller.rb +55 -56
- data/app/controllers/admin/references_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +132 -128
- data/app/controllers/admin/sites_controller.rb +4 -4
- data/app/controllers/admin/snippets_controller.rb +3 -4
- data/app/controllers/admin/users_controller.rb +16 -16
- data/app/controllers/application_controller.rb +47 -48
- data/app/controllers/site_controller.rb +51 -48
- data/app/controllers/social_mailer_controller.rb +13 -16
- data/app/helpers/admin/configuration_helper.rb +19 -20
- data/app/helpers/admin/layouts_helper.rb +0 -1
- data/app/helpers/admin/node_helper.rb +27 -24
- data/app/helpers/admin/pages_helper.rb +2 -2
- data/app/helpers/admin/preferences_helper.rb +0 -1
- data/app/helpers/admin/references_helper.rb +9 -10
- data/app/helpers/admin/regions_helper.rb +3 -3
- data/app/helpers/application_helper.rb +34 -35
- data/app/helpers/rad_social_helper.rb +8 -11
- data/app/helpers/scoped_helper.rb +1 -3
- data/app/helpers/sites_helper.rb +4 -4
- data/app/mailers/devise_mailer.rb +3 -4
- data/app/mailers/rad_social_mailer.rb +8 -8
- data/app/models/asset.rb +62 -63
- data/app/models/asset_type.rb +38 -39
- data/app/models/deprecated_tags.rb +3 -4
- data/app/models/file_not_found_page.rb +1 -3
- data/app/models/haml_filter.rb +1 -1
- data/app/models/layout.rb +4 -5
- data/app/models/legacy_user.rb +2 -2
- data/app/models/menu_renderer.rb +16 -18
- data/app/models/page.rb +96 -93
- data/app/models/page_attachment.rb +1 -2
- data/app/models/page_context.rb +11 -12
- data/app/models/page_part.rb +3 -4
- data/app/models/rails_page.rb +10 -12
- data/app/models/site.rb +22 -21
- data/app/models/snippet.rb +6 -8
- data/app/models/snippet_finder.rb +3 -3
- data/app/models/snippet_tags.rb +4 -4
- data/app/models/standard_tags.rb +258 -252
- data/app/models/status.rb +8 -8
- data/app/models/trusty_cms/config.rb +25 -25
- data/app/models/trusty_cms/page_response_cache_director.rb +2 -3
- data/app/models/user.rb +15 -14
- data/app/models/user_action_observer.rb +3 -3
- data/app/users/_choose_site.html.haml +3 -7
- data/app/views/admin/assets/_form.html.haml +2 -1
- data/app/views/admin/assets/_search.html.haml +2 -1
- data/app/views/admin/assets/edit.html.haml +2 -10
- data/app/views/admin/assets/index.html.haml +4 -2
- data/app/views/admin/assets/new.html.haml +4 -8
- data/app/views/admin/assets/remove.html.haml +2 -1
- data/app/views/admin/configuration/edit.html.haml +7 -7
- data/app/views/admin/configuration/show.html.haml +6 -8
- data/app/views/admin/layouts/_choose_site.html.haml +2 -3
- data/app/views/admin/layouts/_form.html.haml +13 -12
- data/app/views/admin/layouts/_site_chooser.html.haml +2 -2
- data/app/views/admin/layouts/index.html.haml +11 -4
- data/app/views/admin/layouts/remove.html.haml +6 -5
- data/app/views/admin/page_attachments/_attachment.html.haml +2 -2
- data/app/views/admin/page_fields/_page_field.html.haml +3 -3
- data/app/views/admin/page_parts/_page_part.html.haml +5 -6
- data/app/views/admin/pages/_asset_popups.html.haml +15 -16
- data/app/views/admin/pages/_assets.html.haml +8 -7
- data/app/views/admin/pages/_fields.html.haml +16 -13
- data/app/views/admin/pages/_node.html.haml +3 -3
- data/app/views/admin/pages/_popups.html.haml +11 -11
- data/app/views/admin/pages/edit.html.haml +2 -2
- data/app/views/admin/pages/index.html.haml +5 -2
- data/app/views/admin/pages/new.html.haml +3 -3
- data/app/views/admin/pages/remove.html.haml +4 -3
- data/app/views/admin/preferences/edit.html.haml +5 -5
- data/app/views/admin/references/filters.haml +1 -1
- data/app/views/admin/references/tags.haml +3 -3
- data/app/views/admin/removed/_assets_bucket.html.haml +3 -3
- data/app/views/admin/removed/_assets_container.html.haml +18 -18
- data/app/views/admin/removed/_bucket.html.haml +1 -1
- data/app/views/admin/removed/_bucket_asset.html.haml +3 -3
- data/app/views/admin/removed/_show_bucket_link.html.haml +1 -1
- data/app/views/admin/removed/_upload_to_page.html.haml +5 -5
- data/app/views/admin/sites/_form.haml +18 -18
- data/app/views/admin/sites/edit.haml +1 -1
- data/app/views/admin/sites/index.haml +8 -4
- data/app/views/admin/sites/new.haml +1 -1
- data/app/views/admin/snippets/_choose_site.html.haml +4 -5
- data/app/views/admin/snippets/_form.html.haml +8 -9
- data/app/views/admin/snippets/edit.html.haml +1 -1
- data/app/views/admin/snippets/index.html.haml +11 -4
- data/app/views/admin/snippets/new.html.haml +1 -1
- data/app/views/admin/snippets/remove.html.haml +7 -6
- data/app/views/admin/users/_avatar.html.haml +2 -2
- data/app/views/admin/users/_choose_site.html.haml +3 -7
- data/app/views/admin/users/_form.html.haml +18 -21
- data/app/views/admin/users/_password_fields.html.haml +6 -6
- data/app/views/admin/users/index.html.haml +13 -6
- data/app/views/admin/users/remove.html.haml +4 -4
- data/app/views/admin/welcome/login.html.haml +8 -8
- data/app/views/devise/passwords/edit.html.haml +6 -6
- data/app/views/devise/passwords/new.html.haml +3 -3
- data/app/views/devise/sessions/new.html.haml +8 -8
- data/app/views/devise/shared/_links.html.haml +2 -2
- data/app/views/layouts/application.html.haml +24 -19
- data/app/views/rad_social_mailer/social_mail_form.html.haml +15 -15
- data/app/views/widget/_email_form.html.haml +14 -14
- data/app/views/widget/_horizontal_widget.html.haml +5 -5
- data/bin/rails +4 -4
- data/bin/trusty_cms +3 -5
- data/config.ru +1 -1
- data/config/application.rb +14 -15
- data/config/boot.rb +1 -2
- data/config/environment.rb +1 -1
- data/config/environments/production.rb +0 -1
- data/config/environments/test.rb +1 -2
- data/config/initializers/devise.rb +1 -1
- data/config/initializers/kraken.rb +2 -2
- data/config/initializers/tmp.rb +1 -1
- data/config/initializers/trusty_cms_config.rb +48 -48
- data/config/locales/en.yml +8 -8
- data/config/routes.rb +6 -7
- data/lib/active_record_extensions/active_record_extensions.rb +1 -2
- data/lib/annotatable.rb +3 -5
- data/lib/configuration_extensions/configuration_extensions.rb +1 -1
- data/lib/inheritable_class_attributes.rb +13 -9
- data/lib/login_system.rb +73 -73
- data/lib/method_observer.rb +13 -12
- data/lib/ostruct.rb +7 -10
- data/lib/simpleton.rb +0 -4
- data/lib/string_extensions/string_extensions.rb +3 -3
- data/lib/symbol_extensions/symbol_extensions.rb +1 -1
- data/lib/tasks/database.rake +28 -28
- data/lib/tasks/extensions.rake +18 -18
- data/lib/tasks/framework.rake +68 -68
- data/lib/tasks/radiant_config.rake +4 -4
- data/lib/tasks/snippets_extension_tasks.rake +11 -11
- data/lib/tasks/translate.rake +14 -14
- data/lib/tasks/upgrade_to_devise.rake +1 -1
- data/lib/translation_support.rb +22 -22
- data/lib/trusty_cms.rb +2 -2
- data/lib/trusty_cms/admin_ui.rb +19 -16
- data/lib/trusty_cms/admin_ui/region_partials.rb +4 -3
- data/lib/trusty_cms/admin_ui/region_set.rb +4 -5
- data/lib/trusty_cms/available_locales.rb +2 -4
- data/lib/trusty_cms/config/definition.rb +11 -8
- data/lib/trusty_cms/engine.rb +14 -14
- data/lib/trusty_cms/extension.rb +14 -16
- data/lib/trusty_cms/extension_loader.rb +6 -6
- data/lib/trusty_cms/extension_migrator.rb +42 -41
- data/lib/trusty_cms/extension_path.rb +20 -19
- data/lib/trusty_cms/initializer.rb +5 -8
- data/lib/trusty_cms/pagination/controller.rb +7 -10
- data/lib/trusty_cms/pagination/link_renderer.rb +2 -2
- data/lib/trusty_cms/resource_responses.rb +3 -3
- data/lib/trusty_cms/setup.rb +130 -132
- data/lib/trusty_cms/taggable.rb +19 -22
- data/lib/trusty_cms/task_support.rb +9 -6
- data/package.json +10 -2
- data/public/dispatch.fcgi +1 -1
- data/public/dispatch.rb +2 -2
- data/script/extension +1 -1
- data/script/rails +2 -2
- data/spec/dummy/package.json +1 -1
- data/spec/dummy/yarn.lock +3 -3
- data/trusty_cms.gemspec +25 -25
- data/vendor/extensions/clipped-extension/lib/clipped_admin_ui.rb +1 -1
- data/yarn.lock +1992 -4
- metadata +54 -42
- data/app/assets/stylesheets/admin/partials/_deprecated.scss +0 -65
- data/app/assets/stylesheets/admin/partials/_jquery-ui-structure.scss +0 -258
- data/app/assets/stylesheets/admin/partials/_jquery-ui-theme.scss +0 -410
- data/app/assets/stylesheets/admin/partials/_jquery-ui.scss +0 -650
- data/app/views/admin/assets/refresh.html.haml +0 -14
data/app/models/status.rb
CHANGED
@@ -3,7 +3,8 @@ class Status
|
|
3
3
|
|
4
4
|
def initialize(options = {})
|
5
5
|
options = options.symbolize_keys
|
6
|
-
@id
|
6
|
+
@id = options[:id]
|
7
|
+
@name = options[:name]
|
7
8
|
end
|
8
9
|
|
9
10
|
def symbol
|
@@ -27,15 +28,14 @@ class Status
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def self.selectable_values
|
30
|
-
|
31
|
+
selectable.map(&:name)
|
31
32
|
end
|
32
33
|
|
33
34
|
@@statuses = [
|
34
|
-
Status.new(:
|
35
|
-
Status.new(:
|
36
|
-
Status.new(:
|
37
|
-
Status.new(:
|
38
|
-
Status.new(:
|
35
|
+
Status.new(id: 1, name: 'Draft'),
|
36
|
+
Status.new(id: 50, name: 'Reviewed'),
|
37
|
+
Status.new(id: 90, name: 'Scheduled'),
|
38
|
+
Status.new(id: 100, name: 'Published'),
|
39
|
+
Status.new(id: 101, name: 'Hidden'),
|
39
40
|
]
|
40
|
-
|
41
41
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module TrustyCms
|
2
|
-
|
3
2
|
class << self
|
4
3
|
def config_definitions
|
5
4
|
@config_definitions ||= {}
|
@@ -67,7 +66,7 @@ module TrustyCms
|
|
67
66
|
# edit_setting('admin.name)
|
68
67
|
#
|
69
68
|
|
70
|
-
self.table_name =
|
69
|
+
self.table_name = 'config'
|
71
70
|
after_save :update_cache
|
72
71
|
attr_reader :definition
|
73
72
|
|
@@ -105,12 +104,12 @@ module TrustyCms
|
|
105
104
|
end
|
106
105
|
|
107
106
|
def to_hash
|
108
|
-
Hash[
|
107
|
+
Hash[*all.map { |pair| [pair.key, pair.value] }.flatten]
|
109
108
|
end
|
110
109
|
|
111
110
|
def initialize_cache
|
112
111
|
TrustyCms::Config.ensure_cache_file
|
113
|
-
Rails.cache.write('TrustyCms::Config',TrustyCms::Config.to_hash)
|
112
|
+
Rails.cache.write('TrustyCms::Config', TrustyCms::Config.to_hash)
|
114
113
|
Rails.cache.write('TrustyCms.cache_mtime', File.mtime(cache_file))
|
115
114
|
Rails.cache.silence!
|
116
115
|
end
|
@@ -121,6 +120,7 @@ module TrustyCms
|
|
121
120
|
|
122
121
|
def stale_cache?
|
123
122
|
return true unless TrustyCms::Config.cache_file_exists?
|
123
|
+
|
124
124
|
Rails.cache.read('TrustyCms.cache_mtime') != File.mtime(cache_file)
|
125
125
|
end
|
126
126
|
|
@@ -134,15 +134,15 @@ module TrustyCms
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def cache_file
|
137
|
-
File.join(cache_path,'trusty_config_cache.txt')
|
137
|
+
File.join(cache_path, 'trusty_config_cache.txt')
|
138
138
|
end
|
139
139
|
|
140
140
|
def site_settings
|
141
|
-
@site_settings ||= %w{
|
141
|
+
@site_settings ||= %w{site.title site.host dev.host local.timezone}
|
142
142
|
end
|
143
143
|
|
144
144
|
def default_settings
|
145
|
-
@default_settings ||= %w{
|
145
|
+
@default_settings ||= %w{defaults.locale defaults.page.filter defaults.page.parts defaults.page.fields defaults.page.status}
|
146
146
|
end
|
147
147
|
|
148
148
|
def user_settings
|
@@ -161,7 +161,7 @@ module TrustyCms
|
|
161
161
|
#
|
162
162
|
def namespace(prefix, options = {}, &block)
|
163
163
|
prefix = [options[:prefix], prefix].join('.') if options[:prefix]
|
164
|
-
with_options(options.merge(:
|
164
|
+
with_options(options.merge(prefix: prefix), &block)
|
165
165
|
end
|
166
166
|
|
167
167
|
# Declares a setting definition that will constrain and support the use of a particular config entry.
|
@@ -176,7 +176,7 @@ module TrustyCms
|
|
176
176
|
# * :allow_blank should be false if the config item must not be blank or nil
|
177
177
|
# * :allow_change should be false if the config item can only be set, not changed. Add a default to specify an unchanging config entry.
|
178
178
|
# * :allow_display should be false if the config item should not be showable in radius tags
|
179
|
-
#
|
179
|
+
#
|
180
180
|
# TrustyCms.config do |config|
|
181
181
|
# config.define 'defaults.locale', :select_from => lambda { TrustyCms::AvailableLocales.locales }, :allow_blank => true
|
182
182
|
# config.define 'defaults.page.parts', :default => "Body,Extended"
|
@@ -191,7 +191,7 @@ module TrustyCms
|
|
191
191
|
#
|
192
192
|
# but at the moment that's only done in testing.
|
193
193
|
#
|
194
|
-
def define(key, options={})
|
194
|
+
def define(key, options = {})
|
195
195
|
called_from = caller.grep(/\/initializers\//).first
|
196
196
|
if options.is_a? TrustyCms::Config::Definition
|
197
197
|
definition = options
|
@@ -199,7 +199,7 @@ module TrustyCms
|
|
199
199
|
key = [options[:prefix], key].join('.') if options[:prefix]
|
200
200
|
end
|
201
201
|
|
202
|
-
definition ||= TrustyCms::Config::Definition.new(options.merge(:
|
202
|
+
definition ||= TrustyCms::Config::Definition.new(options.merge(definer: called_from))
|
203
203
|
definitions[key] = definition
|
204
204
|
|
205
205
|
if self[key].nil? && !definition.default.nil?
|
@@ -216,9 +216,8 @@ module TrustyCms
|
|
216
216
|
end
|
217
217
|
|
218
218
|
def definition_for(key)
|
219
|
-
definitions[key] ||= TrustyCms::Config::Definition.new(:
|
219
|
+
definitions[key] ||= TrustyCms::Config::Definition.new(empty: true)
|
220
220
|
end
|
221
|
-
|
222
221
|
end
|
223
222
|
|
224
223
|
# The usual way to use a config item:
|
@@ -236,13 +235,14 @@ module TrustyCms
|
|
236
235
|
def value=(param)
|
237
236
|
newvalue = param.to_s
|
238
237
|
if newvalue != self[:value]
|
239
|
-
raise ConfigError, "#{
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
238
|
+
raise ConfigError, "#{key} cannot be changed" unless settable? || self[:value].blank?
|
239
|
+
|
240
|
+
self[:value] = if boolean?
|
241
|
+
newvalue == '1' || newvalue == 'true' ? 'true' : 'false'
|
242
|
+
else
|
243
|
+
newvalue
|
244
|
+
end
|
245
|
+
save!
|
246
246
|
end
|
247
247
|
self[:value]
|
248
248
|
end
|
@@ -270,20 +270,21 @@ module TrustyCms
|
|
270
270
|
# that does not restrict use.
|
271
271
|
#
|
272
272
|
def definition
|
273
|
-
@definition ||= self.class.definition_for(
|
273
|
+
@definition ||= self.class.definition_for(key)
|
274
274
|
end
|
275
275
|
|
276
276
|
# Returns true if the item key ends with '?' or the definition specifies :type => :boolean.
|
277
277
|
#
|
278
278
|
def boolean?
|
279
|
-
definition.boolean? ||
|
279
|
+
definition.boolean? || key.ends_with?('?')
|
280
280
|
end
|
281
281
|
|
282
282
|
# Returns true if the item is boolean and true.
|
283
283
|
#
|
284
284
|
def checked?
|
285
285
|
return nil if self[:value].nil?
|
286
|
-
|
286
|
+
|
287
|
+
boolean? && self[:value] == 'true'
|
287
288
|
end
|
288
289
|
|
289
290
|
# Returns true if the item defintion includes a :select_from parameter that limits the range of permissible options.
|
@@ -302,11 +303,10 @@ module TrustyCms
|
|
302
303
|
TrustyCms::Config.initialize_cache
|
303
304
|
end
|
304
305
|
|
305
|
-
delegate :default, :type, :allow_blank?, :hidden?, :visible?, :settable?, :selection, :notes, :units, :
|
306
|
+
delegate :default, :type, :allow_blank?, :hidden?, :visible?, :settable?, :selection, :notes, :units, to: :definition
|
306
307
|
|
307
308
|
def validate
|
308
309
|
definition.validate(self)
|
309
310
|
end
|
310
|
-
|
311
311
|
end
|
312
312
|
end
|
@@ -22,7 +22,7 @@ module TrustyCms
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def non_cacheable_response
|
25
|
-
@listener.set_expiry nil, :private => true,
|
25
|
+
@listener.set_expiry nil, :private => true, 'no-cache' => true
|
26
26
|
@listener.set_etag('')
|
27
27
|
end
|
28
28
|
|
@@ -32,12 +32,11 @@ module TrustyCms
|
|
32
32
|
timeout = @page.cache_timeout
|
33
33
|
end
|
34
34
|
|
35
|
-
@listener.set_expiry timeout, :
|
35
|
+
@listener.set_expiry timeout, public: true, private: false
|
36
36
|
end
|
37
37
|
|
38
38
|
def cacheable?
|
39
39
|
@listener.cacheable_request? && @page.cache?
|
40
40
|
end
|
41
|
-
|
42
41
|
end
|
43
42
|
end
|
data/app/models/user.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class User < ActiveRecord::Base
|
2
|
-
has_many :pages, :
|
2
|
+
has_many :pages, foreign_key: :created_by_id
|
3
3
|
self.table_name = 'admins'
|
4
4
|
|
5
5
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
6
6
|
devise :database_authenticatable, :registerable,
|
7
|
-
|
7
|
+
:recoverable, :rememberable, :trackable, :validatable
|
8
8
|
|
9
9
|
alias_attribute :created_by_id, :id
|
10
10
|
|
@@ -13,53 +13,54 @@ class User < ActiveRecord::Base
|
|
13
13
|
validate :password_complexity
|
14
14
|
|
15
15
|
# Default Order
|
16
|
-
default_scope {order('last_name')}
|
16
|
+
default_scope { order('last_name') }
|
17
17
|
|
18
18
|
# Associations
|
19
|
-
belongs_to :created_by, :
|
20
|
-
belongs_to :updated_by, :
|
19
|
+
belongs_to :created_by, class_name: 'User'
|
20
|
+
belongs_to :updated_by, class_name: 'User'
|
21
21
|
|
22
22
|
def has_role?(role)
|
23
23
|
case role
|
24
24
|
when :admin
|
25
|
-
|
25
|
+
admin?
|
26
26
|
when :designer
|
27
|
-
|
27
|
+
designer?
|
28
28
|
when :content_editor
|
29
|
-
|
29
|
+
content_editor?
|
30
30
|
else
|
31
31
|
false
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def admin?
|
36
|
-
|
36
|
+
admin
|
37
37
|
end
|
38
38
|
|
39
39
|
def designer?
|
40
|
-
|
40
|
+
designer
|
41
41
|
end
|
42
42
|
|
43
43
|
def content_editor?
|
44
|
-
|
44
|
+
content_editor
|
45
45
|
end
|
46
46
|
|
47
|
-
def locale
|
47
|
+
def locale
|
48
48
|
'en'
|
49
49
|
end
|
50
50
|
|
51
51
|
def name
|
52
|
-
"#{
|
52
|
+
"#{first_name} #{last_name}"
|
53
53
|
end
|
54
54
|
|
55
55
|
def password_required?
|
56
56
|
return false if skip_password_validation
|
57
|
+
|
57
58
|
super
|
58
59
|
end
|
59
60
|
|
60
61
|
def password_complexity
|
61
62
|
return false if password.blank? || password =~ /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,70}$/
|
63
|
+
|
62
64
|
errors.add :password, 'Complexity requirement not met. Length should be 12 characters and include: 1 uppercase, 1 lowercase, 1 digit and 1 special character.'
|
63
65
|
end
|
64
|
-
|
65
66
|
end
|
@@ -4,7 +4,7 @@ class UserActionObserver < ActiveRecord::Observer
|
|
4
4
|
def current_user=(user)
|
5
5
|
self.class.current_user = user
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def self.current_user=(user)
|
9
9
|
Thread.current[:current_user] = user
|
10
10
|
end
|
@@ -18,10 +18,10 @@ class UserActionObserver < ActiveRecord::Observer
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def before_create(model)
|
21
|
-
#model.created_by = self.current_user
|
21
|
+
# model.created_by = self.current_user
|
22
22
|
end
|
23
23
|
|
24
24
|
def before_update(model)
|
25
|
-
#model.updated_by = self.current_user
|
25
|
+
# model.updated_by = self.current_user
|
26
26
|
end
|
27
27
|
end
|
@@ -1,8 +1,4 @@
|
|
1
1
|
- unless current_user.site
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
%td.field{:style => 'text-align: left;'}
|
6
|
-
= select :user, :site_id, [['<any>', '']] + Site.all.map { |s| [s.name, s.id] }
|
7
|
-
%td.help
|
8
|
-
A user with no site is able to act (to whatever extent their status allows) on any site.
|
2
|
+
%label{:for=>"user_admin"} Can edit site
|
3
|
+
= select :user, :site_id, [['<any>', '']] + Site.all.map { |s| [s.name, s.id] }
|
4
|
+
.caption A user with no site is able to act (to whatever extent their status allows) on any site.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
= render_region :form_top
|
2
2
|
- render_region :form do |form|
|
3
3
|
- form.edit_title do
|
4
|
-
|
4
|
+
.title
|
5
5
|
- form.edit_metadata do
|
6
6
|
.drawer
|
7
7
|
.drawer_contents#attributes
|
@@ -16,3 +16,4 @@
|
|
16
16
|
.drawer_handle
|
17
17
|
%a.toggle.more{:href=>'#attributes', :rel=>"toggle[attributes]"}
|
18
18
|
= t('more')
|
19
|
+
%i.fas.fa-angle-down
|
@@ -9,7 +9,8 @@
|
|
9
9
|
- AssetType.all.each do |type|
|
10
10
|
- unless type.name == :other
|
11
11
|
= link_to t("asset_types.#{type.plural}"), admin_assets_url(:filter => type.name), :rel => type.name.to_s, :class => params[:filter] == type.name.to_s ? "selective pressed" : "selective"
|
12
|
-
.
|
12
|
+
.asset_search
|
13
|
+
%i.fas.fa-search
|
13
14
|
%input{:type=>"search", :id => 'filesearchforminput', :class=>"search", :name=>"search", :value=>h(params[:search]), :placeholder=>"Search", :results=>0, :size=>30}
|
14
15
|
|
15
16
|
#type_boxes{:style => "display: none"}
|
@@ -21,20 +21,12 @@
|
|
21
21
|
= updated_stamp @asset
|
22
22
|
|
23
23
|
%fieldset.upload
|
24
|
-
%label.upload
|
24
|
+
%label.custom-file-upload.upload
|
25
25
|
= t("clipped_extension.replace_file")
|
26
|
-
|
26
|
+
= f.file_field :asset, :class => "", :style => "width: 100%"
|
27
27
|
|
28
28
|
.buttons
|
29
29
|
= save_model_button(@asset)
|
30
30
|
= save_model_and_continue_editing_button(@asset)
|
31
31
|
= t("or")
|
32
32
|
= link_to t("cancel"), admin_assets_path
|
33
|
-
|
34
|
-
- main.edit_regenerate do
|
35
|
-
- if current_user.admin? or current_user.designer?
|
36
|
-
%fieldset= t("clipped_extension.regenerate_thumbnails")
|
37
|
-
|
38
|
-
- form_tag refresh_admin_asset_path(@asset), :method => :put do
|
39
|
-
%p.asset_buttons
|
40
|
-
%input.button{ :type => "submit", :value => t("clipped_extension.regenerate") }
|
@@ -1,5 +1,6 @@
|
|
1
1
|
= stylesheet_link_tag 'admin/assets'
|
2
2
|
= javascript_include_tag 'admin/assets_admin'
|
3
|
+
- body_classes << 'reversed'
|
3
4
|
|
4
5
|
- content_for :toolbar do
|
5
6
|
= render 'search'
|
@@ -11,5 +12,6 @@
|
|
11
12
|
|
12
13
|
- render_region :bottom do |bottom|
|
13
14
|
#actions
|
14
|
-
|
15
|
-
%
|
15
|
+
= link_to new_admin_asset_path, class: 'button' do
|
16
|
+
%i.fas.fa-upload
|
17
|
+
= t('clipped_extension.upload_asset')
|
@@ -1,5 +1,5 @@
|
|
1
1
|
= stylesheet_link_tag 'admin/assets'
|
2
|
-
= render_region :top
|
2
|
+
= render_region :top
|
3
3
|
|
4
4
|
- render_region :main do |main|
|
5
5
|
- main.edit_header do
|
@@ -7,18 +7,14 @@
|
|
7
7
|
|
8
8
|
- main.edit_form do
|
9
9
|
- form_for :asset, :url => admin_assets_path, :html => { :method => "post", :multipart => true } do |f|
|
10
|
-
|
11
10
|
= render :partial => "form", :locals => { :f => f }
|
12
|
-
|
13
11
|
%fieldset
|
14
|
-
%label
|
15
|
-
|
12
|
+
%label.custom-file-upload
|
13
|
+
= t("clipped_extension.choose_file")
|
14
|
+
= f.file_field :asset, :style => "width: 100%", :multiple => true
|
16
15
|
|
17
16
|
.buttons
|
18
17
|
= save_model_button(@asset)
|
19
18
|
= save_model_and_continue_editing_button(@asset)
|
20
19
|
= t("or")
|
21
20
|
= link_to t("cancel"), admin_assets_path
|
22
|
-
|
23
|
-
- main.edit_regenerate do
|
24
|
-
|
@@ -1,7 +1,8 @@
|
|
1
|
+
- body_classes << "reversed"
|
1
2
|
= stylesheet_link_tag 'admin/assets'
|
2
3
|
|
3
4
|
%h1= t("clipped_extension.remove_asset")
|
4
|
-
%
|
5
|
+
%h4.warning= t("clipped_extension.confirm_remove_asset").html_safe
|
5
6
|
|
6
7
|
%table.index#assets{:cellpadding => "0", :cellspacing => "0", :border => "0"}
|
7
8
|
%tbody
|
@@ -1,4 +1,4 @@
|
|
1
|
-
- body_classes <<
|
1
|
+
- body_classes << 'reversed'
|
2
2
|
- @selected = :general
|
3
3
|
|
4
4
|
- render_region :main do |main|
|
@@ -6,26 +6,26 @@
|
|
6
6
|
%h1 Configuration
|
7
7
|
|
8
8
|
- main.edit_form do
|
9
|
-
= form_for :trusty_config, :url => admin_configuration_path, :html => {
|
9
|
+
= form_for :trusty_config, :url => admin_configuration_path, :html => {'data-onsubmit_status'=>'Saving changes…', :method => :put} do |f|
|
10
10
|
= render_region :form_top
|
11
11
|
- render_region :form do |form|
|
12
12
|
- form.edit_site do
|
13
13
|
%fieldset
|
14
|
-
%
|
14
|
+
%h4 Site
|
15
15
|
- TrustyCms.config.site_settings.each do |site_setting|
|
16
16
|
%p
|
17
17
|
= edit_config site_setting
|
18
18
|
|
19
19
|
- form.edit_defaults do
|
20
20
|
%fieldset
|
21
|
-
%
|
21
|
+
%h4 Defaults
|
22
22
|
- TrustyCms.config.default_settings.each do |default_setting|
|
23
23
|
%p
|
24
24
|
= edit_config default_setting
|
25
25
|
|
26
26
|
- form.edit_users do
|
27
27
|
%fieldset
|
28
|
-
%
|
28
|
+
%h4 Passwords
|
29
29
|
- TrustyCms.config.user_settings.each do |user_setting|
|
30
30
|
%p
|
31
31
|
= edit_config user_setting
|
@@ -33,6 +33,6 @@
|
|
33
33
|
- render_region :form_bottom do |form_bottom|
|
34
34
|
- form_bottom.edit_buttons do
|
35
35
|
.buttons
|
36
|
-
%input.button{:type=>
|
36
|
+
%input.button{:type=>'submit', :value=>'Save Changes'}/
|
37
37
|
or
|
38
|
-
= link_to
|
38
|
+
= link_to 'Cancel', admin_configuration_path, class: 'alt'
|