Skip to content
This repository has been archived by the owner on Jan 30, 2018. It is now read-only.

Fixes a link to task for calendars, changes a name format of the item in calendar #25

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3c5b539
Fixes a link to task for calendars, show name of the task in Project:…
Jun 4, 2011
8126b81
Allow tasks to be included in the task list reply via ?include=
jamesu Aug 18, 2011
47d2aaf
Filter out objects from archived projects on global api routes
jamesu Aug 19, 2011
2ee6a49
#447452: add urgent flags to tasks and comments
tokland Aug 19, 2011
9030825
#447452: models: manager urgent flag (transitions, previous setting, …
tokland Aug 19, 2011
7028917
#447452: add urgent flag in task form
tokland Aug 19, 2011
51ab841
#447452: navitation: show urgent in today tasks
tokland Aug 19, 2011
2101ebd
web_steps.rb: [fix] make xpath selector relative to scope node
tokland Aug 19, 2011
08678bf
#447452: add basic urgent feature
tokland Aug 19, 2011
70b59ea
#447452: fix urgent task order + styles for calendar
tokland Aug 19, 2011
1033a20
#447452: styles for urgent flag in tasks and calendar_date_select
tokland Aug 19, 2011
0b2f8b4
#447452: Task: Add urgent flag in API response
tokland Aug 19, 2011
6d04558
#447452: move urgent edit to task_edit and add story to task_create
tokland Aug 19, 2011
f609b2f
#447452: use char ! as the urgent task badge
tokland Aug 19, 2011
25d80ca
#447452: refactor TasksHelper#comment_task_due_on
tokland Aug 21, 2011
3d3f09a
A bit of extra margin for the Urgent checkbox
Aug 22, 2011
50b3cb7
#447452: show urgent flag box for conversation to task conversion form
tokland Aug 22, 2011
0746151
#447452: convert_to_task: set urgent flag to false by default
tokland Aug 22, 2011
dcb9e48
Better upload insertion in the activity stream
jamesu Aug 22, 2011
61d9dab
Add a "More..." dropdown by files in comments
Aug 23, 2011
2daac7d
fix project digests when args are encoded in JSON
jrom Aug 24, 2011
39b4791
Added project route for tasks#create, adds tasks to the Inbox
jamesu Aug 24, 2011
e33d704
#458071: redraw calendar box to show it nearer to the link
tokland Aug 24, 2011
5c2206d
Change name limits for project and organization names
jamesu Aug 24, 2011
9481a2b
When deleting a project, associated watchable tag should be removed. …
unixcharles Aug 25, 2011
6e51f4d
Fixes a link to task for calendars, show name of the task in Project:…
Jun 4, 2011
f8cd9ae
Merge branch 'patches/ical' of github.com:denisnovikov/teambox into p…
Aug 26, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added project route for tasks#create, adds tasks to the Inbox
jamesu committed Aug 24, 2011
commit 39b4791f414969b3786d06d95b54f0ae5d141366
12 changes: 11 additions & 1 deletion app/controllers/api_v1/tasks_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class ApiV1::TasksController < ApiV1::APIController
before_filter :load_task_list, :only => [:index, :create, :show, :reorder]
before_filter :load_task_list, :only => [:index, :show, :reorder]
before_filter :load_or_create_task_list, :only => [:create]
before_filter :load_task, :except => [:index, :create, :reorder]

def index
@@ -103,6 +104,15 @@ def load_task
api_error :not_found, :type => 'ObjectNotFound', :message => 'Task not found' if @task_list && @task.task_list_id != @task_list.id
end

def load_or_create_task_list
if params[:task_list_id] or @current_project.nil?
load_task_list
else
# make or load inbox
@task_list = TaskList.find_or_create_by_name_and_project_id_and_user_id('Inbox', @current_project.id, @current_project.user_id)
end
end

def api_scope
conditions = {}
unless params[:status].nil?
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -298,7 +298,7 @@ def self.matches?(request)
resources :tasks, :except => [:new, :edit]
end

resources :tasks, :except => [:new, :edit, :create] do
resources :tasks, :except => [:new, :edit] do
member do
put :watch
put :unwatch
19 changes: 19 additions & 0 deletions spec/controllers/api_v1/tasks_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -267,6 +267,25 @@
@task_list.tasks(true).length.should == 2
@task_list.tasks(true).last.name.should == 'Another TODO!'
end

it "should create an inbox in the desired project if no task list is specified" do
login_as @user

post :create, :project_id => @project.permalink, :id => @task_list.id, :name => 'Another TODO!'
response.should be_success

data = JSON.parse(response.body)
references = data['references'].map{|r| "#{r['id']}_#{r['type']}"}

task = Task.find_by_id(data['id'])
task.should_not == nil
references.include?("#{@project.id}_Project").should == true
references.include?("#{task.user_id}_User").should == true

task_list = TaskList.find_by_id(data['task_list_id'])
task_list.name.should == 'Inbox'
task_list.tasks.first.should == task
end

it "should not allow observers to create tasks" do
login_as @observer