Patch #27090
closedShow the number of attachments on wiki pages
Description
I noticed the problem that users cannot know whether there are any attachments unless users expand the "File" section by clicking it.
To resolve the problem, I suggest showing attachments count on "Files” section.
Please see the screenshots below for the details.
before
¶
after
¶
Patch: show_attachments_count_of_wiki_page_trunk_r16963.patch
(Compatible the latest trunk r16963.)
Files
Related issues
Updated by Mischa The Evil about 7 years ago
- Target version set to Unplanned backlogs
Nice one, although it can slow down wiki page rendering if a page contains lots of attachments.
Updated by Toshi MARUYAMA about 7 years ago
- Related to Feature #27085: Display a counter beside each tab added
Updated by arturo flores about 7 years ago
Alternatively, is there a way of having the files section by expanded by default?
Updated by Go MAEDA almost 7 years ago
Mischa The Evil wrote:
Nice one, although it can slow down wiki page rendering if a page contains lots of attachments.
I slightly improved the Tomomi Yuzuriha's patch to avoid the slowdown caused by additional SQL query ("SELECT COUNT(*) FROM ...
"). I replaced count method with length method. With this change, I think the slowdown that Mischa wrote will never happen.
Vanilla Redmine:
Attachment Load (0.4ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]] Rendered wiki/_content.html.erb (147.0ms) CACHE Attachment Load (0.0ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]]
With Tomomi Yuzuriha's patch applied:
It requires one more query ("SELECT COUNT(*) FROM ...
"). It can cause the slowdown as Mishca pointed out.
Attachment Load (0.2ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]] Rendered wiki/_content.html.erb (74.0ms) (0.2ms) SELECT COUNT(*) FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? [["container_id", 1], ["container_type", "WikiPage"]] CACHE Attachment Load (0.0ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]]
Replaced count
with length
:
Queries are identical with vanilla Redmine. There isn't "SELECT COUNT(*) FROM ...
" which can cause the slowdown.
Attachment Load (0.2ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]] Rendered wiki/_content.html.erb (151.1ms) CACHE Attachment Load (0.0ms) SELECT "attachments".* FROM "attachments" WHERE "attachments"."container_id" = ? AND "attachments"."container_type" = ? ORDER BY attachments.created_on ASC, attachments.id ASC [["container_id", 1], ["container_type", "WikiPage"]]
Updated by Go MAEDA almost 7 years ago
- Target version changed from Unplanned backlogs to 4.1.0
I am setting target version to 4.1.0.
Updated by Go MAEDA almost 7 years ago
- Related to Feature #12183: Hide attachments by default on wiki pages added
Updated by Go MAEDA almost 7 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version changed from 4.1.0 to 4.0.0
Committed. Thank you for your contribution.
Updated by Go MAEDA almost 7 years ago
- Subject changed from Show attachments count in "Files” section of the Wiki page to Show the number of attachments on wiki pages
Updated by Go MAEDA over 6 years ago
- Has duplicate Feature #28893: Show number of attached files in Wiki Files-Link added
Updated by Go MAEDA over 6 years ago
- Status changed from Closed to Reopened
- Target version changed from 4.0.0 to 3.4.6
This change is very small but useful. I think it should be delivered as soon as possible.
Updated by Go MAEDA over 6 years ago
- Status changed from Reopened to Closed
Merged to 3.4-stable branch.