-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove local options from essence editors
Passing options as locals to essence editors is not possible anymore. Static values should be set on the content settings on the contents defintion in elements.yml instead. For dynamic values please use a custom essence class.
- Loading branch information
Showing
18 changed files
with
146 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
spec/dummy/app/views/alchemy/elements/_headline_editor.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<%= render_essence_editor_by_name(element, 'headline') %> | ||
<%= element_editor_for(element) do |el| -%> | ||
<%= el.edit :headline %> | ||
<%- end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'alchemy/essences/_essence_date_editor' do | ||
let(:content) { Alchemy::Content.new(essence: essence) } | ||
let(:essence) { Alchemy::EssenceDate.new } | ||
|
||
before do | ||
view.class.send(:include, Alchemy::Admin::BaseHelper) | ||
allow(view).to receive(:content_label).and_return(content.name) | ||
end | ||
|
||
it "renders a datepicker" do | ||
render 'alchemy/essences/essence_date_editor', content: content | ||
expect(rendered).to have_css('input[type="text"][data-datepicker-type="date"].date') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'alchemy/essences/_essence_select_editor' do | ||
let(:content) { Alchemy::Content.new(essence: essence) } | ||
let(:essence) { Alchemy::EssenceSelect.new } | ||
|
||
before do | ||
view.class.send(:include, Alchemy::Admin::BaseHelper) | ||
allow(view).to receive(:content_label).and_return(content.name) | ||
end | ||
|
||
context 'if no select values are set' do | ||
it 'renders a warning' do | ||
render 'alchemy/essences/essence_select_editor', content: content | ||
expect(rendered).to have_css('.warning') | ||
end | ||
end | ||
|
||
context 'if select values are set' do | ||
before do | ||
allow(content).to receive(:settings) do | ||
{ | ||
select_values: %w(red blue yellow) | ||
} | ||
end | ||
end | ||
|
||
it "renders a select box" do | ||
render 'alchemy/essences/essence_select_editor', content: content | ||
expect(rendered).to have_css('select.alchemy_selectbox') | ||
end | ||
end | ||
end |
Oops, something went wrong.