From: Steve Coast Date: Sat, 7 Apr 2007 19:50:55 +0000 (+0000) Subject: diary / user bits X-Git-Tag: live~9134 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/f9baf5f392370318966c9392e3badbbd715592ad diary / user bits --- diff --git a/app/controllers/diary_entry_controller.rb b/app/controllers/diary_entry_controller.rb new file mode 100644 index 000000000..7c77fc177 --- /dev/null +++ b/app/controllers/diary_entry_controller.rb @@ -0,0 +1,2 @@ +class DiaryEntryController < ApplicationController +end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d79041b4f..9fd20f2ff 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -2,7 +2,7 @@ class UserController < ApplicationController layout 'site' before_filter :authorize, :only => [:preferences, :api_details, :api_gpx_files] - before_filter :authorize_web, :only => [:edit, :account, :go_public] + before_filter :authorize_web, :only => [:edit, :account, :go_public, :view] before_filter :require_user, :only => [:edit, :account, :go_public] def save diff --git a/app/helpers/diary_entry_helper.rb b/app/helpers/diary_entry_helper.rb new file mode 100644 index 000000000..bf6af03da --- /dev/null +++ b/app/helpers/diary_entry_helper.rb @@ -0,0 +1,2 @@ +module DiaryEntryHelper +end diff --git a/app/models/diary_entry.rb b/app/models/diary_entry.rb new file mode 100644 index 000000000..2da92d400 --- /dev/null +++ b/app/models/diary_entry.rb @@ -0,0 +1,2 @@ +class DiaryEntry < ActiveRecord::Base +end diff --git a/app/views/layouts/site.rhtml b/app/views/layouts/site.rhtml index c7670e795..f2cc5b4fe 100644 --- a/app/views/layouts/site.rhtml +++ b/app/views/layouts/site.rhtml @@ -24,8 +24,7 @@ <% if @user %> - Welcome, <%= @user.display_name %> | - <%= link_to 'account', {:controller => 'user', :action => 'account'}, {:id => 'loginanchor'}%> | + Welcome, <%= link_to @user.display_name, {:controller => 'user', :action => 'view', :display_name => @user.display_name}, {:id => 'loginanchor'}%> | <%= link_to 'logout', {:controller => 'user', :action => 'logout'}, {:id => 'loginanchor'}%> <% else %> <%= link_to 'log in', {:controller => 'user', :action => 'login'}, {:id => 'loginanchor'}%> | diff --git a/app/views/user/account.rhtml b/app/views/user/account.rhtml index 81f72fe04..f8047d3d8 100644 --- a/app/views/user/account.rhtml +++ b/app/views/user/account.rhtml @@ -4,7 +4,7 @@ email<%= @user.email %> display name<%= @user.display_name %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>) account created<%= @user.creation_time %> (<%= time_ago_in_words(@user.creation_time) %> ago) - description<%= @user.description %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>) + description<%= simple_format(@user.description) %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>)

Privacy

diff --git a/app/views/user/edit.rhtml b/app/views/user/edit.rhtml index 5e9db6f29..6c30ef0b3 100644 --- a/app/views/user/edit.rhtml +++ b/app/views/user/edit.rhtml @@ -1,7 +1,9 @@ -

Display name:

- +

Edit details:

<%= error_messages_for 'user' %> -<%= start_form_tag :controller => 'user', :action => 'rename' %> -<%= text_field :user, :display_name, :value => @user.display_name %> +<%= start_form_tag :controller => 'user', :action => 'edit', :display_name => @user.display_name %> + + + +
display name<%= text_field :user, :display_name, :value => @user.display_name %>
description<%= text_area :user, :description, :value => @user.description %>
<%= submit_tag 'Change' %> <%= end_form_tag %> diff --git a/config/routes.rb b/config/routes.rb index 039eea09f..8bfc36388 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,7 +33,6 @@ ActionController::Routing::Routes.draw do |map| map.connect '/search.html', :controller => 'way_tag', :action => 'search' map.connect '/login.html', :controller => 'user', :action => 'login' map.connect '/logout.html', :controller => 'user', :action => 'logout' - map.connect '/account', :controller => 'user', :action => 'account' map.connect '/create-account.html', :controller => 'user', :action => 'new' map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password' @@ -57,6 +56,8 @@ ActionController::Routing::Routes.draw do |map| map.connect '/user/:display_name', :controller => 'user', :action => 'view' map.connect '/user/:display_name/diary', :controller => 'diary', :action => 'view' + map.connect '/user/:display_name/edit', :controller => 'user', :action => 'edit' + map.connect '/user/:display_name/account', :controller => 'user', :action => 'account' # test pages map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate' diff --git a/db/migrate.sql b/db/migrate.sql index f6d2fc408..6f7266cef 100644 --- a/db/migrate.sql +++ b/db/migrate.sql @@ -35,3 +35,4 @@ alter table users add data_public boolean default false; alter table gpx_files drop column tmpname; alter table users add column description text not null; +create table diary_entries(id bigint not null auto_increment, user_id bigint not null, title varchar(255), body text, primary key(id)); diff --git a/db/migrate/017_create_diary_entries.rb b/db/migrate/017_create_diary_entries.rb new file mode 100644 index 000000000..e81044d0f --- /dev/null +++ b/db/migrate/017_create_diary_entries.rb @@ -0,0 +1,10 @@ +class CreateDiaryEntries < ActiveRecord::Migration + def self.up + create_table :diary_entries do |t| + end + end + + def self.down + drop_table :diary_entries + end +end