layout 'site'
before_filter :authorize, :only => :preferences
- before_filter :authorize_web, :only => :rename
-
-
+ before_filter :authorize_web, :only => [:rename, :account]
+ before_filter :require_user, :only => [:account, :display_name_edit]
+
def save
@user = User.new(params[:user])
@user.set_defaults
render :action => 'new'
end
end
-
+
def rename
- new_name = params['display_name']
- if @user
- @user.display_name = new_name
+ if params[:user] and params[:user][:display_name]
+ @user.display_name = params[:user][:display_name]
if @user.save
flash[:notice] = "User display name updated OK."
- else
- flash[:notice] = "Rename failed: #{ @user.errors.full_messages.join('; ') }."
+ redirect_to :controller => 'user', :action => 'account'
end
- else
- flash[:notice] = 'not logged in'
end
- redirect_to :back
end
def lost_password
<% end %>
<div id="content">
<% if flash[:notice] %>
- <div id="notice"><%= flash[:notice] %></div>
+ <div id="notice"><%= flash[:notice] %></div>
<% end %>
<%= yield %>
</div>
<span id="greeting">
- <% if @user %>
- Welcome, <%= @user.display_name %> |
- <%= link_to 'logout', {:controller => 'user', :action => 'logout'}, {:id => 'loginanchor'}%>
+ <% if @user %>
+ Welcome, <%= @user.display_name %> |
+ <%= link_to 'account', {:controller => 'user', :action => 'account'}, {:id => 'loginanchor'}%> |
+ <%= link_to 'logout', {:controller => 'user', :action => 'logout'}, {:id => 'loginanchor'}%>
<% else %>
- <%= link_to 'log in', {:controller => 'user', :action => 'login'}, {:id => 'loginanchor'}%> |
- <%= link_to 'sign up', {:controller => 'user', :action => 'new'}, {:id => 'registeranchor'} %>
+ <%= link_to 'log in', {:controller => 'user', :action => 'login'}, {:id => 'loginanchor'}%> |
+ <%= link_to 'sign up', {:controller => 'user', :action => 'new'}, {:id => 'registeranchor'} %>
<% end %>
</span>
<% end %>
<% end %>
</div>
- <% if @user %>
- <div class="optionalbox">
- <span class="oboxheader">User</span>
- <br />
- <br />
- <form action="/user/rename" method="get" style="margin: 0px">
- <span>Display name:</span><br />
- <input type="text" value="<%= @user.display_name %>" maxlength="255" size="8" name="display_name"/>
- <input type="submit" value="Save"/>
- <input type="hidden" value="<%= request.request_uri %>" name="redirect_url"/>
- </form>
- </div>
- <% end %>
<% end %>
--- /dev/null
+<h2>User details</h2>
+<table>
+ <tr><td>id</td><td><%= @user.id %></td></tr>
+ <tr><td>email</td><td><%= @user.email %></td></tr>
+ <tr><td>display name</td><td><%= @user.display_name %> (<%= link_to 'change...', :controller => 'user', :action => 'rename' %>)</td></tr>
+ <tr><td>account created</td><td><%= @user.creation_time %></td></tr>
+</table>
+
+<h2>Privacy</h2>
+
+<%= start_form_tag :controller => 'user', :action => 'public'%>
+<%= submit_tag 'Make all my edits public, forever' %>
+<%= end_form_tag %>
+
</table>
<br>
-<input type="submit" value="Login">
+<%= submit_tag 'Login' %>
<%= end_form_tag %> (<%= link_to 'Lost your password?', :controller => 'user', :action => 'lost_password' %>)
--- /dev/null
+<h2>Display name:</h2>
+
+<%= error_messages_for 'user' %>
+<%= start_form_tag :controller => 'user', :action => 'rename' %>
+<%= text_field :user, :display_name, :value => @user.display_name %>
+<%= submit_tag 'Change' %>
+<%= end_form_tag %>
+/* this script when run on the current db migrates it to rails */
+
drop table meta_nodes;
alter table current_nodes modify tags text not null;
alter table current_nodes modify id bigint(64) not null auto_increment;
alter table gpx_file_tags add id int(20) auto_increment not null, add primary key(id);
alter table users add preferences text;
-create index users_display_name_idx on users(display_name);
\ No newline at end of file
+create index users_display_name_idx on users(display_name);
+
+alter table users add public boolean default false;
+
}\r
\r
#notice {\r
- width: 400px;\r
- border: 1px solid black;\r
+ border: 1px solid green;\r
padding: 7px;\r
- background-color: #f0f0f0;\r
+ background-color: #f0fff0;\r
+ margin-bottom: 20px;\r
}\r
\r
#errorExplanation {\r