From fd836f5490dbc05b84895f4d3736bfa572f80911 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Fri, 11 Jan 2013 21:04:21 +0100 Subject: [PATCH] Update empty error messages and warn if not viewing the most recent wiki page --- app/assets/stylesheets/common.scss | 13 +++++++++++++ app/controllers/wikis_controller.rb | 5 ++--- app/views/wikis/empty.html.haml | 4 ++-- app/views/wikis/show.html.haml | 5 +++++ 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index b72c9e93..f7a93436 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -446,6 +446,19 @@ li.note { } } +.warning_message { + border-left: 4px solid #ed9; + color: #b90; + padding: 10px; + margin-bottom: 10px; + background: #ffffe6; + padding-left: 20px; + + &.centered { + text-align: center; + } +} + .oauth_select_holder { padding: 20px; img { diff --git a/app/controllers/wikis_controller.rb b/app/controllers/wikis_controller.rb index 1ca7e4af..69280291 100644 --- a/app/controllers/wikis_controller.rb +++ b/app/controllers/wikis_controller.rb @@ -8,14 +8,13 @@ class WikisController < ProjectResourceController end def show + @most_recent_wiki = @project.wikis.where(slug: params[:id]).ordered.first if params[:version_id] @wiki = @project.wikis.find(params[:version_id]) else - @wiki = @project.wikis.where(slug: params[:id]).ordered.first + @wiki = @most_recent_wiki end - @note = @project.notes.new(noteable: @wiki) - if @wiki render 'show' else diff --git a/app/views/wikis/empty.html.haml b/app/views/wikis/empty.html.haml index 32b1c925..08b59f03 100644 --- a/app/views/wikis/empty.html.haml +++ b/app/views/wikis/empty.html.haml @@ -1,4 +1,4 @@ %h3.page_title Empty page %hr -.alert-message.block-message.warning - %span You are not allowed to create wiki pages +.error_message + You are not allowed to create wiki pages diff --git a/app/views/wikis/show.html.haml b/app/views/wikis/show.html.haml index ea23f62c..d3bd58bb 100644 --- a/app/views/wikis/show.html.haml +++ b/app/views/wikis/show.html.haml @@ -10,6 +10,11 @@ %i.icon-edit Edit %br +- if @wiki != @most_recent_wiki + .warning_message + This is an old version of this page. + 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)}. + .file_holder .file_content.wiki = preserve do