vipassana-design-standards 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04b79663cfd18924e8502b3f2c76dd273bdb417b51f2374b5a397f08336f38de
|
4
|
+
data.tar.gz: '0568e0e199152a7e90d3d2f871a1008db89587508072b29d1e3fa89e8cb12526'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 441b0ea894604317b5d448b299de866267f2c7c91e3e2c2489132b7f7ed0fdc8e08d93da781d6aa4b0883d937d93ea1876973652c41cdc0da6f6cbcca0c2577d
|
7
|
+
data.tar.gz: 3629049d718c23bec1a8f2bb617d017f35ffd8c993609828ec304dc98a7f475fd15722509a247b3efe1c4318f8da944a2f05b213e06a5f675a358c1dbbcacbd3
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Vipassana
|
2
|
+
module DesignStandardsHelper
|
3
|
+
require "vipassana/logos_inline_svg.rb"
|
4
|
+
require "vipassana/translations.rb"
|
5
|
+
|
6
|
+
def is_rtl?(locale)
|
7
|
+
locale.to_sym.in? [:ar, :fa, :he]
|
8
|
+
end
|
9
|
+
|
10
|
+
def vds_favicon_tag
|
11
|
+
favicon_link_tag "https://design-standards.dhamma.org/dist/favicon.png"
|
12
|
+
end
|
13
|
+
|
14
|
+
def vds_asset_url(path, localhost = false)
|
15
|
+
return "http://localhost:5500/dist/#{path}" if localhost # For localhost dev, just run vscode liveserver
|
16
|
+
|
17
|
+
version = Gem.loaded_specs['vipassana-design-standards'].version
|
18
|
+
"https://design-standards.dhamma.org/dist/#{version}/#{path}"
|
19
|
+
end
|
20
|
+
|
21
|
+
def vds_bootstrap_theme_css_tag(locale: I18n.locale, localhost: false)
|
22
|
+
tags = [
|
23
|
+
stylesheet_link_tag(vds_asset_url("css/bootstrap5-theme#{is_rtl?(locale) ? '.rtl' : ''}.min.css", localhost)),
|
24
|
+
]
|
25
|
+
# Add specific fonts for languages not compatible with Footlight and Lato
|
26
|
+
if locale.to_sym.in? [:gu, :ja, :km]
|
27
|
+
tags << stylesheet_link_tag(vds_asset_url("css/fonts-#{locale}.min.css"))
|
28
|
+
end
|
29
|
+
|
30
|
+
tags.join.html_safe
|
31
|
+
end
|
32
|
+
|
33
|
+
def vds_bootstrap_theme_js_tag(locale: I18n.locale, localhost: false)
|
34
|
+
javascript_include_tag vds_asset_url("js/bootstrap5-theme.min.js", localhost)
|
35
|
+
end
|
36
|
+
|
37
|
+
def vds_logo_svg(locale: I18n.locale, disposition: "default", tagline: true, height: nil, width: nil)
|
38
|
+
height = 70 if height.nil? && width.nil?
|
39
|
+
|
40
|
+
data = VDS_SVGS[locale.to_sym] || VDS_SVGS[:en]
|
41
|
+
disposition += '-no-tagline' if tagline == false
|
42
|
+
string = data[disposition.to_sym] || data[:normal]
|
43
|
+
|
44
|
+
string.gsub!("<svg", "<svg height=\"#{height}\"") if height.present?
|
45
|
+
string.gsub!("<svg", "<svg width=\"#{width}\"") if width.present?
|
46
|
+
|
47
|
+
string.html_safe
|
48
|
+
end
|
49
|
+
|
50
|
+
def vds_logo_html(locale: I18n.locale, disposition: "default", size: '18', tagline: true, dark: false)
|
51
|
+
trans = VDS_TRANSLATIONS[locale.to_sym] || VDS_TRANSLATIONS[:en]
|
52
|
+
|
53
|
+
if disposition == "mobile"
|
54
|
+
disposition = "left-two-lines"
|
55
|
+
tagline = false
|
56
|
+
end
|
57
|
+
|
58
|
+
result = <<-HTML
|
59
|
+
<div class="vipassana-logo"
|
60
|
+
data-disposition="#{disposition}"
|
61
|
+
data-tagline="#{tagline}"
|
62
|
+
data-dark-mode="#{dark}"
|
63
|
+
data-reverse="#{trans[:reverse]}"
|
64
|
+
style="font-size: #{size}px">
|
65
|
+
<img class="logo-wheel" src="https://design-standards.dhamma.org/dist/dhamma-wheel.svg" />
|
66
|
+
<div class="logo-text">
|
67
|
+
<h1 class="logo-title">
|
68
|
+
<span data-start-with="#{trans[:vipassana_meditation].at(0).downcase}">
|
69
|
+
#{trans[:vipassana_meditation]}
|
70
|
+
</span>
|
71
|
+
<span class="logo-space"> </span>
|
72
|
+
<span>#{trans[:as_taught]}</span>
|
73
|
+
</h1>
|
74
|
+
<div class="logo-subtitle">#{trans[:in_the_tradition]}</div>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
HTML
|
78
|
+
result.html_safe
|
79
|
+
end
|
80
|
+
|
81
|
+
# Some icons from bootstrap icons, so all websites use the same
|
82
|
+
def vds_icon_locale
|
83
|
+
result = <<-HTML
|
84
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" fill="currentColor" class="bi bi-translate" viewBox="0 0 16 16">
|
85
|
+
<path d="M4.545 6.714 4.11 8H3l1.862-5h1.284L8 8H6.833l-.435-1.286H4.545zm1.634-.736L5.5 3.956h-.049l-.679 2.022H6.18z"/>
|
86
|
+
<path d="M0 2a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v3h3a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-3H2a2 2 0 0 1-2-2V2zm2-1a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h7a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zm7.138 9.995c.193.301.402.583.63.846-.748.575-1.673 1.001-2.768 1.292.178.217.451.635.555.867 1.125-.359 2.08-.844 2.886-1.494.777.665 1.739 1.165 2.93 1.472.133-.254.414-.673.629-.89-1.125-.253-2.057-.694-2.82-1.284.681-.747 1.222-1.651 1.621-2.757H14V8h-3v1.047h.765c-.318.844-.74 1.546-1.272 2.13a6.066 6.066 0 0 1-.415-.492 1.988 1.988 0 0 1-.94.31z"/>
|
87
|
+
</svg>
|
88
|
+
HTML
|
89
|
+
result.html_safe
|
90
|
+
end
|
91
|
+
|
92
|
+
def vds_icon_account
|
93
|
+
result = <<-HTML
|
94
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="2.2em" height="2.2em" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
|
95
|
+
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
|
96
|
+
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
|
97
|
+
</svg>
|
98
|
+
HTML
|
99
|
+
result.html_safe
|
100
|
+
end
|
101
|
+
|
102
|
+
def vds_icon_menu
|
103
|
+
result = <<-HTML
|
104
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1.8em" height="1.8em" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16">
|
105
|
+
<path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"/>
|
106
|
+
</svg>
|
107
|
+
HTML
|
108
|
+
result.html_safe
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|