From e65cd05ef1dc16f882a46b3bee503c7ba354ddeb Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Fri, 15 May 2020 09:50:35 +0000 Subject: [PATCH] Add the option to disable ellipsis when truncating --- public/css/mango.css | 1 + src/config.cr | 1 + src/routes/main.cr | 2 ++ src/views/index.ecr | 8 +++++--- src/views/title.ecr | 10 ++++++---- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/public/css/mango.css b/public/css/mango.css index ee20a98..03e68cb 100644 --- a/public/css/mango.css +++ b/public/css/mango.css @@ -19,6 +19,7 @@ } .uk-card-title { height: 3em; + overflow: hidden; } .acard:hover { text-decoration: none; diff --git a/src/config.cr b/src/config.cr index 5e57edf..ceca6e6 100644 --- a/src/config.cr +++ b/src/config.cr @@ -12,6 +12,7 @@ class Config property log_level : String = "info" property upload_path : String = File.expand_path "~/mango/uploads", home: true + property disable_ellipsis_truncation : Bool = false property mangadex = Hash(String, String | Int32).new @[YAML::Field(ignore: true)] diff --git a/src/routes/main.cr b/src/routes/main.cr index 3e21fc1..cd70758 100644 --- a/src/routes/main.cr +++ b/src/routes/main.cr @@ -37,6 +37,7 @@ class MainRouter < Router titles = @context.library.titles username = get_username env percentage = titles.map &.load_percetage username + use_dotdotdot = !@context.config.disable_ellipsis_truncation layout "index" rescue e @context.error e @@ -51,6 +52,7 @@ class MainRouter < Router percentage = title.entries.map { |e| title.load_percetage username, e.title } + use_dotdotdot = !@context.config.disable_ellipsis_truncation layout "title" rescue e @context.error e diff --git a/src/views/index.ecr b/src/views/index.ecr index 63508bb..7e9cd08 100644 --- a/src/views/index.ecr +++ b/src/views/index.ecr @@ -32,7 +32,7 @@ <%- if t.entries.size > 0 -%>
<%= (percentage[i] * 100).round(1) %>%
<%- end -%> -

"><%= t.display_name %>

+

" data-title="<%= t.display_name.gsub("\"", """) %>"><%= t.display_name %>

<%= t.size %> entries

@@ -42,8 +42,10 @@ <% content_for "script" do %> - - +<% if use_dotdotdot %> + + +<% end %> <% end %> diff --git a/src/views/title.ecr b/src/views/title.ecr index c6ade3a..b315def 100644 --- a/src/views/title.ecr +++ b/src/views/title.ecr @@ -45,7 +45,7 @@
-

"><%= t.display_name %>

+

" data-title="<%= t.display_name.gsub("\"", """) %>"><%= t.display_name %>

<%= t.size %> entries

@@ -61,7 +61,7 @@
<%= (percentage[i] * 100).round(1) %>%
-

"><%= e.display_name %>

+

" data-title="<%= e.display_name.gsub("\"", """) %>"><%= e.display_name %>

<%= e.pages %> pages

@@ -150,8 +150,10 @@ <% content_for "script" do %> - - +<% if use_dotdotdot %> + + +<% end %>