There is an existing bug that prevents sub-project filtering working, will look into that now. Also still need to know before hand if there are any sub-projects so we can hide the filter if there are none.pull/1093/head
parent
c4738eedef
commit
984d318112
@ -0,0 +1,27 @@ |
||||
angular.module('openproject.services') |
||||
|
||||
.service('ProjectService', ['$http', 'PathHelper', function($http, PathHelper) { |
||||
|
||||
var ProjectService = { |
||||
getProject: function(projectIdentifier) { |
||||
var url = PathHelper.apiV3ProjectPath(projectIdentifier); |
||||
|
||||
return ProjectService.doQuery(url); |
||||
}, |
||||
|
||||
getSubProjects: function(projectIdentifier) { |
||||
var url = PathHelper.apiProjectSubProjectsPath(projectIdentifier); |
||||
|
||||
return ProjectService.doQuery(url); |
||||
}, |
||||
|
||||
doQuery: function(url, params) { |
||||
return $http.get(url, { params: params }) |
||||
.then(function(response){ |
||||
return response.data.projects; |
||||
}); |
||||
} |
||||
}; |
||||
|
||||
return ProjectService; |
||||
}]); |
@ -0,0 +1,60 @@ |
||||
#-- encoding: UTF-8 |
||||
#-- copyright |
||||
# OpenProject is a project management system. |
||||
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF) |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License version 3. |
||||
# |
||||
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: |
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang |
||||
# Copyright (C) 2010-2013 the ChiliProject Team |
||||
# |
||||
# This program is free software; you can redistribute it and/or |
||||
# modify it under the terms of the GNU General Public License |
||||
# as published by the Free Software Foundation; either version 2 |
||||
# of the License, or (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with this program; if not, write to the Free Software |
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
||||
# |
||||
# See doc/COPYRIGHT.rdoc for more details. |
||||
#++ |
||||
|
||||
module Api |
||||
module V3 |
||||
|
||||
class ProjectsController < ApplicationController |
||||
before_filter :find_project |
||||
|
||||
include ::Api::V3::ApiController |
||||
|
||||
def show |
||||
respond_to do |format| |
||||
format.api |
||||
end |
||||
end |
||||
|
||||
def sub_projects |
||||
@sub_projects = @project.descendants.visible |
||||
|
||||
respond_to do |format| |
||||
format.api |
||||
end |
||||
end |
||||
|
||||
private |
||||
|
||||
def find_project |
||||
@project = Project.find(params[:project_id]) |
||||
end |
||||
|
||||
end |
||||
end |
||||
end |
@ -0,0 +1,4 @@ |
||||
|
||||
collection @projects => :projects |
||||
attributes :id, |
||||
:name |
@ -0,0 +1,4 @@ |
||||
|
||||
collection @sub_projects => :projects |
||||
attributes :id, |
||||
:name |
Loading…
Reference in new issue