Replaced ApplicationConfig with app_url in views (#7708)

* Replaced ApplicationConfig with app_url in views
* Refactored urls in mailers
This commit is contained in:
Anna Buianova 2020-05-08 13:19:29 +03:00 committed by GitHub
parent 2d9ff805ba
commit 500cf7f271
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 14 deletions

View file

@ -1,5 +1,5 @@
<% title "Search Results" %>
<link rel="canonical" href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/search" />
<link rel="canonical" href="<%= app_url(search_path) %>" />
<meta name="description" content="<%= SiteConfig.community_description %>">
<meta name="keywords" content="<%= SiteConfig.meta_keywords[:default] %>">

View file

@ -42,12 +42,12 @@
<% end %>
<% if internal_navigation? %>
<link rel="canonical" href="<%= @article.canonical_url.presence || "https://#{ApplicationConfig['APP_DOMAIN']}#{@article.path}" %>" />
<link rel="canonical" href="<%= @article.canonical_url.presence || app_url(@article.path) %>" />
<meta name="description" content="<%= @article.description_and_tags %>">
<meta name="keywords" content="<%= @article.cached_tag_list %>, <%= SiteConfig.meta_keywords[:article] %>">
<% else %>
<%= content_for :page_meta do %>
<link rel="canonical" href="<%= @article.canonical_url.presence || "https://#{ApplicationConfig['APP_DOMAIN']}#{@article.path}" %>" />
<link rel="canonical" href="<%= @article.canonical_url.presence || app_url(@article.path) %>" />
<meta name="description" content="<%= @article.description_and_tags %>">
<meta name="keywords" content="<%= @article.cached_tag_list %>, <%= SiteConfig.meta_keywords[:article] %>">

View file

@ -1,6 +1,5 @@
<% host = "#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}" %>
<% credits_url = url_for(host: host, controller: :credits, action: :index) %>
<% pro_membership_url = url_for(host: host, controller: :users, action: :edit, tab: "pro-membership") %>
<% credits_url = app_url(credits_path) %>
<% pro_membership_url = app_url(user_settings_path("pro-membership")) %>
<p>Hi <%= @user.name %>, your Pro Membership will expire in <%= @days %> days on <%= @date.to_s(:long) %>!</p>

View file

@ -1,6 +1,5 @@
<% host = "#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}" %>
<% credits_url = url_for(host: host, controller: :credits, action: :index) %>
<% pro_membership_url = url_for(host: host, controller: :users, action: :edit, tab: "pro-membership") %>
<% credits_url = app_url(credits_path) %>
<% pro_membership_url = app_url(user_settings_path("pro-membership")) %>
Hi <%= @user.name %>, your Pro Membership will expire in <%= @days %> days on <%= @date.to_s(:long) %>!

View file

@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<% @articles.each do |path, last_comment_at| %>
<url>
<loc><%= ApplicationConfig['APP_PROTOCOL'] %><%= ApplicationConfig['APP_DOMAIN'] %><%= path %></loc>
<loc><%= app_url(path) %></loc>
<lastmod><%= last_comment_at.strftime("%F") %></lastmod>
</url>
<% end %>

View file

@ -52,9 +52,9 @@
<div class="crayons-card crayons-card--secondary p-4">
<ol class="list-decimal pl-6 mb-2">
<li>Sign up at
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>">https://<%= ApplicationConfig["APP_DOMAIN"] %></a></li>
<a href="<%= app_url %>"><%= app_url %></a></li>
<li>Navigate to
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/settings/organization">https://<%= ApplicationConfig["APP_DOMAIN"] %>/settings/organization</a>
<a href="<%= app_url(user_settings_path(:organization)) %>"><%= app_url(user_settings_path(:organization)) %></a>
</li>
<li>Paste the secret code below and click <b>Join Organization</b></li>
</ol>
@ -177,7 +177,7 @@
<h3 class="mb-2">Call-to-action box</h3>
<p>
Customizable text that appears to the right of every post for your organization.
See an example from the <a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/devteam/the-dev-badge-is-available-on-font-awesome-2ihe" target="_blank" rel="noopener">DEV Team</a>.
See an example from the <a href="<%= app_url("/devteam/the-dev-badge-is-available-on-font-awesome-2ihe") %>" target="_blank" rel="noopener">DEV Team</a>.
</p>
</header>
<div class="crayons-field">

View file

@ -4,7 +4,7 @@
<div class="crayons-card mb-6 p-6 grid gap-6">
<div class="flex items-center">
<a href="https://<%= ApplicationConfig["APP_DOMAIN"] %>/<%= current_user.username %>" aria-label="Go to your profile page" class="mr-2">
<a href="<%= app_url(current_user.username) %>" aria-label="Go to your profile page" class="mr-2">
<img src="https://d2fltix0v2e0sb.cloudfront.net/dev-badge.svg" alt="<%= community_name %> badge" height="32" width="32" class="dev-badge crayons-icon" />
</a>
<p>Add the <%= community_name %> badge to your personal site. <a href="/p/badges">Click here for the code</a>.</p>