-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use env vars for conference registrations * check interpolation * fix donate/chat buttons in assemblies/conferences * normalize i18n * exclude overrides * update fixes
- Loading branch information
1 parent
f36f7f6
commit 6b92acf
Showing
20 changed files
with
287 additions
and
24 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
4 changes: 4 additions & 0 deletions
4
app/overrides/decidim/assemblies/assemblies/show/show_donate.html.erb.deface
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,4 @@ | ||
<!-- insert_before '.card.extra.definition-data' --> | ||
|
||
<%= render "decidim/donate" %> | ||
<%= render "decidim/chat" %> |
7 changes: 7 additions & 0 deletions
7
app/overrides/decidim/conferences/conferences/show/first_external_register.html.erb.deface
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,7 @@ | ||
<!-- replace '.column.medium-9.medium-centered > erb[silent]:contains("if current_participatory_space.registrations_enabled?")' --> | ||
|
||
<% if external_conference_registration %> | ||
<div class="column medium-6"> | ||
<%= render "decidim/conferences/external_register_button" %> | ||
</div> | ||
<% elsif current_participatory_space.registrations_enabled? %> |
14 changes: 14 additions & 0 deletions
14
app/overrides/decidim/conferences/conferences/show/second_external_register.html.erb.deface
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,14 @@ | ||
<!-- replace '.columns.mediumlarge-12 > erb[silent]:contains("if current_participatory_space.registrations_enabled?")' --> | ||
|
||
<% if external_conference_registration %> | ||
<hr class="reset mt-none mb-m"> | ||
<section class="section"> | ||
<h3 class="section-heading"><%= t(".register") %></h3> | ||
<div class="card p-m text-center"> | ||
<p><%= t(".make_conference_registration") %></p> | ||
<div class="medium-3" style="margin: 0 auto;"> | ||
<%= render "decidim/conferences/external_register_button" %> | ||
</div> | ||
</div> | ||
</div> | ||
<% elsif current_participatory_space.registrations_enabled? %> |
17 changes: 17 additions & 0 deletions
17
app/overrides/decidim/conferences/conferences/show/show_donate.html.erb.deface
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,17 @@ | ||
<!-- replace '.section:first' --> | ||
|
||
<% if generic_donate_url || generic_chat_url %> | ||
<div class="row"> | ||
<div class="column medium-9"> | ||
<h3 class="section-heading"><%= t("conferences.show.introduction", scope: "decidim") %></h3> | ||
<%= decidim_sanitize_editor_admin translated_attribute(current_participatory_space.short_description) %> | ||
</div> | ||
<div class="column medium-3"> | ||
<%= render "decidim/donate" %> | ||
<%= render "decidim/chat" %> | ||
</div> | ||
</div> | ||
<% else %> | ||
<h3 class="section-heading"><%= t("conferences.show.introduction", scope: "decidim") %></h3> | ||
<%= decidim_sanitize_editor_admin translated_attribute(current_participatory_space.short_description) %> | ||
<% end %> |
2 changes: 1 addition & 1 deletion
2
app/overrides/decidim/proposals/proposals/show/add_donate.html.erb.deface
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,5 +1,5 @@ | ||
<!-- insert_before 'erb[loud]:contains("resource_reference(@proposal)")' --> | ||
|
||
<% if show_donate_on_proposal? %> | ||
<%= render "decidim/donate" %> | ||
<%= render "decidim/donate" %> | ||
<% end %> |
7 changes: 7 additions & 0 deletions
7
app/overrides/layouts/decidim/_conference_hero/external_register.html.erb.deface
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,7 @@ | ||
<!-- replace 'erb[silent]:contains("if current_participatory_space.registrations_enabled?")' --> | ||
|
||
<% if external_conference_registration %> | ||
<div class="column medium-3 end"> | ||
<%= render "decidim/conferences/external_register_button" %> | ||
</div> | ||
<% elsif current_participatory_space.registrations_enabled? %> |
6 changes: 3 additions & 3 deletions
6
app/overrides/layouts/decidim/_wrapper/fixed_logos.html.erb.deface
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,8 +1,8 @@ | ||
<!-- replace '.logo-wrapper' --> | ||
|
||
<div class="logo-wrapper"> | ||
<%= content_tag :svg, role: "img" do | ||
content_tag(:title, current_organization.name) + | ||
<%= content_tag :svg, role: "img" do | ||
content_tag(:title, current_organization.name) + | ||
content_tag(:use, "", "href" => asset_pack_path("media/images/greenparty-#{locale}.svg") + "#logo") | ||
end %> | ||
</div> | ||
</div> |
1 change: 1 addition & 0 deletions
1
app/views/decidim/conferences/_external_register_button.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= link_to t("layouts.decidim.conference_hero.register"), external_conference_registration, target: "_blank", class:"button button--sc light expanded" %> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
describe "Visit a conference", type: :system do | ||
let(:organization) { create :organization } | ||
let(:conference) { create :conference, slug: slug, registrations_enabled: registrations_enabled, organization: organization } | ||
let(:registrations_enabled) { true } | ||
let(:slug) { "my-conference" } | ||
let(:conference_env) { "CONFERENCE_#{slug.gsub("-", "_").upcase}_REGISTRATION" } | ||
let(:external_path) { "https://example.org" } | ||
let(:compare_path) { external_path } | ||
|
||
before do | ||
allow(ENV).to receive(:fetch).and_call_original | ||
allow(ENV).to receive(:fetch).with(conference_env, nil).and_return(external_path) | ||
switch_to_host(organization.host) | ||
visit decidim_conferences.conference_path(conference) | ||
end | ||
|
||
shared_examples "external links" do | ||
it "has a link to external site" do | ||
expect(page).to have_link("Register", href: compare_path, count: 3) | ||
expect(page).not_to have_link("Register", href: decidim_conferences.conference_registration_types_path(conference)) | ||
end | ||
end | ||
|
||
shared_examples "internal links" do | ||
it "has the internal link" do | ||
expect(page).to have_link("Register", href: decidim_conferences.conference_registration_types_path(conference), count: 2) | ||
expect(page).not_to have_link("Register", href: compare_path) | ||
end | ||
end | ||
|
||
shared_examples "no links" do | ||
it "has no registration" do | ||
expect(page).not_to have_link("Register") | ||
end | ||
end | ||
|
||
it_behaves_like "external links" | ||
|
||
context "when language interpolation" do | ||
let(:external_path) { "https://example.org/%{locale}" } | ||
let(:compare_path) { "https://example.org/#{I18n.locale}" } | ||
|
||
it_behaves_like "external links" | ||
end | ||
|
||
context "when registrations not enabled" do | ||
let(:registrations_enabled) { false } | ||
|
||
it_behaves_like "external links" | ||
end | ||
|
||
context "when no path" do | ||
let(:external_path) { "" } | ||
|
||
it_behaves_like "internal links" | ||
|
||
context "when registrations not enabled" do | ||
let(:registrations_enabled) { false } | ||
|
||
it_behaves_like "no links" | ||
end | ||
end | ||
|
||
context "when no env" do | ||
let(:conference_env) { "CONFERENCE_OTHER_CONFERENCE_REGISTRATION" } | ||
|
||
it_behaves_like "internal links" | ||
|
||
context "when registrations not enabled" do | ||
let(:registrations_enabled) { false } | ||
|
||
it_behaves_like "no links" | ||
end | ||
end | ||
end |
Oops, something went wrong.