From 227b7e6b6caa6fa8e63431c136e24dda7a3125ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz> Date: Tue, 13 Jun 2023 10:36:03 +0200 Subject: [PATCH] Zobrazovani titulku --- VERSION | 2 +- templates/shortcuts.html.ep | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 338a5b5..24ba9a3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.6 +2.7.0 diff --git a/templates/shortcuts.html.ep b/templates/shortcuts.html.ep index 0954d00..800b978 100644 --- a/templates/shortcuts.html.ep +++ b/templates/shortcuts.html.ep @@ -32,9 +32,8 @@ <thead> <tr> <th class="text-left">Zkratka</th> - <th class="text-left">PĹ™idano</th> - <th class="text-left">URL</th> - <th class="text-left">PĹ™esmÄ›rovánĂ</th> + <th class="text-left">PĹ™idáno</th> + <th class="text-left">Stránka</th> <th class="text-left">Kliky</th> <th class="text-left"></th> </tr> @@ -43,8 +42,9 @@ <tr v-for="shortcut in shortcuts" > <td v-bind:title="shortcut.title" class="text-bold w-32" @click="showInfo(shortcut)" >{{shortcut.shortcut}}</td> <td class="text-bold w-32" @click="showInfo(shortcut)" >{{ formatTimestamp(shortcut.created) }}</td> - <td v-bind:title="shortcut.title" @click="showInfo(shortcut)" >{{ stripURL(shortcut.url) }}</td> - <td class="w-24" @click="showInfo(shortcut)">{{ shortcut.code == 301 ? '301 trvalĂ©' : '302 doÄŤasnĂ©'}}</td> + <td v-bind:title="shortcut.title" @click="showInfo(shortcut)" >{{ strip(shortcut.url, 64) }} + <div class="text-xs text-grey-200 pt-1">{{ strip(shortcut.title, 72) }}</div> + </td> <td class="w-16 text-right" @click="showInfo(shortcut)">{{shortcut.counter}}</td> <td class="w-40"> <i class="ico--link cursor-pointer mx-1" @click="showInfo(shortcut)" title="Zkopirovat odkaz"></i> @@ -152,7 +152,6 @@ </div> <script type="module"> - const MAX_URL_LENGTH = 50; const BASE_URL = "/api/shortcuts"; const API_HEADERS = { "Content-Type": "application/json", @@ -249,11 +248,11 @@ }) }, - stripURL: function(url) { - if ( url.length > MAX_URL_LENGTH ) { - url = url.substring(0, MAX_URL_LENGTH) + '...'; + strip: function(text, size) { + if ( typeof text === "string" && text.length > size ) { + text = text.substring(0, size) + '...'; } - return url; + return text; }, formatTimestamp: function(timestamp) { -- GitLab