Fix #4425: Add Danbooru Discord server prominently

* Add Discord, Twitter, and Github links to site footer.
* Remove "Desktop mode" and "Keyboard shortcuts" links from footer.
  Users can use the desktop site option in their browser to switch
  between desktop and mobile mode.
* Remove git hash from footer. Users can hover over the Github logo to
  see the hash instead.
This commit is contained in:
evazion
2020-05-08 17:10:05 -05:00
parent d7c236b0fc
commit 26d6e23377
8 changed files with 32 additions and 26 deletions

View File

@@ -1,5 +1,4 @@
import Cookie from './cookie' import Cookie from './cookie'
import CurrentUser from './current_user'
$(function() { $(function() {
$("#hide-upgrade-account-notice").on("click.danbooru", function(e) { $("#hide-upgrade-account-notice").on("click.danbooru", function(e) {
@@ -20,12 +19,6 @@ $(function() {
$('#notice').fadeOut("fast"); $('#notice').fadeOut("fast");
e.preventDefault(); e.preventDefault();
}); });
$("#desktop-version-link a").on("click.danbooru", async function(e) {
e.preventDefault();
await CurrentUser.update({ enable_desktop_mode: true });
location.reload();
});
}); });
window.submitInvisibleRecaptchaForm = function () { window.submitInvisibleRecaptchaForm = function () {

View File

@@ -126,7 +126,7 @@ table tfoot {
} }
.text-small { .text-small {
font-size: 0.8em; font-size: 0.9em;
} }
.fixed-width-container { .fixed-width-container {

View File

@@ -30,6 +30,12 @@ footer#page-footer {
text-align: center; text-align: center;
padding: 1em 0 1em; padding: 1em 0 1em;
border-top: var(--footer-border); border-top: var(--footer-border);
.social-icon img {
vertical-align: bottom;
margin: 0 0.1em;
height: 16px;
}
} }
.sidebar-container { .sidebar-container {

View File

@@ -1,21 +1,23 @@
<footer id="page-footer" class="text-small"> <footer id="page-footer" class="text-small">
<span class="page-footer-app-name"><%= Danbooru.config.app_name %></span> <span class="page-footer-app-name"><%= Danbooru.config.app_name %></span>
<% if Rails.application.config.x.git_hash %> / <%= link_to "Rules", terms_of_service_path %>
<span class="desktop-only page-footer-git-hash"> / <%= link_to "Contact", contact_path %>
(<%= link_to Rails.application.config.x.git_hash.first(9), Danbooru.config.commit_url(Rails.application.config.x.git_hash) %>) /
</span> <span class="social-icons">
<% end %> <% if Danbooru.config.source_code_url.present? %>
&ndash; <%= link_to "Rules", terms_of_service_path %> <%= link_to Danbooru.config.source_code_url, title: "Running commit: #{Rails.application.config.x.git_hash.first(9)}", class: "social-icon" do %>
&ndash; <%= link_to "Contact", contact_path %> <img src="images/github-logo.png">
<% if CurrentUser.user.enable_post_navigation %> <% end %>
<span id="keyboard-shortcuts-link" class="desktop-only"> <% end %>
&ndash; <%= link_to "Keyboard shortcuts", keyboard_shortcuts_path %> <% if Danbooru.config.twitter_username.present? %>
</span> <%= link_to "https://twitter.com/#{Danbooru.config.twitter_username}", class: "social-icon" do %>
<% end %> <img src="images/twitter-logo.png">
<% if CurrentUser.is_member? %> <% end %>
<span id="desktop-version-link" class="mobile-only"> <% end %>
&ndash; <% if Danbooru.config.discord_server_url.present? %>
<%= link_to "Desktop mode", edit_user_path(CurrentUser.id) %> <%= link_to Danbooru.config.discord_server_url, class: "social-icon" do %>
</span> <img src="images/discord-logo.png">
<% end %> <% end %>
<% end %>
</span>
</footer> </footer>

View File

@@ -425,6 +425,11 @@ module Danbooru
end end
end end
# The url of the Discord server associated with this site.
def discord_server_url
nil
end
# The twitter username associated with this site (username only, don't include the @-sign). # The twitter username associated with this site (username only, don't include the @-sign).
def twitter_username def twitter_username
nil nil

BIN
public/images/discord-logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
public/images/github-logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
public/images/twitter-logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB