diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index fec00457..60208eef 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -6,23 +6,14 @@ require_dependency "redcloth" require_dependency "iCal" require 'date' -$delete_img = "" -$edit_img = "" -$notes_img = "" -$done_img = "" +$delete_img = "" +$edit_img = "" +$notes_img = "" +$done_img = "" class ApplicationController < ActionController::Base helper :application include LoginSystem - - - # Convert a date entered in the format in settings.yml - # to database-compatible YYYY-MM-DD format - def date_to_YMD(date) - date_fmt = app_configurations["formats"]["date"] - formatted_date = DateTime.strptime(date, "#{date_fmt}") - formatted_date.strftime("%Y-%m-%d") - end - + end \ No newline at end of file diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 56e6cc0d..e8e0bd91 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -3,7 +3,6 @@ class ContextController < ApplicationController helper :context model :project - scaffold :context before_filter :login_required # caches_action :list, :show @@ -36,6 +35,25 @@ class ContextController < ApplicationController end + def edit + @context = Context.find(@params['id']) + @page_title = "Edit context: #{@context.name.capitalize}" + end + + + def update + @context = Context.find(@params['context']['id']) + @context.attributes = @params['context'] + if @context.save + flash["confirmation"] = 'Context was successfully updated' + redirect_to :action => 'list' + else + flash["warning"] = 'Context could not be updated' + redirect_to :action => 'list' + end + end + + # Filter the contexts to show just the one passed in the URL # e.g. /context/show/ shows just . # diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index b38911e3..74706851 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -3,7 +3,6 @@ class ProjectController < ApplicationController helper :project model :context model :todo - scaffold :project before_filter :login_required # caches_action :list, :show @@ -30,6 +29,25 @@ class ProjectController < ApplicationController end + def edit + @project = Project.find(@params['id']) + @page_title = "Edit project: #{@project.name.capitalize}" + end + + + def update + @project = Project.find(@params['project']['id']) + @project.attributes = @params['project'] + if @project.save + flash["confirmation"] = 'Project was successfully updated' + redirect_to :action => 'list' + else + flash["warning"] = 'Project could not be updated' + redirect_to :action => 'list' + end + end + + # Called by a form button # Parameters from form fields should be passed to create new project # diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index b350c528..f51db968 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -48,15 +48,4 @@ module ApplicationHelper end end - def get_projects() - @projects = Project.find_all - return @@projects - end - - def get_contexts() - @places = Context.find_all - return @@places - end - - end diff --git a/tracks/app/models/todo.rb b/tracks/app/models/todo.rb index 2ce2f6f8..b9c1721b 100644 --- a/tracks/app/models/todo.rb +++ b/tracks/app/models/todo.rb @@ -8,14 +8,12 @@ class Todo < ActiveRecord::Base validates_presence_of :description, :message => "no description provided" validates_length_of :description, :maximum => 100, :message => "description is too long" validates_length_of :notes, :maximum => 60000, :message => "notes are too long" - #validates_format_of :due, :with => /^[\d]{2,2}\/[\d]{2,2}\/[\d]{4,4}$/, :message => "date format incorrect" - + # Add a creation date (Ruby object format) to item before it's saved + # if there is no existing creation date (this prevents creation date + # being reset to completion date when item is completed) + # def before_save - # Add a creation date (Ruby object format) to item before it's saved - # if there is no existing creation date (this prevents creation date - # being reset to completion date when item is completed) - # if self.created == nil self.created = Time.now() end diff --git a/tracks/app/views/context/_edit_context.rhtml b/tracks/app/views/context/_edit_context.rhtml new file mode 100644 index 00000000..4c96fbe6 --- /dev/null +++ b/tracks/app/views/context/_edit_context.rhtml @@ -0,0 +1,8 @@ +<%= hidden_field( "context", "id" ) %> +
+<%= text_field( "context", "name" ) %> +
+ +<%= check_box( "context", "hide" ) %> +
+
\ No newline at end of file diff --git a/tracks/app/views/context/edit.rhtml b/tracks/app/views/context/edit.rhtml new file mode 100644 index 00000000..9d47fefb --- /dev/null +++ b/tracks/app/views/context/edit.rhtml @@ -0,0 +1,12 @@ +
+

Edit context

+
+ <%= render_partial "edit_context", "@context" %> + +
+ + <%= link_to 'Cancel', :action => 'list' %> +
+ +<% if @flash["confirmation"] %>
<%= @flash["confirmation"] %>
<% end %> +<% if @flash["warning"] %>
<%= @flash["warning"] %>
<% end %> diff --git a/tracks/app/views/context/list.rhtml b/tracks/app/views/context/list.rhtml index ecc6b0e4..a8f86a17 100644 --- a/tracks/app/views/context/list.rhtml +++ b/tracks/app/views/context/list.rhtml @@ -26,14 +26,14 @@
-

Add context


<%= text_field("new_context", "name") %>
-
+ <%= check_box( "new_context", "hide" ) %>
+
diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index ec21696e..123df133 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -7,6 +7,7 @@ + <%= @page_title %> diff --git a/tracks/app/views/project/_edit_project.rhtml b/tracks/app/views/project/_edit_project.rhtml new file mode 100644 index 00000000..e2d377af --- /dev/null +++ b/tracks/app/views/project/_edit_project.rhtml @@ -0,0 +1,5 @@ +<%= hidden_field( "project", "id" ) %> +
+<%= text_field( "project", "name" ) %> +
+
\ No newline at end of file diff --git a/tracks/app/views/project/edit.rhtml b/tracks/app/views/project/edit.rhtml new file mode 100644 index 00000000..8f73008a --- /dev/null +++ b/tracks/app/views/project/edit.rhtml @@ -0,0 +1,12 @@ +
+

Edit project

+
+ <%= render_partial "edit_project", "@project" %> + +
+ + <%= link_to 'Cancel', :action => 'list' %> +
+ +<% if @flash["confirmation"] %>
<%= @flash["confirmation"] %>
<% end %> +<% if @flash["warning"] %>
<%= @flash["warning"] %>
<% end %> diff --git a/tracks/app/views/project/list.rhtml b/tracks/app/views/project/list.rhtml index ba936023..7d4d0453 100644 --- a/tracks/app/views/project/list.rhtml +++ b/tracks/app/views/project/list.rhtml @@ -19,11 +19,11 @@
-

Add project


<%= text_field( "new_project", "name" ) %>
+
diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todo/_item.rhtml index bd12a8b9..d1736f7b 100644 --- a/tracks/app/views/todo/_item.rhtml +++ b/tracks/app/views/todo/_item.rhtml @@ -1,12 +1,12 @@ <%= hidden_field( "item", "id" ) %>
-<%= text_field( "item", "description" ) %> +<%= text_field( "item", "description", "tabindex" => 1 ) %>

-<%= text_area( "item", "notes", "cols" => 35, "rows" => 15 ) %> +<%= text_area( "item", "notes", "tabindex" => 2, "cols" => 35, "rows" => 15 ) %>

- <% for @place in @places %> <% if @item %> <% if @place.id == @item.context_id %> @@ -21,7 +21,7 @@

- <% if @belongs == nil %> <% end %> @@ -35,6 +35,7 @@ <% end %>
-
-<%= date_select( "item", "due", :include_blank => true ) %> +
+<%= date_select( "item", "due", :include_blank => true, "tabindex" => 5 ) %> +

diff --git a/tracks/app/views/todo/edit.rhtml b/tracks/app/views/todo/edit.rhtml index fefddad0..6ebc65c7 100644 --- a/tracks/app/views/todo/edit.rhtml +++ b/tracks/app/views/todo/edit.rhtml @@ -1,5 +1,5 @@
-

Update task

+

Edit task

<%= render_partial "todo/item", "@item" %> diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml index ce7bccd7..cced3b8e 100644 --- a/tracks/app/views/todo/list.rhtml +++ b/tracks/app/views/todo/list.rhtml @@ -27,7 +27,6 @@
-

Add next action

<%= render_partial "todo/item", @item %> diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index a1eacb9f..fee53359 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -13,6 +13,9 @@ Project wiki: 4. Did a bit of refactoring to try to make page loading a bit more efficient. 5. Added a new row to the context table: 'hide'. This determines whether a particular context gets hidden on the main page. If the checkbox on the add new context form is checked, the context is hidden, and isn't listed on the front (todo/list) page. This is useful for contexts like 'wish list' or 'someday/maybe' that you don't want taking up your attention all the time. 6. Added a list of links to the hidden contexts at the bottom of the page. +7. Changed the method of adding due dates to drop-down option lists. It's more obvious and less error prone than typing in the date. Your preferences for date formatting are still honoured when displaying due dates. +8. Added a favicon, kindly produced by Jim Ray. +9. Added border="0" to the button images to stop Firefox putting a red border around them. ## Version 1.01 diff --git a/tracks/public/.htaccess b/tracks/public/.htaccess index 5dd8ecd6..ab6f0e83 100644 --- a/tracks/public/.htaccess +++ b/tracks/public/.htaccess @@ -10,7 +10,7 @@ RewriteEngine On RewriteBase /dispatch.fcgi # Enable this rewrite rule to point to the controller/action that should serve root. -# RewriteRule ^$ /controller/action [R] +RewriteRule ^$ /todo/list [R] # Add missing slash RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R] diff --git a/tracks/public/favicon.ico b/tracks/public/favicon.ico new file mode 100644 index 00000000..861f34a3 Binary files /dev/null and b/tracks/public/favicon.ico differ diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index 2dfdbb92..b039be50 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -44,7 +44,7 @@ a:hover { #navcontainer { margin: 15px; - width: 820px; + width: 822px; } #navlist { @@ -107,19 +107,22 @@ h2 a:hover { } #input_box { - margin: 20px 50px 20px 490px; + margin-left: 490px; + margin-top: 20px; + width: 313px; padding: 0px 15px 0px 15px; - border: 1px solid #999; + /* border: 1px solid #999; */ } #input_box h2 { - background: #CCC; + /* background: #CCC; padding: 5px; - margin-top: 0px; + margin: 0px; margin-left: -15px; - margin-right: -15px; - color: #fff; - text-shadow: rgba(0,0,0,.4) 0px 2px 5px; + margin-right: -15px; + text-shadow: rgba(0,0,0,.4) 0px 2px 5px; */ + color: #999; + } .box { @@ -257,4 +260,20 @@ table.list { .next_actions td { border: none; padding-bottom: 5px; -} \ No newline at end of file + } + +/* Form elements */ +form { + border: 1px solid #CCC; + padding: 10px; + margin: 0px; + width: 313px; + } + +label { + font-weight: bold; + } + +input { + margin-bottom: 5px; + } \ No newline at end of file