Add images to session links

This commit is contained in:
cryptogopher 2023-04-08 04:19:36 +02:00
parent 7d0da45653
commit a46c41197c
7 changed files with 21 additions and 11 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M15,4A4,4 0 0,0 11,8A4,4 0 0,0 15,12A4,4 0 0,0 19,8A4,4 0 0,0 15,4M15,5.9C16.16,5.9 17.1,6.84 17.1,8C17.1,9.16 16.16,10.1 15,10.1A2.1,2.1 0 0,1 12.9,8A2.1,2.1 0 0,1 15,5.9M4,7V10H1V12H4V15H6V12H9V10H6V7H4M15,13C12.33,13 7,14.33 7,17V20H23V17C23,14.33 17.67,13 15,13M15,14.9C17.97,14.9 21.1,16.36 21.1,17V18.1H8.9V17C8.9,16.36 12,14.9 15,14.9Z" /></svg>

After

Width:  |  Height:  |  Size: 432 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16" /></svg>
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path fill="#ffffff" d="M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16" /></svg>

Before

Width:  |  Height:  |  Size: 152 B

After

Width:  |  Height:  |  Size: 167 B

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z" /></svg>
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path fill="#ffffff" d="M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z" /></svg>

Before

Width:  |  Height:  |  Size: 278 B

After

Width:  |  Height:  |  Size: 293 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="icon" viewBox="0 0 24 24"><path d="M16,17V14H9V10H16V7L21,12L16,17M14,2A2,2 0 0,1 16,4V6H14V4H5V20H14V18H16V20A2,2 0 0,1 14,22H5A2,2 0 0,1 3,20V4A2,2 0 0,1 5,2H14Z" /></svg>

After

Width:  |  Height:  |  Size: 218 B

View File

@ -43,6 +43,7 @@ input:focus:not([type=checkbox]) {
margin: 0.5em 0;
}
.application-menu a, input[type=submit] {
align-items: center;
border: 1px solid;
background-color: #ffffff;
border-color: #a0a0a0;
@ -51,15 +52,15 @@ input:focus:not([type=checkbox]) {
display: flex;
fill: #a0a0a0;
float: right;
font-size: 0.8em;
font-size: 0.8rem;
font-weight: bold;
margin-left: 1em;
padding: 0.6em;
}
.application-menu a svg {
height: 1rem;
height: 1.3rem;
padding-right: 0.4rem;
width: 1rem;
width: 1.3rem;
}
.application-menu a.active,
.application-menu a:hover,

View File

@ -26,6 +26,11 @@ module ApplicationHelper
form_for(record, **options, &block)
end
def image_link_to(name, image = nil, options = nil, html_options = nil)
name = svg_tag("pictograms/#{image}.svg#icon") + name if image
link_to name, options, html_options
end
def svg_tag(source, options = {})
image_name, id = source.split('#')
content_tag :svg, options do

View File

@ -12,13 +12,15 @@
<body>
<div class="application-menu">
<%= link_to_if user_signed_in?, t(:sign_out), destroy_user_session_path,
data: { turbo_method: :delete } do %>
<%= link_to svg_tag('pictograms/login.svg#icon')+t(:sign_in), new_user_session_path,
class: class_names(active: current_page?(new_user_session_path))%>
<% if user_signed_in? %>
<%= image_link_to t(:sign_out), "logout", destroy_user_session_path,
data: { turbo_method: :delete } %>
<% else %>
<%= image_link_to t(:sign_in), "login", new_user_session_path,
class: class_names(active: current_page?(new_user_session_path)) %>
<%= image_link_to t(:register), "account-plus-outline", new_user_registration_path,
class: class_names(active: current_page?(new_user_registration_path)) %>
<% end %>
<%= link_to_unless(user_signed_in?, t(:register), new_user_registration_path) { } %>
</div>
<div class="flashes">