diff --git a/app/stylesheets/_mixins.sass b/app/stylesheets/_mixins.sass index 64d0f8e..25e437e 100644 --- a/app/stylesheets/_mixins.sass +++ b/app/stylesheets/_mixins.sass @@ -8,12 +8,18 @@ background-color: $color border: 1px solid $border -=pretty-bullets($bullet-icon, $width: image-width($bullet-icon), $height: image-height($bullet-icon), $line-height: 18px, $padding: 14px) +=tags-bullet($width: image-width($bullet-icon), $height: image-height($bullet-icon), $line-height: 18px, $padding: 14px) margin-left: 0 - li.bullet - background: image-url($bullet-icon) no-repeat ($padding - $width) / 2 ($line-height - $height) / 2 + li.tags + background: image-url("tags.png") no-repeat ($padding - $width) / 2 ($line-height - $height) / 2 li list-style-type: none padding-left: $padding - +=notes-bullet($width: image-width($bullet-icon), $height: image-height($bullet-icon), $line-height: 18px, $padding: 14px) + margin-left: 0 + li.notes + background: image-url("notes.png") no-repeat ($padding - $width) / 2 ($line-height - $height) / 2 + li + list-style-type: none + padding-left: $padding diff --git a/app/stylesheets/screen.sass b/app/stylesheets/screen.sass index 6893fd3..1bdea54 100644 --- a/app/stylesheets/screen.sass +++ b/app/stylesheets/screen.sass @@ -11,6 +11,9 @@ +box-shadow(#333,1px,1px,2px) form.mark_complete display: inline + img + padding-left: 5px + padding-right: 5px ul.tags display: inline float: right @@ -22,7 +25,29 @@ @include box(rgb(231,235,249),rgb(188,202,240), 7px, 4px, 0) form.edit_task ul - +pretty-bullets("tags.png", 14px, 14px, 20px, 25px) + width: 100% + +tags-bullet(14px, 14px, 20px, 25px) + +notes-bullet(14px, 14px, 20px, 25px) + input, textarea + width: 100% + input[type=submit] + margin-left: 25px + ul#complete li.task text-decoration: line-through + +.task .notes + display: none + +form.new_task + textarea + width: 351px + height: 40px + input[type=text] + width: 350px + ul + +tags-bullet(14px, 14px, 20px, 25px) + +notes-bullet(14px, 14px, 20px, 25px) + + diff --git a/app/views/lists/show.html.haml b/app/views/lists/show.html.haml index 50802a8..38f9214 100644 --- a/app/views/lists/show.html.haml +++ b/app/views/lists/show.html.haml @@ -10,9 +10,14 @@ = form_for [@list, @task], :remote => true do |f| - %p - ~f.text_field :description, :placeholder => "New to do" - =f.text_field :tag_list, :placeholder => "Tags" - ~f.submit + %ul + %li + ~f.text_field :description, :placeholder => "New to do" + %li.tags + =f.text_field :tag_list, :placeholder => "Tags" + %li.notes + =f.text_area :notes, :placehoder => "Notes" + %li + =f.submit %hr = link_to "Back to list index", lists_path diff --git a/app/views/tasks/_task.html.haml b/app/views/tasks/_task.html.haml index 98c4c5a..a932963 100644 --- a/app/views/tasks/_task.html.haml +++ b/app/views/tasks/_task.html.haml @@ -3,9 +3,15 @@ = form_tag complete_task_path(@list.id, task.id), :class => "mark_complete", :remote => true do = check_box_tag "complete", "1", false, "data-remote".to_sym => true, :action => complete_task_path(@list.id, task.id) = "#{task.description}" + - unless task.notes.blank? + = image_tag "notes.png" + = link_to "Edit", edit_list_task_path(@list.id, task.id) %ul.tags - task.tag_list.each do |tag| %li=tag - + - unless task.notes.blank? + .notes + %hr + %p= task.notes diff --git a/app/views/tasks/create.js.erb b/app/views/tasks/create.js.erb index febc6ae..909cc29 100644 --- a/app/views/tasks/create.js.erb +++ b/app/views/tasks/create.js.erb @@ -1 +1,3 @@ <%= render :template => 'tasks/complete' %> + +$('form.new_task').clearForm(); diff --git a/app/views/tasks/edit.html.haml b/app/views/tasks/edit.html.haml index bd1f46b..ee85192 100644 --- a/app/views/tasks/edit.html.haml +++ b/app/views/tasks/edit.html.haml @@ -3,7 +3,11 @@ %ul %li =f.text_field :description, :placeholder => "To do" - %li.bullet + %li.tags =f.text_field :tag_list, :placeholder => "Tags" + %li.notes + =f.text_area :notes, :placeholder => "Notes" %p - =f.submit + = link_to "Cancel", list_path(@list) + = " | " + = f.submit diff --git a/db/migrate/20100817165434_add_notes_to_tasks.rb b/db/migrate/20100817165434_add_notes_to_tasks.rb new file mode 100644 index 0000000..c12c23c --- /dev/null +++ b/db/migrate/20100817165434_add_notes_to_tasks.rb @@ -0,0 +1,9 @@ +class AddNotesToTasks < ActiveRecord::Migration + def self.up + add_column :tasks, :notes, :text + end + + def self.down + remove_column :tasks, :notes + end +end diff --git a/db/schema.rb b/db/schema.rb index 6d41980..c960ff5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100817123058) do +ActiveRecord::Schema.define(:version => 20100817165434) do create_table "lists", :force => true do |t| t.string "name" @@ -42,6 +42,7 @@ t.integer "list_id" t.datetime "created_at" t.datetime "updated_at" + t.text "notes" end end diff --git a/public/images/notes.png b/public/images/notes.png index 646b63c..b3ddf86 100644 Binary files a/public/images/notes.png and b/public/images/notes.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8b13789..9b5b88f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1 +1,21 @@ +$.fn.clearForm = function() { +  return this.each(function() { +    var type = this.type, tag = this.tagName.toLowerCase(); +    if (tag == 'form') +      return $(':input',this).clearForm(); +    if (type == 'text' || type == 'password' || tag == 'textarea') +      this.value = ''; +    else if (type == 'checkbox' || type == 'radio') +      this.checked = false; +    else if (tag == 'select') +      this.selectedIndex = -1; +  }); +}; + + +$(function(){ + $(".task img").live('click', function () { + $(this).siblings(".task .notes").toggle(); + }); +}); diff --git a/public/stylesheets/screen.css b/public/stylesheets/screen.css index 229b751..0c59ce6 100644 --- a/public/stylesheets/screen.css +++ b/public/stylesheets/screen.css @@ -400,12 +400,17 @@ section.content-sub { display: inline; } /* line 14, ../../app/stylesheets/screen.sass */ +.task img { + padding-left: 5px; + padding-right: 5px; +} +/* line 17, ../../app/stylesheets/screen.sass */ .task ul.tags { display: inline; float: right; margin-top: 2px; } -/* line 18, ../../app/stylesheets/screen.sass */ +/* line 21, ../../app/stylesheets/screen.sass */ .task ul.tags li { display: inline; list-style-type: none; @@ -420,12 +425,14 @@ section.content-sub { border: 1px solid #bccaf0; } -/* line 24, ../../app/stylesheets/screen.sass */ +/* line 27, ../../app/stylesheets/screen.sass */ form.edit_task ul { + width: 100%; + margin-left: 0; margin-left: 0; } /* line 13, ../../app/stylesheets/_mixins.sass */ -form.edit_task ul li.bullet { +form.edit_task ul li.tags { background: url('/images/tags.png?1282061111') no-repeat 5.5px 3px; } /* line 15, ../../app/stylesheets/_mixins.sass */ @@ -433,8 +440,63 @@ form.edit_task ul li { list-style-type: none; padding-left: 25px; } +/* line 21, ../../app/stylesheets/_mixins.sass */ +form.edit_task ul li.notes { + background: url('/images/notes.png?1282062393') no-repeat 5.5px 3px; +} +/* line 23, ../../app/stylesheets/_mixins.sass */ +form.edit_task ul li { + list-style-type: none; + padding-left: 25px; +} +/* line 31, ../../app/stylesheets/screen.sass */ +form.edit_task ul input, form.edit_task ul textarea { + width: 100%; +} +/* line 33, ../../app/stylesheets/screen.sass */ +form.edit_task ul input[type=submit] { + margin-left: 25px; +} -/* line 27, ../../app/stylesheets/screen.sass */ +/* line 37, ../../app/stylesheets/screen.sass */ ul#complete li.task { text-decoration: line-through; } + +/* line 40, ../../app/stylesheets/screen.sass */ +.task .notes { + display: none; +} + +/* line 44, ../../app/stylesheets/screen.sass */ +form.new_task textarea { + width: 351px; + height: 40px; +} +/* line 47, ../../app/stylesheets/screen.sass */ +form.new_task input[type=text] { + width: 350px; +} +/* line 49, ../../app/stylesheets/screen.sass */ +form.new_task ul { + margin-left: 0; + margin-left: 0; +} +/* line 13, ../../app/stylesheets/_mixins.sass */ +form.new_task ul li.tags { + background: url('/images/tags.png?1282061111') no-repeat 5.5px 3px; +} +/* line 15, ../../app/stylesheets/_mixins.sass */ +form.new_task ul li { + list-style-type: none; + padding-left: 25px; +} +/* line 21, ../../app/stylesheets/_mixins.sass */ +form.new_task ul li.notes { + background: url('/images/notes.png?1282062393') no-repeat 5.5px 3px; +} +/* line 23, ../../app/stylesheets/_mixins.sass */ +form.new_task ul li { + list-style-type: none; + padding-left: 25px; +}