]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - flakes/taskwarrior-web/fixes.patch
Squash changes containing private information
[perso/Immae/Config/Nix.git] / flakes / taskwarrior-web / fixes.patch
1 diff --git a/lib/taskwarrior-web/helpers.rb b/lib/taskwarrior-web/helpers.rb
2 index 212aed7..94c57df 100644
3 --- a/lib/taskwarrior-web/helpers.rb
4 +++ b/lib/taskwarrior-web/helpers.rb
5 @@ -1,6 +1,8 @@
6 require 'active_support/core_ext/date/calculations'
7
8 module TaskwarriorWeb::App::Helpers
9 + include ERB::Util
10 +
11 def format_date(timestamp)
12 format = TaskwarriorWeb::Config.dateformat || '%-m/%-d/%Y'
13 Time.parse(timestamp).localtime.strftime(format)
14 diff --git a/lib/taskwarrior-web/model/task.rb b/lib/taskwarrior-web/model/task.rb
15 index 212aed7..94c57df 100644
16 --- a/lib/taskwarrior-web/model/task.rb
17 +++ b/lib/taskwarrior-web/model/task.rb
18 @@ -15,8 +15,14 @@
19
20 def initialize(attributes = {})
21 attributes.each do |attr, value|
22 + if attr == "uuid"
23 + next
24 + end
25 send("#{attr}=", value) if respond_to?(attr.to_sym)
26 end
27 + if attributes.has_key? "uuid"
28 + send("uuid=", attributes["uuid"])
29 + end
30
31 @_errors = []
32 @tags = [] if @tags.nil?
33 diff --git a/lib/taskwarrior-web/services/builder/base.rb b/lib/taskwarrior-web/services/builder/base.rb
34 index 58d246e..8f716ac 100644
35 --- a/lib/taskwarrior-web/services/builder/base.rb
36 +++ b/lib/taskwarrior-web/services/builder/base.rb
37 @@ -10,7 +10,7 @@ module TaskwarriorWeb::CommandBuilder::Base
38 :complete => ':id done',
39 :annotate => ':id annotate',
40 :denotate => ':id denotate',
41 - :projects => '_projects',
42 + :projects => '_unique project',
43 :tags => '_tags',
44 :sync => 'sync'
45 }
46 @@ -21,7 +21,7 @@
47 substitute_parts if @command_string =~ /:id/
48 end
49 parse_params
50 - @built = "#{@command_string}#{@params}"
51 + @built = "#{@params}#{@command_string}"
52 end
53
54 def task_command
55 @@ -43,23 +43,23 @@
56
57 def parse_params
58 string = ''
59 - string << %( #{@params.delete(:description).shellescape}) if @params.has_key?(:description)
60 + string << %(#{@params.delete(:description).shellescape} ) if @params.has_key?(:description)
61
62 if tags = @params.delete(:tags)
63 tag_indicator = TaskwarriorWeb::Config.property('tag.indicator') || '+'
64 - tags.each { |tag| string << %( #{tag_indicator}#{tag.to_s.shellescape}) }
65 + tags.each { |tag| string << %(#{tag_indicator}#{tag.to_s.shellescape} ) }
66 end
67
68 if tags = @params.delete(:remove_tags)
69 - tags.each { |tag| string << %( -#{tag.to_s.shellescape}) }
70 + tags.each { |tag| string << %(-#{tag.to_s.shellescape} ) }
71 end
72
73 @params.each do |attr, value|
74 if @command != :update or attr != :uuid
75 if value.respond_to? :each
76 - value.each { |val| string << %( #{attr.to_s}:\\"#{val.to_s.shellescape}\\") }
77 + value.each { |val| string << %(#{attr.to_s}:\\"#{val.to_s.shellescape}\\" ) }
78 else
79 - string << %( #{attr.to_s}:\\"#{value.to_s.shellescape}\\")
80 + string << %(#{attr.to_s}:\\"#{value.to_s.shellescape}\\" )
81 end
82 end
83 end
84 diff --git a/lib/taskwarrior-web/views/tasks/_form.erb b/lib/taskwarrior-web/views/tasks/_form.erb
85 index 789e7a1..fa08698 100644
86 --- a/lib/taskwarrior-web/views/tasks/_form.erb
87 +++ b/lib/taskwarrior-web/views/tasks/_form.erb
88 @@ -1,14 +1,14 @@
89 <div class="control-group">
90 <label for="task-description" class="control-label">Description</label>
91 <div class="controls">
92 - <input type="text" required="required" id="task-description" name="task[description]" value="<%= @task.description unless @task.nil? %>" />
93 + <input type="text" required="required" id="task-description" name="task[description]" value="<%=h @task.description unless @task.nil? %>" />
94 </div>
95 </div>
96
97 <div class="control-group">
98 <label for="task-project" class="control-label">Project</label>
99 <div class="controls">
100 - <input type="text" id="task-project" name="task[project]" value="<%= @task.project unless @task.nil? %>" autocomplete="off" />
101 + <input type="text" id="task-project" name="task[project]" value="<%=h @task.project unless @task.nil? %>" autocomplete="off" />
102 </div>
103 </div>
104
105 @@ -45,7 +45,7 @@
106 <div class="control-group">
107 <label for="task-tags" class="control-label">Tags</label>
108 <div class="controls">
109 - <input type="text" id="task-tags" name="task[tags]" value="<%= @task.tags.join(', ') unless @task.nil? %>" autocomplete="off" />
110 + <input type="text" id="task-tags" name="task[tags]" value="<%=h @task.tags.join(', ') unless @task.nil? %>" autocomplete="off" />
111 <span class="help-block">Enter tags separated by commas or spaces (e.g. <em>each, word will,be a tag</em>)</span>
112 </div>
113 </div>