trusty-cms 4.0.2 → 4.1.4
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 +89 -89
- 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/javascripts/rad_social/rad_ajax_form.js +3 -0
- data/app/assets/javascripts/rad_social/rad_email.js +0 -1
- data/app/assets/javascripts/rad_social/rad_email_form.js +2 -7
- 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 -493
- 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 +64 -67
- 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 -130
- 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 +12 -22
- 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 -17
- data/app/views/widget/_email_form.html.haml +13 -18
- 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 +13 -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 -43
- data/app/assets/javascripts/rad_social/captcha.js +0 -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
@@ -1,18 +1,16 @@
|
|
1
1
|
module Admin::NodeHelper
|
2
|
-
|
3
2
|
def render_nodes(page, starting_index, parent_index = nil, simple = false)
|
4
|
-
@rendered_html =
|
3
|
+
@rendered_html = ''
|
5
4
|
render_node page, starting_index, parent_index, simple
|
6
5
|
@rendered_html
|
7
6
|
end
|
8
7
|
|
9
8
|
def render_node(page, index, parent_index = nil, simple = false)
|
10
|
-
|
11
9
|
@current_node = prepare_page(page)
|
12
10
|
|
13
|
-
@rendered_html += (render :
|
14
|
-
:
|
15
|
-
|
11
|
+
@rendered_html += (render partial: 'admin/pages/node',
|
12
|
+
locals: { level: index, index: index, parent_index: parent_index,
|
13
|
+
page: page, simple: simple, branch: (page.children.count > 0) })
|
16
14
|
index
|
17
15
|
end
|
18
16
|
|
@@ -35,14 +33,19 @@ module Admin::NodeHelper
|
|
35
33
|
|
36
34
|
def expanded_rows
|
37
35
|
unless @expanded_rows
|
38
|
-
@expanded_rows =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
@expanded_rows = if rows = cookies[:expanded_rows]
|
37
|
+
rows.split(',').map do |x|
|
38
|
+
begin
|
39
|
+
Integer(x)
|
40
|
+
rescue StandardError
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
end .compact
|
44
|
+
else
|
45
|
+
[]
|
43
46
|
end
|
44
47
|
|
45
|
-
if homepage
|
48
|
+
if homepage && !@expanded_rows.include?(homepage.id)
|
46
49
|
@expanded_rows << homepage.id
|
47
50
|
end
|
48
51
|
end
|
@@ -54,37 +57,37 @@ module Admin::NodeHelper
|
|
54
57
|
end
|
55
58
|
|
56
59
|
def expander(level)
|
57
|
-
|
58
|
-
|
59
|
-
:class => "expander", :alt => 'toggle children',
|
60
|
-
:title => '')
|
60
|
+
if @current_node.children.empty? || (level == 0)
|
61
|
+
''
|
61
62
|
else
|
62
|
-
|
63
|
+
image((expanded ? 'collapse' : 'expand'),
|
64
|
+
class: 'expander', alt: 'toggle children',
|
65
|
+
title: '')
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
66
69
|
def icon
|
67
70
|
icon_name = @current_node.virtual? ? 'virtual_page' : 'page'
|
68
|
-
image(icon_name, :
|
71
|
+
image(icon_name, class: 'icon', alt: '', title: '')
|
69
72
|
end
|
70
73
|
|
71
74
|
def node_title
|
72
|
-
%{<span class="title">#{
|
75
|
+
%{<span class="title">#{h(@current_node.title)}</span>}.html_safe
|
73
76
|
end
|
74
77
|
|
75
78
|
def page_type
|
76
79
|
display_name = @current_node.class.display_name
|
77
80
|
if display_name == 'Page'
|
78
|
-
|
81
|
+
''
|
79
82
|
else
|
80
|
-
%{<span class="info">(#{
|
83
|
+
%{<span class="info">(#{h(display_name)})</span>}.html_safe
|
81
84
|
end
|
82
85
|
end
|
83
86
|
|
84
87
|
def spinner
|
85
88
|
image('spinner.gif',
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
+
class: 'busy', id: "busy_#{@current_node.id}",
|
90
|
+
alt: '', title: '',
|
91
|
+
style: 'display: none;')
|
89
92
|
end
|
90
93
|
end
|
@@ -16,10 +16,10 @@ module Admin::PagesHelper
|
|
16
16
|
|
17
17
|
def status_to_display
|
18
18
|
@page.status_id = 100 if @page.status_id == 90
|
19
|
-
@display_status = Status.selectable.map{ |s| [I18n.translate(s.name.downcase), s.id] }
|
19
|
+
@display_status = Status.selectable.map { |s| [I18n.translate(s.name.downcase), s.id] }
|
20
20
|
end
|
21
21
|
|
22
22
|
def clean_page_description(page)
|
23
|
-
page.description.to_s.strip.gsub(/\t/,'').gsub(/\s+/,' ')
|
23
|
+
page.description.to_s.strip.gsub(/\t/, '').gsub(/\s+/, ' ')
|
24
24
|
end
|
25
25
|
end
|
@@ -1,27 +1,26 @@
|
|
1
|
-
require
|
1
|
+
require 'RedCloth'
|
2
2
|
|
3
3
|
module Admin::ReferencesHelper
|
4
4
|
def tag_reference
|
5
5
|
String.new.tap do |output|
|
6
6
|
class_of_page.tag_descriptions.sort.each do |tag_name, description|
|
7
|
-
value = t("desc.#{tag_name.gsub(':','-')}").match('desc') ? description : t("desc.#{tag_name.gsub(':','-')}")
|
8
|
-
output << render(:
|
9
|
-
|
10
|
-
|
11
|
-
})
|
7
|
+
value = t("desc.#{tag_name.gsub(':', '-')}").match('desc') ? description : t("desc.#{tag_name.gsub(':', '-')}")
|
8
|
+
output << render(partial: 'admin/references/tag_reference.haml',
|
9
|
+
locals: { tag_name: tag_name,
|
10
|
+
description: RedCloth.new(TrustyCms::Taggable::Util.strip_leading_whitespace(value)).to_html })
|
12
11
|
end
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
def filter_reference
|
17
|
-
|
16
|
+
if filter.blank?
|
17
|
+
'There is no filter on the current page part.'
|
18
|
+
else
|
18
19
|
if filter.description.blank?
|
19
|
-
|
20
|
+
'There is no documentation on this filter.'
|
20
21
|
else
|
21
22
|
filter.description
|
22
23
|
end
|
23
|
-
else
|
24
|
-
"There is no filter on the current page part."
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module Admin::RegionsHelper
|
2
|
-
def render_region(region, options={}, &block)
|
2
|
+
def render_region(region, options = {}, &block)
|
3
3
|
lazy_initialize_region_set
|
4
4
|
default_partials = TrustyCms::AdminUI::RegionPartials.new(self)
|
5
5
|
if block_given?
|
6
6
|
block.call(default_partials)
|
7
|
-
(options[:locals] ||= {}).merge!(:
|
7
|
+
(options[:locals] ||= {}).merge!(defaults: default_partials)
|
8
8
|
end
|
9
9
|
output = @region_set[region].compact.map do |partial|
|
10
10
|
begin
|
11
|
-
render options.merge(:
|
11
|
+
render options.merge(partial: partial)
|
12
12
|
rescue ::ActionView::MissingTemplate # couldn't find template
|
13
13
|
default_partials[partial]
|
14
14
|
rescue ::ActionView::TemplateError => e # error in template
|
@@ -22,26 +22,26 @@ module ApplicationHelper
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def onsubmit_status(model)
|
25
|
-
model.new_record? ? t('creating_status', :
|
25
|
+
model.new_record? ? t('creating_status', model: t(model.class.name.downcase)) : "#{I18n.t('saving_changes')}…"
|
26
26
|
end
|
27
27
|
|
28
28
|
def save_model_button(model, options = {})
|
29
29
|
model_name = model.class.name.underscore
|
30
30
|
human_model_name = model_name.humanize.titlecase
|
31
31
|
options[:label] ||= model.new_record? ?
|
32
|
-
t('buttons.create', :
|
33
|
-
t('buttons.save_changes', :
|
34
|
-
options[:class] ||=
|
32
|
+
t('buttons.create', name: t(model_name, default: human_model_name), default: 'Create ' + human_model_name) :
|
33
|
+
t('buttons.save_changes', default: 'Save Changes')
|
34
|
+
options[:class] ||= 'button'
|
35
35
|
options[:accesskey] ||= 'S'
|
36
36
|
submit_tag options.delete(:label), options
|
37
37
|
end
|
38
38
|
|
39
|
-
def save_model_and_continue_editing_button(
|
40
|
-
submit_tag t('buttons.save_and_continue'), :
|
39
|
+
def save_model_and_continue_editing_button(_model)
|
40
|
+
submit_tag t('buttons.save_and_continue'), name: 'continue', class: 'button', accesskey: 's'
|
41
41
|
end
|
42
42
|
|
43
43
|
def current_item?(item)
|
44
|
-
if item.tab
|
44
|
+
if item.tab&.many? { |i| current_url?(i.relative_url) }
|
45
45
|
# Accept only stricter URL matches if more than one matches
|
46
46
|
current_page?(item.url)
|
47
47
|
else
|
@@ -50,7 +50,7 @@ module ApplicationHelper
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def current_tab?(tab)
|
53
|
-
@current_tab ||= tab if tab.any? {|item| current_url?(item.relative_url) }
|
53
|
+
@current_tab ||= tab if tab.any? { |item| current_url?(item.relative_url) }
|
54
54
|
@current_tab == tab
|
55
55
|
end
|
56
56
|
|
@@ -70,7 +70,7 @@ module ApplicationHelper
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def admin?
|
73
|
-
current_user
|
73
|
+
current_user&.admin?
|
74
74
|
end
|
75
75
|
|
76
76
|
def designer?
|
@@ -82,11 +82,11 @@ module ApplicationHelper
|
|
82
82
|
updated_by = (model.updated_by || model.created_by)
|
83
83
|
name = updated_by ? updated_by.name : nil
|
84
84
|
time = (model.updated_at || model.created_at)
|
85
|
-
if name
|
86
|
-
html = %{<
|
85
|
+
if name || time
|
86
|
+
html = %{<div class="updated_line">#{t('timestamp.last_updated')} }
|
87
87
|
html << %{#{t('timestamp.by')} <strong>#{name}</strong> } if name
|
88
88
|
html << %{#{t('timestamp.at')} #{timestamp(time)}} if time
|
89
|
-
html << %{</
|
89
|
+
html << %{</div>}
|
90
90
|
html.html_safe
|
91
91
|
end
|
92
92
|
end
|
@@ -94,7 +94,7 @@ module ApplicationHelper
|
|
94
94
|
|
95
95
|
def timestamp(time)
|
96
96
|
# time.strftime("%I:%M %p on %B %e, %Y").sub("AM", 'am').sub("PM", 'pm')
|
97
|
-
I18n.localize(time, :
|
97
|
+
I18n.localize(time, format: :timestamp)
|
98
98
|
end
|
99
99
|
|
100
100
|
def meta_errors?
|
@@ -122,11 +122,11 @@ module ApplicationHelper
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def translate_with_default(name)
|
125
|
-
t(name.underscore.downcase, :
|
125
|
+
t(name.underscore.downcase, default: name)
|
126
126
|
end
|
127
127
|
|
128
128
|
def available_locales_select
|
129
|
-
[[t('select.default'),'']] + TrustyCms::AvailableLocales.locales
|
129
|
+
[[t('select.default'), '']] + TrustyCms::AvailableLocales.locales
|
130
130
|
end
|
131
131
|
|
132
132
|
def stylesheet_overrides
|
@@ -147,12 +147,12 @@ module ApplicationHelper
|
|
147
147
|
|
148
148
|
# Returns a Gravatar URL associated with the email parameter.
|
149
149
|
# See: http://douglasfshearer.com/blog/gravatar-for-ruby-and-ruby-on-rails
|
150
|
-
def gravatar_url(email, options={})
|
150
|
+
def gravatar_url(email, options = {})
|
151
151
|
# Default to highest rating. Rating can be one of G, PG, R X.
|
152
|
-
options[:rating] ||=
|
152
|
+
options[:rating] ||= 'G'
|
153
153
|
|
154
154
|
# Default size of the image.
|
155
|
-
options[:size] ||=
|
155
|
+
options[:size] ||= '32px'
|
156
156
|
|
157
157
|
# Default image url to be used when no gravatar is found
|
158
158
|
# or when an image exceeds the rating parameter.
|
@@ -160,7 +160,9 @@ module ApplicationHelper
|
|
160
160
|
default_avatar_url = "#{request.protocol}#{request.host_with_port}#{ActionController::Base.relative_url_root}#{local_avatar_url}"
|
161
161
|
options[:default] ||= default_avatar_url
|
162
162
|
|
163
|
-
|
163
|
+
if email.blank?
|
164
|
+
local_avatar_url
|
165
|
+
else
|
164
166
|
# Build the Gravatar url.
|
165
167
|
url = '//gravatar.com/avatar/'
|
166
168
|
url << "#{Digest::MD5.new.update(email)}?"
|
@@ -169,31 +171,29 @@ module ApplicationHelper
|
|
169
171
|
url << "&default=#{options[:default]}" if options[:default]
|
170
172
|
# Test the Gravatar url
|
171
173
|
require 'open-uri'
|
172
|
-
begin; open "http:#{url}", :
|
173
|
-
rescue; local_avatar_url
|
174
|
+
begin; open "http:#{url}", proxy: true
|
175
|
+
rescue StandardError; local_avatar_url
|
174
176
|
else; url
|
175
177
|
end
|
176
|
-
else
|
177
|
-
local_avatar_url
|
178
178
|
end
|
179
179
|
end
|
180
180
|
|
181
181
|
# returns the usual set of pagination links.
|
182
182
|
# options are passed through to will_paginate
|
183
183
|
# and a 'show all' depagination link is added if relevant.
|
184
|
-
def pagination_for(list, options={})
|
184
|
+
def pagination_for(list, options = {})
|
185
185
|
if list.respond_to? :total_pages
|
186
186
|
options = {
|
187
|
-
:
|
188
|
-
:
|
187
|
+
max_per_page: @trusty_config['pagination.max_per_page'] || 500,
|
188
|
+
depaginate: true,
|
189
189
|
}.merge(options.symbolize_keys)
|
190
190
|
depaginate = options.delete(:depaginate) # supply :depaginate => false to omit the 'show all' link
|
191
191
|
depagination_limit = options.delete(:max_per_page) # supply :max_per_page => false to include the 'show all' link no matter how large the collection
|
192
192
|
html = will_paginate(list, will_paginate_options.merge(options))
|
193
193
|
if depaginate && list.total_pages > 1 && (!depagination_limit.blank? || list.total_entries <= depagination_limit.to_i)
|
194
|
-
html << content_tag(:div, link_to(t('show_all'), :
|
194
|
+
html << content_tag(:div, link_to(t('show_all'), pp: 'all'), class: 'depaginate')
|
195
195
|
elsif depaginate && list.total_entries > depagination_limit.to_i
|
196
|
-
html = content_tag(:div, link_to(
|
196
|
+
html = content_tag(:div, link_to('paginate', p: 1), class: 'pagination')
|
197
197
|
end
|
198
198
|
html
|
199
199
|
end
|
@@ -201,12 +201,11 @@ module ApplicationHelper
|
|
201
201
|
|
202
202
|
private
|
203
203
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
204
|
+
def append_image_extension(name)
|
205
|
+
if name =~ /\.(.*?)$/
|
206
|
+
name
|
207
|
+
else
|
208
|
+
name + '.png'
|
209
209
|
end
|
210
|
-
|
211
|
-
|
210
|
+
end
|
212
211
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module RadSocialHelper
|
2
|
-
|
3
2
|
def rad_test_method
|
4
|
-
|
3
|
+
'SURPRISE SURPRISE SURPRISE'
|
5
4
|
end
|
6
5
|
|
7
6
|
def rad_share_widget(options)
|
@@ -9,15 +8,13 @@ module RadSocialHelper
|
|
9
8
|
message = options[:message].nil? ? "Check out #{options[:title]}." : options[:message]
|
10
9
|
email_subject = options[:email_subject].nil? ? options[:title] : options[:email_subject]
|
11
10
|
email_message = options[:email_message].nil? ? "I thought you might be interested in this: #{url}" : "#{options[:email_message]} #{url}"
|
12
|
-
email_action_url = options[:email_action_url].nil? ?
|
11
|
+
email_action_url = options[:email_action_url].nil? ? '/rad_social/mail' : options[:email_action_url]
|
13
12
|
|
14
|
-
render :
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}
|
13
|
+
render partial: 'widget/horizontal_widget',
|
14
|
+
locals: { url: url,
|
15
|
+
message: message,
|
16
|
+
email_subject: email_subject,
|
17
|
+
email_message: email_message,
|
18
|
+
email_action_url: email_action_url }
|
21
19
|
end
|
22
|
-
|
23
20
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module ScopedHelper
|
2
2
|
def self.included(base)
|
3
|
-
|
4
3
|
base.module_eval do
|
5
4
|
def title
|
6
|
-
t = current_site.name
|
5
|
+
t = current_site.name
|
7
6
|
t = TrustyCms::Config['admin.title'] || 'TrustyCMS' if t.blank?
|
8
7
|
t
|
9
8
|
end
|
@@ -13,7 +12,6 @@ module ScopedHelper
|
|
13
12
|
st = TrustyCms::Config['admin.subtitle'] || 'publishing for small teams' if st.blank?
|
14
13
|
st
|
15
14
|
end
|
16
|
-
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
data/app/helpers/sites_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module SitesHelper
|
2
2
|
def order_links(site)
|
3
3
|
String.new.tap do |output|
|
4
|
-
output << link_to(image(
|
5
|
-
output << link_to(image(
|
6
|
-
output << link_to(image(
|
7
|
-
output << link_to(image(
|
4
|
+
output << link_to(image('move_to_top.png', alt: 'Move to top'), move_to_top_admin_site_path(site), method: :put)
|
5
|
+
output << link_to(image('move_higher.png', alt: 'Move up'), move_higher_admin_site_path(site), method: :post)
|
6
|
+
output << link_to(image('move_lower.png', alt: 'Move down'), move_lower_admin_site_path(site), method: :post)
|
7
|
+
output << link_to(image('move_to_bottom.png', alt: 'Move to bottom'), move_to_bottom_admin_site_path(site), method: :put)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
class DeviseMailer < Devise::Mailer
|
2
|
-
|
3
|
-
def reset_password_instructions(record, token, opts={})
|
2
|
+
def reset_password_instructions(record, token, opts = {})
|
4
3
|
mail = super
|
5
|
-
mail.subject =
|
4
|
+
mail.subject = 'Reset Password for TrustyCMS'
|
6
5
|
mail
|
7
|
-
end
|
6
|
+
end
|
8
7
|
end
|
@@ -3,7 +3,7 @@ require 'roadie-rails'
|
|
3
3
|
class RadSocialMailer < ApplicationMailer
|
4
4
|
include Roadie::Rails::Automatic
|
5
5
|
|
6
|
-
def social_mail
|
6
|
+
def social_mail(options)
|
7
7
|
from_address = Mail::Address.new options[:from] # ex: "john@example.com"
|
8
8
|
from_address.display_name = options[:from_name] # ex: "John Doe"
|
9
9
|
|
@@ -14,12 +14,12 @@ class RadSocialMailer < ApplicationMailer
|
|
14
14
|
@actual_from = from_address if @actual_from.nil?
|
15
15
|
|
16
16
|
mail({
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
to: options[:to],
|
18
|
+
from: @actual_from,
|
19
|
+
reply_to: @from_email,
|
20
|
+
subject: options[:subject],
|
21
|
+
text: @message,
|
22
|
+
content_type: 'text/html',
|
23
|
+
})
|
24
24
|
end
|
25
25
|
end
|