From 832cfdf60540eedd6e115772db4c6720b57b2d18 Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sun, 16 Jan 2005 15:00:11 +0000 Subject: [PATCH] Extracted default layout --- app/controllers/wiki_controller.rb | 1 + app/views/bottom.rhtml | 4 ---- app/views/{top.rhtml => layouts/default.rhtml} | 15 +++++++++++---- app/views/wiki/authors.rhtml | 4 +--- app/views/wiki/edit.rhtml | 4 +--- app/views/wiki/edit_web.rhtml | 4 +--- app/views/wiki/export.rhtml | 4 +--- app/views/wiki/feeds.rhtml | 4 +--- app/views/wiki/list.rhtml | 4 +--- app/views/wiki/locked.rhtml | 4 +--- app/views/wiki/login.rhtml | 5 +---- app/views/wiki/new.rhtml | 4 +--- app/views/wiki/new_system.rhtml | 4 +--- app/views/wiki/new_web.rhtml | 4 +--- app/views/wiki/page.rhtml | 3 --- app/views/wiki/print.rhtml | 4 +--- app/views/wiki/published.rhtml | 4 +--- app/views/wiki/recently_revised.rhtml | 4 +--- app/views/wiki/revision.rhtml | 4 +--- app/views/wiki/rollback.rhtml | 4 +--- app/views/wiki/search.rhtml | 4 +--- app/views/wiki/web_list.rhtml | 4 +--- test/functional/wiki_controller_test.rb | 2 +- 23 files changed, 31 insertions(+), 67 deletions(-) delete mode 100755 app/views/bottom.rhtml rename app/views/{top.rhtml => layouts/default.rhtml} (81%) mode change 100755 => 100644 diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index cff255c3..e2bdf5ed 100755 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -4,6 +4,7 @@ require 'redcloth_for_tex' class WikiController < ApplicationController + layout 'default', :except => [:rss_feed, :rss_with_headlines, :tex_web, :tex] before_filter :pre_process def index diff --git a/app/views/bottom.rhtml b/app/views/bottom.rhtml deleted file mode 100755 index 01ab2b28..00000000 --- a/app/views/bottom.rhtml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/views/top.rhtml b/app/views/layouts/default.rhtml old mode 100755 new mode 100644 similarity index 81% rename from app/views/top.rhtml rename to app/views/layouts/default.rhtml index bb216eb8..778403a6 --- a/app/views/top.rhtml +++ b/app/views/layouts/default.rhtml @@ -11,7 +11,7 @@ <% end %> - + +
-
+

<% if @page and (@page.name == 'HomePage') and %w( show published print ).include?(@action_name) %> @@ -46,4 +47,10 @@ <% end %>

- <%= render 'navigation' unless @web.nil? || @hide_navigation %> +<%= render 'navigation' unless @web.nil? || @hide_navigation %> +<%= @content_for_layout %> + +
+
+ + diff --git a/app/views/wiki/authors.rhtml b/app/views/wiki/authors.rhtml index e4d87eef..77bb0177 100755 --- a/app/views/wiki/authors.rhtml +++ b/app/views/wiki/authors.rhtml @@ -1,4 +1,4 @@ -<% @title = 'Authors' %><%= render 'top' %> +<% @title = 'Authors' %> - -<%= render 'bottom' %> diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 92e78053..eb812d5d 100755 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -2,7 +2,7 @@ @title = "Editing #{@page.name}" @content_width = 720 @hide_navigation = true -%><%= render 'top' %> +%> <%= "

Please correct the error that caused this error in rendering:
#{@params["msg"]}

" if @params["msg"] %> @@ -27,5 +27,3 @@ function cleanAuthorName() { } } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/edit_web.rhtml b/app/views/wiki/edit_web.rhtml index f1903234..80c60bae 100755 --- a/app/views/wiki/edit_web.rhtml +++ b/app/views/wiki/edit_web.rhtml @@ -1,4 +1,4 @@ -<% @title = "Edit Web" %><%= render 'top' %> +<% @title = "Edit Web" %>

Name and address

@@ -134,5 +134,3 @@ function validateSetup() { return true; } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/export.rhtml b/app/views/wiki/export.rhtml index 5712a987..685ac1c8 100755 --- a/app/views/wiki/export.rhtml +++ b/app/views/wiki/export.rhtml @@ -1,4 +1,4 @@ -<% @title = "Export" %><%= render 'top' %> +<% @title = "Export" %>

You can export all the pages in this web as a zip file in either HTML (with working links and all) or the pure markup (to import in another wiki).

@@ -10,5 +10,3 @@
  • PDF <% end %> - -<%= render 'bottom' %> diff --git a/app/views/wiki/feeds.rhtml b/app/views/wiki/feeds.rhtml index cc0169bb..35a02197 100755 --- a/app/views/wiki/feeds.rhtml +++ b/app/views/wiki/feeds.rhtml @@ -1,4 +1,4 @@ -<% @title = "Feeds" %><%= render 'top' %> +<% @title = "Feeds" %>

    You can subscribe to this wiki by RSS and get either just the headlines of the pages that change or the entire page.

    @@ -6,5 +6,3 @@
  • ">Full content (RSS 2.0)
  • ">Headlines (RSS 2.0) - -<%= render 'bottom' %> diff --git a/app/views/wiki/list.rhtml b/app/views/wiki/list.rhtml index 3f416229..471a3508 100755 --- a/app/views/wiki/list.rhtml +++ b/app/views/wiki/list.rhtml @@ -1,4 +1,4 @@ -<% @title = "All Pages" %><%= render 'top' %> +<% @title = "All Pages" %> <% unless @categories.empty? %>
    @@ -55,5 +55,3 @@ <% end %>
    - -<%= render 'bottom' %> diff --git a/app/views/wiki/locked.rhtml b/app/views/wiki/locked.rhtml index a12ade5f..79f0458e 100755 --- a/app/views/wiki/locked.rhtml +++ b/app/views/wiki/locked.rhtml @@ -1,4 +1,4 @@ -<% @title = "#{@page.plain_name} is locked" %><%= render 'top' %> +<% @title = "#{@page.plain_name} is locked" %> <% if @page.lock_duration(Time.now) == 0 %>

    <%= @page.locked_by_link %> just started editing this page.

    @@ -10,5 +10,3 @@ Edit the page anyway | Cancel

    - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/login.rhtml b/app/views/wiki/login.rhtml index 24e94df9..5a404509 100755 --- a/app/views/wiki/login.rhtml +++ b/app/views/wiki/login.rhtml @@ -1,4 +1,4 @@ -<% @title = "#{@web_name} Login" %><% @hide_navigation = true %><%= render 'top' %> +<% @title = "#{@web_name} Login" %><% @hide_navigation = true %>

    @@ -6,6 +6,3 @@

  • - - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/new.rhtml b/app/views/wiki/new.rhtml index 5123ace3..fcd0cf86 100755 --- a/app/views/wiki/new.rhtml +++ b/app/views/wiki/new.rhtml @@ -2,7 +2,7 @@ @title = "Creating #{WikiWords.separate(CGI.unescape(@page_name))}" @content_width = 720 @hide_navigation = true -%><%= render 'top' %> +%> <%= render("#{@web.markup}_help") if @web %> @@ -23,5 +23,3 @@ function cleanAuthorName() { } } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/new_system.rhtml b/app/views/wiki/new_system.rhtml index 9113e5f1..26f3bcac 100755 --- a/app/views/wiki/new_system.rhtml +++ b/app/views/wiki/new_system.rhtml @@ -1,4 +1,4 @@ -<% @title = "Instiki Setup"; @content_width = 500 %><%= render 'top' %> +<% @title = "Instiki Setup"; @content_width = 500 %>

    Congratulations on succesfully installing and starting Instiki. @@ -74,5 +74,3 @@ function validateSetup() { return true; } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/new_web.rhtml b/app/views/wiki/new_web.rhtml index d5332269..39964fd6 100755 --- a/app/views/wiki/new_web.rhtml +++ b/app/views/wiki/new_web.rhtml @@ -1,4 +1,4 @@ -<% @title = "New Wiki Web"; @content_width = 500 %><%= render 'top' %> +<% @title = "New Wiki Web"; @content_width = 500 %>

    Each web serves as an isolated name space for wiki pages, so different subjects or projects can write about different MuppetShows. @@ -60,5 +60,3 @@ function validateSetup() { return true; } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/page.rhtml b/app/views/wiki/page.rhtml index 8d506bd8..0c26057a 100755 --- a/app/views/wiki/page.rhtml +++ b/app/views/wiki/page.rhtml @@ -1,5 +1,4 @@ <% @title = @page.plain_name %> -<%= render 'top' %>

    <%= @page.display_content %> @@ -77,5 +76,3 @@ } } - -<%= render 'bottom' %> diff --git a/app/views/wiki/print.rhtml b/app/views/wiki/print.rhtml index c358c158..d7f20619 100755 --- a/app/views/wiki/print.rhtml +++ b/app/views/wiki/print.rhtml @@ -3,7 +3,7 @@ @hide_navigation = true @style_additions = ".newWikiWord { background-color: white; font-style: italic; }" @inline_style = true -%><%= render 'top' %> +%> <%= @page.display_content_for_export %> @@ -12,5 +12,3 @@ by <%= @page.author_link({ :mode => :export }) %>
    - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/published.rhtml b/app/views/wiki/published.rhtml index 191ffdae..77eddf38 100755 --- a/app/views/wiki/published.rhtml +++ b/app/views/wiki/published.rhtml @@ -3,8 +3,6 @@ @hide_navigation = false @style_additions = ".newWikiWord { background-color: white; font-style: italic; }" @inline_style = true -%><%= render 'top' %> +%> <%= @page.display_published %> - -<%= render 'bottom' %> diff --git a/app/views/wiki/recently_revised.rhtml b/app/views/wiki/recently_revised.rhtml index 5a387c7c..213889ce 100755 --- a/app/views/wiki/recently_revised.rhtml +++ b/app/views/wiki/recently_revised.rhtml @@ -1,4 +1,4 @@ -<% @title = "Recently Revised" %><%= render 'top' %> +<% @title = "Recently Revised" %> <% unless @categories.empty? %>
    @@ -26,5 +26,3 @@ <% revision_date = page.revised_on %> <% end %> - -<%= render 'bottom' %> diff --git a/app/views/wiki/revision.rhtml b/app/views/wiki/revision.rhtml index 52b2924c..461d11e5 100755 --- a/app/views/wiki/revision.rhtml +++ b/app/views/wiki/revision.rhtml @@ -1,4 +1,4 @@ -<% @title = "#{@page.plain_name} (Rev ##{@revision.number})" %><%= render 'top' %> +<% @title = "#{@page.plain_name} (Rev ##{@revision.number})" %>
    <%= @revision.display_content %> @@ -77,5 +77,3 @@ } } - -<%= render 'bottom' %> \ No newline at end of file diff --git a/app/views/wiki/rollback.rhtml b/app/views/wiki/rollback.rhtml index 7581f70e..7dba172a 100755 --- a/app/views/wiki/rollback.rhtml +++ b/app/views/wiki/rollback.rhtml @@ -2,7 +2,7 @@ @title = "Rollback to #{@page.plain_name} Rev ##{@revision.number}" @content_width = 720 @hide_navigation = true -%><%= render 'top' %> +%> <%= "

    Please correct the error that caused this error in rendering:
    #{@params["msg"]}

    " if @params["msg"] %> @@ -27,5 +27,3 @@ function cleanAuthorName() { } } - -<%= render 'bottom' %> diff --git a/app/views/wiki/search.rhtml b/app/views/wiki/search.rhtml index c3704fbf..9f3bb36d 100755 --- a/app/views/wiki/search.rhtml +++ b/app/views/wiki/search.rhtml @@ -1,4 +1,4 @@ -<% @title = @results.length > 0 ? "#{@results.length} pages contains \"#{@params["query"]}\"" : "No pages contains \"#{@query}\"" %><%= render 'top' %> +<% @title = @results.length > 0 ? "#{@results.length} pages contains \"#{@params["query"]}\"" : "No pages contains \"#{@query}\"" %> <% if @results.length > 0 %>
      @@ -11,5 +11,3 @@

      If you're a high-tech computer wizard, you might even want try constructing a regular expression. That's actually what Instiki uses, so go right ahead and flex your "[a-z]*Leet?RegExpSkill(s|z)"

      <% end %> - -<%= render 'bottom' %> diff --git a/app/views/wiki/web_list.rhtml b/app/views/wiki/web_list.rhtml index d05f25ca..71e124fb 100755 --- a/app/views/wiki/web_list.rhtml +++ b/app/views/wiki/web_list.rhtml @@ -1,4 +1,4 @@ -<% @title = "Wiki webs" %><%= render 'top' %> +<% @title = "Wiki webs" %>
        <% for web in @webs %> @@ -16,5 +16,3 @@ <% end %>
      - -<%= render 'bottom' %> diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index 504d6aa1..00a7a3e0 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -427,7 +427,7 @@ class WikiControllerTest < Test::Unit::TestCase @request.port = 8080 r = process 'rss_with_headlines', 'web' => 'wiki1' - + assert_success pages = r.template_objects['pages_by_revision'] assert_equal [@home, @oak, @elephant], pages,