Skip to content

Commit 26a409b

Browse files
authored
Merge pull request #3041 from AlchemyCMS/remove-7x-deprecations
Remove 7.x deprecations
2 parents 3a146ed + fbe82b4 commit 26a409b

27 files changed

Lines changed: 94 additions & 528 deletions

app/helpers/alchemy/admin/base_helper.rb

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -80,36 +80,6 @@ def sites_for_select
8080
end
8181
end
8282

83-
# Returns a javascript driven live filter for lists.
84-
#
85-
# The items must have a html +name+ attribute that holds the filterable value.
86-
#
87-
# == Example
88-
#
89-
# Given a list of items:
90-
#
91-
# <%= js_filter_field('#products .product') %>
92-
#
93-
# <ul id="products">
94-
# <li class="product" name="kat litter">Kat Litter</li>
95-
# <li class="product" name="milk">Milk</li>
96-
# </ul>
97-
#
98-
# @param [String] items
99-
# A jquery compatible selector string that represents the items to filter
100-
# @param [Hash] options
101-
# HTML options passed to the input field
102-
#
103-
# @option options [String] :class ('js_filter_field')
104-
# The css class of the <input> tag
105-
# @option options [String or Hash] :data ({'alchemy-list-filter' => items})
106-
# A HTML data attribute that holds the jQuery selector that represents the list to be filtered
107-
# @deprecated render Alchemy::Admin::ListFilter.new(items) instead
108-
def js_filter_field(items, _options = {})
109-
render Alchemy::Admin::ListFilter.new(items)
110-
end
111-
deprecate js_filter_field: "render Alchemy::Admin::ListFilter.new(items) instead", deprecator: Alchemy::Deprecation
112-
11383
# Returns a link that opens a modal confirmation to delete window.
11484
#
11585
# === Example:
@@ -220,49 +190,6 @@ def render_alchemy_title
220190
"Alchemy CMS - #{title}"
221191
end
222192

223-
# Renders a toolbar button for the Alchemy toolbar
224-
#
225-
# == Example
226-
#
227-
# <%= toolbar_button(
228-
# icon: :plus,
229-
# label: 'Create',
230-
# url: new_resource_path,
231-
# title: 'Create Resource',
232-
# hotkey: 'alt+n',
233-
# dialog_options: {
234-
# title: 'Create Resource',
235-
# size: "430x400"
236-
# },
237-
# if_permitted_to: [:create, resource_model]
238-
# ) %>
239-
#
240-
# @option options [String] :icon
241-
# Icon class. See +app/assets/stylesheets/alchemy/icons.css.sccs+ for available icons, or make your own.
242-
# @option options [String] :label
243-
# Text for button label.
244-
# @option options [String] :url
245-
# Url for link.
246-
# @option options [String] :title
247-
# Text for title tag.
248-
# @option options [String] :hotkey
249-
# Keyboard shortcut for this button. I.E +alt-n+
250-
# @option options [Boolean] :dialog (true)
251-
# Open the link in a modal dialog.
252-
# @option options [Hash] :dialog_options
253-
# Overlay options. See link_to_dialog helper.
254-
# @option options [Array] :if_permitted_to ([:action, :controller])
255-
# Check permission for button. Exactly how you defined the permission in your +authorization_rules.rb+. Defaults to controller and action from button url.
256-
# @option options [Boolean] :skip_permission_check (false)
257-
# Skip the permission check. NOT RECOMMENDED!
258-
# @option options [Boolean] :loading_indicator (true)
259-
# Shows the please wait dialog while loading. Only for buttons not opening an dialog.
260-
# @deprecated render Alchemy::Admin::ToolbarButton.new instead
261-
def toolbar_button(options = {})
262-
render Alchemy::Admin::ToolbarButton.new(**options)
263-
end
264-
deprecate toolbar_button: "render Alchemy::Admin::ToolbarButton.new instead", deprecator: Alchemy::Deprecation
265-
266193
# Renders a textfield ready to display a datepicker
267194
#
268195
# A Javascript observer converts this into a fancy Datepicker.

app/helpers/alchemy/base_helper.rb

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22

33
module Alchemy
44
module BaseHelper
5-
# An alias for truncate.
6-
# Left here for downwards compatibilty.
7-
# @deprecated
8-
def shorten(text, length)
9-
text.truncate(length: length)
10-
end
11-
deprecate :shorten, deprecator: Alchemy::Deprecation
12-
135
# Logs a message in the Rails logger (warn level)
146
# and optionally displays an error message to the user.
157
def warning(message, text = nil)
@@ -45,27 +37,5 @@ def render_icon(icon_name, options = {})
4537
def render_message(type = :info, msg = nil, &)
4638
render Alchemy::Admin::Message.new(msg || capture(&), type: type)
4739
end
48-
49-
# Checks if the given argument is a String or a Page object.
50-
# If a String is given, it tries to find the page via page_layout
51-
# Logs a warning if no page is given.
52-
# @deprecated
53-
def page_or_find(page)
54-
unless Current.language
55-
warning("No default language set up")
56-
return nil
57-
end
58-
59-
if page.is_a?(String)
60-
page = Current.language.pages.find_by(page_layout: page)
61-
end
62-
if page.blank?
63-
warning("No Page found for #{page.inspect}")
64-
nil
65-
else
66-
page
67-
end
68-
end
69-
deprecate :page_or_find, deprecator: Alchemy::Deprecation
7040
end
7141
end

app/helpers/alchemy/elements_block_helper.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,8 @@ def ingredient_by_role(role)
100100
# A lambda used for formatting the element's tags (see Alchemy::ElementsHelper::element_tags_attributes). Set to +false+ to not include tags in the wrapper element.
101101
#
102102
def element_view_for(element, options = {})
103-
if options[:id].nil?
104-
Alchemy::Deprecation.warn <<~WARN
105-
Relying on an implicit DOM id in `element_view_for` is deprecated. Please provide an explicit `id` if you actually want to render an `id` attribute on the #{element.name} element wrapper tag.
106-
WARN
107-
end
108-
109-
if options[:class].nil?
110-
Alchemy::Deprecation.warn <<~WARN
111-
Relying on an implicit CSS class in `element_view_for` is deprecated. Please provide an explicit `class` for the #{element.name} element wrapper tag.
112-
WARN
113-
end
114-
115103
options = {
116104
tag: :div,
117-
id: (!!options[:id]) ? options[:id] : element.dom_id,
118-
class: element.name,
119105
tags_formatter: ->(tags) { tags.join(" ") }
120106
}.merge(options)
121107

app/models/alchemy/element.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,6 @@ def new(attributes = {})
134134
super(element_definition.merge(element_attributes).except(*FORBIDDEN_DEFINITION_ATTRIBUTES))
135135
end
136136

137-
# The class responsible for the +dom_id+ of elements.
138-
# Defaults to +Alchemy::Element::DomId+.
139-
# @deprecated
140-
def dom_id_class
141-
if caller.none? { |l| l =~ Regexp.new("alchemy/element/presenters.rb:87:in `dom_id'") }
142-
Alchemy::Deprecation.warn("dom_id_class is deprecated and will be removed from Alchemy 8.0. Please pass an id to the element_view_for helper instead.")
143-
end
144-
@_dom_id_class || DomId
145-
end
146-
147-
# Register a custom +DomId+ class responsible for the +dom_id+ of elements.
148-
# Defaults to +Alchemy::Element::DomId+.
149-
# @deprecated
150-
def dom_id_class=(klass)
151-
@_dom_id_class = klass
152-
end
153-
deprecate :dom_id_class=, deprecator: Alchemy::Deprecation
154-
155137
# This methods does a copy of source and all its ingredients.
156138
#
157139
# == Options

app/models/alchemy/element/dom_id.rb

Lines changed: 0 additions & 31 deletions
This file was deleted.

app/models/alchemy/element/presenters.rb

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,6 @@ def display_name_with_preview_text(maxlength = 30)
7878
"#{display_name}: #{preview_text(maxlength)}"
7979
end
8080

81-
# Returns a dom id used for elements html id tag.
82-
# @deprecated
83-
def dom_id
84-
if caller.none? { |l| l =~ Regexp.new("alchemy/elements_block_helper.rb:117:in `element_view_for'") }
85-
Alchemy::Deprecation.warn("dom_id is deprecated and will be removed from Alchemy 8.0. Please pass an id to the element_view_for helper instead.")
86-
end
87-
self.class.dom_id_class.new(self).call
88-
end
89-
9081
# The ingredient that's used for element's preview text.
9182
#
9283
# It tries to find one of element's ingredients that is defined +as_element_title+.

app/models/alchemy/language.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,6 @@ def on_current_site
7171
on_site(Current.site)
7272
end
7373

74-
# Store the current language in the current thread.
75-
# @deprecated Use {Alchemy::Current#language=} instead.
76-
def current=(language)
77-
Current.language = language
78-
end
79-
deprecate "current=": :"Alchemy::Current.language=", deprecator: Alchemy::Deprecation
80-
81-
# Current language from current thread or default.
82-
# @deprecated Use {Alchemy::Current#language} instead.
83-
def current
84-
Current.language
85-
end
86-
deprecate current: :"Alchemy::Current.language", deprecator: Alchemy::Deprecation
87-
8874
# The root page of the current language.
8975
def current_root_page
9076
Current.language&.pages&.language_roots&.first

app/models/alchemy/page.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,6 @@ def searchable_alchemy_resource_attributes
200200
%w[name urlname title]
201201
end
202202

203-
# Used to store the current page previewed in the edit page template.
204-
# @deprecated Use {Alchemy::Current#preview_page=} instead.
205-
def current_preview=(page)
206-
Current.preview_page = page
207-
end
208-
deprecate "current_preview=": :"Alchemy::Current.preview_page=", deprecator: Alchemy::Deprecation
209-
210-
# Returns the current page previewed in the edit page template.
211-
# @deprecated Use {Alchemy::Current#preview_page} instead.
212-
def current_preview
213-
Current.preview_page
214-
end
215-
deprecate current_preview: :"Alchemy::Current.preview_page", deprecator: Alchemy::Deprecation
216-
217203
# @return the language root page for given language id.
218204
# @param language_id [Fixnum]
219205
#

app/models/alchemy/site.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,6 @@ def default_language
5757
end
5858

5959
class << self
60-
# @deprecated Use {Alchemy::Current#site=} instead.
61-
def current=(site)
62-
Current.site = site
63-
end
64-
deprecate "current=": :"Alchemy::Current.site=", deprecator: Alchemy::Deprecation
65-
66-
# @deprecated Use {Alchemy::Current#site} instead.
67-
def current
68-
Current.site
69-
end
70-
deprecate current: :"Alchemy::Current.site", deprecator: Alchemy::Deprecation
71-
72-
alias_method :default, :first
73-
deprecate default: :first, deprecator: Alchemy::Deprecation
74-
7560
def find_for_host(host)
7661
# These are split up into two separate queries in order to run the
7762
# fastest query first (selecting the domain by its primary host name).

app/serializers/alchemy/element_serializer.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class ElementSerializer < ActiveModel::Serializer
1010
:tag_list,
1111
:created_at,
1212
:updated_at,
13-
:dom_id,
1413
:display_name
1514

1615
has_many :nested_elements

0 commit comments

Comments
 (0)