mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-22 20:42:40 +00:00
Updated links menu items
This commit is contained in:
parent
e95a1b6840
commit
79a7a9a32f
4 changed files with 32 additions and 15 deletions
|
@ -31,14 +31,24 @@ func gistInit(next echo.HandlerFunc) echo.HandlerFunc {
|
|||
}
|
||||
setData(ctx, "gist", gist)
|
||||
|
||||
if config.C.SSH.Port == "22" {
|
||||
setData(ctx, "ssh_clone_url", config.C.SSH.Domain+":"+userName+"/"+gistName+".git")
|
||||
} else {
|
||||
setData(ctx, "ssh_clone_url", "ssh://"+config.C.SSH.Domain+":"+config.C.SSH.Port+"/"+userName+"/"+gistName+".git")
|
||||
if config.C.SSH.Enabled {
|
||||
if config.C.SSH.Port == "22" {
|
||||
setData(ctx, "sshCloneUrl", config.C.SSH.Domain+":"+userName+"/"+gistName+".git")
|
||||
} else {
|
||||
setData(ctx, "sshCloneUrl", "ssh://"+config.C.SSH.Domain+":"+config.C.SSH.Port+"/"+userName+"/"+gistName+".git")
|
||||
}
|
||||
}
|
||||
|
||||
setData(ctx, "httpCloneUrl", "http://"+ctx.Request().Host+"/"+userName+"/"+gistName+".git")
|
||||
setData(ctx, "httpCopyUrl", "http://"+ctx.Request().Host+"/"+userName+"/"+gistName)
|
||||
httpProtocol := "http"
|
||||
if ctx.Request().TLS != nil {
|
||||
httpProtocol = "https"
|
||||
}
|
||||
setData(ctx, "httpProtocol", strings.ToUpper(httpProtocol))
|
||||
|
||||
if config.C.HTTP.Git {
|
||||
setData(ctx, "httpCloneUrl", httpProtocol+"://"+config.C.HTTP.Domain+":"+config.C.HTTP.Port+"/"+userName+"/"+gistName+".git")
|
||||
}
|
||||
setData(ctx, "httpCopyUrl", httpProtocol+"://"+config.C.HTTP.Domain+":"+config.C.HTTP.Port+"/"+userName+"/"+gistName)
|
||||
|
||||
setData(ctx, "currentUrl", template.URL(ctx.Request().URL.Path))
|
||||
|
||||
|
|
3
public/main.js
vendored
3
public/main.js
vendored
|
@ -92,6 +92,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
let gistmenubuttoncopy = document.getElementById('gist-menu-button-copy')
|
||||
let gistmenuinput = document.getElementById('gist-menu-input')
|
||||
let gistmenutitle = document.getElementById('gist-menu-title')
|
||||
gistmenutitle.textContent = gistmenucopy.children[0].firstChild.textContent
|
||||
gistmenuinput.value = gistmenucopy.children[0].dataset.link
|
||||
|
||||
gistmenutoggle.onclick = () => {
|
||||
gistmenucopy.classList.toggle('hidden')
|
||||
}
|
||||
|
|
20
templates/base/gist_header.html
vendored
20
templates/base/gist_header.html
vendored
|
@ -144,19 +144,23 @@
|
|||
<div class="flex rounded-md shadow-sm">
|
||||
<div class="relative">
|
||||
<button type="button" id="gist-menu-toggle" class="relative text-xs inline-flex items-center space-x-2 rounded-l-md border border-gray-600 bg-gray-800 px-2 py-1.5 text-sm font-medium text-slate-300 hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:border-primary-500 focus:outline-none focus:ring-1 focus:ring-primary-500 leading-3 focus-within:z-10 -mr-px">
|
||||
<span id="gist-menu-title">Clone via HTTP</span>
|
||||
<span id="gist-menu-title"></span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
|
||||
</svg>
|
||||
</button>
|
||||
<div class="absolute left-0 z-10 mt-2 w-56 origin-top-left bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none" role="menu" aria-orientation="vertical" aria-labelledby="menu-button" tabindex="-1">
|
||||
<div class="py-1 cursor-pointer border-1 rounded-md border-gray-700 hidden" id="gist-menu-copy" role="none">
|
||||
<div class="text-slate-300 block px-4 py-2 text-sm hover:bg-gray-700 gist-menu-item" role="menuitem" id="gist-menu-http" data-link="{{ .httpCloneUrl }}"><p>Clone via HTTP</p>
|
||||
<p class="text-xs font-normal text-gray-400">Clone with Git using HTTP basic authentication.</p>
|
||||
</div>
|
||||
<div class="text-slate-300 block px-4 py-2 text-sm hover:bg-gray-700 gist-menu-item" role="menuitem" id="gist-menu-ssh" data-link="{{ .ssh_clone_url }}"><p>Clone via SSH</p>
|
||||
<p class="text-xs font-normal text-gray-400">Clone with Git using an SSH key.</p>
|
||||
</div>
|
||||
{{ if .httpCloneUrl }}
|
||||
<div class="text-slate-300 block px-4 py-2 text-sm hover:bg-gray-700 gist-menu-item" role="menuitem" id="gist-menu-http" data-link="{{ .httpCloneUrl }}"><p>Clone via {{ .httpProtocol }}</p>
|
||||
<p class="text-xs font-normal text-gray-400">Clone with Git using HTTP basic authentication.</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if .sshCloneUrl }}
|
||||
<div class="text-slate-300 block px-4 py-2 text-sm hover:bg-gray-700 gist-menu-item" role="menuitem" id="gist-menu-ssh" data-link="{{ .sshCloneUrl }}"><p>Clone via SSH</p>
|
||||
<p class="text-xs font-normal text-gray-400">Clone with Git using an SSH key.</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="text-slate-300 block px-4 py-2 text-sm hover:bg-gray-700 gist-menu-item" role="menuitem" id="gist-menu-embed" data-link="(soon)"><p>Embed</p>
|
||||
<p class="text-xs font-normal text-gray-400">Embed this gist in your website. (soon)</p>
|
||||
</div>
|
||||
|
@ -167,7 +171,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="relative flex flex-grow items-stretch focus-within:z-10">
|
||||
<input id="gist-menu-input" value="{{ .httpCloneUrl }}" class="block code bg-gray-900 w-full rounded-none border border-gray-600 focus:border-primary-500 focus:ring-primary-500 focus:outline-none focus:ring-1 text-xs px-2">
|
||||
<input id="gist-menu-input" value="" class="block code bg-gray-900 w-full rounded-none border border-gray-600 focus:border-primary-500 focus:ring-primary-500 focus:outline-none focus:ring-1 text-xs px-2">
|
||||
</div>
|
||||
<button id="gist-menu-button-copy" type="button" class="relative text-xs -ml-px inline-flex items-center space-x-2 rounded-r-md border border-gray-600 bg-gray-800 px-2 py-1 text-sm font-medium text-slate-300 hover:bg-gray-700 hover:border-gray-500 hover:text-slate-300 focus:border-primary-500 focus:outline-none focus:ring-1 focus:ring-primary-500 leading-3">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
|
||||
|
|
2
templates/pages/ssh_keys.html
vendored
2
templates/pages/ssh_keys.html
vendored
|
@ -3,7 +3,7 @@
|
|||
<header class="pb-4">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold leading-tight">SSH Keys</h1>
|
||||
<p class="text-sm text-gray-400 italic">Used only to pull/push gists using Git via SSH</p>
|
||||
<p class="text-sm text-gray-400 italic">Used only to push gists using Git via SSH</p>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
|
|
Loading…
Reference in a new issue