Patch #6440
Support for wiki page rendering in my page
| Status: | New | Start date: | 2010-09-20 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% | |
| Category: | Wiki | |||
| Target version: | - |
Related issues
History
#1 Updated by Sergei Danilov over 2 years ago
See #6437
#2 Updated by Sergei Danilov over 2 years ago
- File _wiki.rhtml
added
#3 Updated by Sergei Danilov over 2 years ago
- File my_controller.diff
added
#4 Updated by Sergei Danilov over 2 years ago
- Goto "Administration/Custom Fields", select "Users" tab, create new text field name it "wiki"
- Copy file "_wiki.rhtml" to "redmine\app\views\my\blocks\" folder
- Apply patch for "my_controller.rb"
- For desired user fill custom field "wiki" in format "project:wiki_page"
- Goto "My Page", click "Personalize this page", add block "wiki"
That's all!
Now you can see wiki page in "My page".
#5 Updated by Sergei Danilov over 2 years ago
- File _wiki.rhtml
added
#6 Updated by Sergei Danilov over 2 years ago
- Status changed from New to Resolved
#7 Updated by Felix Schäfer over 2 years ago
- Status changed from Resolved to New
The status "resolved" is reserved for stuff committed to trunk but not in stable yet, thank you.
#8 Updated by Michael Jean 9 months ago
This solution did not work for me. After I try to add the wiki block it displays 500 inside the block. Then when I try to click the "my page" link again I get 500. My "my page" link will no longer display. My redmine version is 1.3.2, here is the log:
Processing MyController#page (for 132.156.30.171 at 2012-09-06 14:35:43) [GET]
Parameters: {"action"=>"page", "controller"=>"my"}
Rendering template within layouts/base
Rendering my/page
Completed in 187ms (View: 62, DB: 109) | 200 OK [http://nrgcolla-test/my/page]
Processing MyController#page_layout (for 132.156.30.171 at 2012-09-06 14:35:47) [GET]
Parameters: {"action"=>"page_layout", "controller"=>"my"}
Rendering template within layouts/base
Rendering my/page_layout
Completed in 218ms (View: 187, DB: 31) | 200 OK [http://nrgcolla-test/my/page_layout]
Processing MyController#add_block (for 132.156.30.171 at 2012-09-06 14:36:09) [POST]
Parameters: {"block"=>"wiki", "action"=>"add_block", "authenticity_token"=>"y+APo6xutvYjPfX4QC4SVYWdFPi4AOberlfjVLuhh1A=", "controller"=>"my"}
ActionView::TemplateError (undefined method `title' for nil:NilClass) on line #6 of app/views/my/blocks/_wiki.rhtml:
3: <% page = Wiki.find_page(custom_value) %>
4:
5: <div class="contextual">
6: <%= link_to(l(:button_edit), {:action => 'edit', :page => page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) %>
7: </div>
8:
9: <%= render(:partial => "wiki/content", :locals => {:content => page.content}) %>
app/views/my/blocks/_wiki.rhtml:6:in `_run_rhtml_app47views47my47blocks47_wiki46rhtml_locals_object_user_wiki'
app/views/my/blocks/_wiki.rhtml:1:in `_run_rhtml_app47views47my47blocks47_wiki46rhtml_locals_object_user_wiki'
app/views/my/_block.html.erb:12
app/controllers/my_controller.rb:141:in `add_block'
config/initializers/mongrel_cluster_with_rails_211_fix.rb:62:in `dispatch_cgi'
Rendering D:/BitNamiRedmineStack1.3.2/apps/redmine/public/500.html (500 Internal Server Error)
#9 Updated by Michael Jean 9 months ago
Using the other _wiki.rhtml file attached to this issue I get a similar error:
Processing MyController#page (for 132.156.30.171 at 2012-09-06 15:14:00) [GET]
Parameters: {"action"=>"page", "controller"=>"my"}
Rendering template within layouts/base
Rendering my/page
Completed in 437ms (View: 140, DB: 250) | 200 OK [http://nrgcolla-test/my/page]
Processing MyController#page_layout (for 132.156.30.171 at 2012-09-06 15:14:02) [GET]
Parameters: {"action"=>"page_layout", "controller"=>"my"}
Rendering template within layouts/base
Rendering my/page_layout
Completed in 94ms (View: 47, DB: 31) | 200 OK [http://nrgcolla-test/my/page_layout]
Processing MyController#add_block (for 132.156.30.171 at 2012-09-06 15:14:07) [POST]
Parameters: {"block"=>"wiki", "action"=>"add_block", "controller"=>"my", "authenticity_token"=>"y+APo6xutvYjPfX4QC4SVYWdFPi4AOberlfjVLuhh1A="}
ActionView::TemplateError (undefined method `content' for nil:NilClass) on line #5 of app/views/my/blocks/_wiki.rhtml:
2: <% if !custom_value.value.blank? && custom_value.custom_field.name=="wiki" %>
3: <% page = Wiki.find_page(custom_value) %>
4:
5: <%= render(:partial => "wiki/content", :locals => {:content => page.content}) %>
6: <p><%= link_to 'Edit', url_for(:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title) %></p>
7: <% end %>
8: <% end %>
app/views/my/blocks/_wiki.rhtml:5:in `_run_rhtml_app47views47my47blocks47_wiki46rhtml_locals_object_user_wiki'
app/views/my/blocks/_wiki.rhtml:1:in `_run_rhtml_app47views47my47blocks47_wiki46rhtml_locals_object_user_wiki'
app/views/my/_block.html.erb:12
app/controllers/my_controller.rb:141:in `add_block'
config/initializers/mongrel_cluster_with_rails_211_fix.rb:62:in `dispatch_cgi'
Rendering D:/BitNamiRedmineStack1.3.2/apps/redmine/public/500.html (500 Internal Server Error)
#10 Updated by Michael Jean 8 months ago
I set up and tested the patch with Redmine 1.4.3 to compare and I found the same result. What version of Redmine is this patch compatible with?
NoMethodError in My#add_block
Showing app/views/my/blocks/_wiki.rhtml where line #5 raised:
undefined method `content' for nil:NilClass
Extracted source (around line #5):
2: <% if !custom_value.value.blank? && custom_value.custom_field.name=="wiki" %>
3: <% page = Wiki.find_page(custom_value) %>
4:
5: <%= render(:partial => "wiki/content", :locals => {:content => page.content}) %>
6: <p><%= link_to 'Edit', url_for(:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title) %></p>
7: <% end %>
8: <% end %>
#11 Updated by Sergei Danilov 8 months ago
Michael Jean wrote:
I set up and tested the patch with Redmine 1.4.3 to compare and I found the same result. What version of Redmine is this patch compatible with?
[...]
Redmine 1.0.1.devel.4083