diff --git a/Gemfile b/Gemfile index 7076e5e1b..f97f4a242 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,11 @@ gem 'highline', '~> 1.6.8' # Wiki gem "gollum", "1.3.1" gem "redcarpet", "1.17.2" +gem 'creole' +gem 'rdiscount' +gem 'org-ruby' +gem 'RedCloth' +gem 'wikicloth' # XML-RPC support # gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git' diff --git a/Gemfile.lock b/Gemfile.lock index 39b210530..b2ccdde64 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,7 @@ GIT GEM remote: http://rubygems.org/ specs: + RedCloth (4.2.9) abstract (1.0.0) actionmailer (3.0.11) actionpack (= 3.0.11) @@ -63,6 +64,7 @@ GEM chronic (0.6.6) cocaine (0.2.1) columnize (0.3.5) + creole (0.4.2) daemons (1.1.4) delayed_job (2.1.4) activesupport (~> 3.0) @@ -74,6 +76,7 @@ GEM diff-lcs (1.1.3) erubis (2.6.6) abstract (>= 1.0.0) + expression_parser (0.9.0) factory_girl (2.3.2) activesupport factory_girl_rails (1.4.0) @@ -134,6 +137,8 @@ GEM omniauth-openid (1.0.1) omniauth (~> 1.0) rack-openid (~> 1.3.1) + org-ruby (0.6.0) + rubypants (>= 0.2.0) orm_adapter (0.0.5) paperclip (2.5.0) activerecord (>= 2.3.0) @@ -173,6 +178,7 @@ GEM raindrops (0.8.0) rake (0.9.2.2) rbx-require-relative (0.0.5) + rdiscount (1.6.8) rdoc (3.11) json (~> 1.4) redcarpet (1.17.2) @@ -198,6 +204,7 @@ GEM ruby-openid (2.1.8) ruby_parser (2.3.1) sexp_processor (~> 3.0) + rubypants (0.2.0) russian (0.6.0) i18n (>= 0.5.0) sanitize (2.0.3) @@ -224,6 +231,9 @@ GEM whenever (0.7.0) activesupport (>= 2.3.4) chronic (~> 0.6.3) + wikicloth (0.7.1) + builder + expression_parser will_paginate (3.0.2) yui-compressor (0.9.5) @@ -231,6 +241,7 @@ PLATFORMS ruby DEPENDENCIES + RedCloth airbrake (~> 3.0.5) ancestry (~> 1.2.4) bluepill @@ -239,6 +250,7 @@ DEPENDENCIES capistrano capistrano-ext capistrano_colors + creole delayed_job devise (~> 1.5.2) factory_girl_rails (~> 1.4.0) @@ -255,12 +267,14 @@ DEPENDENCIES newrelic_rpm omniauth (~> 1.0.1) omniauth-openid (~> 1.0.1) + org-ruby paperclip (~> 2.5) pg (~> 0.11.0) rails (= 3.0.11) rails-xmlrpc (~> 0.3.6) rails3-generators rails3-jquery-autocomplete + rdiscount redcarpet (= 1.17.2) rr rspec-rails (~> 2.7.0) @@ -271,5 +285,6 @@ DEPENDENCIES unicorn (~> 4.1.1) web-app-theme whenever + wikicloth will_paginate (~> 3.0.2) yui-compressor (= 0.9.5) diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index b80b3c606..6c584ad02 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -178,9 +178,11 @@ class WikiController < ApplicationController sha1 = params[:sha1] sha2 = params[:sha2] - if @wiki.revert_page(@page, sha1, sha2, commit_message) - flash[:notice] = t("flash.wiki.revert_success") - redirect_to project_wiki_path(@project, "#{CGI.escape(@name)}") + if @wiki.revert_page(@page, sha1, sha2, commit) + flash[:notice] = t("flash.wiki.revert_success") + puts 'TEST!!!' + puts @name + redirect_to project_wiki_path(@project, CGI.escape(@name)) else # if revert wasn't successful then redirect back to comparsion. # if second commit version is missed, then second version is @@ -271,7 +273,12 @@ class WikiController < ApplicationController if params['message'] and !params['message'].empty? msg = params['message'] else - msg = "#{!!@wiki.page(@name) ? 'Updated page' : 'Created page'} #{@name}" +# msg = "#{!!@wiki.page(@name) ? 'Updated page' : 'Created page'} #{@name}" + msg = case action_name.to_s + when 'create' then 'Created page ' + when 'update' then 'Updated page ' + when 'revert' then 'Reverted page ' + end + @name.to_s end { :message => msg } end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 0be57da56..6bfbe25aa 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -37,7 +37,7 @@ module WikiHelper end def formats - Gollum::Page::FORMAT_NAMES.map do |key, val| + APP_CONFIG['wiki_formats'].map do |key, val| [ val, key.to_s ] end.sort do |a, b| a.first.downcase <=> b.first.downcase