Feature #32629

Add edit button to Wiki sidebar

Added by Go MAEDA 11 months ago. Updated 8 months 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 11 months ago

#2 Updated by Takenori TAKAKI 10 months 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 10 months ago

  • Target version set to Candidate for next major release

#4 Updated by Mischa The Evil 10 months 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 10 months 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 10 months 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 10 months 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 10 months 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 months ago

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

LGTM. Setting the target version to 4.2.0.

#10 Updated by Robert Schneider 8 months ago

+1

Good idea. Small suggestion: If is not already considered: What do you think about that the Sidebar page contains those three default links straight away? If it was not created yet and you click the button or go directly to the page via URL, one sees the default links in the editor. This would also allow to remove those links.

If the page does not exist then the default links will be shown. But if it is entered the first time, the page gets populated with the default links. From there on only the Sidebar page gets rendered as Sidebar. If it gets deleted, then the default links will be shown again. So there two states: show 'virtual' Sidebar with the default links or show the Sidebar wiki page.

Also available in: Atom PDF