mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-06-10 05:54:16 +08:00
issue pm
This commit is contained in:
2
app/assets/javascripts/pm/issues.js
Normal file
2
app/assets/javascripts/pm/issues.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
2
app/assets/javascripts/pm/journals.js
Normal file
2
app/assets/javascripts/pm/journals.js
Normal file
@@ -0,0 +1,2 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
3
app/assets/stylesheets/pm/issues.scss
Normal file
3
app/assets/stylesheets/pm/issues.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the pm/issues controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
3
app/assets/stylesheets/pm/journals.scss
Normal file
3
app/assets/stylesheets/pm/journals.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the pm/journals controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
37
app/controllers/pm/issues_controller.rb
Normal file
37
app/controllers/pm/issues_controller.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
class Pm::IssuesController < ApplicationController
|
||||
before_action :require_login, except: [:index]
|
||||
|
||||
def index
|
||||
@project = Project.find_by_id(params[:project_id]) || Project.new(id: 0, user_id: 0, name: 'pm_mm', identifier: 'pm_mm')
|
||||
@object_result = Api::V1::Issues::ListService.call(@project, query_params, current_user)
|
||||
@total_issues_count = @object_result[:total_issues_count]
|
||||
@opened_issues_count = @object_result[:opened_issues_count]
|
||||
@closed_issues_count = @object_result[:closed_issues_count]
|
||||
if params[:only_name].present?
|
||||
@issues = kaminary_select_paginate(
|
||||
@object_result[:data].select(:id, :subject, :project_issues_index, :updated_on, :created_on))
|
||||
else
|
||||
@issues = kaminari_paginate(@object_result[:data])
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
project = Project.find_by_id(params[:project_id]) || Project.new(id: 0, user_id: 0, name: 'pm_mm', identifier: 'pm_mm')
|
||||
@object_result = Api::V1::Issues::CreateService.call(project, issue_params, current_user)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def issue_params
|
||||
params.permit(
|
||||
:status_id, :priority_id, :milestone_id,
|
||||
:branch_name, :start_date, :due_date,
|
||||
:subject, :description, :blockchain_token_num,
|
||||
:pm_project_id, :pm_sprint_id, :pm_issue_type,
|
||||
issue_tag_ids: [],
|
||||
assigner_ids: [],
|
||||
attachment_ids: [],
|
||||
receivers_login: []
|
||||
)
|
||||
end
|
||||
end
|
||||
2
app/helpers/pm/issues_helper.rb
Normal file
2
app/helpers/pm/issues_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Pm::IssuesHelper
|
||||
end
|
||||
2
app/helpers/pm/journals_helper.rb
Normal file
2
app/helpers/pm/journals_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Pm::JournalsHelper
|
||||
end
|
||||
@@ -36,6 +36,7 @@
|
||||
# blockchain_token_num :integer
|
||||
# pm_project_id :integer
|
||||
# pm_sprint_id :integer
|
||||
# pm_issue_type :integer
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
|
||||
@@ -31,9 +31,10 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||
@receivers_login = params[:receivers_login]
|
||||
@pm_project_id = params[:pm_project_id]
|
||||
@pm_sprint_id = params[:pm_sprint_id]
|
||||
@pm_issue_type = params[:pm_issue_type]
|
||||
end
|
||||
|
||||
def call
|
||||
def call
|
||||
raise Error, errors.full_messages.join(", ") unless valid?
|
||||
ActiveRecord::Base.transaction do
|
||||
check_issue_status(status_id)
|
||||
@@ -48,7 +49,6 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||
load_attachments(attachment_ids) unless attachment_ids.blank?
|
||||
load_issue_tags(issue_tag_ids) unless issue_tag_ids.blank?
|
||||
load_atme_receivers(receivers_login) unless receivers_login.blank?
|
||||
|
||||
try_lock("Api::V1::Issues::CreateService:#{project.id}") # 开始写数据,加锁
|
||||
@created_issue = Issue.new(issue_attributes)
|
||||
build_author_participants
|
||||
@@ -61,6 +61,7 @@ class Api::V1::Issues::CreateService < ApplicationService
|
||||
@created_issue.issue_tags = @issue_tags unless issue_tag_ids.blank?
|
||||
@created_issue.pm_project_id = @pm_project_id
|
||||
@created_issue.pm_sprint_id = @pm_sprint_id
|
||||
@created_issue.pm_issue_type = @pm_issue_type
|
||||
@created_issue.issue_tags_value = @issue_tags.order("id asc").pluck(:id).join(",") unless issue_tag_ids.blank?
|
||||
@created_issue.save!
|
||||
|
||||
|
||||
@@ -792,6 +792,11 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :pm do
|
||||
resource :issues
|
||||
resource :journals
|
||||
end
|
||||
|
||||
namespace :admins do
|
||||
mount Sidekiq::Web => '/sidekiq'
|
||||
get '/', to: 'dashboards#index'
|
||||
|
||||
@@ -56,8 +56,7 @@ defaults format: :json do
|
||||
end
|
||||
end
|
||||
|
||||
resources :pm_issues
|
||||
|
||||
|
||||
scope module: :issues do
|
||||
resources :issue_tags, except: [:new, :edit] do
|
||||
collection do
|
||||
|
||||
5
db/migrate/20231031070603_add_pm_issue_type_to_issues.rb
Normal file
5
db/migrate/20231031070603_add_pm_issue_type_to_issues.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class AddPmIssueTypeToIssues < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :issues, :pm_issue_type, :integer
|
||||
end
|
||||
end
|
||||
5
spec/controllers/pm/issues_controller_spec.rb
Normal file
5
spec/controllers/pm/issues_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Pm::IssuesController, type: :controller do
|
||||
|
||||
end
|
||||
5
spec/controllers/pm/journals_controller_spec.rb
Normal file
5
spec/controllers/pm/journals_controller_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Pm::JournalsController, type: :controller do
|
||||
|
||||
end
|
||||
15
spec/helpers/pm/issues_helper_spec.rb
Normal file
15
spec/helpers/pm/issues_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Pm::IssuesHelper. For example:
|
||||
#
|
||||
# describe Pm::IssuesHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Pm::IssuesHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
15
spec/helpers/pm/journals_helper_spec.rb
Normal file
15
spec/helpers/pm/journals_helper_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the Pm::JournalsHelper. For example:
|
||||
#
|
||||
# describe Pm::JournalsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
RSpec.describe Pm::JournalsHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
||||
Reference in New Issue
Block a user