diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb
index 1224624d..5b160d58 100644
--- a/tracks/app/controllers/todos_controller.rb
+++ b/tracks/app/controllers/todos_controller.rb
@@ -402,7 +402,7 @@ class TodosController < ApplicationController
@todos, @page = @user.todos.paginate(:all,
:conditions => ['state = ?', 'active' ], :include => [:context],
:order => 'due IS NULL, due ASC, todos.created_at ASC',
- :page => params[:page], :per_page => 6)
+ :page => params[:page], :per_page => @prefs.mobile_todos_per_page)
@pagination_params = { :format => :m }
@pagination_params[:context_id] = @context.to_param if @context
@pagination_params[:project_id] = @project.to_param if @project
diff --git a/tracks/app/views/preferences/edit.rhtml b/tracks/app/views/preferences/edit.rhtml
index 8666a07c..7275de74 100644
--- a/tracks/app/views/preferences/edit.rhtml
+++ b/tracks/app/views/preferences/edit.rhtml
@@ -18,6 +18,7 @@
| <%= submit_tag "Update" %> |
<%= link_to "Cancel", :action => 'index' %> |
diff --git a/tracks/app/views/preferences/index.rhtml b/tracks/app/views/preferences/index.rhtml
index 76b415dd..4d7cb84a 100644
--- a/tracks/app/views/preferences/index.rhtml
+++ b/tracks/app/views/preferences/index.rhtml
@@ -27,6 +27,7 @@
<% end %>
Refresh interval (in minutes): <%= @prefs.refresh %>
Verbose action descriptors: <%= @prefs.verbose_action_descriptors %>
+ Actions per page (Mobile View): <%= @prefs.mobile_todos_per_page %>
<%= link_to "Edit preferences »", { :controller => 'preferences', :action => 'edit'}, :class => 'edit_link' %>
diff --git a/tracks/db/migrate/032_add_mobile_todos_per_page_preference.rb b/tracks/db/migrate/032_add_mobile_todos_per_page_preference.rb
new file mode 100644
index 00000000..976d67c9
--- /dev/null
+++ b/tracks/db/migrate/032_add_mobile_todos_per_page_preference.rb
@@ -0,0 +1,9 @@
+class AddMobileTodosPerPagePreference < ActiveRecord::Migration
+ def self.up
+ add_column :preferences, :mobile_todos_per_page, :integer, :null => false, :default => 6
+ end
+
+ def self.down
+ remove_column :preferences, :mobile_todos_per_page
+ end
+end
diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb
index 0afa6c2a..ef2b3d84 100644
--- a/tracks/db/schema.rb
+++ b/tracks/db/schema.rb
@@ -2,13 +2,13 @@
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.
-ActiveRecord::Schema.define(:version => 31) do
+ActiveRecord::Schema.define(:version => 32) do
create_table "contexts", :force => true do |t|
- t.column "name", :string, :default => "", :null => false
- t.column "position", :integer, :null => false
- t.column "hide", :boolean, :default => false
- t.column "user_id", :integer, :default => 1
+ t.column "name", :string, :default => "", :null => false
+ t.column "hide", :integer, :limit => 4, :default => 0, :null => false
+ t.column "position", :integer, :default => 0, :null => false
+ t.column "user_id", :integer, :default => 0, :null => false
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
@@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 31) do
add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name"
create_table "notes", :force => true do |t|
- t.column "user_id", :integer, :null => false
- t.column "project_id", :integer, :null => false
+ t.column "user_id", :integer, :default => 0, :null => false
+ t.column "project_id", :integer, :default => 0, :null => false
t.column "body", :text
t.column "created_at", :datetime
t.column "updated_at", :datetime
@@ -44,7 +44,7 @@ ActiveRecord::Schema.define(:version => 31) do
end
create_table "preferences", :force => true do |t|
- t.column "user_id", :integer, :null => false
+ t.column "user_id", :integer, :default => 0, :null => false
t.column "date_format", :string, :limit => 40, :default => "%d/%m/%Y", :null => false
t.column "week_starts", :integer, :default => 0, :null => false
t.column "show_number_completed", :integer, :default => 5, :null => false
@@ -59,14 +59,15 @@ ActiveRecord::Schema.define(:version => 31) do
t.column "time_zone", :string, :default => "London", :null => false
t.column "show_project_on_todo_done", :boolean, :default => false, :null => false
t.column "title_date_format", :string, :default => "%A, %d %B %Y", :null => false
+ t.column "mobile_todos_per_page", :integer, :default => 6, :null => false
end
add_index "preferences", ["user_id"], :name => "index_preferences_on_user_id"
create_table "projects", :force => true do |t|
t.column "name", :string, :default => "", :null => false
- t.column "position", :integer, :null => false
- t.column "user_id", :integer, :default => 1
+ t.column "position", :integer, :default => 0, :null => false
+ t.column "user_id", :integer, :default => 0, :null => false
t.column "description", :text
t.column "state", :string, :limit => 20, :default => "active", :null => false
t.column "created_at", :datetime
@@ -83,7 +84,7 @@ ActiveRecord::Schema.define(:version => 31) do
t.column "updated_at", :datetime
end
- add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
+ add_index "sessions", ["session_id"], :name => "sessions_session_id_index"
create_table "taggings", :force => true do |t|
t.column "taggable_id", :integer
@@ -103,16 +104,16 @@ ActiveRecord::Schema.define(:version => 31) do
add_index "tags", ["name"], :name => "index_tags_on_name"
create_table "todos", :force => true do |t|
- t.column "context_id", :integer, :null => false
- t.column "project_id", :integer
- t.column "description", :string, :default => "", :null => false
+ t.column "context_id", :integer, :default => 0, :null => false
+ t.column "description", :string, :limit => 100, :default => "", :null => false
t.column "notes", :text
t.column "created_at", :datetime
t.column "due", :date
t.column "completed_at", :datetime
- t.column "user_id", :integer, :default => 1
+ t.column "project_id", :integer
+ t.column "user_id", :integer, :default => 0, :null => false
t.column "show_from", :date
- t.column "state", :string, :limit => 20, :default => "immediate", :null => false
+ t.column "state", :string, :limit => 20, :default => "immediate", :null => false
end
add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state"
@@ -122,10 +123,10 @@ ActiveRecord::Schema.define(:version => 31) do
add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id"
create_table "users", :force => true do |t|
- t.column "login", :string, :limit => 80, :default => "", :null => false
- t.column "password", :string, :limit => 40, :default => "", :null => false
+ t.column "login", :string, :limit => 80
+ t.column "password", :string, :limit => 40
t.column "word", :string
- t.column "is_admin", :boolean, :default => false, :null => false
+ t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false
t.column "first_name", :string
t.column "last_name", :string
t.column "auth_type", :string, :default => "database", :null => false