From e50389788b81deab2f821b569aa5dbec48b61956 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 12 Feb 2006 15:18:21 +0000 Subject: [PATCH] Moved settings for Tracks from the file settings.yml to the database. Running 'rake migrate' will update your database appropriately, and add the default settings into it. Then you should be able to visit http://0.0.0.0:3000/user/preferences to view and edit your settings. The advantage is that you don't need to mess about with the settings.yml file, and each of the users can have their own settings. I'm intending this to be the last big change before releasing 1.04. Can people with access to the trunk through subversion check out this changeset and report any bugs? git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@182 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/README_FIRST.txt | 9 ++--- tracks/app/controllers/application.rb | 17 ++++----- tracks/app/controllers/context_controller.rb | 2 +- tracks/app/controllers/login_controller.rb | 3 ++ tracks/app/controllers/project_controller.rb | 2 +- tracks/app/controllers/todo_controller.rb | 6 ++-- tracks/app/controllers/user_controller.rb | 31 +++++++++++++++- tracks/app/helpers/application_helper.rb | 3 +- tracks/app/helpers/todo_helper.rb | 15 ++++---- tracks/app/models/user.rb | 5 ++- tracks/app/views/layouts/standard.rhtml | 3 +- .../app/views/user/preference_edit_form.rhtml | 29 +++++++++++++++ tracks/app/views/user/preferences.rhtml | 15 ++++++++ tracks/config/environment.rb | 6 +--- tracks/config/settings.yml.tmpl | 17 --------- .../006_add_preferences_to_user_table.rb | 14 ++++++++ tracks/db/schema.rb | 35 ++++++++++--------- tracks/doc/CHANGELOG | 5 +-- tracks/doc/README_FOR_APP | 13 ++++--- tracks/lib/tasks/setup_tracks.rake | 16 +-------- tracks/public/stylesheets/standard.css | 12 ++++++- 21 files changed, 164 insertions(+), 94 deletions(-) create mode 100644 tracks/app/views/user/preference_edit_form.rhtml create mode 100644 tracks/app/views/user/preferences.rhtml delete mode 100644 tracks/config/settings.yml.tmpl create mode 100644 tracks/db/migrate/006_add_preferences_to_user_table.rb diff --git a/tracks/README_FIRST.txt b/tracks/README_FIRST.txt index 291b2e22..5548c539 100644 --- a/tracks/README_FIRST.txt +++ b/tracks/README_FIRST.txt @@ -1,13 +1,8 @@ -The main README file is in tracks/doc/README_FOR_APP, and the change log in tracks/doc/CHANGELOG. If you downloaded this application as a *.zip file, then there is documentation for the app in tracks/doc/app. If you open the index.html file in a browser, you can view the documentation for the methods, as well as viewing README_FOR_APP and CHANGELOG in more attractive format. If you checked out the application with Subversion, you need to generate the documentation. Navigate inside the tracks directory in a terminal, then issue the following command: - rake appdoc - -This will generate the documentation as above in tracks/doc/app. - -Database schemas for MySQL, PostgreSQL and SQLite are available in tracks/db, along with some example contents in tracks_1.031_content.sql. +The main README file is in tracks/doc/README_FOR_APP, and the change log in tracks/doc/CHANGELOG. ** IMPORTANT ** -Before you do anything else, you need to copy certain files and rename the copy: +Before you do anything else, you need to copy the following file and rename the copy: tracks/config/database.yml.tmpl -> tracks/config/database.yml diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index 6d40b8f7..8b248da1 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -11,15 +11,10 @@ class ApplicationController < ActionController::Base include LoginSystem before_filter :set_session_expiration + before_filter :get_current_user - # Contstants from settings.yml - # - DATE_FORMAT = app_configurations["formats"]["date"] - WEEK_STARTS_ON = app_configurations["formats"]["week_starts"] - NO_OF_ACTIONS = app_configurations["formats"]["hp_completed"] - STALENESS_STARTS = app_configurations["formats"]["staleness_starts"] - - # Count the number of uncompleted actions, excluding those in hidden contexts + # Count the number of uncompleted actions, excluding those + # in hidden contexts # def count_shown_items(hidden) count = 0 @@ -57,4 +52,10 @@ class ApplicationController < ActionController::Base end end + private + + def get_current_user + @user = @session['user'] + end + end diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index c8a9cf8f..b040da3c 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -52,7 +52,7 @@ class ContextController < ApplicationController @item.attributes = @params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], DATE_FORMAT) + @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index 98496635..d22c84f1 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -53,6 +53,9 @@ class LoginController < ApplicationController user.is_admin = 1 if User.find_all.empty? if user.save @session['user'] = User.authenticate(user.login, @params['user']['password']) + @user = @session['user'] + @user.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk", "loginhash" => "change-me"} + @user.save flash['notice'] = "Signup successful" redirect_back_or_default :controller => "todo", :action => "list" end diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 12aaeb58..bd08a906 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -71,7 +71,7 @@ class ProjectController < ApplicationController @item.attributes = @params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], DATE_FORMAT) + @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 29441d34..8e7269c0 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -23,7 +23,7 @@ class TodoController < ApplicationController self.init @on_page = "home" @page_title = "TRACKS::List tasks" - @done = @done[0..(NO_OF_ACTIONS-1)] + @done = @done[0..(@user.preferences["no_completed"].to_i-1)] @contexts_to_show = @contexts.clone @contexts_to_show = @contexts_to_show.collect {|x| (!x.hide? and !x.find_not_done_todos.empty?) ? x:nil }.compact @@ -44,7 +44,7 @@ class TodoController < ApplicationController @item.attributes = @params["todo"] if @item.due? - @item.due = Date.strptime(@params["todo"]["due"], DATE_FORMAT) + @item.due = Date.strptime(@params["todo"]["due"], @user.preferences["date_format"]) else @item.due = "" end @@ -115,7 +115,7 @@ class TodoController < ApplicationController item.attributes = @params["item"] if item.due? - item.due = Date.strptime(@params["item"]["due"], DATE_FORMAT) + item.due = Date.strptime(@params["item"]["due"], @user.preferences["date_format"]) else item.due = "" end diff --git a/tracks/app/controllers/user_controller.rb b/tracks/app/controllers/user_controller.rb index 4e3e1812..fd05e2b0 100644 --- a/tracks/app/controllers/user_controller.rb +++ b/tracks/app/controllers/user_controller.rb @@ -1,5 +1,5 @@ class UserController < ApplicationController - scaffold :user + layout 'standard' def index render_text "This will be our jumping-off point for managing user functions!" @@ -8,4 +8,33 @@ class UserController < ApplicationController def admin render_text "You'll only be allowed to go here if you're an administrator." end + + def preferences + @page_title = "TRACKS::Preferences" + @prefs = @user.preferences + end + + def edit_preferences + @page_title = "TRACKS::Edit Preferences" + @prefs = @user.preferences + + render :action => "preference_edit_form", :object => @prefs + end + + def update_preferences + @user.preferences = { "date_format" => "#{@params['prefs']['date_format']}", + "week_starts" => "#{@params['prefs']['week_starts']}", + "no_completed" => "#{@params['prefs']['no_completed']}", + "staleness_starts" => "#{@params['prefs']['staleness_starts']}", + "due_style" => "#{@params['prefs']['due_style']}", + "admin_email" => "#{@params['prefs']['admin_email']}", + "loginhash" => "#{@params['prefs']['loginhash']}" + } + if @user.save + redirect_to :action => 'preferences' + else + render :action => 'edit_preferences' + end + end + end \ No newline at end of file diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index fd19812e..3f5822b9 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -6,7 +6,8 @@ module ApplicationHelper # def format_date(date) if date - formatted_date = date.strftime("#{ApplicationController::DATE_FORMAT}") + date_format = @user.preferences["date_format"] + formatted_date = date.strftime("#{date_format}") else formatted_date = '' end diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index 7eb1914c..4dc72976 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -1,5 +1,6 @@ module TodoHelper + require 'user_controller' # Counts the number of uncompleted items in the specified context # def count_items(context) @@ -46,11 +47,11 @@ module TodoHelper def staleness_class(item) if item.due || item.done? return "" - elsif item.created_at < (ApplicationController::STALENESS_STARTS*3).days.ago + elsif item.created_at < (@user.preferences["staleness_starts"].to_i*3).days.ago return " stale_l3" - elsif item.created_at < (ApplicationController::STALENESS_STARTS*2).days.ago + elsif item.created_at < (@user.preferences["staleness_starts"].to_i*2).days.ago return " stale_l2" - elsif item.created_at < (ApplicationController::STALENESS_STARTS).days.ago + elsif item.created_at < (@user.preferences["staleness_starts"].to_i).days.ago return " stale_l1" else return "" @@ -78,7 +79,7 @@ module TodoHelper "Due Tomorrow " # due 2-7 days away when 2..7 - if app_configurations["formats"]["due_style"] == 1 + if @user.preferences["due_style"] == "1" "Due on " + due.strftime("%A") + " " else "Due in " + @days.to_s + " days " @@ -101,8 +102,10 @@ module TodoHelper end def calendar_setup( input_field ) - str = "Calendar.setup({ ifFormat:\"#{ApplicationController::DATE_FORMAT}\"" - str << ",firstDay:#{ApplicationController::WEEK_STARTS_ON},showOthers:true,range:[2004, 2010]" + date_format = @user.preferences["date_format"] + week_starts = @user.preferences["week_starts"] + str = "Calendar.setup({ ifFormat:\"#{date_format}\"" + str << ",firstDay:#{week_starts},showOthers:true,range:[2004, 2010]" str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })" javascript_tag str end diff --git a/tracks/app/models/user.rb b/tracks/app/models/user.rb index 6862c901..900b4d9e 100644 --- a/tracks/app/models/user.rb +++ b/tracks/app/models/user.rb @@ -6,6 +6,8 @@ class User < ActiveRecord::Base has_many :projects, :order => "position ASC" has_many :todos, :order => "completed DESC" has_many :notes, :order => "created_at DESC" + + serialize :preferences attr_protected :is_admin @@ -20,7 +22,7 @@ class User < ActiveRecord::Base protected def self.sha1(pass) - Digest::SHA1.hexdigest("#{app_configurations["admin"]["loginhash"]}--#{pass}--") + Digest::SHA1.hexdigest("change-me--#{pass}--") end before_create :crypt_password @@ -35,4 +37,5 @@ protected validates_presence_of :password, :login, :word validates_uniqueness_of :login, :on => :create validates_confirmation_of :password, :on => :create + end diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index ffa17e38..13ce47e8 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -30,8 +30,9 @@
  • <%= link_to( "Home", {:controller => "todo", :action => "list"}, {:accesskey=>"t", :title=>"Home"} ) %>
  • <%= link_to( "Contexts", {:controller => "context", :action => "list"}, {:accesskey=>"c", :title=>"Contexts"} ) %>
  • <%= link_to( "Projects", {:controller => "project", :action => "list"}, {:accesskey=>"p", :title=>"Projects"} ) %>
  • -
  • <%= link_to( "Completed", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %>
  • +
  • <%= link_to( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %>
  • <%= link_to( "Notes", {:controller => "note", :action => "index"}, :title => "Show all notes" ) %>
  • +
  • <%= link_to( "Preferences", {:controller => "user", :action => "preferences"}, :title => "Show my preferences" ) %>
  • Show
  • Hide
  • <%= link_to(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "feed", :action => "na_feed", :name => "#{@session['user']['login']}", :token => "#{@session['user']['word']}"}, :title => "Subscribe to an RSS feed of your next actions" ) %>
  • diff --git a/tracks/app/views/user/preference_edit_form.rhtml b/tracks/app/views/user/preference_edit_form.rhtml new file mode 100644 index 00000000..2bd323c8 --- /dev/null +++ b/tracks/app/views/user/preference_edit_form.rhtml @@ -0,0 +1,29 @@ +
    +

    Help on preferences

    +

    The preference settings should mostly be self-explanatory, but some hints are included below:

    + +
    + +
    + <%= start_form_tag :action => 'update_preferences' %> + + <% @prefs.each do |k,v| %> + + + + + <% end %> + + + +
    <%= submit_tag "Update" %><%= link_to "Cancel", :controller => 'user', :action => 'preferences' %>
    + <%= end_form_tag %> +
    \ No newline at end of file diff --git a/tracks/app/views/user/preferences.rhtml b/tracks/app/views/user/preferences.rhtml new file mode 100644 index 00000000..642424fc --- /dev/null +++ b/tracks/app/views/user/preferences.rhtml @@ -0,0 +1,15 @@ +
    + +

    Your preferences

    + + +<%= link_to "Edit preferences", :controller => 'user', :action => 'edit_preferences' %> +
    diff --git a/tracks/config/environment.rb b/tracks/config/environment.rb index 292916d5..a33d732f 100644 --- a/tracks/config/environment.rb +++ b/tracks/config/environment.rb @@ -48,8 +48,4 @@ end # inflect.uncountable %w( fish sheep ) # end -# Include your application configuration below -def app_configurations - @app_cfg = nil if ENV['RAILS_ENV'] == 'development' - @app_cfg ||= YAML::load(File.open("#{RAILS_ROOT}/config/settings.yml")) -end \ No newline at end of file +# Include your application configuration below \ No newline at end of file diff --git a/tracks/config/settings.yml.tmpl b/tracks/config/settings.yml.tmpl deleted file mode 100644 index 0c24af42..00000000 --- a/tracks/config/settings.yml.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -# It's very important not to use TAB characters in this file -# Use two spaces instead of a TAB -# week_starts is the day you want the calendar to display first (0=Sunday, 1=Monday etc.) -# hp_completed is the number of completed items you want displayed on the home page -# staleness_starts is the number of days before actions start to go yellow with age! -# due_style 0 is "due in N days" for N=2..7 -# due_style 1 is "due on weekdayname" for N=2..7 -# -formats: - date: %d/%m/%Y - week_starts: 1 - hp_completed: 5 - staleness_starts: 7 - due_style: 0 -admin: - email: butshesagirl@rousette.org.uk - loginhash: change-me diff --git a/tracks/db/migrate/006_add_preferences_to_user_table.rb b/tracks/db/migrate/006_add_preferences_to_user_table.rb new file mode 100644 index 00000000..8f9ad2d7 --- /dev/null +++ b/tracks/db/migrate/006_add_preferences_to_user_table.rb @@ -0,0 +1,14 @@ +class AddPreferencesToUserTable < ActiveRecord::Migration + def self.up + add_column "users", "preferences", :text + @users = User.find(:all) + @users.each do |u| + u.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk", "loginhash" => "change-me"} + u.save + end + end + + def self.down + remove_column "users", "preferences" + end +end diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index 205d7eb1..6da455ae 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -2,18 +2,18 @@ # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. -ActiveRecord::Schema.define(:version => 5) do +ActiveRecord::Schema.define(:version => 6) do create_table "contexts", :force => true do |t| t.column "name", :string, :default => "", :null => false + t.column "position", :integer, :default => 0, :null => false t.column "hide", :boolean, :default => false - t.column "position", :integer, :null => false - t.column "user_id", :integer, :default => 1 + t.column "user_id", :integer, :default => 0, :null => false end 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 @@ -21,29 +21,30 @@ ActiveRecord::Schema.define(:version => 5) do create_table "projects", :force => true do |t| t.column "name", :string, :default => "", :null => false - t.column "position", :integer, :null => false + t.column "position", :integer, :default => 0, :null => false t.column "done", :boolean, :default => false - t.column "user_id", :integer, :default => 1 - t.column "description", :text, :default => "" + t.column "user_id", :integer, :default => 0, :null => false + t.column "description", :text end create_table "todos", :force => true do |t| - t.column "context_id", :integer, :limit => 11, :default => 0, :null => false - t.column "description", :string, :limit => 100, :default => "", :null => false + t.column "context_id", :integer, :default => 0, :null => false + t.column "project_id", :integer + t.column "description", :string, :default => "", :null => false t.column "notes", :text - t.column "done", :boolean, :default => false - t.column "created_at", :datetime, :null => false + t.column "done", :boolean, :default => false, :null => false + t.column "created_at", :datetime t.column "due", :date t.column "completed", :datetime - t.column "project_id", :integer, :limit => 11 - t.column "user_id", :integer, :default => 1 + t.column "user_id", :integer, :default => 0, :null => false end create_table "users", :force => true do |t| - t.column "login", :string, :limit => 80 - t.column "password", :string, :limit => 40 + t.column "login", :string, :limit => 80, :default => "", :null => false + t.column "password", :string, :limit => 40, :default => "", :null => false t.column "word", :string - t.column "is_admin", :boolean, :default => false + t.column "is_admin", :boolean, :default => false, :null => false + t.column "preferences", :text end end diff --git a/tracks/doc/CHANGELOG b/tracks/doc/CHANGELOG index ce0f93d8..0722eb84 100644 --- a/tracks/doc/CHANGELOG +++ b/tracks/doc/CHANGELOG @@ -3,7 +3,7 @@ * Homepage: http://www.rousette.org.uk/projects/ * Author: bsag (http://www.rousette.org.uk/) * Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP) -* Version: 1.03 +* Version: 1.04 * Copyright: (cc) 2004-2006 rousette.org.uk * License: GNU GPL @@ -13,7 +13,7 @@ Trac (for bug reports and feature requests): http://dev.rousette.org.uk/report/6 Wiki (deprecated - please use Trac): http://www.rousette.org.uk/projects/wiki/ -== Version 1.031 +== Version 1.04 1. Tidied up the interface a bit, fixing mistakes in the wording. 2. The number of actions reported is now correctly pluralized depending on the number of actions (e.g. 1 action, 2 actions). @@ -35,6 +35,7 @@ Wiki (deprecated - please use Trac): http://www.rousette.org.uk/projects/wiki/ 17. The next action count badge is now dynamically updated whenever you add or delete a next action, so that you don't have to refresh to see the count updated. 18. Validation errors are now reported in a status box (just above the new next action form). 19. There's a rake task (upgrade_sqlite_db) which allows you to safely upgrade databases created with version 1.03, afterwhich you can run rake migrate to complete the process. From there, rake migrate should work OK. +20. Moved settings for Tracks from the file settings.yml to the database. Running 'rake migrate' will update your database appropriately, and add the default settings into it. Then you should be able to visit http://0.0.0.0:3000/user/preferences to view and edit your settings. The advantage is that you don't need to mess about with the settings.yml file, and each of the users can have their own settings. == Version 1.03 diff --git a/tracks/doc/README_FOR_APP b/tracks/doc/README_FOR_APP index bbe5a52d..f598d933 100644 --- a/tracks/doc/README_FOR_APP +++ b/tracks/doc/README_FOR_APP @@ -3,7 +3,7 @@ * Homepage: http://www.rousette.org.uk/projects/ * Author: bsag (http://www.rousette.org.uk/) * Contributors: Nicholas Lee, Lolindrath, Jim Ray, Arnaud Limbourg, Timothy Martens, Luke Melia, John Leonard (for great installation tutorials on Windows XP) -* Version: 1.031 +* Version: 1.04 * Copyright: (cc) 2004-2006 rousette.org.uk * License: GNU GPL @@ -17,7 +17,7 @@ While fully usable for everyday use, Tracks is still a work in progress. Make su == Installation (for trunk version only) -Before you start, you need to make sure that you have Ruby 1.8.2 installed. Rails 1.0 and RedCloth are now included in the vendor directory of the distribution, so you don't need to install them yourself. You also need some kind of database. MySQL is probably the most popular, but it's also easy to use PostgreSQL or SQLite. If you have Mac OS X Tiger, you already have Ruby 1.8.2 and SQLite3 installed, so all you need to do after installing Rails and Redcloth is to install the sqlite3-ruby gem (1.1.0). See http://dev.rousette.org.uk/wiki/Tracks/Install for more details on installing all the necessary components on all the supported platforms. +Before you start, you need to make sure that you have Ruby 1.8.2 installed. Rails 1.0 and RedCloth are now included in the vendor directory of the distribution, so you don't need to install them yourself. You also need some kind of database. MySQL is probably the most popular, but it's also easy to use PostgreSQL or SQLite/SQLite3. If you have Mac OS X Tiger, you already have Ruby 1.8.2 and SQLite3 installed, so all you need to do after installing Rails and Redcloth is to install the sqlite3-ruby gem (1.1.0). See http://dev.rousette.org.uk/wiki/Tracks/Install for more details on installing all the necessary components on all the supported platforms. === New users @@ -36,18 +36,16 @@ In the following, I'm assuming that you're using MySQL and the built-in WEBrick * Copy the file config/database.yml.tmpl to config/database.yml. * Open the tracks/config/database.yml file, and enter your username and password details for the database you just set up. If you're running in production mode, you only really need to set up the entry under 'production'. NB: If you do set up the entry for 'test', make sure that you specify a different database, or when you run tests, they will overwrite your data. NB: It's very important that you don't use TABS in any of the .yml files. Just use spaces to indent. -* The file tracks/Rakefile contains various useful tasks you can run. The first one you need to run copies all the other files and directories with *.tmpl extensions and removes the extension: +* Run 'rake setup_tracks', which will copy all the files and directories with *.tmpl extensions and removes the extension. It ignores any files or directories that you've already converted, so it's safe to run it when you're upgrading: cd /PATHTO/TRACKS rake setup_tracks -* Run 'rake setup_tracks', which will copy all the files and directories with *.tmpl extensions and removes the extension. It ignores any files or directories that you've already converted, so it's safe to run it when you're upgrading: +* Run 'rake migrate', which will create the necessary tables in your database, including some required contents: cd /PATHTO/TRACKS rake migrate -* Check over the file config/settings.yml, and make sure that the settings are to your liking. -* If you'd also like some example data to play with, you can import it from tracks_1.04_content.sql (in tracks/db). You don't have to use the example data, but if you don't, you'll need to visit http://YOURURL/contexts first to add a few contexts before you add any next actions. Note that no users are provided in the content file, so you'll need to visit the signup page (http://YOURURL/signup) to create some users. * Check the shebang lines of the public/dispatch.* files and all the files in the script directory. They are set to #!/usr/bin/env ruby by default. This should work for all *nix based setups (Linux or Mac OS X), but Windows users will probably have to change it. Try this command at the command line, run inside the Tracks directory: ruby -i.bak -pe 'gsub!("#!/usr/bin/env ruby", "#!c:/ruby/bin/ruby")' public/dispatch.* script/* * Run the following command at your command line (Important: If you already have an application running on WEBrick (Tracks or anything else), make sure that you stop the server, or run Tracks on a different port using the --port option): @@ -55,6 +53,8 @@ In the following, I'm assuming that you're using MySQL and the built-in WEBrick ruby script/server -e production * In a browser, go to http://0.0.0.0:3000/signup. This will allow you to choose a username and password for the admin user. Thereafter, anyone else trying to access /signup will get a message that they are not allowed to sign up, and are given your email address to contact for permission. When you are logged in as the admin user, you can visit /signup to sign up additional users (who will not be able to view any of your next actions, contexts, projects or notes, but can set up their own separate tasks), and visit /login to login yourself. +* Add some contexts at http://0.0.0.0:3000/contexts and projects at http://0.0.0.0:3000/projects and then you're ready to add all your next actions. +* You can set various preferences by visiting http://0.0.0.0:3000/user/preferences. These are stored on a per-user basis in the database. * Have fun! ==== SQLite/SQLite3 @@ -70,7 +70,6 @@ Then cd into the db directory and run rake migrate. This should create the datab * For safety, rename your current Tracks directory to 'tracks-old' or something similar. * The 'rake migrate' script should be able to update your database tables with the contents in place, but it's very important to make a MySQL dump of both the contents and tables before you go any further. KEEP THIS BACKUP IN A SAFE PLACE IN CASE YOU HAVE TO REVERT TO IT. -* Make sure that you check settings.yml.tmpl for new info, and add any new fields to your settings.yml file. Some new settings have been added in the past couple of versions, and not having the correct settings is a common cause of errors. * Before you do anything else, BACK UP YOUR DATABASE (tables and content). Then make a separate export of the contents only (assuming that you want to move your data to the new version.) * Run 'rake setup_tracks', which will copy all the files and directories with *.tmpl extensions and removes the extension. It ignores any files or directories that you've already converted, so it's safe to run it when you're upgrading: diff --git a/tracks/lib/tasks/setup_tracks.rake b/tracks/lib/tasks/setup_tracks.rake index 8006ff88..0881dfb3 100644 --- a/tracks/lib/tasks/setup_tracks.rake +++ b/tracks/lib/tasks/setup_tracks.rake @@ -11,19 +11,5 @@ task :setup_tracks => :environment do puts f_only + " created" end end - # Check the config dir for template files - # We can't convert the database.yml.tmpl file, because database.yml needs - # to exist for rake to run tasks! - cd("config") do - FileList["settings.yml.tmpl"].each do |template_file| - f = File.basename(template_file) # with suffix - f_only = File.basename(template_file,".tmpl") # without suffix - if File.exists?(f_only) - puts f_only + " already exists" - else - cp(f, f_only) - puts f_only + " created" - end - end - end + end \ No newline at end of file diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index dbc8f702..964be252 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -340,6 +340,11 @@ a.footer_link:hover {color: #fff; background-color: #cc3334 !important;} padding: 5px; text-align: center; } + +.highlight { + background: #ffC; + padding: 2px; +} /* Backgrounds marking out 'staleness' of a task based on age of creation date The colour of the background gets progressively yellower with age */ @@ -439,6 +444,10 @@ div#list-projects, div#list-contexts { padding-bottom: 5px; } +.container form { + border: none; + } + div.project_description { background: #eee; padding: 5px; @@ -556,4 +565,5 @@ div.message { list-style: disc; } -ul.warning { list-style-type: circle; font-size: 1em; } \ No newline at end of file +ul.warning { list-style-type: circle; font-size: 1em; } +ul#prefs {list-style-type: disc; margin-left: 5px;} \ No newline at end of file