diary / user bits
This commit is contained in:
parent
3aabf07e10
commit
f9baf5f392
10 changed files with 28 additions and 9 deletions
2
app/controllers/diary_entry_controller.rb
Normal file
2
app/controllers/diary_entry_controller.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
class DiaryEntryController < ApplicationController
|
||||
end
|
|
@ -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
|
||||
|
|
2
app/helpers/diary_entry_helper.rb
Normal file
2
app/helpers/diary_entry_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module DiaryEntryHelper
|
||||
end
|
2
app/models/diary_entry.rb
Normal file
2
app/models/diary_entry.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
class DiaryEntry < ActiveRecord::Base
|
||||
end
|
|
@ -24,8 +24,7 @@
|
|||
|
||||
<span id="greeting">
|
||||
<% 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'}%> |
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<tr><td>email</td><td><%= @user.email %></td></tr>
|
||||
<tr><td>display name</td><td><%= @user.display_name %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>)</td></tr>
|
||||
<tr><td>account created</td><td><%= @user.creation_time %> (<%= time_ago_in_words(@user.creation_time) %> ago)</td></tr>
|
||||
<tr><td>description</td><td><%= @user.description %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>)</td></tr>
|
||||
<tr><td valign="top">description</td><td><%= simple_format(@user.description) %> (<%= link_to 'change...', :controller => 'user', :action => 'edit' %>)</td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Privacy</h2>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<h2>Display name:</h2>
|
||||
|
||||
<h2>Edit details:</h2>
|
||||
<%= 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 %>
|
||||
<table>
|
||||
<tr><td>display name</td><td><%= text_field :user, :display_name, :value => @user.display_name %></td></tr>
|
||||
<tr><td valign="top">description</td><td><%= text_area :user, :description, :value => @user.description %></td></tr>
|
||||
</table>
|
||||
<%= submit_tag 'Change' %>
|
||||
<%= end_form_tag %>
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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));
|
||||
|
|
10
db/migrate/017_create_diary_entries.rb
Normal file
10
db/migrate/017_create_diary_entries.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue