-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐞
Neighborhood
: Link explicitly to the Neighborhood URL.
- #892 - #74 I noticed that the `Convene` link in the footer was always to the current `root_url`, which will be the `Space` when visiting the `Space` via a `Domain`. This shifts it to use the `APP_ROOT_URL`, and allows `Operator`s to configure the Neighborhood name and Tagline.
- Loading branch information
Showing
4 changed files
with
47 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class Neighborhood::LinkComponent < ApplicationComponent | ||
include ViewComponent::InlineTemplate | ||
|
||
erb_template <<~ERB | ||
<%= link_to name, url %>: <%= tagline %> | ||
ERB | ||
|
||
def neighborhood | ||
@neighborhood ||= Neighborhood.new | ||
end | ||
|
||
delegate :name, :url, :tagline, to: :neighborhood | ||
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe Neighborhood::LinkComponent, type: :component do | ||
subject(:output) { render_inline(component) } | ||
|
||
let(:component) { described_class.new } | ||
|
||
it { is_expected.to have_link("Convene", href: ENV.fetch("APP_ROOT_URL")) } | ||
it { is_expected.to have_content("Space to Work, Play, or Simply Be") } | ||
|
||
context "when an Operator has set custom values" do | ||
before do | ||
stub_const("ENV", "NEIGHBORHOOD_NAME" => "Parsley's Persimmons Cooperative", "NEIGHBORHOOD_TAGLINE" => "The Place for Persimmon People", "APP_ROOT_URL" => "https://parsleys-persimmons-coop.example.com") | ||
end | ||
|
||
it { is_expected.to have_link("Parsley's Persimmons Cooperative", href: "https://parsleys-persimmons-coop.example.com") } | ||
it { is_expected.to have_content("The Place for Persimmon People") } | ||
end | ||
end |