プロジェクト

全般

プロフィール

Vote #78836

完了

Show the number of attachments on wiki pages

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Wiki_1
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
1
version_id:
141
issue_org_id:
27090
author_id:
310142
assigned_to_id:
332
comments:
11
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.

h2. before
!before.png!

h2. after
!after.png!

Patch: attachment:show_attachments_count_of_wiki_page_trunk_r16963.patch
(Compatible the latest trunk r16963.)


journals

Nice one, although it can slow down wiki page rendering if a page contains lots of attachments.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Alternatively, is there a way of having the files section by expanded by default?
--------------------------------------------------------------------------------
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":http://api.rubyonrails.org/classes/ActiveRecord/Associations/CollectionProxy.html#method-i-count method with "length":http://api.rubyonrails.org/classes/ActiveRecord/Associations/CollectionProxy.html#method-i-length method. With this change, I think the slowdown that Mischa wrote will never happen.

*Vanilla Redmine:*
<pre>
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"]]
</pre>

*With Tomomi Yuzuriha's patch applied:*

It requires one more query ("@SELECT COUNT(*) FROM ...@"). It can cause the slowdown as Mishca pointed out.

<pre>
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"]]
</pre>

*Replaced @count@ with @length@:*

Queries are identical with vanilla Redmine. There isn't "@SELECT COUNT(*) FROM ...@" which can cause the slowdown.
<pre>
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"]]
</pre>
--------------------------------------------------------------------------------
I am setting target version to 4.1.0.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Committed. Thank you for your contribution.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This change is very small but useful. I think it should be delivered as soon as possible.
--------------------------------------------------------------------------------
Merged to 3.4-stable branch.
--------------------------------------------------------------------------------


related_issues

relates,New,27085,Display a counter beside each tab
relates,Closed,12183,Hide attachments by default on wiki pages
duplicates,Closed,28893,Show number of attached files in Wiki Files-Link

Admin Redmine さんが3年以上前に更新

  • カテゴリWiki_1 にセット
  • 対象バージョン3.4.6_141 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0