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,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 | .oauth_select_holder { | 462 | .oauth_select_holder { |
450 | padding: 20px; | 463 | padding: 20px; |
451 | img { | 464 | img { |
app/controllers/wikis_controller.rb
@@ -8,14 +8,13 @@ class WikisController < ProjectResourceController | @@ -8,14 +8,13 @@ class WikisController < ProjectResourceController | ||
8 | end | 8 | end |
9 | 9 | ||
10 | def show | 10 | def show |
11 | + @most_recent_wiki = @project.wikis.where(slug: params[:id]).ordered.first | ||
11 | if params[:version_id] | 12 | if params[:version_id] |
12 | @wiki = @project.wikis.find(params[:version_id]) | 13 | @wiki = @project.wikis.find(params[:version_id]) |
13 | else | 14 | else |
14 | - @wiki = @project.wikis.where(slug: params[:id]).ordered.first | 15 | + @wiki = @most_recent_wiki |
15 | end | 16 | end |
16 | 17 | ||
17 | - @note = @project.notes.new(noteable: @wiki) | ||
18 | - | ||
19 | if @wiki | 18 | if @wiki |
20 | render 'show' | 19 | render 'show' |
21 | else | 20 | else |
app/views/wikis/empty.html.haml
app/views/wikis/show.html.haml
@@ -10,6 +10,11 @@ | @@ -10,6 +10,11 @@ | ||
10 | %i.icon-edit | 10 | %i.icon-edit |
11 | Edit | 11 | Edit |
12 | %br | 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 | .file_holder | 18 | .file_holder |
14 | .file_content.wiki | 19 | .file_content.wiki |
15 | = preserve do | 20 | = preserve do |