Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated render_essence_* helpers #1652

Merged
merged 1 commit into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions app/helpers/alchemy/admin/essences_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,6 @@
module Alchemy
module Admin
module EssencesHelper
include Alchemy::EssencesHelper
include Alchemy::Admin::ContentsHelper

# Renders the Content editor partial from the given Content.
def render_essence_editor(content)
render_essence(content, :editor)
end
deprecate :render_essence_editor, deprecator: Alchemy::Deprecation

# Renders the Content editor partial found in views/contents/ for the content with name inside the passed Element.
# For options see -> render_essence
#
# Content creation on the fly:
#
# If you update the elements.yml file after creating an element this helper displays a error message with an option to create the content.
#
def render_essence_editor_by_name(element, name)
if element.blank?
return warning('Element is nil', Alchemy.t(:no_element_given))
end
content = element.content_by_name(name)
if content.nil?
render_missing_content(element, name)
else
render_essence_editor(content)
end
end
deprecate :render_essence_editor_by_name, deprecator: Alchemy::Deprecation

# Returns all public pages from current language as an option tags string suitable or the Rails +select_tag+ helper.
#
# @param [Array]
Expand All @@ -53,13 +24,6 @@ def pages_for_select(pages = nil, selected = nil, prompt = "Choose page", page_a
options_for_select(values, selected.to_s)
end

# Renders the missing content partial
#
def render_missing_content(element, name)
render 'alchemy/admin/contents/missing', {element: element, name: name}
end
deprecate :render_missing_content, deprecator: Alchemy::Deprecation

# Renders a thumbnail for given EssencePicture content with correct cropping and size
def essence_picture_thumbnail(content)
picture = content.ingredient
Expand Down
1 change: 0 additions & 1 deletion app/helpers/alchemy/elements_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ module Alchemy
# The most important helper for frontend developers is the {#render_elements} helper.
#
module ElementsHelper
include Alchemy::EssencesHelper
include Alchemy::UrlHelper
include Alchemy::ElementsBlockHelper

Expand Down
119 changes: 0 additions & 119 deletions app/helpers/alchemy/essences_helper.rb

This file was deleted.

15 changes: 0 additions & 15 deletions app/views/alchemy/admin/contents/_missing.html.erb

This file was deleted.

22 changes: 11 additions & 11 deletions spec/dummy/app/views/alchemy/elements/_news.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="news" id="<%= element_dom_id(news) %>" <%= element_preview_code(news) -%>>
<div class="date">
<%= render_essence_view_by_name(news, 'date', :date_format => "%d.%m.%Y") %>
</div>
<h2>
<%= render_essence_view_by_name(news, 'news_headline') %>
</h2>
<div class="body">
<%= render_essence_view_by_name(news, 'body') %>
</div>
</div>
<%= element_view_for(news) do |el| %>
<div class="date">
<%= el.render :date, date_format: "%d.%m.%Y" %>
</div>
<h2>
<%= el.render :news_headline %>
</h2>
<div class="body">
<%= el.render :body %>
</div>
<% end %>
43 changes: 0 additions & 43 deletions spec/helpers/alchemy/admin/essences_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,6 @@
create(:alchemy_element, :with_contents, name: 'article')
end

describe 'essence rendering' do
before do
if element
element.content_by_name('intro').essence.update(body: 'hello!')
end
end

describe '#render_essence_editor' do
it "should render an essence editor" do
content = element.content_by_name('intro')
expect(helper.render_essence_editor(content)).
to match(/input.+type="text".+value="hello!/)
end
end

describe '#render_essence_editor_by_name' do
subject { render_essence_editor_by_name(element, content) }

let(:content) { 'intro' }

it "renders an essence editor by given name" do
is_expected.to match(/input.+type="text".+value="hello!/)
end

context 'when element is nil' do
let(:element) { nil }

it "displays a warning" do
is_expected.to have_selector(".warning.message")
is_expected.to have_content("No element given.")
end
end

context 'when content is not found on element' do
let(:content) { 'sputz' }

it "displays a warning" do
is_expected.to have_selector(".content_editor.missing")
end
end
end
end

describe '#pages_for_select' do
let(:contact_form) do
create(:alchemy_element, :with_contents, name: 'contactform')
Expand Down
86 changes: 0 additions & 86 deletions spec/helpers/alchemy/essences_helper_spec.rb

This file was deleted.