Feature #32629
closed
Add edit button to Wiki sidebar
Added by Go MAEDA almost 5 years ago.
Updated over 3 years ago.
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.
Files
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 %>
- Target version set to Candidate for next major release
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).
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...
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.".
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.
- Target version changed from Candidate for next major release to 4.2.0
LGTM. Setting the target version to 4.2.0.
+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.
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you.
Also available in: Atom
PDF