mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-03 03:15:31 -04:00
On the title page, hide progress label of nested titles
This commit is contained in:
parent
d921d04abf
commit
7c9728683c
@ -208,11 +208,11 @@ class Title
|
||||
info = TitleInfo.new @dir
|
||||
page = load_progress username, entry
|
||||
entry_obj = @entries.find{|e| e.title == entry}
|
||||
return 0 if entry_obj.nil?
|
||||
return 0.0 if entry_obj.nil?
|
||||
page / entry_obj.pages
|
||||
end
|
||||
def load_percetage(username)
|
||||
return 0 if @entries.empty?
|
||||
return 0.0 if @entries.empty?
|
||||
read_pages = total_pages = 0
|
||||
@entries.each do |e|
|
||||
read_pages += load_progress username, e.title
|
||||
|
@ -33,6 +33,7 @@ class MainRouter < Router
|
||||
env.redirect "/login"
|
||||
end
|
||||
end
|
||||
|
||||
get "/" do |env|
|
||||
titles = @context.library.titles
|
||||
username = get_username env
|
||||
@ -47,8 +48,6 @@ class MainRouter < Router
|
||||
username = get_username env
|
||||
percentage = title.entries.map { |e|
|
||||
title.load_percetage username, e.title }
|
||||
titles_percentage = title.titles.map { |t|
|
||||
title.load_percetage username, t.title }
|
||||
layout "title"
|
||||
rescue e
|
||||
@context.error e
|
||||
|
@ -31,7 +31,7 @@
|
||||
</div>
|
||||
<div id="item-container" class="uk-child-width-1-4@m uk-child-width-1-2" uk-grid>
|
||||
<%- title.titles.each_with_index do |t, i| -%>
|
||||
<div class="item" data-mtime="<%= t.mtime.to_unix %>" data-progress="<%= titles_percentage[i] %>">
|
||||
<div class="item" data-mtime="<%= t.mtime.to_unix %>" data-progress="0.0">
|
||||
<a class="acard" href="/book/<%= t.id %>">
|
||||
<div class="uk-card uk-card-default">
|
||||
<div class="uk-card-media-top">
|
||||
@ -42,9 +42,6 @@
|
||||
<%- end -%>
|
||||
</div>
|
||||
<div class="uk-card-body">
|
||||
<%- if t.entries.size > 0 -%>
|
||||
<div class="uk-card-badge uk-label"><%= (titles_percentage[i] * 100).round(1) %>%</div>
|
||||
<%- end -%>
|
||||
<h3 class="uk-card-title break-word" data-title="<%= t.title.gsub("\"", """) %>"><%= t.title %></h3>
|
||||
<p><%= t.size %> entries</p>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user