junebug-wiki 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ = 0.0.30 2007-04-21
2
+
3
+ * Small style tweaks, make header smaller
4
+ * Changed quicksave checkbox to 'minor update' button
5
+ * Fixed issue with creation of pages when first viewing them, before explicitly saving
6
+ * Orphans page (/all/orphans)
7
+ * Backlink bugfix
8
+
1
9
  = 0.0.29 2007-04-15
2
10
 
3
11
  * Support Unicode wikiwords. Thanks Julian Tarkhanov
@@ -74,11 +74,13 @@ body {
74
74
 
75
75
  #hd #search {
76
76
  float: right;
77
- margin-top: 5px;
77
+ /* margin-top: 5px;*/
78
+ margin-right: 10px;
78
79
  }
79
80
 
80
81
  #hd #search input {
81
- margin-bottom: 0px;
82
+ /* margin-bottom: 0px;*/
83
+ margin: 0px;
82
84
  }
83
85
 
84
86
  #hd a {
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.dirname(__FILE__) # for running in foreground in dev
2
2
  $KCODE = 'u'
3
3
  require 'rubygems'
4
- require_gem 'camping', '>=1.5'
4
+ gem 'camping', '>=1.5'
5
5
  require 'camping/session'
6
6
 
7
7
  Camping.goes :Junebug
@@ -27,9 +27,14 @@ module Junebug::Controllers
27
27
  def get page_name, version = nil
28
28
  redirect("/login?return_to=#{CGI::escape(@env['REQUEST_URI'])}") and return unless logged_in?
29
29
  page_name_spc = page_name.gsub(/_/,' ')
30
- @page = Page.find(:first, :conditions=>['title = ?', page_name_spc])
31
- @page = Page.create(:title => page_name_spc, :user_id=>@state.user.id) unless @page
32
- @page = @page.versions.find_by_version(version) unless version.nil? or version == @page.version.to_s
30
+ @page = Page.find_by_title(page_name_spc)
31
+ if @page.nil?
32
+ # new page
33
+ @page = Page.new(:title=>page_name_spc, :body=>'') unless @page
34
+ else
35
+ # check for version request
36
+ @page = @page.versions.find_by_version(version) unless version.nil? or version == @page.version.to_s
37
+ end
33
38
  @page_title = "Editing: #{page_name_spc}"
34
39
  render :edit
35
40
  end
@@ -39,19 +44,24 @@ module Junebug::Controllers
39
44
  redirect("/login?return_to=#{CGI::escape(@env['REQUEST_URI'])}") and return unless logged_in?
40
45
  page_name_spc = page_name.gsub(/_/,' ')
41
46
  if input.submit == 'save'
42
- if ! input.quicksave
43
- attrs = { :body => input.post_body, :title => input.post_title, :user_id =>@state.user.id }
44
- attrs[:readonly] = input.post_readonly if is_admin?
45
- Page.find_or_create_by_title(page_name_spc).update_attributes(attrs)
47
+ attrs = { :body => input.post_body, :title => input.post_title, :user_id =>@state.user.id }
48
+ attrs[:readonly] = input.post_readonly if is_admin?
49
+ @page = Page.find_by_title(page_name_spc)
50
+ if @page.nil?
51
+ # new page
52
+ @page = Page.create(attrs)
46
53
  else
47
- attrs = { :body => input.post_body }
48
- attrs[:readonly] = input.post_readonly if is_admin?
49
- page = Page.find_by_title(page_name_spc)
50
- current_version = page.find_version(page.version)
51
- current_version.update_attributes(attrs)
52
- page.without_revision { page.update_attributes(attrs) }
54
+ @page.update_attributes(attrs)
53
55
  end
54
56
  redirect Show, input.post_title.gsub(/ /,'_')
57
+ elsif input.submit == 'minor edit'
58
+ attrs = { :body => input.post_body }
59
+ attrs[:readonly] = input.post_readonly if is_admin?
60
+ page = Page.find_by_title(page_name_spc)
61
+ current_version = page.find_version(page.version)
62
+ current_version.update_attributes(attrs)
63
+ page.without_revision { page.update_attributes(attrs) }
64
+ redirect Show, input.post_title.gsub(/ /,'_')
55
65
  else # cancel
56
66
  redirect Show, page_name
57
67
  end
@@ -107,11 +117,22 @@ module Junebug::Controllers
107
117
  page_name_spc = page_name.gsub(/_/,' ')
108
118
  @page = Page.find_by_title(page_name_spc)
109
119
  @page_title = "Backlinks for: #{page_name_spc}"
110
- @pages = Page.find(:all, :conditions => ["body LIKE ?", "%#{page_name_spc}%"])
120
+ @pages = Page.find(:all, :conditions => ["body LIKE ? OR body LIKE ?", "%[[#{page_name_spc}]]%", "%[[#{page_name_spc}|%"])
111
121
  render :backlinks
112
122
  end
113
123
  end
114
124
 
125
+ class Orphans < R '/all/orphans'
126
+ def get
127
+ @page_title = "Orphan pages"
128
+ @pages = Page.find :all, :order => 'title'
129
+ @pages = @pages.reject do |page|
130
+ linked_pages = Page.find(:all, :conditions => ["body LIKE ? OR body LIKE ?", "%[[#{page.title}]]%", "%[[#{page.title}|%"]).length > 0
131
+ end
132
+ render :orphans
133
+ end
134
+ end
135
+
115
136
  class Recent < R '/all/recent'
116
137
  def get
117
138
  @page_title = "Recent Changes"
@@ -2,7 +2,7 @@ module Junebug #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 29
5
+ TINY = 30
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -34,7 +34,7 @@ module Junebug::Views
34
34
  br :clear=>'all'
35
35
  end
36
36
  _footer {
37
- text "Last edited by <b>#{@version.user.username}</b> on #{@page.updated_at.strftime('%B %d, %Y %I:%M %p')}"
37
+ text "Page last edited by <b>#{@version.user.username}</b> on #{@page.updated_at.strftime('%B %d, %Y %I:%M %p')}"
38
38
  text " (#{diff_link(@page, @version)}) " if @version.version > 1
39
39
  br
40
40
  text '<b>[readonly]</b> ' if @page.readonly
@@ -77,6 +77,9 @@ module Junebug::Views
77
77
  textarea @page.body, :name => 'post_body', :rows => 17, :cols => 80
78
78
  }
79
79
  input :type => 'submit', :name=>'submit', :value=>'cancel', :class=>'button', :style=>'float: right;'
80
+ if @page.user_id == @state.user.id
81
+ input :type => 'submit', :name=>'submit', :value=>'minor edit', :class=>'button', :style=>'float: right;', :accesskey => 'm'
82
+ end
80
83
  input :type => 'submit', :name=>'submit', :value=>'save', :class=>'button', :style=>'float: right;', :accesskey => 's'
81
84
  if is_admin?
82
85
  opts = { :type => 'checkbox', :value=>'1', :name => 'post_readonly' }
@@ -85,10 +88,6 @@ module Junebug::Views
85
88
  text " Readonly "
86
89
  br
87
90
  end
88
- if @page.user_id == @state.user.id
89
- input :type=>'checkbox', :value=>'1', :name=>'quicksave'
90
- text " Minor edit (don't increment version) "
91
- end
92
91
 
93
92
  end
94
93
  br :clear=>'all'
@@ -150,7 +149,22 @@ module Junebug::Views
150
149
  _footer { '' }
151
150
  end
152
151
 
153
-
152
+ def orphans
153
+ _header :show
154
+ _body do
155
+ h1 @page_title
156
+ ul {
157
+ @pages.each { |p|
158
+ li{
159
+ a p.title, :href => R(Show, p.title_url)
160
+ text ' - empty page' if p.body.nil? or p.body.empty?
161
+ }
162
+ }
163
+ }
164
+ end
165
+ _footer { '' }
166
+ end
167
+
154
168
  def list
155
169
  _header :static
156
170
  _body do
@@ -255,32 +269,32 @@ module Junebug::Views
255
269
 
256
270
  span :id=>'userlinks' do
257
271
  if logged_in?
258
- text "Welcome, #{@state.user.username} - "
272
+ text "Hi, #{@state.user.username} - "
259
273
  a 'sign out', :href=>"#{R(Logout)}?return_to=#{@env['REQUEST_URI']}"
260
274
  else
261
275
  a 'sign in', :href=> "#{R(Login)}?return_to=#{@env['REQUEST_URI']}"
262
276
  end
263
277
  end
264
-
278
+
279
+ span :id=>'search' do
280
+ # text 'Search: '
281
+ form :action => R(Search), :method => 'post' do
282
+ input :name => 'q', :type => 'text', :value=>(''), :accesskey => 's'
283
+ #input :type => 'submit', :name => 'search', :value => 'Search',
284
+ # :style=>'margin: 0 0 5px 5px;'
285
+ end
286
+ end
287
+
265
288
  span :id=>'navlinks' do
266
289
  a 'Home', :href => R(Show, Junebug.config['startpage'])
267
290
  text ' | '
268
- a 'Recent Changes', :href => R(Recent)
291
+ a 'Updates', :href => R(Recent)
269
292
  text ' | '
270
- a 'All Pages', :href => R(List)
293
+ a 'Pages', :href => R(List)
271
294
  text ' | '
272
295
  a 'Help', :href => R(Show, "Junebug_help")
273
296
  end
274
297
 
275
- span :id=>'search' do
276
- text 'Search: '
277
- form :action => R(Search), :method => 'post' do
278
- input :name => 'q', :type => 'text', :value=>(''), :accesskey => 's'
279
- #input :type => 'submit', :name => 'search', :value => 'Search',
280
- # :style=>'margin: 0 0 5px 5px;'
281
- end
282
- end
283
-
284
298
  br :clear => 'all'
285
299
 
286
300
  # if type == :static
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: junebug-wiki
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.29
7
- date: 2007-04-15 00:00:00 -07:00
6
+ version: 0.0.30
7
+ date: 2007-04-21 00:00:00 -07:00
8
8
  summary: Junebug is a minimalist ruby wiki running on Camping.
9
9
  require_paths:
10
10
  - lib