[refs #193] Compare routes repair and compare design

This commit is contained in:
konstantin.grabar 2012-02-17 18:12:05 +04:00
parent 7863869a30
commit d9025b093f
4 changed files with 42 additions and 23 deletions

View File

@ -117,6 +117,7 @@ class WikiController < ApplicationController
def compare_wiki def compare_wiki
if request.post? if request.post?
@versions = params[:versions] || [] @versions = params[:versions] || []
puts "VERSIONS1: " + @versions.inspect
if @versions.size < 2 if @versions.size < 2
redirect_to history_project_wiki_index_path(@project) redirect_to history_project_wiki_index_path(@project)
else else
@ -125,6 +126,7 @@ class WikiController < ApplicationController
end end
elsif request.get? elsif request.get?
@versions = params[:versions].split(/\.{2,3}/) @versions = params[:versions].split(/\.{2,3}/)
puts "VERSIONS2: " + @versions.inspect
if @versions.size < 2 if @versions.size < 2
redirect_to history_project_wiki_index_path(@project) redirect_to history_project_wiki_index_path(@project)
return return

View File

@ -19,5 +19,5 @@
= t("layout.time.ago") = t("layout.time.ago")
- unless action_name == 'preview' or cannot? :write, @project - unless action_name == 'preview' or cannot? :write, @project
%p#delete-link %p#delete-link
= link_to project_wiki_path(@project, escaped_name), :method => :delete, :confirm => t("layout.confirm") do = link_to project_wiki_path(@project, escaped_name), :method => :delete, :confirm => t("layout.confirm"), :class => 'button width100' do
%span= t("layout.wiki.delete_page") %span= t("layout.wiki.delete_page")

View File

@ -1,29 +1,46 @@
= render :partial => 'gollum_includes' = render :partial => 'gollum_includes'
= render :partial => 'project_short' =# render :partial => 'project_short'
= render :partial => 'projects/submenu'
%a{ :name => "wiki"} %h3.wiki
.block - if @name
= render :partial => 'navigation' = t("layout.wiki.history_for")
%strong= @page.name
- else
= t("layout.wiki.wiki_history")
.content .r
#wiki-wrapper.inner.compare - if can? :read, @project
#head = link_to t("layout.wiki.back_to_history"),
%h1.title @name ? history_project_wiki_path(@project, escaped_name) : history_project_wiki_index_path(@project),
- if @name :class => 'button width100'
= t("layout.wiki.history_for")
%strong= @page.name
- else
= t("layout.wiki.wiki_history")
%ul.actions #wiki-content
- if can? :read, @project = render :partial => "compare"
%li.minibutton= link_to t("layout.wiki.back_to_history"),
@name ? history_project_wiki_path(@project, escaped_name) : history_project_wiki_index_path(@project)
= render :partial => 'searchbar'
#wiki-content //%a{ :name => "wiki"}
= render :partial => "compare" //.block
// = render :partial => 'navigation'
//
// .content
// #wiki-wrapper.inner.compare
// #head
// %h1.title
// - if @name
// = t("layout.wiki.history_for")
// %strong= @page.name
// - else
// = t("layout.wiki.wiki_history")
//
// %ul.actions
// - if can? :read, @project
// %li.minibutton= link_to t("layout.wiki.back_to_history"),
// @name ? history_project_wiki_path(@project, escaped_name) : history_project_wiki_index_path(@project)
// = render :partial => 'searchbar'
//
// #wiki-content
// = render :partial => "compare"
- content_for :sidebar do - content_for :sidebar do
- render :partial => 'projects/sidebar' - render :partial => 'sidebar'

View File

@ -101,7 +101,7 @@ Rosa::Application.routes.draw do
match '_access' => 'wiki#git', :as => :git, :via => :get match '_access' => 'wiki#git', :as => :git, :via => :get
match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', :as => :revert, :via => [:get, :post] match '_revert/:sha1/:sha2' => 'wiki#revert_wiki', :as => :revert, :via => [:get, :post]
match '_compare' => 'wiki#compare_wiki', :as => :compare, :via => :post match '_compare' => 'wiki#compare_wiki', :as => :compare, :via => :post
match '_compare/*versions' => 'wiki#compare_wiki', :as => :compare_versions, :via => :get match '_compare/:versions' => 'wiki#compare_wiki', :versions => /.*/, :as => :compare_versions, :via => :get
post :preview post :preview
get :search get :search
get :pages get :pages