From 148b8f4c39850537414b45d6e614a243065761cf Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sun, 26 Jan 2014 17:20:29 +0100 Subject: [PATCH] Update thread post/file count on index refresh in the catalog. Conflicts: src/General/Index.coffee src/General/lib/thread.class --- src/General/Index.coffee | 2 ++ src/General/lib/thread.class | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 94387d9d4..9de94365c 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -323,6 +323,8 @@ Index = threadRoot = Build.thread g.BOARD, threadData if thread = g.BOARD.threads[threadData.no] thread.setPage Math.floor i / Index.threadsNumPerPage + thread.setCount 'post', threadData.replies + 1, threadData.bumplimit + thread.setCount 'file', threadData.images + !!threadData.ext, threadData.imagelimit thread.setStatus 'Sticky', !!threadData.sticky thread.setStatus 'Closed', !!threadData.closed else diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class index aa2dd000a..267fde338 100755 --- a/src/General/lib/thread.class +++ b/src/General/lib/thread.class @@ -17,6 +17,13 @@ class Thread for key in ['title', 'textContent'] icon[key] = icon[key].replace /\d+/, pageNum return + + setCount: (type, count, reachedLimit) -> + return unless @catalogView + el = $ ".#{type}-count", @catalogView + el.textContent = count + (if reachedLimit then $.addClass else $.rmClass) el, 'warning' + setStatus: (type, status) -> name = "is#{type}" return if @[name] is status