Merge pull request #5000 from consul/remove_setting_url
Remove URL setting
This commit is contained in:
@@ -18,7 +18,7 @@ class RelatedContentsController < ApplicationController
|
|||||||
elsif related_content.duplicate?
|
elsif related_content.duplicate?
|
||||||
flash[:error] = t("related_content.error_duplicate")
|
flash[:error] = t("related_content.error_duplicate")
|
||||||
else
|
else
|
||||||
flash[:error] = t("related_content.error", url: Setting["url"])
|
flash[:error] = t("related_content.error", url: root_url)
|
||||||
end
|
end
|
||||||
redirect_to polymorphic_path(related_content.parent_relationable)
|
redirect_to polymorphic_path(related_content.parent_relationable)
|
||||||
end
|
end
|
||||||
@@ -41,7 +41,7 @@ class RelatedContentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def valid_url?
|
def valid_url?
|
||||||
params[:url].start_with?(Setting["url"])
|
params[:url].start_with?(root_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def child_relationable_params
|
def child_relationable_params
|
||||||
|
|||||||
@@ -159,7 +159,6 @@ class Setting < ApplicationRecord
|
|||||||
"twitter_handle": nil,
|
"twitter_handle": nil,
|
||||||
"twitter_hashtag": nil,
|
"twitter_hashtag": nil,
|
||||||
"youtube_handle": nil,
|
"youtube_handle": nil,
|
||||||
"url": "http://example.com", # Public-facing URL of the app.
|
|
||||||
# CONSUL installation's organization name
|
# CONSUL installation's organization name
|
||||||
"org_name": "CONSUL",
|
"org_name": "CONSUL",
|
||||||
"meta_title": nil,
|
"meta_title": nil,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="input-group-field">
|
<div class="input-group-field">
|
||||||
<%= text_field_tag :url, "",
|
<%= text_field_tag :url, "",
|
||||||
"aria-describedby": "related_content_help_text",
|
"aria-describedby": "related_content_help_text",
|
||||||
placeholder: t("related_content.placeholder", url: setting["url"]) %>
|
placeholder: t("related_content.placeholder", url: root_url) %>
|
||||||
|
|
||||||
<%= hidden_field_tag :relationable_klass, relationable.class.name %>
|
<%= hidden_field_tag :relationable_klass, relationable.class.name %>
|
||||||
<%= hidden_field_tag :relationable_id, relationable.id %>
|
<%= hidden_field_tag :relationable_id, relationable.id %>
|
||||||
|
|||||||
@@ -8,9 +8,7 @@
|
|||||||
<meta name="twitter:image" content="<%= root_url + (local_assigns[:twitter_image_url] || "social_media_icon_twitter.png") %>" />
|
<meta name="twitter:image" content="<%= root_url + (local_assigns[:twitter_image_url] || "social_media_icon_twitter.png") %>" />
|
||||||
<!-- Facebook OG -->
|
<!-- Facebook OG -->
|
||||||
<meta id="ogtitle" property="og:title" content="<%= local_assigns[:social_title] || setting["meta_title"] %>" />
|
<meta id="ogtitle" property="og:title" content="<%= local_assigns[:social_title] || setting["meta_title"] %>" />
|
||||||
<% if setting["url"] %>
|
<meta property="article:publisher" content="<%= root_url %>" />
|
||||||
<meta property="article:publisher" content="<%= setting["url"] %>" />
|
|
||||||
<% end %>
|
|
||||||
<% if setting["facebook_handle"] %>
|
<% if setting["facebook_handle"] %>
|
||||||
<meta property="article:author" content="https://www.facebook.com/<%= setting["facebook_handle"] %>" />
|
<meta property="article:author" content="https://www.facebook.com/<%= setting["facebook_handle"] %>" />
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ en:
|
|||||||
telegram_handle_description: "If filled in it will appear in the footer"
|
telegram_handle_description: "If filled in it will appear in the footer"
|
||||||
instagram_handle: "Instagram handle"
|
instagram_handle: "Instagram handle"
|
||||||
instagram_handle_description: "If filled in it will appear in the footer"
|
instagram_handle_description: "If filled in it will appear in the footer"
|
||||||
url: "Main URL"
|
|
||||||
url_description: "Main URL of your website"
|
|
||||||
org_name: "Site name"
|
org_name: "Site name"
|
||||||
org_name_description: "This name will appear on mailers subject, help pages..."
|
org_name_description: "This name will appear on mailers subject, help pages..."
|
||||||
related_content_score_threshold: "Related content score threshold"
|
related_content_score_threshold: "Related content score threshold"
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ es:
|
|||||||
telegram_handle_description: "Si está rellenado aparecerá en el pie de página"
|
telegram_handle_description: "Si está rellenado aparecerá en el pie de página"
|
||||||
instagram_handle: "Usuario de Instagram"
|
instagram_handle: "Usuario de Instagram"
|
||||||
instagram_handle_description: "Si está rellenado aparecerá en el pie de página"
|
instagram_handle_description: "Si está rellenado aparecerá en el pie de página"
|
||||||
url: "URL general de la web"
|
|
||||||
url_description: "URL principal de tu web"
|
|
||||||
org_name: "Nombre del sitio"
|
org_name: "Nombre del sitio"
|
||||||
org_name_description: "Este nombre aparecerá en el asunto de emails, páginas de ayuda..."
|
org_name_description: "Este nombre aparecerá en el asunto de emails, páginas de ayuda..."
|
||||||
related_content_score_threshold: "Umbral de puntuación de contenido relacionado"
|
related_content_score_threshold: "Umbral de puntuación de contenido relacionado"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SitemapGenerator::Sitemap.namer = SitemapGenerator::SimpleNamer.new(:sitemap, ex
|
|||||||
|
|
||||||
# default host
|
# default host
|
||||||
SitemapGenerator::Sitemap.verbose = false if Rails.env.test?
|
SitemapGenerator::Sitemap.verbose = false if Rails.env.test?
|
||||||
SitemapGenerator::Sitemap.default_host = Setting["url"]
|
SitemapGenerator::Sitemap.default_host = root_url(ActionMailer::Base.default_url_options)
|
||||||
|
|
||||||
# sitemap generator
|
# sitemap generator
|
||||||
SitemapGenerator::Sitemap.create do
|
SitemapGenerator::Sitemap.create do
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ section "Creating Admin Notifications & Templates" do
|
|||||||
%i[title body].index_with do |attribute|
|
%i[title body].index_with do |attribute|
|
||||||
-> { I18n.t("seeds.admin_notifications.proposal.#{attribute}") }
|
-> { I18n.t("seeds.admin_notifications.proposal.#{attribute}") }
|
||||||
end
|
end
|
||||||
).merge(link: "#{Setting["url"]}/proposals", segment_recipient: "administrators")
|
).merge(
|
||||||
|
link: Rails.application.routes.url_helpers.proposals_url(ActionMailer::Base.default_url_options),
|
||||||
|
segment_recipient: "administrators"
|
||||||
|
)
|
||||||
).deliver
|
).deliver
|
||||||
|
|
||||||
AdminNotification.create!(
|
AdminNotification.create!(
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ section "Creating Settings" do
|
|||||||
"telegram_handle": "CONSUL",
|
"telegram_handle": "CONSUL",
|
||||||
"twitter_handle": "@consul_dev",
|
"twitter_handle": "@consul_dev",
|
||||||
"twitter_hashtag": "#consul_dev",
|
"twitter_hashtag": "#consul_dev",
|
||||||
"url": "http://localhost:3000",
|
|
||||||
"votes_for_proposal_success": "100",
|
"votes_for_proposal_success": "100",
|
||||||
"youtube_handle": "CONSUL"
|
"youtube_handle": "CONSUL"
|
||||||
}.each do |name, value|
|
}.each do |name, value|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
|
|
||||||
before do
|
before do
|
||||||
integration_session.host = Capybara.app_host # TODO: remove after upgrading to Rails 6.1
|
integration_session.host = Capybara.app_host # TODO: remove after upgrading to Rails 6.1
|
||||||
Setting["url"] = Capybara.app_host
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "related contents are listed" do
|
scenario "related contents are listed" do
|
||||||
@@ -40,7 +39,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
expect(page).to have_css ".add-related-content[aria-expanded='true']"
|
expect(page).to have_css ".add-related-content[aria-expanded='true']"
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in "Link to related content", with: polymorphic_url(related1)
|
fill_in "Link to related content", with: polymorphic_url(related1, port: app_port)
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -57,7 +56,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_button "Add related content"
|
click_button "Add related content"
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in "Link to related content", with: polymorphic_url(related2)
|
fill_in "Link to related content", with: polymorphic_url(related2, port: app_port)
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -77,7 +76,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "Link not valid. Remember to start with #{Capybara.app_host}."
|
expect(page).to have_content "Link not valid. Remember to start with #{app_host}/."
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "returns error when relating content URL to itself" do
|
scenario "returns error when relating content URL to itself" do
|
||||||
@@ -87,7 +86,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_button "Add related content"
|
click_button "Add related content"
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in "Link to related content", with: polymorphic_url(relationable)
|
fill_in "Link to related content", with: polymorphic_url(relationable, port: app_port)
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -111,7 +110,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_button "Add related content"
|
click_button "Add related content"
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in "Link to related content", with: "#{Capybara.app_host}/mypath/#{related.id}"
|
fill_in "Link to related content", with: "#{app_host}/mypath/#{related.id}"
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ shared_examples "relationable" do |relationable_model_name|
|
|||||||
click_button "Add related content"
|
click_button "Add related content"
|
||||||
|
|
||||||
within("#related_content") do
|
within("#related_content") do
|
||||||
fill_in "url", with: polymorphic_url(related1)
|
fill_in "url", with: polymorphic_url(related1, port: app_port)
|
||||||
click_button "Add"
|
click_button "Add"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ module CommonActions
|
|||||||
include Verifications
|
include Verifications
|
||||||
|
|
||||||
def app_host
|
def app_host
|
||||||
"#{Capybara.app_host}:#{Capybara::Server.ports.values.last}"
|
"#{Capybara.app_host}:#{app_port}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def app_port
|
||||||
|
Capybara::Server.ports.values.last
|
||||||
end
|
end
|
||||||
|
|
||||||
def fill_in_signup_form(email = "manuela@consul.dev", password = "judgementday")
|
def fill_in_signup_form(email = "manuela@consul.dev", password = "judgementday")
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ describe "Social media meta tags" do
|
|||||||
"Citizen participation tool for an open, transparent and democratic government."
|
"Citizen participation tool for an open, transparent and democratic government."
|
||||||
end
|
end
|
||||||
let(:twitter_handle) { "@consul_test" }
|
let(:twitter_handle) { "@consul_test" }
|
||||||
let(:url) { "http://consul.dev" }
|
|
||||||
let(:facebook_handle) { "consultest" }
|
let(:facebook_handle) { "consultest" }
|
||||||
let(:org_name) { "CONSUL TEST" }
|
let(:org_name) { "CONSUL TEST" }
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ describe "Social media meta tags" do
|
|||||||
Setting["meta_title"] = meta_title
|
Setting["meta_title"] = meta_title
|
||||||
Setting["meta_description"] = meta_description
|
Setting["meta_description"] = meta_description
|
||||||
Setting["twitter_handle"] = twitter_handle
|
Setting["twitter_handle"] = twitter_handle
|
||||||
Setting["url"] = url
|
|
||||||
Setting["facebook_handle"] = facebook_handle
|
Setting["facebook_handle"] = facebook_handle
|
||||||
Setting["org_name"] = org_name
|
Setting["org_name"] = org_name
|
||||||
end
|
end
|
||||||
@@ -30,7 +28,7 @@ describe "Social media meta tags" do
|
|||||||
expect(page).to have_meta "twitter:description", with: meta_description
|
expect(page).to have_meta "twitter:description", with: meta_description
|
||||||
expect(page).to have_meta "twitter:image", with: "#{app_host}/social_media_icon_twitter.png"
|
expect(page).to have_meta "twitter:image", with: "#{app_host}/social_media_icon_twitter.png"
|
||||||
expect(page).to have_property "og:title", with: meta_title
|
expect(page).to have_property "og:title", with: meta_title
|
||||||
expect(page).to have_property "article:publisher", with: url
|
expect(page).to have_property "article:publisher", with: "#{app_host}/"
|
||||||
expect(page).to have_property "article:author", with: "https://www.facebook.com/#{facebook_handle}"
|
expect(page).to have_property "article:author", with: "https://www.facebook.com/#{facebook_handle}"
|
||||||
expect(page).to have_property "og:url", with: "#{app_host}/"
|
expect(page).to have_property "og:url", with: "#{app_host}/"
|
||||||
expect(page).to have_property "og:image", with: "#{app_host}/social_media_icon.png"
|
expect(page).to have_property "og:image", with: "#{app_host}/social_media_icon.png"
|
||||||
|
|||||||
Reference in New Issue
Block a user