forked from Gitlink/forgeplus
add: project unit list
This commit is contained in:
parent
a14459da50
commit
8f98a83379
|
@ -1,4 +1,8 @@
|
||||||
class Projects::ProjectUnitsController < Projects::BaseController
|
class Projects::ProjectUnitsController < Projects::BaseController
|
||||||
|
def index
|
||||||
|
@project_units = @project.project_units
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if current_user.admin? || @project.owner?(current_user)
|
if current_user.admin? || @project.owner?(current_user)
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
|
|
@ -261,8 +261,46 @@ attachments |array|附件
|
||||||
Remember — a happy kitten is an authenticated kitten!
|
Remember — a happy kitten is an authenticated kitten!
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
## 更改项目导航
|
## 项目模块信息
|
||||||
更改项目导航信息
|
项目模块信息
|
||||||
|
|
||||||
|
> 示例:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
curl -X GET \
|
||||||
|
http://localhost:3000/api/yystopf/ceshi/project_units.json
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
await octokit.request('GET /api/yystopf/ceshi/project_units')
|
||||||
|
```
|
||||||
|
|
||||||
|
### HTTP 请求
|
||||||
|
`GET /api/yystopf/ceshi/project_units`
|
||||||
|
|
||||||
|
### 返回字段说明:
|
||||||
|
参数 | 类型 | 字段说明
|
||||||
|
--------- | ----------- | -----------
|
||||||
|
|type |string|模块名称 |
|
||||||
|
|
||||||
|
> 返回的JSON示例:
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "code"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "pulls"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "issues"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
## 更改项目模块展示
|
||||||
|
更改项目模块展示
|
||||||
|
|
||||||
> 示例:
|
> 示例:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
json.array! @project_units do |unit|
|
||||||
|
json.type unit.unit_type
|
||||||
|
end
|
|
@ -529,7 +529,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
scope module: :projects do
|
scope module: :projects do
|
||||||
resources :teams, only: [:index, :create, :destroy]
|
resources :teams, only: [:index, :create, :destroy]
|
||||||
resources :project_units, only: [:create]
|
resources :project_units, only: [:index, :create]
|
||||||
scope do
|
scope do
|
||||||
get(
|
get(
|
||||||
'/blob/*id/diff',
|
'/blob/*id/diff',
|
||||||
|
|
Loading…
Reference in New Issue