junebug-wiki 0.0.33 → 0.0.34
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Rakefile +1 -1
- data/lib/junebug/controllers.rb +7 -5
- data/lib/junebug/version.rb +1 -1
- data/lib/junebug/views.rb +2 -2
- data/test/test_wiki.rb +20 -0
- metadata +3 -3
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/junebug/controllers.rb
CHANGED
@@ -17,7 +17,7 @@ module Junebug::Controllers
|
|
17
17
|
def get page_name, version = nil
|
18
18
|
@page = Page.find_by_title(page_name.gsub(/_/,' '))
|
19
19
|
if @page.nil?
|
20
|
-
logged_in? ? redirect(Edit, page_name, 1) : redirect("/login?return_to=#{CGI::escape(
|
20
|
+
logged_in? ? redirect(Edit, page_name, 1) : redirect("/login?return_to=#{CGI::escape('/'+page_name)}")
|
21
21
|
else
|
22
22
|
@page_title = @page.title
|
23
23
|
@version = (version.nil? or version == @page.version.to_s) ? @page : @page.versions.find_by_version(version)
|
@@ -29,7 +29,7 @@ module Junebug::Controllers
|
|
29
29
|
class Edit < R slug('/edit'), slug('/(\d+)/edit')
|
30
30
|
|
31
31
|
def get page_name, version = nil
|
32
|
-
redirect("/login?return_to=#{CGI::escape(
|
32
|
+
redirect("/login?return_to=#{CGI::escape('/'+page_name+'/edit')}") and return unless logged_in?
|
33
33
|
page_name_spc = page_name.gsub(/_/,' ')
|
34
34
|
@page = Page.find_by_title(page_name_spc)
|
35
35
|
if @page.nil?
|
@@ -43,7 +43,7 @@ module Junebug::Controllers
|
|
43
43
|
|
44
44
|
# FIXME: no error checking, also no verify quicksave/readonly rights
|
45
45
|
def post page_name
|
46
|
-
redirect(
|
46
|
+
redirect('/login') and return unless logged_in? # shouldn't be here
|
47
47
|
page_name_spc = page_name.gsub(/_/,' ')
|
48
48
|
@page = Page.find_by_title(page_name_spc)
|
49
49
|
if input.submit == 'cancel'
|
@@ -82,7 +82,7 @@ module Junebug::Controllers
|
|
82
82
|
|
83
83
|
class Delete < R slug('/delete')
|
84
84
|
def get page_name
|
85
|
-
redirect("/login") and return unless logged_in?
|
85
|
+
redirect("/login") and return unless logged_in? # shouldn't be here
|
86
86
|
Page.find_by_title(page_name.gsub(/_/,' ')).destroy() if is_admin?
|
87
87
|
redirect Junebug.startpage
|
88
88
|
end
|
@@ -91,7 +91,7 @@ module Junebug::Controllers
|
|
91
91
|
|
92
92
|
class Revert < R slug('/(\d)/revert')
|
93
93
|
def get page_name, version
|
94
|
-
redirect("/login") and return unless logged_in?
|
94
|
+
redirect("/login") and return unless logged_in? # shouldn't be here
|
95
95
|
Page.find_by_title(page_name.gsub(/_/,' ')).revert_to!(version) if is_admin?
|
96
96
|
redirect Show, page_name
|
97
97
|
end
|
@@ -224,6 +224,8 @@ module Junebug::Controllers
|
|
224
224
|
def get
|
225
225
|
@page_title = "Login/Create Account"
|
226
226
|
@return_to = input.return_to
|
227
|
+
puts "\nBB" + @return_to.to_s
|
228
|
+
puts "input: #{input}"
|
227
229
|
render :login
|
228
230
|
end
|
229
231
|
|
data/lib/junebug/version.rb
CHANGED
data/lib/junebug/views.rb
CHANGED
@@ -297,8 +297,8 @@ module Junebug::Views
|
|
297
297
|
def _markup txt
|
298
298
|
return '' if txt.blank?
|
299
299
|
titles = Junebug::Models::Page.find(:all, :select => 'title').collect { |p| p.title }
|
300
|
-
txt.gsub
|
301
|
-
page = title = $1
|
300
|
+
txt = txt.gsub(Junebug::Models::Page::PAGE_LINK) do
|
301
|
+
page = title = $1.strip
|
302
302
|
title = $2 unless $2.empty?
|
303
303
|
page_url = page.gsub(/ /, '_')
|
304
304
|
if titles.include?(page)
|
data/test/test_wiki.rb
CHANGED
@@ -55,6 +55,26 @@ class TestJunebug < Camping::FunctionalTest
|
|
55
55
|
assert_response :redirect
|
56
56
|
assert_redirected_to '/login'
|
57
57
|
end
|
58
|
+
|
59
|
+
def test_return_to
|
60
|
+
# gets don't seem to pass query params correctly in testing mode, so i've removed them
|
61
|
+
post '/login', :username => 'admin', :password => 'password'
|
62
|
+
assert_response :redirect
|
63
|
+
assert_redirected_to '/Welcome_to_Junebug'
|
64
|
+
|
65
|
+
# get '/logout'
|
66
|
+
# assert_response :redirect
|
67
|
+
# assert_redirected_to '/Welcome_to_Junebug'
|
68
|
+
|
69
|
+
post '/login', :username => 'admin', :password => 'password', :return_to => "/TestPage7"
|
70
|
+
assert_response :redirect
|
71
|
+
assert_redirected_to '/TestPage7'
|
72
|
+
|
73
|
+
# get '/logout', :return_to => '/TestPage7'
|
74
|
+
# assert_response :redirect
|
75
|
+
# assert_redirected_to '/TestPage7'
|
76
|
+
end
|
77
|
+
|
58
78
|
|
59
79
|
def test_required_login
|
60
80
|
# existing pages
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: junebug-wiki
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-08-
|
6
|
+
version: 0.0.34
|
7
|
+
date: 2007-08-26 00:00:00 -07:00
|
8
8
|
summary: Junebug is a minimalist ruby wiki running on Camping.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: "1.2"
|
125
125
|
version:
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: activerecord
|