public
Description: A kind of map bugs tracker for OpenStreetMap
Clone URL: git://github.com/karouf/typocosmy.git
Added a my-mapbugs page
karouf (author)
Sun Jul 06 09:25:53 -0700 2008
commit  87a984c3f3ec749cfd4aeca0ac0e1874e12f2362
tree    58543f5b821c8464c8a13cbe9a566c6c6e21e8b6
parent  0fb8755f686f53290b1338a0ab156ea4c3385673
...
19
20
21
 
22
23
24
...
19
20
21
22
23
24
25
0
@@ -19,6 +19,7 @@ class ErrorsController < ApplicationController
0
    @error.location = Point.from_lon_lat(lon, lat)
0
   
0
    @error.author_ip = request.remote_ip
0
+ @error.user = current_user
0
   
0
    if @error.save
0
    @saved = true
...
1
2
3
 
 
 
4
5
6
...
22
23
24
 
 
 
 
25
...
1
2
 
3
4
5
6
7
8
...
24
25
26
27
28
29
30
31
0
@@ -1,6 +1,8 @@
0
 class UsersController < ApplicationController
0
   
0
- # render new.rhtml
0
+ before_filter :login_required, :only => :my_errors
0
+
0
+ # render new.rhtml
0
   def new
0
     @user = User.new
0
   end
0
@@ -22,4 +24,8 @@ class UsersController < ApplicationController
0
       render :action => 'new'
0
     end
0
   end
0
+
0
+ def my_errors
0
+ @errors = Error.find(:all, :conditions => "user_id = #{current_user.id}")
0
+ end
0
 end
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 class Error < ActiveRecord::Base
0
   belongs_to :feature
0
+ belongs_to :user
0
 
0
   Resolutions = {
0
   :add => "add",
...
1
2
3
 
4
5
6
...
1
 
 
2
3
4
5
0
@@ -1,6 +1,5 @@
0
 <% if logged_in? -%>
0
- <div id="user-bar-greeting"><%= "Logged in as ".t %><%= current_user.login #link_to_current_user :content_method => :login
0
- %></div>
0
+ <div id="user-bar-greeting"><%= "Logged in as ".t %><%= link_to current_user.login, my_mapbugs_path %></div>
0
   <div id="user-bar-action" >(<%= link_to "log out".t, logout_path, { :title => "Log out".t } %>)</div>
0
 <% else -%>
0
   <div id="user-bar-greeting"><%= "Not logged in".t #abbr_tag_with_IP 'Not logged in'.t, :style => 'border: none;'
...
15
16
17
 
18
 
19
20
21
...
15
16
17
18
19
20
21
22
23
0
@@ -15,7 +15,9 @@ ActionController::Routing::Routes.draw do |map|
0
   map.login '/:locale/login', :controller => 'sessions', :action => 'new'
0
   map.register '/:locale/register', :controller => 'users', :action => 'create'
0
   map.signup '/:locale/signup', :controller => 'users', :action => 'new'
0
+
0
   map.resources :users, :path_prefix => ':locale', :locale => /[a-zA-Z]{2}|/
0
+ map.my_mapbugs '/:locale/my-mapbugs', :controller => 'users', :action => 'my_errors'
0
   
0
   map.resource :session, :path_prefix => ':locale', :locale => /[a-zA-Z]{2}|/
0
   
...
20
21
22
 
23
24
25
...
20
21
22
23
24
25
26
0
@@ -20,6 +20,7 @@ ActiveRecord::Schema.define(:version => 2147483647) do
0
     t.column "comment", :text
0
     t.column "email", :string
0
     t.column "author_ip", :string
0
+ t.column "user_id", :integer
0
   end
0
 
0
   create_table "features", :force => true do |t|
...
65
66
67
68
 
69
70
71
...
65
66
67
 
68
69
70
71
0
@@ -65,7 +65,7 @@ module AuthenticatedSystem
0
       respond_to do |format|
0
         format.html do
0
           store_location
0
- redirect_to new_session_path
0
+ redirect_to login_path
0
         end
0
         # format.any doesn't work in rails version < http://dev.rubyonrails.org/changeset/8987
0
         # you may want to change format.any to e.g. format.any(:js, :xml)
...
32
33
34
35
 
36
37
38
39
 
 
 
 
 
40
41
42
...
32
33
34
 
35
36
37
38
39
40
41
42
43
44
45
46
47
0
@@ -32,11 +32,16 @@ body {
0
   margin-bottom: 0em;
0
 }
0
 
0
-#header a {
0
+#header h1 a {
0
   color: white;
0
   text-decoration: none;
0
 }
0
 
0
+#header a {
0
+ color: white;
0
+ text-decoration: underline;
0
+}
0
+
0
 #header p {
0
   font-family: Arial, sans-serif;
0
   font-size: 80%;

Comments

    No one has commented yet.