Feature #32629

Add edit button to Wiki sidebar

Added by Go MAEDA about 1 month ago. Updated 9 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Wiki
Target version:4.2.0
Resolution:

Description

I suggest adding "Edit" button to Wiki sidebar. The button is to edit the wiki page named "Sidebar".

You can customize the Wiki sidebar by editing the page named "Sidebar" in Redmine 1.0.0 (RC) or later (#5208). However, the feature is really difficult to find because there is no user interface that indicates the existence of the feature. There is a sentence that explains the feature in RedmineWikis, but I don't think it is enough to let many users know the feature.

The content of the wiki page named 'Sidebar' is rendered in the wiki sidebar if it exists.

It will be really easy to find the feature if "Edit" button is placed on the top of the Wiki sidebar.

wiki-sidebar-edit-button@2x.png (42.2 KB) Go MAEDA, 2019-12-13 04:43

add-edit-button-to-wiki-sidebar.png (93 KB) Takenori TAKAKI, 2019-12-15 12:29

32629.patch Magnifier (1.44 KB) Takenori TAKAKI, 2019-12-17 05:26


Related issues

Related to Redmine - Feature #5208: Aibility to edit wiki sidebar Closed 2010-03-29

History

#1 Updated by Go MAEDA about 1 month ago

#2 Updated by Takenori TAKAKI about 1 month ago

Wow! I didn't know that feature. . .
If users can learn that Sidebar can be customized, Wiki usage will expand!
I post a patch and Screenshot below.

diff --git a/app/views/wiki/_sidebar.html.erb b/app/views/wiki/_sidebar.html.erb
index 16e8be167..236a02a36 100644
--- a/app/views/wiki/_sidebar.html.erb
+++ b/app/views/wiki/_sidebar.html.erb
@@ -1,3 +1,7 @@
+<div class="contextual">
+  <%= link_to l(:button_edit), edit_project_wiki_page_path(@project, 'sidebar'),
+              :class => 'icon icon-edit' %>
+</div>
 <% if @wiki && @wiki.sidebar -%>
   <div class="wiki">
     <%= textilizable @wiki.sidebar.content, :text %>

#3 Updated by Go MAEDA about 1 month ago

  • Target version set to Candidate for next major release

#4 Updated by Mischa The Evil about 1 month ago

Takenori TAKAKI wrote in #note-2:

I post a patch [...]

I don't think we should display such a link when the user doesn't have sufficient permissions to add/edit that 'Sidebar' page (see r3632).

#5 Updated by Go MAEDA about 1 month ago

Mischa The Evil wrote:

I don't think we should display such a link when the user doesn't have sufficient permissions to add/edit that 'Sidebar' page (see r3632).

Users who have protect_wiki_pages permission are allowed to edit "Sidebar" page.
source:tags/4.0.5/app/models/wiki_page.rb#L60
source:tags/4.0.5/app/models/wiki_page.rb#L203

#6 Updated by Mischa The Evil about 1 month ago

Go MAEDA wrote in #note-5:

Users who have protect_wiki_pages permission are allowed to edit "Sidebar" page.

I know, but the patch posted by Takenori in #note-2 doesn't seem to be doing any check on the user having that permission whatsoever. Please let me know if I'm missing something here...

#7 Updated by Go MAEDA about 1 month ago

Mischa The Evil wrote:

Go MAEDA wrote in #note-5:

Users who have protect_wiki_pages permission are allowed to edit "Sidebar" page.

I know, but the patch posted by Takenori in #note-2 doesn't seem to be doing any check on the user having that permission whatsoever. Please let me know if I'm missing something here...

Sorry for the confusing comment. I intended to add technical details. I should have added a sentence "The patch should be updated to check the permission.".

#8 Updated by Takenori TAKAKI about 1 month ago

Mischa The Evil wrote:

I don't think we should display such a link when the user doesn't have sufficient permissions to add/edit that 'Sidebar' page (see r3632).

Thank you for pointing out the lack of permission checks.
I recreated patch ( 32629.patch ) with permission checks, based on comments from Mischa The Evil and Go Maeda.

#9 Updated by Go MAEDA 9 days ago

  • Target version changed from Candidate for next major release to 4.2.0

LGTM. Setting the target version to 4.2.0.

Also available in: Atom PDF