Commit fd836f5490dbc05b84895f4d3736bfa572f80911
1 parent
b55ed840
Exists in
master
and in
4 other branches
Update empty error messages and warn if not viewing the most recent wiki page
Showing
4 changed files
with
22 additions
and
5 deletions
Show diff stats
app/assets/stylesheets/common.scss
| ... | ... | @@ -446,6 +446,19 @@ li.note { |
| 446 | 446 | } |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | +.warning_message { | |
| 450 | + border-left: 4px solid #ed9; | |
| 451 | + color: #b90; | |
| 452 | + padding: 10px; | |
| 453 | + margin-bottom: 10px; | |
| 454 | + background: #ffffe6; | |
| 455 | + padding-left: 20px; | |
| 456 | + | |
| 457 | + &.centered { | |
| 458 | + text-align: center; | |
| 459 | + } | |
| 460 | +} | |
| 461 | + | |
| 449 | 462 | .oauth_select_holder { |
| 450 | 463 | padding: 20px; |
| 451 | 464 | img { | ... | ... |
app/controllers/wikis_controller.rb
| ... | ... | @@ -8,14 +8,13 @@ class WikisController < ProjectResourceController |
| 8 | 8 | end |
| 9 | 9 | |
| 10 | 10 | def show |
| 11 | + @most_recent_wiki = @project.wikis.where(slug: params[:id]).ordered.first | |
| 11 | 12 | if params[:version_id] |
| 12 | 13 | @wiki = @project.wikis.find(params[:version_id]) |
| 13 | 14 | else |
| 14 | - @wiki = @project.wikis.where(slug: params[:id]).ordered.first | |
| 15 | + @wiki = @most_recent_wiki | |
| 15 | 16 | end |
| 16 | 17 | |
| 17 | - @note = @project.notes.new(noteable: @wiki) | |
| 18 | - | |
| 19 | 18 | if @wiki |
| 20 | 19 | render 'show' |
| 21 | 20 | else | ... | ... |
app/views/wikis/empty.html.haml
app/views/wikis/show.html.haml
| ... | ... | @@ -10,6 +10,11 @@ |
| 10 | 10 | %i.icon-edit |
| 11 | 11 | Edit |
| 12 | 12 | %br |
| 13 | +- if @wiki != @most_recent_wiki | |
| 14 | + .warning_message | |
| 15 | + This is an old version of this page. | |
| 16 | + You can view the #{link_to "most recent version", project_wiki_path(@project, @wiki)} or browse the #{link_to "history", history_project_wiki_path(@project, @wiki)}. | |
| 17 | + | |
| 13 | 18 | .file_holder |
| 14 | 19 | .file_content.wiki |
| 15 | 20 | = preserve do | ... | ... |