From eaa5919cc06c5338140732df6b7f9bd2426a1d91 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 27 Dec 2019 16:05:13 +0800 Subject: [PATCH] =?UTF-8?q?issue=E7=9A=84=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 151 +++++++++++++++++- app/controllers/journals_controller.rb | 73 +++++++++ app/helpers/issues_helper.rb | 19 +++ app/models/issue.rb | 47 +++--- app/models/journal.rb | 72 ++++++++- app/views/issues/_journal_item.json.jbuilder | 3 - app/views/issues/commit_issues.json.jbuilder | 4 + app/views/issues/copy.json.jbuilder | 8 + app/views/issues/edit.json.jbuilder | 5 +- app/views/issues/index.json.jbuilder | 27 ++++ app/views/issues/index.xlsx.axlsx | 13 ++ app/views/issues/index_chosen.json.jbuilder | 2 + app/views/issues/show.json.jbuilder | 7 +- .../journals/_journal_item.json.jbuilder | 15 ++ app/views/journals/index.json.jbuilder | 8 + config/locales/zh-CN.yml | 20 ++- config/routes.rb | 14 +- 17 files changed, 447 insertions(+), 41 deletions(-) create mode 100644 app/controllers/journals_controller.rb delete mode 100644 app/views/issues/_journal_item.json.jbuilder create mode 100644 app/views/issues/commit_issues.json.jbuilder create mode 100644 app/views/issues/copy.json.jbuilder create mode 100644 app/views/issues/index.json.jbuilder create mode 100644 app/views/issues/index.xlsx.axlsx create mode 100644 app/views/issues/index_chosen.json.jbuilder create mode 100644 app/views/journals/_journal_item.json.jbuilder create mode 100644 app/views/journals/index.json.jbuilder diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index a11662af4..848838c71 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -1,12 +1,116 @@ class IssuesController < ApplicationController before_action :require_login before_action :set_project - before_action :check_project_public, only: [:index ,:show] - before_action :check_issue_permission, except: [:index, :show] - before_action :set_issue, only: [:edit, :update, :destroy, :show] + before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen] + before_action :check_issue_permission, except: [:index, :show, :copy, :index_chosen] + before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :index_chosen] def index + issues = @project.issues.includes(:user,:tracker, :issue_tag, :version, :issue_status, :journals) + issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user)) + @all_issues_size = issues.size + @open_issues_size = issues.where.not(status_id: 5).size + @close_issues_size = issues.where(status_id: 5).size + @assign_to_me_size = issues.where(assigned_to_id: current_user&.id).size + @my_published_size = issues.where(author_id: current_user&.id).size + + status_type = params[:status_type].to_s #issue状态的选择 + search_name = params[:search].to_s + start_time = params[:start_date] + end_time = params[:due_date] + + if status_type.to_s == "1" #表示开启中的 + issues = issues.where.not(status_id: 5) + elsif status_type.to_s == "2" #表示关闭中的 + issues = issues.where(status_id: 5) + end + + if search_name.present? + issues = issues.where("subject like ?", "%#{search_name}%") + end + + if start_time&.present? || end_time&.present? + issues = issues.where("start_date between ? and ?",start_time&.present? ? start_time.to_date : Time.now.to_date, end_time&.present? ? end_time.to_date : Time.now.to_date) + end + + issues = issues.where(author_id: params[:author_id]) if params[:author_id].present? + issues = issues.where(assigned_to_id: params[:assigned_to_id]) if params[:assigned_to_id].present? + issues = issues.where(tracker_id: params[:tracker_id]) if params[:tracker_id].present? + issues = issues.where(status_id: params[:status_id]) if params[:status_id].present? + issues = issues.where(priority_id: params[:priority_id]) if params[:priority_id].present? + issues = issues.where(fixed_version_id: params[:fixed_version_id]) if params[:fixed_version_id].present? + issues = issues.where(done_ratio: params[:done_ratio].to_i) if params[:done_ratio].present? + + order_type = params[:order_type] || "desc" #或者"asc" + order_name = params[:order_name] || "created_on" #或者"updated_on" + + @page = params[:page] + @limit = params[:limit] || "15" + @issues = issues.order("#{order_name} #{order_type}") + @issues_size = issues.size + @issues = issues.order("#{order_name} #{order_type}").page(@page).per(@limit) + + respond_to do |format| + format.json + format.xlsx{ + set_export_cookies + export_issues(@issues) + export_name = "#{@project.name}_issues列表_#{Time.now.strftime('%Y%m%d_%H%M%S')}" + render xlsx: "#{export_name.strip}",template: "issues/index.xlsx.axlsx",locals: {table_columns:@table_columns,issues:@export_issues} + } + end + end + + def index_chosen + @issue_chosen = issue_left_chosen(@project, nil) + end + + def commit_issues + issues = @project.issues.includes(:user,:tracker) + issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user)) + @all_issues_size = issues.size + @open_issues_size = issues.where.not(status_id: 5).size + @close_issues_size = issues.where(status_id: 5).size + + status_type = params[:status_type].to_s + + if status_type.to_s == "1" #表示开启中的 + issues = issues.where.not(status_id: 5) + elsif status_type.to_s == "2" #表示关闭中的 + issues = issues.where(status_id: 5) + end + + @commit_issues = [] + total_commit_issues = { + name: "合计", + user_login: nil, + all_count: issues.size, + trackers: trackers_size(issues) + } + @commit_issues.push(total_commit_issues) + + members = issues.pluck(:assigned_to_id).uniq + members.each do |m| + user = User.select(:id, :login, :firstname, :lastname).find(m) + user_issues = issues.where(assigned_to_id: m) #指派给 + member_params = { + name: user.try(:show_real_name), + user_login: user.try(:login), + all_count: issues.size, + trackers: trackers_size(user_issues) + } + @commit_issues.push(member_params) + end + + un_assign = issues.where(assigned_to_id: nil) + total_commit_issues = { + name: "未指派", + user_login: nil, + all_count: un_assign.size, + trackers: trackers_size(un_assign) + } + @commit_issues.push(total_commit_issues) end @@ -75,7 +179,8 @@ class IssuesController < ApplicationController start_date: params[:start_date].to_s.to_date, due_date: params[:due_date].to_s.to_date, estimated_hours: params[:estimated_hours], - done_ratio: params[:done_ratio] + done_ratio: params[:done_ratio], + closed_on: (params[:status_id].to_i == 5) ? Time.now : nil } if @issue.update_attributes(issue_params) @@ -115,7 +220,6 @@ class IssuesController < ApplicationController @issue_attachments = @issue.attachments @issue_user = @issue.user @issue_assign_to = @issue.get_assign_user - @journals = @issue.journals.journal_includes.order("created_on desc") end def destroy @@ -124,9 +228,16 @@ class IssuesController < ApplicationController else normal_status(-1, "删除失败") end - end + def copy + @new_issue = @issue.dup + if @new_issue.save + @status = 1 + else + @status = -1 + end + end private def set_project @@ -223,7 +334,7 @@ class IssuesController < ApplicationController if issue_done_ratio.size > 0 issue_done_ratio.each do |t| is_chosen = (t == issue_info[8].to_s) ? "1" : "0" - new_issue = {ratio: (t.to_s + "%"), is_chosen: is_chosen} + new_issue = {id:t.to_i, ratio: (t.to_s + "%"), is_chosen: is_chosen} new_done_info.push(new_issue) end end @@ -242,4 +353,30 @@ class IssuesController < ApplicationController } end + + def export_issues(issues) + @table_columns = %w(ID 类型 标题 描述 状态 指派给 优先级 发布人 创建时间 里程碑 开始时间 截止时间 完成度) + @export_issues = [] + issues.each do |i| + issue_array = [i.id, i.tracker.try(:name), i.subject, i.description, i.issue_status.try(:name),i.get_assign_user.try(:show_real_name), + i.issue_tag.try(:title), i.user.try(:show_real_name), format_time(i.created_on), i.version.try(:title), i.start_date.to_s, i.due_date.to_s, i.done_ratio.to_s + "%" ] + + @export_issues.push(issue_array) + + end + end + + def trackers_size(issues) + trackers_id = Tracker.pluck(:id,:name) + tracker_array = [] + trackers_id.each do |t| + tracker_info = { + id: t[0], + name: t[1], + issues_count: issues.issues_count(t[0]) + } + tracker_array.push(tracker_info) + end + tracker_array + end end \ No newline at end of file diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb new file mode 100644 index 000000000..02096be17 --- /dev/null +++ b/app/controllers/journals_controller.rb @@ -0,0 +1,73 @@ +class JournalsController < ApplicationController + before_action :require_login + before_action :set_issue + before_action :check_issue_permission + + def index + @page = params[:page] || 1 + @limit = params[:limit] || 10 + journals = @issue.journals.journal_includes.order("created_on desc") + @journals_size = journals.size + @journals = journals.parent_journals.page(@page).per(@limit) + end + + def create + notes = params[:content] + if notes.blank? + normal_status(-1, "评论内容不能为空") + else + journal_params = { + journalized_id: @issue.id , + journalized_type: "Issue", + user_id: current_user.id , + notes: notes.to_s.strip, + parent_id: params[:parent_id] + } + journal = Journal.new journal_params + if journal.save + if params[:attachment_ids].present? + params[:attachment_ids].each do |id| + attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id) + unless attachment.blank? + attachment.container = journal + attachment.save + end + end + end + normal_status(0, "评论成功") + else + normal_status(-1, "评论失败") + end + end + end + + def destroy + journal = Journal.find(params[:id]) + if journal.present? + if journal.destroy #如果有子评论,子评论删除吗? + normal_status(0, "评论删除成功") + else + normal_status(-1, "评论删除失败") + end + else + normal_status(-1, "评论不存在") + end + end + + + private + + def set_issue + @issue = Issue.find_by_id(params[:issue_id]) + unless @issue.present? + normal_status(-1, "标签不存在") + end + end + + def check_issue_permission + @project = @issue.project + unless @project.member?(current_user) || current_user.admin? + normal_status(-1, "您没有权限") + end + end +end \ No newline at end of file diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index f742d5af8..102c0a17e 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -20,4 +20,23 @@ module IssuesHelper end + def children_content(journal_id) + children_journals = Journal.children_journals(journal_id).journal_includes + children_journal_content = [] + if children_journals.present? + children_journals.each do |j| + journal_info = { + id: j.id, + content: j.try(:notes), + created_at: time_from_now(j.created_on), + user_name: j.user.try(:show_real_name), + user_login: j.user.try(:login), + user_pictrue: url_to_avatar(j.user) + } + children_journal_content.push(journal_info) + end + end + children_journal_content + end + end \ No newline at end of file diff --git a/app/models/issue.rb b/app/models/issue.rb index 8f8ccceea..5d92f246e 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1,45 +1,52 @@ class Issue < ApplicationRecord belongs_to :project belongs_to :tracker - belongs_to :issue_tag, foreign_key: :priority_id + belongs_to :issue_tag, foreign_key: :priority_id,optional: true belongs_to :version, foreign_key: :fixed_version_id,optional: true belongs_to :user,optional: true, foreign_key: :author_id belongs_to :issue_status, foreign_key: :status_id,optional: true has_many :commit_issues has_many :attachments, as: :container, dependent: :destroy has_many :memos - has_many :journals + has_many :journals, :as => :journalized, :dependent => :destroy has_many :journal_details, through: :journals scope :issue_includes, ->{includes(:user)} + # scope :issues_count, lambda{|tracker_id| where(tracker_id: tracker_id).size} + def get_assign_user User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.assigned_to_id) end def create_journal_detail(change_files, issue_files, issue_file_ids) - journal = Journal.where(journalized_id: self.id, journalized_type: "Issue", user_id: self.author_id, notes: [nil,""]) - if journal.present? - journal.update_all(created_on: Time.now) - journal = journal.last - else - journal_params = { - journalized_id: self.id, journalized_type: "Issue", user_id: self.author_id - } - journal = Journal.new journal_params - journal.save - end - if change_files - journal.journal_details.create(property: "attachment", prop_key: "#{issue_files.size}", old_value: issue_file_ids, value: issue_files) - end + journal_params = { + journalized_id: self.id, journalized_type: "Issue", user_id: self.author_id + } + journal = Journal.new journal_params - change_values = %w(subject description is_private assigned_to_id tracker_id status_id priority_id fixed_version_id start_date due_date estimated_hours done_ratio) - change_values.each do |at| - if self.send("saved_change_to_#{at}?") - journal.journal_details.create(property: "attr", prop_key: "#{at}", old_value: self.send("#{at}_before_last_save"), value: self.send(at)) + if journal.save + if change_files + old_attachment_names = self.attachments.select(:filename,:id).where(id: issue_file_ids).pluck(:filename).join(",") + new_attachment_name = self.attachments.select(:filename,:id).where(id: issue_files).pluck(:filename).join(",") + journal.journal_details.create(property: "attachment", prop_key: "#{issue_files.size}", old_value: old_attachment_names, value: new_attachment_name) + end + change_values = %w(subject description is_private assigned_to_id tracker_id status_id priority_id fixed_version_id start_date due_date estimated_hours done_ratio) + change_values.each do |at| + if self.send("saved_change_to_#{at}?") + journal.journal_details.create(property: "attr", prop_key: "#{at}", old_value: self.send("#{at}_before_last_save"), value: self.send(at)) + end end end end + def get_journals_size + journals.size + end + + def self.issues_count(tracker_id) + includes(:trakcer).where(tracker_id: tracker_id).size + end + end \ No newline at end of file diff --git a/app/models/journal.rb b/app/models/journal.rb index dd42bc743..b3f078ec3 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -1,7 +1,75 @@ class Journal < ApplicationRecord belongs_to :user - belongs_to :issue, foreign_key: :journalized_id + belongs_to :issue, foreign_key: :journalized_id, :touch => true has_many :journal_details, :dependent => :delete_all + has_many :attachments, as: :container, dependent: :destroy + + scope :journal_includes, ->{includes(:user, :journal_details, :attachments)} + scope :parent_journals, ->{where(parent_id: nil)} + scope :children_journals, lambda{|journal_id| where(parent_id: journal_id)} + + + def is_journal_detail? + self.notes.blank? && self.journal_details.present? + end + + def journal_content + send_details = [] + if self.is_journal_detail? + details = self.journal_details.select(:property, :prop_key, :old_value, :value).pluck(:property, :prop_key, :old_value, :value) + if details.size > 0 + details.each do |de| + if de[0] == "attr" + content = "" + else + content = "附件" + end + old_value = de[2] + value = de[3] + if de[1].to_i > 0 + prop_name = "" + else + prop_name = I18n.t("journal_detail.#{de[1]}") + case de[1] + when "is_private" + old_value = I18n.t("journal_detail.#{de[2]}") + value = I18n.t("journal_detail.#{de[3]}") + when "assigned_to_id" + u = User.select(:id, :login, :lastname, :firstname) + old_value = u.find(de[2]).try(:show_real_name) + value = u.find(de[3]).try(:show_real_name) + when "tracker_id" + t = Tracker.select(:id, :name) + old_value = t.find(de[2]).try(:name) + value = t.find(de[3]).try(:name) + when "status_id" + t = IssueStatus.select(:id, :name) + old_value = t.find(de[2]).try(:name) + value = t.find(de[3]).try(:name) + when "priority_id" + t = IssueTag.select(:id, :title) + old_value = t.find(de[2]).try(:title) + value = t.find(de[3]).try(:title) + when "fixed_version_id" + t = Version.select(:id, :title) + old_value = t.find(de[2]).try(:title) + value = t.find(de[3]).try(:title) + else + old_value = de[2] + value = de[3] + end + end + prop_hash = { + detail: (content + prop_name), + old_value: old_value, + value: value + } + send_details.push(prop_hash) + end + end + end + send_details + end + - scope :journal_includes, ->{includes(:user, :journal_details)} end \ No newline at end of file diff --git a/app/views/issues/_journal_item.json.jbuilder b/app/views/issues/_journal_item.json.jbuilder deleted file mode 100644 index 24c3d3356..000000000 --- a/app/views/issues/_journal_item.json.jbuilder +++ /dev/null @@ -1,3 +0,0 @@ -json.issue_id journal.journalized_id -json.notes journal.try(:notes) -json.created_at time_from_now(journal.created_on) \ No newline at end of file diff --git a/app/views/issues/commit_issues.json.jbuilder b/app/views/issues/commit_issues.json.jbuilder new file mode 100644 index 000000000..36becb175 --- /dev/null +++ b/app/views/issues/commit_issues.json.jbuilder @@ -0,0 +1,4 @@ +json.all_count @all_issues_size +json.open_count @open_issues_size +json.close_count @close_issues_size +json.commit_issues @commit_issues \ No newline at end of file diff --git a/app/views/issues/copy.json.jbuilder b/app/views/issues/copy.json.jbuilder new file mode 100644 index 000000000..13db86a1a --- /dev/null +++ b/app/views/issues/copy.json.jbuilder @@ -0,0 +1,8 @@ +if @status > 0 + json.status 0 + json.message "复制成功" + json.issue_id @new_issue.id +else + json.status -1 + json.message "复制失败" +end \ No newline at end of file diff --git a/app/views/issues/edit.json.jbuilder b/app/views/issues/edit.json.jbuilder index 8de9d1576..eb9dc880f 100644 --- a/app/views/issues/edit.json.jbuilder +++ b/app/views/issues/edit.json.jbuilder @@ -1,10 +1,11 @@ json.partial! "commons/success" json.extract! @issue, :id,:subject,:description,:is_private,:assigned_to_id,:tracker_id,:status_id,:priority_id,:fixed_version_id, - :start_date,:due_date,:estimated_hours,:done_ratio + :start_date,:due_date,:estimated_hours +json.done_ratio @issue.done_ratio.to_s + "%" json.issue_chosen @issue_chosen json.attachments do json.array! @issue_attachments do |attachment| - json.partial! "attachments/attachment", attachment: attachment + json.partial! "attachments/attachment_simple", locals: {attachment: attachment} end end diff --git a/app/views/issues/index.json.jbuilder b/app/views/issues/index.json.jbuilder new file mode 100644 index 000000000..46335c476 --- /dev/null +++ b/app/views/issues/index.json.jbuilder @@ -0,0 +1,27 @@ +json.partial! "commons/success" +json.all_count @all_issues_size +json.open_count @open_issues_size +json.close_count @close_issues_size +json.assign_me_count @assign_to_me_size +json.my_published_count @my_published_size +json.search_count @issues_size +json.limit @limit + +json.issues do + json.array! @issues.to_a do |issue| + json.id issue.id + json.name issue.subject + json.created_at format_time(issue.created_on) + json.updated_at format_time(issue.updated_on) + json.assign_user_name issue.get_assign_user.try(:show_real_name) + json.assign_user_login issue.get_assign_user.try(:login) + json.author_name issue.user.try(:show_real_name) + json.author_login issue.user.try(:login) + json.tracker issue.tracker.try(:name) + json.issue_status issue.issue_status.try(:name) + json.priority issue.issue_tag.try(:title) + json.version issue.version.try(:title) + json.done_ratio issue.done_ratio.to_s + "%" + json.journals_count issue.get_journals_size + end +end diff --git a/app/views/issues/index.xlsx.axlsx b/app/views/issues/index.xlsx.axlsx new file mode 100644 index 000000000..fd8f7b120 --- /dev/null +++ b/app/views/issues/index.xlsx.axlsx @@ -0,0 +1,13 @@ +wb = xlsx_package.workbook +wb.styles do |s| + sz_all = s.add_style :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center, :vertical => :center} + blue_cell = s.add_style :bg_color => "FAEBDC", :sz => 10,:height => 20,:b => true, :border => { :style => :thin, :color =>"000000" },:alignment => {wrap_text: true,:horizontal => :center,:vertical => :center} + + wb.add_worksheet(:name => "issues列表") do |sheet| + sheet.add_row table_columns, :style => blue_cell, height: 30 + sheet.column_info.first.width = 12 + issues.each do |user| + sheet.add_row user, :style => sz_all #用户id + end #each_widh_index + end #add_worksheet +end \ No newline at end of file diff --git a/app/views/issues/index_chosen.json.jbuilder b/app/views/issues/index_chosen.json.jbuilder new file mode 100644 index 000000000..1f442f713 --- /dev/null +++ b/app/views/issues/index_chosen.json.jbuilder @@ -0,0 +1,2 @@ +json.partial! "commons/success" +json.issue_chosen @issue_chosen \ No newline at end of file diff --git a/app/views/issues/show.json.jbuilder b/app/views/issues/show.json.jbuilder index cd1442a5f..1416e91e5 100644 --- a/app/views/issues/show.json.jbuilder +++ b/app/views/issues/show.json.jbuilder @@ -4,6 +4,7 @@ json.created_at format_time(@issue.created_on) json.assign_user_name @issue_assign_to.try(:show_real_name) json.assign_user_login @issue_assign_to.try(:login) json.author_name @issue_user.try(:show_real_name) +json.author_login @issue_user.try(:login) json.author_picture url_to_avatar(@issue_user) json.tracker @issue.tracker.try(:name) json.issue_status @issue.issue_status.try(:name) @@ -16,10 +17,6 @@ json.attachments do end end -json.issue_comments do - json.array! @journals do |journal| - json.partial! "issues/journal_item", journal: journal - end -end + diff --git a/app/views/journals/_journal_item.json.jbuilder b/app/views/journals/_journal_item.json.jbuilder new file mode 100644 index 000000000..3c0de5453 --- /dev/null +++ b/app/views/journals/_journal_item.json.jbuilder @@ -0,0 +1,15 @@ +json.id journal.id +json.user_name journal.user.try(:show_real_name) +json.user_login journal.user.try(:login) +json.user_picture url_to_avatar(journal.user) +json.is_journal_detail journal.is_journal_detail? #判断是否修改了参数而添加的回复内容 +json.content journal.try(:notes) +json.children_journals children_content(journal.id) +json.journal_details journal.journal_content +json.created_at time_from_now(journal.created_on) + +json.attachments do + json.array! journal.attachments do |attachment| + json.partial! "attachments/attachment_simple", locals: {attachment: attachment} + end +end \ No newline at end of file diff --git a/app/views/journals/index.json.jbuilder b/app/views/journals/index.json.jbuilder new file mode 100644 index 000000000..2485e72bd --- /dev/null +++ b/app/views/journals/index.json.jbuilder @@ -0,0 +1,8 @@ +json.partial! "commons/success" +json.limit @limit +json.journals_count @journals_size +json.issue_journals do + json.array! @journals do |journal| + json.partial! "journals/journal_item", journal: journal + end +end \ No newline at end of file diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index f11271ff5..a8d5d1583 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -13,4 +13,22 @@ zh-CN: 'pending': '待审批' 'processed': '已审批' 'refused': '已拒绝' - 'agreed': '已同意' \ No newline at end of file + 'agreed': '已同意' + + journal_detail: + subject: 主题 + description: 描述 + is_private: 私有 + assigned_to_id: 指派给 + tracker_id: 类型 + status_id: 状态 + priority_id: 标签 + fixed_version_id: 里程碑 + start_date: 开始日期 + due_date: 结束日期 + estimated_hours: 工时 + done_ratio: 完成度 + t: 是 + f: 否 + true: 是 + false: 否 diff --git a/config/routes.rb b/config/routes.rb index 707d6f502..6dd2cfa33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,13 +27,25 @@ Rails.application.routes.draw do put 'commons/unhidden', to: 'commons#unhidden' delete 'commons/delete', to: 'commons#delete' + resources :issues, except: [:index, :new,:create, :update, :edit, :destroy] do + resources :journals, only: [:index, :create, :destroy] + end + resources :project_categories, only: [:index, :show] resources :project_languages, only: [:index, :show] resources :ignores, only: [:index, :show] resources :licenses, only: [:index, :show] resources :projects, only: [:index, :create, :show] do - resources :issues + resources :issues do + collection do + get :commit_issues + end + member do + post :copy + get :index_chosen + end + end resources :issue_tags, only: [:create, :edit, :update, :destroy, :index] resources :versions do member do