junebug-wiki 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -0
- data/Manifest.txt +0 -1
- data/RELEASE_NOTES.txt +12 -0
- data/deploy/config.yml +1 -1
- data/deploy/public/style/base.css +14 -8
- data/dump/junebug_pages.yml +3 -9
- data/lib/junebug/controllers.rb +31 -26
- data/lib/junebug/helpers.rb +1 -1
- data/lib/junebug/models.rb +6 -2
- data/lib/junebug/tasks/dump.rake +35 -13
- data/lib/junebug/version.rb +1 -1
- data/lib/junebug/views.rb +74 -63
- data/test/wiki_test.rb +14 -21
- metadata +2 -3
- data/deploy/public/style/yui/grids.css +0 -88
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
= 0.0.22 2006-11-28
|
2
|
+
|
3
|
+
* *EXISTING USERS PLEASE READ THE RELEASE NOTES*
|
4
|
+
* Data dump improvements
|
5
|
+
* Removed yahoo grids (weren't using them), page structure simplification
|
6
|
+
* Changed page naming convention (underscores in url, spaces in title and db)
|
7
|
+
* Changed header format to help avoid title duplication in text
|
8
|
+
|
1
9
|
= 0.0.21 2006-11-26
|
2
10
|
|
3
11
|
* *EXISTING USERS PLEASE READ THE RELEASE NOTES*
|
data/Manifest.txt
CHANGED
data/RELEASE_NOTES.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
= 0.0.22 2006-11-28
|
2
|
+
|
3
|
+
The wikiword syntax has changed slightly. Starting in this version, wikiwords can not contain underscores. Furthermore, in page urls, spaces will now be replaced by underscores. Example:
|
4
|
+
|
5
|
+
Invalid wikiword link syntax: [[Test_page]]
|
6
|
+
|
7
|
+
Valid wikiword link syntax: [[Test page]]
|
8
|
+
Corresponding page url: http://www.wiki.com/Test_page
|
9
|
+
|
10
|
+
Also, you will notice that the page title is now presented in the page body rather than the header. I was finding that the previous location in the header usually led me to rewrite the title in the body for clarity.
|
11
|
+
|
12
|
+
|
1
13
|
= 0.0.21 2006-11-26
|
2
14
|
|
3
15
|
The database configuration in config.yml has been changed to allow easy support for databases other than sqlite3. Existing junebug installations will need to make the following changes:
|
data/deploy/config.yml
CHANGED
@@ -48,10 +48,16 @@ ins {
|
|
48
48
|
/* PAGE STRUCTURE */
|
49
49
|
body {
|
50
50
|
background:#d7d7d7;
|
51
|
+
text-align: center;
|
52
|
+
min-width: 800px;
|
51
53
|
}
|
52
54
|
|
53
55
|
#doc {
|
54
56
|
font-family: 'Lucida Grande', 'Trebuchet MS', Arial, Helvetica, sans-serif;
|
57
|
+
width: 800px;
|
58
|
+
margin-left: auto;
|
59
|
+
margin-right: auto;
|
60
|
+
text-align: left;
|
55
61
|
}
|
56
62
|
|
57
63
|
#hd {
|
@@ -59,13 +65,18 @@ body {
|
|
59
65
|
background-color: #6677aa;
|
60
66
|
padding: 8px 25px;
|
61
67
|
color: #ffffff;
|
68
|
+
margin-bottom: 10px;
|
69
|
+
}
|
70
|
+
|
71
|
+
#hd #userlinks {
|
72
|
+
float: right;
|
62
73
|
}
|
63
74
|
|
64
75
|
#hd a {
|
65
76
|
color: #ffffff;
|
66
77
|
}
|
67
78
|
|
68
|
-
|
79
|
+
/*#hd h1 a {
|
69
80
|
color: #ffffff;
|
70
81
|
}
|
71
82
|
#hd h1 a:link, #hd h1 a:visited {
|
@@ -77,7 +88,7 @@ body {
|
|
77
88
|
font-size: 167%;
|
78
89
|
padding-bottom: 5px;
|
79
90
|
font-weight: normal;
|
80
|
-
}
|
91
|
+
}*/
|
81
92
|
|
82
93
|
#bd {
|
83
94
|
background-color: #ffffff;
|
@@ -85,12 +96,6 @@ body {
|
|
85
96
|
border-width:0 5px 5px 0;
|
86
97
|
}
|
87
98
|
|
88
|
-
#yui-main{
|
89
|
-
}
|
90
|
-
|
91
|
-
.yui-b{
|
92
|
-
}
|
93
|
-
|
94
99
|
#ft {
|
95
100
|
border: 1px solid #eee;
|
96
101
|
background-color: #ddd;
|
@@ -169,6 +174,7 @@ body {
|
|
169
174
|
.content h1 {
|
170
175
|
font-size: 182%;
|
171
176
|
margin-bottom: 10px;
|
177
|
+
border-bottom: 2px dotted #bbb;
|
172
178
|
}
|
173
179
|
|
174
180
|
.content h2 {
|
data/dump/junebug_pages.yml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
---
|
2
2
|
- updated_at: 2006-11-23 09:39:25 -08:00
|
3
|
-
title:
|
3
|
+
title: Welcome to Junebug
|
4
4
|
readonly: true
|
5
5
|
body: |
|
6
|
-
h1. Welcome to Junebug!
|
7
|
-
|
8
6
|
To complete setup of you new wiki, here are a few things you should do:
|
9
7
|
|
10
8
|
|
@@ -35,11 +33,9 @@
|
|
35
33
|
user_id: 1
|
36
34
|
created_at: 2006-10-29 16:19:34 -08:00
|
37
35
|
- updated_at: 2006-11-23 12:08:56 -08:00
|
38
|
-
title:
|
36
|
+
title: Junebug help
|
39
37
|
readonly:
|
40
38
|
body: |
|
41
|
-
h1. Junebug Help
|
42
|
-
|
43
39
|
h2. Wiki Words
|
44
40
|
|
45
41
|
Junebug will create a wiki link for any text enclosed in double brackets:
|
@@ -80,11 +76,9 @@
|
|
80
76
|
user_id: 1
|
81
77
|
created_at: 2006-11-01 00:10:07 -08:00
|
82
78
|
- updated_at: 2006-11-23 09:42:05 -08:00
|
83
|
-
title:
|
79
|
+
title: Textile syntax test
|
84
80
|
readonly:
|
85
81
|
body: |-
|
86
|
-
h1. Textile Syntax Test
|
87
|
-
|
88
82
|
See "this page":http://hobix.com/textile/ for the full range of formatting options
|
89
83
|
|
90
84
|
h2. Headers
|
data/lib/junebug/controllers.rb
CHANGED
@@ -9,72 +9,75 @@ module Junebug::Controllers
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
class Show < R '/([
|
12
|
+
class Show < R '/([0-9A-Za-z_]+)', '/([0-9A-Za-z_]+)/(\d+)'
|
13
13
|
def get page_name, version = nil
|
14
|
-
@page_title = page_name
|
15
14
|
#redirect(Edit, page_name, 1) and return unless @page = Page.find_by_title(page_name)
|
16
|
-
redirect("#{Junebug.config['url']}/#{page_name.gsub(/ /,'+')}/1/edit") and return unless @page = Page.find_by_title(page_name)
|
15
|
+
redirect("#{Junebug.config['url']}/#{page_name.gsub(/ /,'+')}/1/edit") and return unless @page = Page.find_by_title(page_name.gsub(/_/,' '))
|
16
|
+
@page_title = @page.title
|
17
17
|
@version = (version.nil? or version == @page.version.to_s) ? @page : @page.versions.find_by_version(version)
|
18
18
|
render :show
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class Edit < R '/([
|
22
|
+
class Edit < R '/([0-9A-Za-z_]+)/edit', '/([0-9A-Za-z_]+)/(\d+)/edit'
|
23
23
|
def get page_name, version = nil
|
24
24
|
redirect("#{Junebug.config['url']}/login") and return unless logged_in?
|
25
|
-
|
26
|
-
@page = Page.find(:first, :conditions=>['title = ?',
|
27
|
-
@page = Page.create(:title =>
|
25
|
+
page_name_spc = page_name.gsub(/_/,' ')
|
26
|
+
@page = Page.find(:first, :conditions=>['title = ?', page_name_spc])
|
27
|
+
@page = Page.create(:title => page_name_spc, :user_id=>@state.user.id) unless @page
|
28
28
|
@page = @page.versions.find_by_version(version) unless version.nil? or version == @page.version.to_s
|
29
|
+
@page_title = "Editing: #{page_name_spc}"
|
29
30
|
render :edit
|
30
31
|
end
|
31
32
|
|
32
33
|
# FIXME: no error checking, also no verify quicksave/readonly rights
|
33
34
|
def post page_name
|
34
35
|
redirect("#{Junebug.config['url']}/login") and return unless logged_in?
|
36
|
+
page_name_spc = page_name.gsub(/_/,' ')
|
35
37
|
if input.submit == 'save'
|
36
38
|
if ! input.quicksave
|
37
39
|
attrs = { :body => input.post_body, :title => input.post_title, :user_id =>@state.user.id }
|
38
40
|
attrs[:readonly] = input.post_readonly if is_admin?
|
39
|
-
Page.find_or_create_by_title(
|
41
|
+
Page.find_or_create_by_title(page_name_spc).update_attributes(attrs)
|
40
42
|
else
|
41
43
|
attrs = { :body => input.post_body }
|
42
44
|
attrs[:readonly] = input.post_readonly if is_admin?
|
43
|
-
page = Page.find_by_title(
|
45
|
+
page = Page.find_by_title(page_name_spc)
|
44
46
|
current_version = page.find_version(page.version)
|
45
47
|
current_version.update_attributes(attrs)
|
46
48
|
page.without_revision { page.update_attributes(attrs) }
|
47
49
|
end
|
48
50
|
# redirect Show, input.post_title
|
49
|
-
redirect "#{Junebug.config['url']}/#{input.post_title.gsub(/ /,'
|
51
|
+
redirect "#{Junebug.config['url']}/#{input.post_title.gsub(/ /,'_')}"
|
50
52
|
else # cancel
|
51
|
-
redirect "#{Junebug.config['url']}/#{page_name
|
53
|
+
redirect "#{Junebug.config['url']}/#{page_name}"
|
52
54
|
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
56
|
-
class Delete < R '/([
|
58
|
+
class Delete < R '/([0-9A-Za-z_]+)/delete'
|
57
59
|
def get page_name
|
58
60
|
redirect("#{Junebug.config['url']}/login") and return unless logged_in?
|
59
|
-
Page.find_by_title(page_name).destroy() if is_admin?
|
61
|
+
Page.find_by_title(page_name.gsub(/_/,' ')).destroy() if is_admin?
|
60
62
|
redirect Junebug.startpage
|
61
63
|
end
|
62
64
|
|
63
65
|
end
|
64
66
|
|
65
|
-
class Revert < R '/([
|
67
|
+
class Revert < R '/([0-9A-Za-z_]+)/(\d+)/revert'
|
66
68
|
def get page_name, version
|
67
69
|
redirect("#{Junebug.config['url']}/login") and return unless logged_in?
|
68
|
-
Page.find_by_title(page_name).revert_to!(version) if is_admin?
|
69
|
-
redirect "#{Junebug.config['url']}/#{page_name
|
70
|
+
Page.find_by_title(page_name.gsub(/_/,' ')).revert_to!(version) if is_admin?
|
71
|
+
redirect "#{Junebug.config['url']}/#{page_name}"
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
73
|
-
class Versions < R '/([
|
75
|
+
class Versions < R '/([0-9A-Za-z_]+)/versions'
|
74
76
|
def get page_name
|
75
|
-
|
76
|
-
@page = Page.find_by_title(
|
77
|
+
page_name_spc = page_name.gsub(/_/,' ')
|
78
|
+
@page = Page.find_by_title(page_name_spc)
|
77
79
|
@versions = @page.find_versions(:order => 'version DESC', :include => [:user])
|
80
|
+
@page_title = "Version History: #{page_name_spc}"
|
78
81
|
render :versions
|
79
82
|
end
|
80
83
|
end
|
@@ -87,11 +90,12 @@ module Junebug::Controllers
|
|
87
90
|
end
|
88
91
|
end
|
89
92
|
|
90
|
-
class Backlinks < R '/([
|
93
|
+
class Backlinks < R '/([0-9A-Za-z_]+)/backlinks'
|
91
94
|
def get page_name
|
92
|
-
|
93
|
-
@
|
94
|
-
@
|
95
|
+
page_name_spc = page_name.gsub(/_/,' ')
|
96
|
+
@page = Page.find_by_title(page_name_spc)
|
97
|
+
@page_title = "Backlinks for: #{page_name_spc}"
|
98
|
+
@pages = Page.find(:all, :conditions => ["body LIKE ?", "%#{page_name_spc}%"])
|
95
99
|
render :backlinks
|
96
100
|
end
|
97
101
|
end
|
@@ -104,11 +108,12 @@ module Junebug::Controllers
|
|
104
108
|
end
|
105
109
|
end
|
106
110
|
|
107
|
-
class Diff < R '/([
|
111
|
+
class Diff < R '/([0-9A-Za-z_]+)/(\d+)/(\d+)/diff'
|
108
112
|
include HTMLDiff
|
109
113
|
def get page_name, v1, v2
|
110
|
-
|
111
|
-
@
|
114
|
+
page_name_spc = page_name.gsub(/_/,' ')
|
115
|
+
@page_title = "Diff: #{page_name_spc}"
|
116
|
+
@page = Page.find_by_title(page_name_spc)
|
112
117
|
@v1 = @page.find_version(v1)
|
113
118
|
@v2 = @page.find_version(v2)
|
114
119
|
|
data/lib/junebug/helpers.rb
CHANGED
@@ -27,7 +27,7 @@ module Junebug::Helpers
|
|
27
27
|
|
28
28
|
def diff_link(page, version=nil)
|
29
29
|
version = page if version.nil?
|
30
|
-
a 'diff', :href => R(Junebug::Controllers::Diff,page.
|
30
|
+
a 'diff', :href => R(Junebug::Controllers::Diff,page.title_url,version.version-1,version.version)
|
31
31
|
end
|
32
32
|
|
33
33
|
def auto_link_urls(text)
|
data/lib/junebug/models.rb
CHANGED
@@ -27,11 +27,11 @@ module Junebug::Models
|
|
27
27
|
class Page < Base
|
28
28
|
belongs_to :user
|
29
29
|
#PAGE_LINK = /\[\[([^\]|]*)[|]?([^\]]*)\]\]/
|
30
|
-
PAGE_LINK = /\[\[([
|
30
|
+
PAGE_LINK = /\[\[([0-9A-Za-z ]+)[|]?([^\]]*)\]\]/
|
31
31
|
#before_save { |r| r.title = r.title.underscore }
|
32
32
|
#PAGE_LINK = /([A-Z][a-z]+[A-Z]\w+)/
|
33
33
|
validates_uniqueness_of :title
|
34
|
-
validates_format_of :title, :with => /^[
|
34
|
+
validates_format_of :title, :with => /^[0-9A-Za-z ]+$/
|
35
35
|
validates_presence_of :title
|
36
36
|
acts_as_versioned
|
37
37
|
non_versioned_fields.push 'title'
|
@@ -39,6 +39,10 @@ module Junebug::Models
|
|
39
39
|
def title=(text)
|
40
40
|
write_attribute(:title, text ? text.strip.squeeze(' ') : text)
|
41
41
|
end
|
42
|
+
|
43
|
+
def title_url
|
44
|
+
title.gsub(' ','_')
|
45
|
+
end
|
42
46
|
end
|
43
47
|
|
44
48
|
class Page::Version < Base
|
data/lib/junebug/tasks/dump.rake
CHANGED
@@ -4,31 +4,53 @@ require 'active_record'
|
|
4
4
|
|
5
5
|
namespace :dump do
|
6
6
|
|
7
|
+
desc 'Dump page and user data'
|
8
|
+
task :all => [:pages, :users]
|
9
|
+
|
7
10
|
desc 'Dump wiki pages'
|
8
11
|
task :pages do
|
12
|
+
Junebug.connect
|
13
|
+
|
9
14
|
fixtures_dir = File.join('.', 'dump')
|
10
|
-
|
11
|
-
# clean out fixtures dir
|
12
|
-
puts "fixtures_dir: #{fixtures_dir}"
|
13
|
-
Dir[File.join(fixtures_dir, '*')].each { |f| rm_f(f, :verbose => false) }
|
14
|
-
|
15
|
-
# open db connection
|
16
|
-
ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :database => "./junebug.db")
|
17
|
-
|
15
|
+
|
18
16
|
# open fixtures file
|
19
17
|
File.open(File.join(fixtures_dir, "junebug_pages.yml"), 'w') do |file|
|
20
18
|
|
21
19
|
# grab all pages
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
objs = Junebug::Models::Page.find(:all)
|
21
|
+
data = []
|
22
|
+
objs.each do |obj|
|
23
|
+
data << obj.attributes
|
26
24
|
end
|
27
25
|
|
28
|
-
file.write
|
26
|
+
file.write data.to_yaml
|
29
27
|
end
|
30
28
|
|
31
29
|
puts "Got pages and put them in #{fixtures_dir}."
|
32
30
|
end
|
33
31
|
|
32
|
+
desc 'Dump user data'
|
33
|
+
task :users do
|
34
|
+
Junebug.connect
|
35
|
+
|
36
|
+
fixtures_dir = File.join('.', 'dump')
|
37
|
+
|
38
|
+
# open fixtures file
|
39
|
+
File.open(File.join(fixtures_dir, "junebug_users.yml"), 'w') do |file|
|
40
|
+
|
41
|
+
# grab all users
|
42
|
+
objs = Junebug::Models::User.find(:all)
|
43
|
+
data = []
|
44
|
+
objs.each do |obj|
|
45
|
+
data << obj.attributes
|
46
|
+
end
|
47
|
+
|
48
|
+
file.write data.to_yaml
|
49
|
+
end
|
50
|
+
|
51
|
+
puts "Got users and put them in #{fixtures_dir}."
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
34
56
|
end
|
data/lib/junebug/version.rb
CHANGED
data/lib/junebug/views.rb
CHANGED
@@ -1,33 +1,34 @@
|
|
1
1
|
require 'redcloth'
|
2
2
|
|
3
3
|
module Junebug::Views
|
4
|
+
|
4
5
|
def layout
|
5
6
|
html {
|
6
7
|
head {
|
7
8
|
title @page_title ? @page_title : @page.title
|
8
9
|
link :href=>'/style/yui/reset.css', :type=>'text/css', :rel=>'stylesheet'
|
9
10
|
link :href=>'/style/yui/fonts.css', :type=>'text/css', :rel=>'stylesheet'
|
10
|
-
link :href=>'/style/yui/grids.css', :type=>'text/css', :rel=>'stylesheet'
|
11
11
|
link :href=>'/style/base.css', :type=>'text/css', :rel=>'stylesheet'
|
12
12
|
link :href=>Junebug.config['feed'], :rel => "alternate", :title => "Recently Updated Pages", :type => "application/atom+xml"
|
13
|
-
|
14
13
|
}
|
15
14
|
body {
|
16
|
-
div :id=>'doc'
|
15
|
+
div :id=>'doc' do
|
17
16
|
self << yield
|
18
17
|
end
|
19
18
|
}
|
20
19
|
}
|
21
20
|
end
|
22
21
|
|
22
|
+
|
23
23
|
def show
|
24
|
-
_header (@version.version == @page.version ? :backlinks : :show)
|
25
|
-
_body
|
26
|
-
_button 'edit', R(Edit, @page.
|
24
|
+
_header (@version.version == @page.version ? :backlinks : :show)
|
25
|
+
_body do
|
26
|
+
_button 'edit', R(Edit, @page.title_url, @version.version), {:style=>'float: right; margin: 0 0 5px 5px;'} if logged_in? && (@version.version == @page.version && (! @page.readonly || is_admin?))
|
27
|
+
h1 @page.title
|
27
28
|
_markup @version.body
|
28
|
-
_button 'edit', R(Edit, @page.
|
29
|
+
_button 'edit', R(Edit, @page.title_url, @version.version), {:style=>'float: right; margin: 5px 0 0 5px;'} if logged_in? && (@version.version == @page.version && (! @page.readonly || is_admin?)) && (@version.body && @version.body.size > 200)
|
29
30
|
br :clear=>'all'
|
30
|
-
|
31
|
+
end
|
31
32
|
_footer {
|
32
33
|
text "Last edited by <b>#{@version.user.username}</b> on #{@page.updated_at.strftime('%B %d, %Y %I:%M %p')}"
|
33
34
|
text " (#{diff_link(@page, @version)}) " if @version.version > 1
|
@@ -37,31 +38,33 @@ module Junebug::Views
|
|
37
38
|
text "Version #{@version.version} "
|
38
39
|
text "(current) " if @version.version == @page.version
|
39
40
|
#text 'Other versions: '
|
40
|
-
a '«older', :href => R(Show, @page.
|
41
|
-
a 'newer»', :href => R(Show, @page.
|
42
|
-
a 'current', :href => R(Show, @page.
|
43
|
-
a 'versions', :href => R(Versions, @page.
|
41
|
+
a '«older', :href => R(Show, @page.title_url, @version.version-1) unless @version.version == 1
|
42
|
+
a 'newer»', :href => R(Show, @page.title_url, @version.version+1) unless @version.version == @page.version
|
43
|
+
a 'current', :href => R(Show, @page.title_url) unless @version.version == @page.version
|
44
|
+
a 'versions', :href => R(Versions, @page.title_url)
|
44
45
|
}
|
45
46
|
}
|
46
47
|
if is_admin?
|
47
48
|
div.admin {
|
48
|
-
_button 'delete', R(Delete, @page.
|
49
|
-
_button 'revert to', R(Revert, @page.
|
49
|
+
_button 'delete', R(Delete, @page.title_url), {:onclick=>"return confirm('Sure you want to delete?')"} if @version.version == @page.version
|
50
|
+
_button 'revert to', R(Revert, @page.title_url, @version.version), {:onclick=>"return confirm('Sure you want to revert?')"} if @version.version != @page.version
|
50
51
|
}
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
55
|
+
|
54
56
|
def edit
|
55
|
-
_header :show
|
56
|
-
_body
|
57
|
+
_header :show
|
58
|
+
_body do
|
59
|
+
h1 @page_title
|
57
60
|
div.formbox {
|
58
|
-
form :method => 'post', :action => R(Edit, @page.
|
61
|
+
form :method => 'post', :action => R(Edit, @page.title_url) do
|
59
62
|
p {
|
60
63
|
label 'Page Title'
|
61
64
|
br
|
62
65
|
input :value => @page.title, :name => 'post_title', :size => 30,
|
63
66
|
:type => 'text'
|
64
|
-
small " word characters [0-9A-Za-
|
67
|
+
small " word characters [0-9A-Za-z] and spaces only"
|
65
68
|
}
|
66
69
|
p {
|
67
70
|
label 'Page Content'
|
@@ -85,18 +88,19 @@ module Junebug::Views
|
|
85
88
|
a 'syntax help', :href => 'http://hobix.com/textile/', :target=>'_blank'
|
86
89
|
br :clear=>'all'
|
87
90
|
}
|
88
|
-
|
91
|
+
end
|
89
92
|
_footer { '' }
|
90
93
|
end
|
91
94
|
|
95
|
+
|
92
96
|
def versions
|
93
|
-
_header :show
|
94
|
-
_body
|
97
|
+
_header :show
|
98
|
+
_body do
|
95
99
|
h1 @page_title
|
96
100
|
ul {
|
97
101
|
@versions.each_with_index do |page,i|
|
98
102
|
li {
|
99
|
-
a "version #{page.version}", :href => R(Show, @page.
|
103
|
+
a "version #{page.version}", :href => R(Show, @page.title_url, page.version)
|
100
104
|
text " (#{diff_link(@page, page)}) " if page.version > 1
|
101
105
|
text' - created '
|
102
106
|
text last_updated(page)
|
@@ -106,36 +110,38 @@ module Junebug::Views
|
|
106
110
|
}
|
107
111
|
end
|
108
112
|
}
|
109
|
-
|
113
|
+
end
|
110
114
|
_footer { '' }
|
111
115
|
end
|
112
116
|
|
117
|
+
|
113
118
|
def backlinks
|
114
|
-
_header :show
|
115
|
-
_body
|
119
|
+
_header :show
|
120
|
+
_body do
|
116
121
|
h1 "Backlinks to #{@page.title}"
|
117
122
|
ul {
|
118
123
|
@pages.each { |p| li{ a p.title, :href => R(Show, p.title) } }
|
119
124
|
}
|
120
|
-
|
125
|
+
end
|
121
126
|
_footer { '' }
|
122
127
|
end
|
123
128
|
|
129
|
+
|
124
130
|
def list
|
125
|
-
_header :static
|
126
|
-
_body
|
127
|
-
h1 "All
|
131
|
+
_header :static
|
132
|
+
_body do
|
133
|
+
h1 "All wiki pages"
|
128
134
|
ul {
|
129
|
-
@pages.each { |p| li{ a p.title, :href => R(Show, p.
|
135
|
+
@pages.each { |p| li{ a p.title, :href => R(Show, p.title_url) } }
|
130
136
|
}
|
131
|
-
|
137
|
+
end
|
132
138
|
_footer { '' }
|
133
139
|
end
|
134
140
|
|
135
141
|
|
136
142
|
def recent
|
137
|
-
_header :static
|
138
|
-
_body
|
143
|
+
_header :static
|
144
|
+
_body do
|
139
145
|
h1 "Updates in the last 30 days"
|
140
146
|
page = @pages.shift
|
141
147
|
while page
|
@@ -144,9 +150,9 @@ module Junebug::Views
|
|
144
150
|
ul {
|
145
151
|
loop do
|
146
152
|
li {
|
147
|
-
a page.title, :href => R(Show, page.
|
153
|
+
a page.title, :href => R(Show, page.title_url)
|
148
154
|
text ' ('
|
149
|
-
a 'versions', :href => R(Versions, page.
|
155
|
+
a 'versions', :href => R(Versions, page.title_url)
|
150
156
|
text ",#{diff_link(page)}" if page.version > 1
|
151
157
|
text ') '
|
152
158
|
span page.updated_at.strftime('%I:%M %p')
|
@@ -156,25 +162,25 @@ module Junebug::Views
|
|
156
162
|
end
|
157
163
|
}
|
158
164
|
end
|
159
|
-
|
165
|
+
end
|
160
166
|
_footer { '' }
|
161
167
|
end
|
162
168
|
|
163
169
|
def diff
|
164
|
-
_header :show
|
165
|
-
_body
|
170
|
+
_header :show
|
171
|
+
_body do
|
166
172
|
text 'Comparing '
|
167
173
|
span "version #{@v2.version}", :style=>"background-color: #cfc; padding: 1px 4px;"
|
168
174
|
text ' and '
|
169
175
|
span "version #{@v1.version}", :style=>"background-color: #ddd; padding: 1px 4px;"
|
170
176
|
text ' '
|
171
|
-
a "back", :href => R(Show, @page.
|
177
|
+
a "back", :href => R(Show, @page.title_url)
|
172
178
|
br
|
173
179
|
br
|
174
180
|
pre.diff {
|
175
|
-
|
181
|
+
text @difftext
|
176
182
|
}
|
177
|
-
|
183
|
+
end
|
178
184
|
_footer { '' }
|
179
185
|
end
|
180
186
|
|
@@ -209,48 +215,53 @@ module Junebug::Views
|
|
209
215
|
txt.gsub!(Junebug::Models::Page::PAGE_LINK) do
|
210
216
|
page = title = $1
|
211
217
|
title = $2 unless $2.empty?
|
212
|
-
|
218
|
+
page_url = page.gsub(/ /, '_')
|
213
219
|
if titles.include?(page)
|
214
|
-
%Q{<a href="#{self/R(Show,
|
220
|
+
%Q{<a href="#{self/R(Show, page_url)}">#{title}</a>}
|
215
221
|
else
|
216
|
-
%Q{<span>#{title}<a href="#{self/R(Edit,
|
222
|
+
%Q{<span>#{title}<a href="#{self/R(Edit, page_url, 1)}">?</a></span>}
|
217
223
|
end
|
218
224
|
end
|
219
225
|
text RedCloth.new(auto_link_urls(txt), [ ]).to_html
|
220
226
|
end
|
221
227
|
|
222
|
-
def _header type
|
228
|
+
def _header type
|
223
229
|
div :id=>'hd' do
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
h1 { a page_title, :href => R(Show, page_title) }
|
230
|
+
|
231
|
+
span :id=>'userlinks' do
|
232
|
+
if logged_in?
|
233
|
+
text "Welcome, #{@state.user.username} - "
|
234
|
+
a 'sign out', :href=>"#{R(Logout)}?return_to=#{@env['REQUEST_URI']}"
|
235
|
+
else
|
236
|
+
a 'sign in', :href=> "#{R(Login)}?return_to=#{@env['REQUEST_URI']}"
|
237
|
+
end
|
233
238
|
end
|
234
|
-
|
239
|
+
|
240
|
+
span :id=>'navlinks' do
|
235
241
|
a 'Home', :href => R(Show, Junebug.config['startpage'])
|
236
242
|
text ' | '
|
237
243
|
a 'RecentChanges', :href => R(Recent)
|
238
244
|
text ' | '
|
239
245
|
a 'All Pages', :href => R(List)
|
240
246
|
text ' | '
|
241
|
-
a 'Help', :href => R(Show, "
|
242
|
-
|
247
|
+
a 'Help', :href => R(Show, "Junebug_help")
|
248
|
+
end
|
249
|
+
|
250
|
+
# if type == :static
|
251
|
+
# h1 page_title
|
252
|
+
# elsif type == :backlinks
|
253
|
+
# h1 { a page_title, :href => R(Backlinks, page_title) }
|
254
|
+
# else
|
255
|
+
# h1 { a page_title, :href => R(Show, page_title) }
|
256
|
+
# end
|
257
|
+
|
243
258
|
end
|
244
259
|
end
|
245
260
|
|
246
261
|
def _body
|
247
262
|
div :id=>'bd' do
|
248
|
-
div
|
249
|
-
|
250
|
-
div.content do
|
251
|
-
yield
|
252
|
-
end
|
253
|
-
end
|
263
|
+
div.content do
|
264
|
+
yield
|
254
265
|
end
|
255
266
|
end
|
256
267
|
end
|
data/test/wiki_test.rb
CHANGED
@@ -15,43 +15,43 @@ class JunebugTest < Camping::FunctionalTest
|
|
15
15
|
def test_index
|
16
16
|
get
|
17
17
|
assert_response :redirect
|
18
|
-
assert_redirected_to '/
|
18
|
+
assert_redirected_to '/Welcome_to_Junebug'
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_start_page
|
22
|
-
get '/
|
22
|
+
get '/Welcome_to_Junebug'
|
23
23
|
assert_response :success
|
24
|
-
assert_match_body %r!title>
|
24
|
+
assert_match_body %r!title>Welcome to Junebug</title!
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_login
|
28
28
|
post '/login', :username => 'admin', :password => 'password'
|
29
29
|
assert_response :redirect
|
30
|
-
assert_redirected_to '/
|
30
|
+
assert_redirected_to '/Welcome_to_Junebug'
|
31
31
|
|
32
32
|
get '/logout'
|
33
33
|
assert_response :redirect
|
34
|
-
assert_redirected_to '/
|
34
|
+
assert_redirected_to '/Welcome_to_Junebug'
|
35
35
|
end
|
36
36
|
|
37
37
|
def test_required_login
|
38
|
-
get '/
|
38
|
+
get '/Welcome_to_Junebug/edit'
|
39
39
|
assert_response :redirect
|
40
40
|
assert_redirected_to '/login'
|
41
41
|
|
42
|
-
get '/
|
42
|
+
get '/Welcome_to_Junebug/1/edit'
|
43
43
|
assert_response :redirect
|
44
44
|
assert_redirected_to '/login'
|
45
45
|
|
46
|
-
post '/
|
46
|
+
post '/Welcome_to_Junebug/edit'
|
47
47
|
assert_response :redirect
|
48
48
|
assert_redirected_to '/login'
|
49
49
|
|
50
|
-
get '/
|
50
|
+
get '/Welcome_to_Junebug/delete'
|
51
51
|
assert_response :redirect
|
52
52
|
assert_redirected_to '/login'
|
53
53
|
|
54
|
-
get '/
|
54
|
+
get '/Welcome_to_Junebug/1/revert'
|
55
55
|
assert_response :redirect
|
56
56
|
assert_redirected_to '/login'
|
57
57
|
end
|
@@ -100,9 +100,6 @@ class PageTest < Camping::UnitTest
|
|
100
100
|
|
101
101
|
page = create(:title => 'test page')
|
102
102
|
assert page.valid?
|
103
|
-
|
104
|
-
page = create(:title => 'test_page')
|
105
|
-
assert page.valid?
|
106
103
|
|
107
104
|
page = create(:title => 'test')
|
108
105
|
assert page.valid?
|
@@ -139,6 +136,10 @@ class PageTest < Camping::UnitTest
|
|
139
136
|
page = create(:title => 'page\'s')
|
140
137
|
deny page.valid?
|
141
138
|
assert_not_nil page.errors.on(:title)
|
139
|
+
|
140
|
+
page = create(:title => 'test_title')
|
141
|
+
deny page.valid?
|
142
|
+
assert_not_nil page.errors.on(:title)
|
142
143
|
end
|
143
144
|
|
144
145
|
def test_unique_title
|
@@ -153,14 +154,6 @@ class PageTest < Camping::UnitTest
|
|
153
154
|
# lowercase
|
154
155
|
page2 = create(:title => 'testtitle')
|
155
156
|
assert page2.valid?
|
156
|
-
|
157
|
-
# create page with underscores
|
158
|
-
page1 = create(:title => 'test_title')
|
159
|
-
assert page1.valid?
|
160
|
-
|
161
|
-
# different from page with spaces
|
162
|
-
page1 = create(:title => 'test title')
|
163
|
-
assert page1.valid?
|
164
157
|
end
|
165
158
|
|
166
159
|
def test_spaces
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: junebug-wiki
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2006-11-
|
6
|
+
version: 0.0.22
|
7
|
+
date: 2006-11-28 00:00:00 -08:00
|
8
8
|
summary: Junebug is a minimalist ruby wiki running on Camping.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -41,7 +41,6 @@ files:
|
|
41
41
|
- deploy/public/images/feed-icon-14x14.png
|
42
42
|
- deploy/public/style/base.css
|
43
43
|
- deploy/public/style/yui/fonts.css
|
44
|
-
- deploy/public/style/yui/grids.css
|
45
44
|
- deploy/public/style/yui/reset.css
|
46
45
|
- deploy/wiki
|
47
46
|
- dump/junebug_pages.yml
|
@@ -1,88 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
|
3
|
-
Code licensed under the BSD License:
|
4
|
-
http://developer.yahoo.net/yui/license.txt
|
5
|
-
version: 0.11.3
|
6
|
-
*/
|
7
|
-
body {
|
8
|
-
text-align:center;
|
9
|
-
}
|
10
|
-
|
11
|
-
#doc {
|
12
|
-
width:57.69em;
|
13
|
-
*width:56.3em; /* IE */
|
14
|
-
min-width:750px;
|
15
|
-
margin:auto;
|
16
|
-
text-align:left;
|
17
|
-
}
|
18
|
-
|
19
|
-
#hd,#bd {margin-bottom:1em;text-align:left;}
|
20
|
-
#ft {/*font-size:77%;font-family:verdana;*/clear:both;}
|
21
|
-
|
22
|
-
/* rules for main templates */
|
23
|
-
.yui-t1 #yui-main .yui-b, .yui-t2 #yui-main .yui-b, .yui-t3 #yui-main .yui-b,
|
24
|
-
.yui-t4 .yui-b, .yui-t5 .yui-b, .yui-t6 .yui-b {float:right;}
|
25
|
-
.yui-t1 .yui-b, .yui-t2 .yui-b, .yui-t3 .yui-b, .yui-t4 #yui-main .yui-b, .yui-
|
26
|
-
t5 #yui-main .yui-b, .yui-t6 #yui-main .yui-b {float:left;}
|
27
|
-
|
28
|
-
/* t1: L160 */
|
29
|
-
.yui-t1 #yui-main .yui-b {width:76%;min-width:570px;}
|
30
|
-
.yui-t1 .yui-b {width:21.33%;min-width:160px;}
|
31
|
-
|
32
|
-
/* t2 & t4: L180 & R180 */
|
33
|
-
.yui-t2 #yui-main .yui-b, .yui-t4 #yui-main .yui-b {width:73.4%;min-
|
34
|
-
width:550px;}
|
35
|
-
.yui-t2 .yui-b, .yui-t4 .yui-b {width:24%;min-width:180px;}
|
36
|
-
|
37
|
-
/* t3 & t6: L300 & R300 */
|
38
|
-
.yui-t3 #yui-main .yui-b, .yui-t6 #yui-main .yui-b {width:57.6%;min-
|
39
|
-
width:430px;}
|
40
|
-
.yui-t3 .yui-b, .yui-t6 .yui-b {width:40%;min-width:300px;}
|
41
|
-
|
42
|
-
/* t5: R240 */
|
43
|
-
.yui-t5 #yui-main .yui-b {width:65.4%;min-width:490px;}
|
44
|
-
.yui-t5 .yui-b {width:32%;min-width:240px;}
|
45
|
-
|
46
|
-
/* t7: 750 */
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
/* grid-generic rules for all templates */
|
51
|
-
|
52
|
-
/* all modules and grids nested in a grid get floated */
|
53
|
-
.yui-g .yui-u, .yui-g .yui-g, .yui-ge .yui-u, .yui-gf .yui-u {
|
54
|
-
float:right;
|
55
|
-
display:inline; /* IE */
|
56
|
-
}
|
57
|
-
|
58
|
-
/* float left and kill margin on first for added flex */
|
59
|
-
.yui-g .first, .yui-gd .first, .yui-ge .first, .yui-gf .first {float:left; }
|
60
|
-
|
61
|
-
/* 2 col */
|
62
|
-
.yui-g .yui-u, .yui-g .yui-g {width:49.1%;}
|
63
|
-
.yui-g .yui-g .yui-u {width:48.1%;} /* smaller for nested to preserve margins */
|
64
|
-
|
65
|
-
/* 3 col */
|
66
|
-
.yui-gb .yui-u, .yui-gc .yui-u, .yui-gd .yui-u {
|
67
|
-
float:left; /* need to reverse the order for 3 */
|
68
|
-
margin-left:2%; *margin-left:1.895%;
|
69
|
-
width:32%;
|
70
|
-
}
|
71
|
-
|
72
|
-
.yui-gb .first, .yui-gc .first, .yui-gd .first {margin-left:0;}
|
73
|
-
|
74
|
-
/* colspan 2 */
|
75
|
-
.yui-gc .first, .yui-gd .yui-u {width:66%;}
|
76
|
-
.yui-gd .first {width:32%;}
|
77
|
-
|
78
|
-
/* colspan 3 */
|
79
|
-
.yui-ge .yui-u {width:24%;}
|
80
|
-
.yui-ge .first, .yui-gf .yui-u {width:74.2%;}
|
81
|
-
.yui-gf .first {width:24%;}
|
82
|
-
.yui-ge .first {width:74.2%;}
|
83
|
-
|
84
|
-
/* self clear floated parent containers */
|
85
|
-
#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-
|
86
|
-
ge:after, .yui-gf:after
|
87
|
-
{content:".";display:block;height:0;clear:both;visibility:hidden;}
|
88
|
-
#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf {zoom:1;} /* IE */
|