junebug-wiki 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ = 0.0.31 2007-04-22
2
+
3
+ * User list and user history pages
4
+
1
5
  = 0.0.30 2007-04-21
2
6
 
3
7
  * Small style tweaks, make header smaller
@@ -133,6 +133,29 @@ module Junebug::Controllers
133
133
  end
134
134
  end
135
135
 
136
+ class Users < R '/all/users'
137
+ def get
138
+ @page_title = "Users"
139
+ #@users = User.find(:all, :order => 'username')
140
+ @users = User.find_by_sql("SELECT users.id, username, role, count(*) AS count FROM junebug_users AS users, junebug_page_versions AS versions WHERE users.id=versions.user_id GROUP BY users.id ORDER BY count DESC")
141
+ render :users
142
+ end
143
+ end
144
+
145
+ class Userinfo < R '/userinfo/(\w+)'
146
+ def get username
147
+ @page_title = "User info"
148
+ @user = User.find_by_username(username)
149
+ @versions = Page::Version.find(:all, :conditions => ["user_id = ?", @user.id], :order=>'updated_at desc')
150
+ @groups = Hash.new {|hash,key| hash[key] = []}
151
+ @versions.each { |p|
152
+ @groups[p.updated_at.strftime('%Y-%m-%d')].push(p)
153
+ }
154
+ render :userinfo
155
+ end
156
+ end
157
+
158
+
136
159
  class Recent < R '/all/recent'
137
160
  def get
138
161
  @page_title = "Recent Changes"
@@ -13,6 +13,7 @@ module Junebug::Models
13
13
  validates_format_of :password, :with => /^([\w]*)$/
14
14
  validates_length_of :password, :within=>5..30
15
15
  has_many :pages
16
+ has_many :page_versions, :class_name => 'Junebug::Models::Page::Version'
16
17
 
17
18
  def username=(text)
18
19
  write_attribute(:username, (text ? text.strip.downcase : text) )
@@ -53,6 +54,7 @@ module Junebug::Models
53
54
 
54
55
  class Page::Version < Base
55
56
  belongs_to :user, :class_name=>"Junebug::Models::User", :foreign_key=>'user_id' # Hack to prevent camping error on initial load
57
+ belongs_to :page, :class_name=>"Junebug::Models::Page", :foreign_key=>'page_id' # Hack to prevent camping error on initial load
56
58
  end
57
59
 
58
60
  class CreateJunebug < V 1.0
@@ -2,7 +2,7 @@ module Junebug #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 30
5
+ TINY = 31
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -106,7 +106,7 @@ module Junebug::Views
106
106
  li {
107
107
  a "version #{page.version}", :href => R(Show, @page.title_url, page.version)
108
108
  text " (#{diff_link(@page, page)}) " if page.version > 1
109
- text' - created '
109
+ text' - edited '
110
110
  text last_updated(page)
111
111
  text ' ago by '
112
112
  strong page.user.username
@@ -164,7 +164,48 @@ module Junebug::Views
164
164
  end
165
165
  _footer { '' }
166
166
  end
167
-
167
+
168
+ def users
169
+ _header :static
170
+ _body do
171
+ h1 "Users"
172
+ ul {
173
+ @users.each { |u|
174
+ li {
175
+ a u.username, :href => R(Userinfo, u.username)
176
+ text " - #{u.count} edits"
177
+ }
178
+ }
179
+ }
180
+ end
181
+ _footer { '' }
182
+ end
183
+
184
+ def userinfo
185
+ _header :static
186
+ _body do
187
+ h1 "Edit history: #{@user.username}"
188
+
189
+ @groups.keys.sort.reverse.each { |key|
190
+ @versions = @groups[key]
191
+ h2 key
192
+ ul {
193
+ @versions.each { |pv|
194
+ li{
195
+ a pv.page.title, :href => R(Show, pv.page.title_url)
196
+ text ", v#{pv.version}"
197
+ text " (#{diff_link(pv.page, pv)}) " if pv.version > 1
198
+ # text' - edited '
199
+ # text last_updated(pv)
200
+ # text ' ago'
201
+ }
202
+ }
203
+ }
204
+ }
205
+ end
206
+ _footer { '' }
207
+ end
208
+
168
209
  def list
169
210
  _header :static
170
211
  _body do
@@ -292,6 +333,10 @@ module Junebug::Views
292
333
  text ' | '
293
334
  a 'Pages', :href => R(List)
294
335
  text ' | '
336
+ a 'Users', :href => R(Users)
337
+ text ' | '
338
+ a 'Admin', :href => R(Orphans)
339
+ text ' | '
295
340
  a 'Help', :href => R(Show, "Junebug_help")
296
341
  end
297
342
 
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.30
7
- date: 2007-04-21 00:00:00 -07:00
6
+ version: 0.0.31
7
+ date: 2007-04-22 00:00:00 -07:00
8
8
  summary: Junebug is a minimalist ruby wiki running on Camping.
9
9
  require_paths:
10
10
  - lib