diff --git a/lib/taskwarrior-web/helpers.rb b/lib/taskwarrior-web/helpers.rb index 212aed7..94c57df 100644 --- a/lib/taskwarrior-web/helpers.rb +++ b/lib/taskwarrior-web/helpers.rb @@ -1,6 +1,8 @@ require 'active_support/core_ext/date/calculations' module TaskwarriorWeb::App::Helpers + include ERB::Util + def format_date(timestamp) format = TaskwarriorWeb::Config.dateformat || '%-m/%-d/%Y' Time.parse(timestamp).localtime.strftime(format) diff --git a/lib/taskwarrior-web/model/task.rb b/lib/taskwarrior-web/model/task.rb index 212aed7..94c57df 100644 --- a/lib/taskwarrior-web/model/task.rb +++ b/lib/taskwarrior-web/model/task.rb @@ -15,8 +15,14 @@ def initialize(attributes = {}) attributes.each do |attr, value| + if attr == "uuid" + next + end send("#{attr}=", value) if respond_to?(attr.to_sym) end + if attributes.has_key? "uuid" + send("uuid=", attributes["uuid"]) + end @_errors = [] @tags = [] if @tags.nil? diff --git a/lib/taskwarrior-web/services/builder/base.rb b/lib/taskwarrior-web/services/builder/base.rb index 58d246e..8f716ac 100644 --- a/lib/taskwarrior-web/services/builder/base.rb +++ b/lib/taskwarrior-web/services/builder/base.rb @@ -10,7 +10,7 @@ module TaskwarriorWeb::CommandBuilder::Base :complete => ':id done', :annotate => ':id annotate', :denotate => ':id denotate', - :projects => '_projects', + :projects => '_unique project', :tags => '_tags', :sync => 'sync' } @@ -21,7 +21,7 @@ substitute_parts if @command_string =~ /:id/ end parse_params - @built = "#{@command_string}#{@params}" + @built = "#{@params}#{@command_string}" end def task_command @@ -43,23 +43,23 @@ def parse_params string = '' - string << %( #{@params.delete(:description).shellescape}) if @params.has_key?(:description) + string << %(#{@params.delete(:description).shellescape} ) if @params.has_key?(:description) if tags = @params.delete(:tags) tag_indicator = TaskwarriorWeb::Config.property('tag.indicator') || '+' - tags.each { |tag| string << %( #{tag_indicator}#{tag.to_s.shellescape}) } + tags.each { |tag| string << %(#{tag_indicator}#{tag.to_s.shellescape} ) } end if tags = @params.delete(:remove_tags) - tags.each { |tag| string << %( -#{tag.to_s.shellescape}) } + tags.each { |tag| string << %(-#{tag.to_s.shellescape} ) } end @params.each do |attr, value| if @command != :update or attr != :uuid if value.respond_to? :each - value.each { |val| string << %( #{attr.to_s}:\\"#{val.to_s.shellescape}\\") } + value.each { |val| string << %(#{attr.to_s}:\\"#{val.to_s.shellescape}\\" ) } else - string << %( #{attr.to_s}:\\"#{value.to_s.shellescape}\\") + string << %(#{attr.to_s}:\\"#{value.to_s.shellescape}\\" ) end end end diff --git a/lib/taskwarrior-web/views/tasks/_form.erb b/lib/taskwarrior-web/views/tasks/_form.erb index 789e7a1..fa08698 100644 --- a/lib/taskwarrior-web/views/tasks/_form.erb +++ b/lib/taskwarrior-web/views/tasks/_form.erb @@ -1,14 +1,14 @@