Skip to content

Commit

Permalink
Change the participant initiatives editor toolbars type (#10845)
Browse files Browse the repository at this point in the history
* Change the participant initiatives editor toolbars type

* Fix the expectation in the initiative editor spec

* Add specs to ensure correct editor in complete and edit views

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
  • Loading branch information
alecslupu and ahukkanen committed May 11, 2023
1 parent 6e0dc86 commit 6d71e1f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
Expand Up @@ -45,7 +45,7 @@
</div>

<div class="field">
<%= text_editor_for(f, :description, lines: 8, toolbar: :full) %>
<%= text_editor_for(f, :description, lines: 8, toolbar: :content) %>
</div>

<div class="field">
Expand Down
Expand Up @@ -27,7 +27,7 @@
</div>

<div class="field">
<%= text_editor_for(f, :description, lines: 8, toolbar: :full) %>
<%= text_editor_for(f, :description, lines: 8, toolbar: :content) %>
</div>

<div class="actions">
Expand Down
Expand Up @@ -22,7 +22,7 @@
</div>

<div class="field">
<%= text_editor_for(form, :description, toolbar: :full, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative), value: translated_attribute(@form.description)) %>
<%= text_editor_for(form, :description, toolbar: :content, lines: 8, disabled: !allowed_to?(:update, :initiative, initiative: current_initiative), value: translated_attribute(@form.description)) %>
</div>

<div class="field">
Expand Down
13 changes: 12 additions & 1 deletion decidim-initiatives/spec/system/create_initiative_spec.rb
Expand Up @@ -206,7 +206,7 @@
find_button("I want to promote this initiative").click
end

it_behaves_like "having a rich text editor", "new_initiative_previous_form", "full"
it_behaves_like "having a rich text editor", "new_initiative_previous_form", "content"
end

describe "creating an initiative" do
Expand Down Expand Up @@ -442,6 +442,17 @@
expect(page).to have_content("Area")
end
end

context "when rich text editor is enabled for participants" do
before do
expect(page).to have_content("Create")
organization.update(rich_text_editor_in_public_views: true)

visit current_path
end

it_behaves_like "having a rich text editor", "new_initiative_form", "content"
end
end
end

Expand Down
15 changes: 15 additions & 0 deletions decidim-initiatives/spec/system/edit_initiative_spec.rb
Expand Up @@ -97,4 +97,19 @@
expect(page).to have_content("not authorized")
end
end

context "when rich text editor is enabled for participants" do
let(:initiative) { create(:initiative, :created, author: user, scoped_type: scoped_type, organization: organization) }
let(:organization) { create(:organization, rich_text_editor_in_public_views: true) }

before do
visit initiative_path

click_link("Edit", href: edit_initiative_path)

expect(page).to have_content "EDIT INITIATIVE"
end

it_behaves_like "having a rich text editor", "edit_initiative", "content"
end
end

0 comments on commit 6d71e1f

Please sign in to comment.