taskwarrior-web 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81ddd844b563c653dcac866ead7c1481a768d17d
4
- data.tar.gz: b30140d7d71ac62c8dd594e389683020377cd94d
3
+ metadata.gz: 2e9612d9c9cee0c532430c68bf9b66a1cfbaaa6f
4
+ data.tar.gz: da7c54198ac489b756efcb9d71f9649a5bace0ee
5
5
  SHA512:
6
- metadata.gz: 5e98706d90542916ca02463a1733b3147f635fdfd3bd664c224e1eb32844be34cacc171e90057536c6fc860080e8524ff6df4c290203e07cbf97ed0f9cfce9ad
7
- data.tar.gz: bc577b814732ba215a9618b5658f3246d4b4c6e78f2df4cc7e51bd04edb50759a8d981d07e06c541f24461ae9e1db793150d79aa334cfdb3a201c2294b05c038
6
+ metadata.gz: aa6f01caf1480aad08d527d0f62b2263a57b19713620ee100dc375ec78e6f144d5ff0016c7d1bddcd713b864812c8903a9f18714415e9e507c57948a7d930de0
7
+ data.tar.gz: 0e6c15697f13a35d706a3dc8e39942cc1700275a35a6bd7021fe8d687fabed31714f2fd3a31a2e22200cc7227cae247a8e9d4d182361c7776e9464665010b1f7
@@ -1,3 +1,9 @@
1
+ ## v1.1.11 (7/15/13)
2
+
3
+ * Rethinking the tasks that are included in project lists. Now, they include
4
+ completed and waiting tasks as well, with visual distinctions.
5
+ * Misc small fixes
6
+
1
7
  ## v1.1.10 (6/28/13)
2
8
 
3
9
  * Added ability to specify "wait" property for tasks
data/Guardfile CHANGED
@@ -1,6 +1,3 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
1
  guard 'bundler' do
5
2
  watch('Gemfile')
6
3
  watch('taskwarrior-web.gemspec')
data/config.ru CHANGED
@@ -1,7 +1,5 @@
1
1
  require File.join(File.dirname(__FILE__), 'lib', 'taskwarrior-web')
2
2
 
3
3
  disable :run
4
- TaskwarriorWeb::App.set({
5
- :environment => :production
6
- })
4
+ TaskwarriorWeb::App.set({ :environment => :production })
7
5
  run TaskwarriorWeb::App
@@ -132,7 +132,7 @@ class TaskwarriorWeb::App < Sinatra::Base
132
132
  get '/projects/overview/?' do
133
133
  @title = 'Projects'
134
134
  @tasks = TaskwarriorWeb::Task.query('status.not' => :deleted, 'project.not' => '')
135
- .sort_by! { |t| [-t.urgency.to_f, t.priority.nil?.to_s, t.priority.to_s, t.due.nil?.to_s, t.due.to_s] }
135
+ .sort_by! { |t| [t.active? ? 0 : 1, -t.urgency.to_f, t.priority.nil?.to_s, t.priority.to_s, t.due.nil?.to_s, t.due.to_s] }
136
136
  .group_by { |t| t.project.to_s }
137
137
  .reject { |project, tasks| tasks.select { |task| task.status == 'pending' }.empty? }
138
138
  erb :'projects/index'
@@ -141,7 +141,7 @@ class TaskwarriorWeb::App < Sinatra::Base
141
141
  get '/projects/:name/?' do
142
142
  @title = unlinkify(params[:name])
143
143
  @tasks = TaskwarriorWeb::Task.query('status.not' => :deleted, :project => @title)
144
- .sort_by! { |t| [-t.urgency.to_f, t.priority.nil?.to_s, t.priority.to_s, t.due.nil?.to_s, t.due.to_s] }
144
+ .sort_by! { |t| [t.active? ? 0 : 1, -t.urgency.to_f, t.priority.nil?.to_s, t.priority.to_s, t.due.nil?.to_s, t.due.to_s] }
145
145
  erb :'projects/show'
146
146
  end
147
147
 
@@ -10,7 +10,7 @@ SimpleNavigation::Configuration.run do |navigation|
10
10
  tasks.item :completed, 'Completed', '/tasks/completed'
11
11
  tasks.item :deleted, 'Deleted', '/tasks/deleted'
12
12
  end
13
- primary.item :projects, 'Projects', '/projects' do |projects|
13
+ primary.item :projects, 'Projects', '/projects', { :highlights_on => %r{/projects/?.+?} } do |projects|
14
14
  projects.dom_class = 'nav nav-pills'
15
15
  projects.item :overview, 'Overview', '/projects/overview'
16
16
  end
@@ -6,6 +6,10 @@ module TaskwarriorWeb::App::Helpers
6
6
  Time.parse(timestamp).localtime.strftime(format)
7
7
  end
8
8
 
9
+ def format_tags(tags)
10
+ tags.join(', ')
11
+ end
12
+
9
13
  def colorize_date(timestamp)
10
14
  return if timestamp.nil?
11
15
  due_def = (TaskwarriorWeb::Config.due || 7).to_i
@@ -58,6 +58,10 @@ module TaskwarriorWeb
58
58
  @_errors.empty?
59
59
  end
60
60
 
61
+ def active?
62
+ status.in? ['pending', 'waiting']
63
+ end
64
+
61
65
  def to_hash
62
66
  Hash[instance_variables.select { |var| !var.to_s.start_with?('@_') }.map { |var| [var[1..-1].to_sym, instance_variable_get(var)] }]
63
67
  end
@@ -64,6 +64,11 @@ html, body { height: 100%; }
64
64
  #push, #footer { height: 70px; }
65
65
  #footer .container > * { margin: 20px 0; }
66
66
 
67
+ tr.completed td { text-decoration: line-through; }
68
+
69
+ /** Prevents crud links from being broken onto lines **/
70
+ span.crud-links { white-space: nowrap; }
71
+
67
72
  /** Icon spacing **/
68
73
  h2.project i { vertical-align: 35%; }
69
74
  span.crud-links i { margin-top: 4px; }
@@ -6,6 +6,7 @@ $(document).ready(function() {
6
6
  initTablesort();
7
7
  initAnnotationsModal();
8
8
  initUjs();
9
+ initAutoclose();
9
10
  refreshDockBadge();
10
11
 
11
12
  // Hack to account for navbar when clicking anchor links.
@@ -144,6 +145,10 @@ var initTablesort = function() {
144
145
  };
145
146
 
146
147
  var initAnnotationsModal = function() {
148
+ $('#annotations-modal').on('shown', function() {
149
+ $(this).find('[name="annotation[description]"]').focus();
150
+ });
151
+
147
152
  $(document).on('click', 'a.annotation-add', function(event) {
148
153
  event.preventDefault();
149
154
  $.get($(this).attr('href') + '.json', function(data) {
@@ -167,6 +172,19 @@ var initUjs = function() {
167
172
  });
168
173
  };
169
174
 
175
+ /**
176
+ * Anything that has a "data-autoclose" attribute will fade out after the given
177
+ * number of milliseconds.
178
+ */
179
+ var initAutoclose = function() {
180
+ $('[data-autoclose]').each(function(index, element) {
181
+ $element = $(element);
182
+ setTimeout(function() {
183
+ $element.fadeOut(function() { $(this).remove(); });
184
+ }, $element.data('autoclose'))
185
+ })
186
+ };
187
+
170
188
  // Count updating.
171
189
 
172
190
  var refreshDockBadge = function() {
@@ -1,3 +1,3 @@
1
1
  module TaskwarriorWeb
2
- VERSION = '1.1.10'
2
+ VERSION = '1.1.11'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  <div id="flash-messages">
2
2
  <% flash_types.select{ |severity| flash.has?(severity) }.each do |severity| %>
3
- <div class="alert alert-<%= severity %>">
3
+ <div class="alert alert-<%= severity %>"<% if severity == :success %> data-autoclose="5000"<% end %>>
4
4
  <button type="button" class="close" data-dismiss="alert">&times;</button>
5
5
  <%= flash[severity] %>
6
6
  </div>
@@ -30,15 +30,13 @@
30
30
  </thead>
31
31
  <tbody>
32
32
  <% tasks.each do |task| %>
33
- <% if task.status == 'pending' %>
34
- <tr class="<%= colorize_date(task.due) %>">
35
- <td><%= task.description %></td>
36
- <td><%= format_date(task.due) unless task.due.nil? %></td>
37
- <td><%= task.tags.join(', ') unless task.tags.nil? %></td>
38
- <td><%= task.priority unless task.priority.nil? %></td>
39
- <% if @can_edit %><td><%= crud_links(task) %></td><% end %>
40
- </tr>
41
- <% end %>
33
+ <tr class="<%= colorize_date(task.due) if task.active? %> <%= task.status %>">
34
+ <td><%= task.description %></td>
35
+ <td><%= format_date(task.due) unless task.due.nil? %></td>
36
+ <td><%= format_tags(task.tags) unless task.tags.nil? %></td>
37
+ <td><%= task.priority unless task.priority.nil? %></td>
38
+ <% if @can_edit %><td><%= crud_links(task) if task.active? %></td><% end %>
39
+ </tr>
42
40
  <% end %>
43
41
  </tbody>
44
42
  </table>
@@ -13,15 +13,14 @@
13
13
  </thead>
14
14
  <tbody>
15
15
  <% @tasks.each do |task| %>
16
- <% if task.status == 'pending' %>
17
- <tr class="<%= colorize_date(task.due) %>">
18
- <td><%= task.description %></td>
19
- <td><%= format_date(task.due) unless task.due.nil? %></td>
20
- <td><%= task.tags.join(', ') unless task.tags.nil? %></td>
21
- <td><%= task.priority unless task.priority.nil? %></td>
22
- <% if @can_edit %><td><%= crud_links(task) %></td><% end %>
23
- </tr>
24
- <% end %>
16
+ <tr class="<%= colorize_date(task.due) if task.active? %> <%= task.status %>">
17
+ <td><%= task.description %></td>
18
+ <td><%= format_date(task.due) unless task.due.nil? %></td>
19
+ <td><%= format_tags(task.tags) unless task.tags.nil? %></td>
20
+ <td><%= task.tags.join(', ') unless task.tags.nil? %></td>
21
+ <td><%= task.priority unless task.priority.nil? %></td>
22
+ <% if @can_edit %><td><%= crud_links(task) if task.active? %></td><% end %>
23
+ </tr>
25
24
  <% end %>
26
25
  </tbody>
27
26
  </table>
@@ -23,7 +23,7 @@
23
23
  <label for="task-wait" class="control-label">Hide until</label>
24
24
  <div class="controls">
25
25
  <input class="date-picker" type="text" id="task-wait" name="task[wait]" value="<%= format_date(@task.wait) unless @task.nil? || @task.wait.blank? %>" data-date-format="<%= @date_format %>" />
26
- <span class="help-block">If specified, the task will appear in the "Waiting" list until the given date.</span>
26
+ <span class="help-block">If specified, the task will appear in the <a href="/tasks/waiting">Waiting</a> list until the given date.</span>
27
27
  </div>
28
28
  </div>
29
29
 
@@ -24,7 +24,7 @@
24
24
  </thead>
25
25
  <tbody>
26
26
  <% @tasks.each do |task| %>
27
- <tr<%= %{ class="#{colorize_date(task.due)}"} if params[:status] == 'pending' %>>
27
+ <tr<%= %{ class="#{colorize_date(task.due)}"} if task.active? %>>
28
28
  <% if params[:status] == 'pending' %>
29
29
  <td><input type="checkbox" class="complete" data-task-id="<%= task.uuid %>" /></td>
30
30
  <% end %>
@@ -45,7 +45,7 @@
45
45
  <td><a href="/projects/<%= linkify(task.project) %>"><%= task.project %></a></td>
46
46
  <td><%= format_date(task.due) unless task.due.nil? %></td>
47
47
  <% if params[:status] == 'waiting' %><td><%= format_date(task.wait) unless task.wait.nil? %></td><% end %>
48
- <td><%= task.tags.join(', ') unless task.tags.nil? %></td>
48
+ <td><%= format_tags(task.tags) unless task.tags.nil? %></td>
49
49
  <td><%= task.priority unless task.priority.nil? %></td>
50
50
  <% if can_edit %><td><%= crud_links(task) %></td><% end %>
51
51
  </tr>
@@ -11,9 +11,9 @@ describe TaskwarriorWeb::App do
11
11
  end
12
12
 
13
13
  before do
14
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.user').any_number_of_times.and_return(nil)
15
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.filter').any_number_of_times.and_return(nil)
16
- TaskwarriorWeb::Runner.should_receive(:run).any_number_of_times.and_return('{}')
14
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.user').and_return(nil)
15
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.filter').and_return(nil)
16
+ allow(TaskwarriorWeb::Runner).to receive(:run).and_return('{}')
17
17
  end
18
18
 
19
19
  ['/', '/tasks'].each do |path|
@@ -70,7 +70,7 @@ describe TaskwarriorWeb::App do
70
70
 
71
71
  it 'should render the task form' do
72
72
  task = TaskwarriorWeb::Task.new({:tags => 'tag1, tag2'})
73
- TaskwarriorWeb::Task.should_receive(:new).any_number_of_times.and_return(task)
73
+ allow(TaskwarriorWeb::Task).to receive(:new).and_return(task)
74
74
  post '/tasks', :task => {}
75
75
  last_response.body.should have_tag('form') do
76
76
  with_tag('input', :with => { :name => 'task[tags]' , :value => 'tag1, tag2' })
@@ -79,7 +79,7 @@ describe TaskwarriorWeb::App do
79
79
 
80
80
  it 'should display errors messages' do
81
81
  task = TaskwarriorWeb::Task.new
82
- TaskwarriorWeb::Task.should_receive(:new).any_number_of_times.and_return(task)
82
+ allow(TaskwarriorWeb::Task).to receive(:new).and_return(task)
83
83
  post '/tasks', :task => {}
84
84
  last_response.body.should have_tag('.alert-error')
85
85
  end
@@ -160,7 +160,7 @@ describe TaskwarriorWeb::App do
160
160
  describe 'DELETE /tasks/:uuid' do
161
161
  context 'given a non-existant task' do
162
162
  it 'should return a 404' do
163
- TaskwarriorWeb::Task.should_receive(:find).any_number_of_times.and_return(nil)
163
+ allow(TaskwarriorWeb::Task).to receive(:find).and_return(nil)
164
164
  delete '/tasks/429897527'
165
165
  last_response.should be_not_found
166
166
  end
@@ -193,7 +193,7 @@ describe TaskwarriorWeb::App do
193
193
 
194
194
  describe 'GET /projects/:name' do
195
195
  it 'should replace characters in the title' do
196
- TaskwarriorWeb::Task.should_receive(:query).any_number_of_times.and_return([])
196
+ allow(TaskwarriorWeb::Task).to receive(:query).and_return([])
197
197
  get '/projects/Test--Project'
198
198
  last_response.body.should include('<title>Test.Project')
199
199
  end
@@ -277,14 +277,14 @@ describe 'HTTP authentication' do
277
277
  end
278
278
 
279
279
  before do
280
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.filter').any_number_of_times.and_return(nil)
281
- TaskwarriorWeb::Runner.should_receive(:run).any_number_of_times.and_return('{}')
280
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.filter').and_return(nil)
281
+ allow(TaskwarriorWeb::Runner).to receive(:run).and_return('{}')
282
282
  end
283
283
 
284
284
  context 'when credentials are specified in .taskrc' do
285
285
  before do
286
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.user').any_number_of_times.and_return('test_user')
287
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.passwd').and_return('test_pass')
286
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.user').and_return('test_user')
287
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.passwd').and_return('test_pass')
288
288
  end
289
289
 
290
290
  it 'should ask for authentication' do
@@ -307,7 +307,7 @@ describe 'HTTP authentication' do
307
307
 
308
308
  context 'when no credentials are specified in .taskrc' do
309
309
  before do
310
- TaskwarriorWeb::Config.should_receive(:property).with('task-web.user').any_number_of_times.and_return(nil)
310
+ allow(TaskwarriorWeb::Config).to receive(:property).with('task-web.user').and_return(nil)
311
311
  end
312
312
 
313
313
  it 'should bypass authentication' do
@@ -11,11 +11,8 @@ describe TaskwarriorWeb::App::Helpers do
11
11
 
12
12
  describe '#format_date' do
13
13
  context 'with no format specified' do
14
- before do
15
- TaskwarriorWeb::Config.should_receive(:dateformat).any_number_of_times.and_return(nil)
16
- end
17
-
18
14
  it 'should format various dates and times to the default format' do
15
+ allow(TaskwarriorWeb::Config).to receive(:dateformat).and_return(nil)
19
16
  helpers.format_date('2012-01-11 12:23:00').should eq('1/11/2012')
20
17
  helpers.format_date('2012-01-11').should eq('1/11/2012')
21
18
  helpers.format_date('20121231T230000Z').should eq(Time.parse('20121231T230000Z').localtime.strftime('%-m/%-d/%Y'))
@@ -25,13 +22,13 @@ describe TaskwarriorWeb::App::Helpers do
25
22
 
26
23
  context 'with a specified date format' do
27
24
  it 'should format dates using the specified format' do
28
- TaskwarriorWeb::Config.should_receive(:dateformat).any_number_of_times.and_return('%d/%-m/%Y')
25
+ allow(TaskwarriorWeb::Config).to receive(:dateformat).and_return('%d/%-m/%Y')
29
26
  helpers.format_date('2012-12-11 12:23:00').should eq('11/12/2012')
30
27
  helpers.format_date('2012-12-11').should eq('11/12/2012')
31
28
  end
32
29
 
33
30
  it 'should convert Taskwarrior formats to Ruby formats correctly' do
34
- TaskwarriorWeb::Config.should_receive(:store).any_number_of_times.and_return({'dateformat' => 'd/m/Y'})
31
+ allow(TaskwarriorWeb::Config).to receive(:store).and_return({ 'dateformat' => 'd/m/Y' })
35
32
  helpers.format_date('2012-01-11 12:23:00').should eq('11/1/2012')
36
33
  helpers.format_date('2012-12-02 12:23:00').should eq('2/12/2012')
37
34
  end
@@ -48,7 +45,7 @@ describe TaskwarriorWeb::App::Helpers do
48
45
 
49
46
  context 'with a due setting specified' do
50
47
  before do
51
- TaskwarriorWeb::Config.should_receive(:due).any_number_of_times.and_return(3)
48
+ allow(TaskwarriorWeb::Config).to receive(:due).and_return(3)
52
49
  end
53
50
 
54
51
  it 'should return "warning" when a given date is today' do
@@ -60,14 +57,14 @@ describe TaskwarriorWeb::App::Helpers do
60
57
  end
61
58
 
62
59
  it 'should return "success" when a date is within the specified range' do
63
- TaskwarriorWeb::Config.should_receive(:due).any_number_of_times.and_return(5)
60
+ allow(TaskwarriorWeb::Config).to receive(:due).and_return(5)
64
61
  helpers.colorize_date(Date.tomorrow.to_s).should eq('success')
65
62
  end
66
63
  end
67
64
 
68
65
  context 'with no due setting specified' do
69
66
  before do
70
- TaskwarriorWeb::Config.should_receive(:due).any_number_of_times.and_return(nil)
67
+ allow(TaskwarriorWeb::Config).to receive(:due).and_return(nil)
71
68
  end
72
69
 
73
70
  it 'should use the default setting of 7 days' do
@@ -3,7 +3,7 @@ require 'taskwarrior-web/model/task'
3
3
 
4
4
  describe TaskwarriorWeb::Task do
5
5
  RSpec::Mocks::setup(TaskwarriorWeb::Runner)
6
- TaskwarriorWeb::Runner.stub(:run) { '{}' }
6
+ TaskwarriorWeb::Runner.double(:run) { '{}' }
7
7
 
8
8
  describe '#initialize' do
9
9
  it 'should assign the passed attributes' do
@@ -16,7 +16,6 @@ Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].e
16
16
 
17
17
  RSpec.configure do |config|
18
18
  config.mock_with :rspec
19
- config.include(RSpec::Mocks::Methods)
20
19
  end
21
20
 
22
21
  SimpleNavigation.config_file_paths << File.dirname(__FILE__) + '/../lib/taskwarrior-web/config'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskwarrior-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-28 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra