Working on assign to me, status change and link to new issue

This commit is contained in:
Alexander Meindl 2018-02-17 11:34:26 +01:00
parent 9f1ab50170
commit 40993087d8
27 changed files with 225 additions and 24 deletions

View File

@ -4,9 +4,13 @@ Changelog
2.0.9
+++++
- Update bootstrap library to 4.0.0
- Updated bootstrap library to 4.0.0
- Drop angular_gantt library
- enables deface overwrite directory for all installed plugins (not only additionals)
- Updated d3plus to version v2.0.0-alpha.16
- add "Assign to me" to issues
- add "Status on sidebar" for issues
- add link to create new issue on user profile
2.0.8
+++++

View File

@ -0,0 +1,46 @@
class AdditionalsAssignToMeController < ApplicationController
before_action :find_issue
helper :additionals_issues
def update
old_user = @issue.assigned_to
user_in_project = @project.assignable_users.detect { |u| u.id == User.current.id }
if old_user == User.current || user_in_project.nil?
redirect_to(issue_path(@issue))
return
end
@issue.assigned_to = User.current
@issue.save
new_journal = @issue.init_journal(User.current)
new_journal.save!
last_journal = @issue.journals.visible.order('created_on').last
JournalDetail.new(property: 'attr',
prop_key: 'user',
old_value: old_user,
value: User.current.name,
journal: new_journal).save!
if last_journal.nil?
redirect_to(issue_path(@issue))
return
end
last_journal = @issue.journals.visible.order('created_on').last
redirect_to "#{issue_path(@issue)}#change-#{last_journal.id}"
end
private
def find_issue
@issue = Issue.find_by(id: params[:issue_id].to_i)
raise Unauthorized unless @issue.visible? && @issue.editable?
@project = @issue.project
rescue ActiveRecord::RecordNotFound
render_404
end
end

View File

@ -0,0 +1,48 @@
class AdditionalsChangeStatusController < ApplicationController
before_action :find_issue
helper :additionals_issues
def update
issue_old_status = @issue.status.name
new_status_id = params[:new_status_id].to_i
allowed_status = @issue.new_statuses_allowed_to(User.current)
.detect { |s| s.id == new_status_id }
if new_status_id < 1 || @issue.status_id == new_status_id || allowed_status.nil?
redirect_to(issue_path(@issue))
return
end
@issue.status_id = new_status_id
@issue.save
new_journal = @issue.init_journal(User.current)
new_journal.save!
last_journal = @issue.journals.visible.order('created_on').last
JournalDetail.new(property: 'attr',
prop_key: 'status',
old_value: issue_old_status,
value: @issue.status.name,
journal: new_journal).save!
if last_journal.nil?
redirect_to(issue_path(@issue))
return
end
last_journal = @issue.journals.visible.order('created_on').last
redirect_to "#{issue_path(@issue)}#change-#{last_journal.id}"
end
private
def find_issue
@issue = Issue.find_by(id: params[:issue_id].to_i)
raise Unauthorized unless @issue.visible? && @issue.editable?
@project = @issue.project
rescue ActiveRecord::RecordNotFound
render_404
end
end

View File

@ -0,0 +1,5 @@
Deface::Override.new virtual_path: 'issues/_action_menu',
name: 'add-issue-assign-to-me',
insert_bottom: 'div.contextual',
original: 'c0a30490bb9ac5c5644e674319f17e40c57034d8',
partial: 'issues/additionals_action_menu'

View File

@ -3,3 +3,8 @@ Deface::Override.new virtual_path: 'users/show',
insert_top: 'div.splitcontentleft ul:first-child',
original: 'aff8d775275e3f33cc45d72b8e2896144be4beff',
partial: 'hooks/view_users_show'
Deface::Override.new virtual_path: 'users/show',
name: 'user-contextual-hook',
insert_bottom: 'div.contextual',
original: '9d6a7ad6ba0addc68c6b4f6c3b868511bc8eb542',
partial: 'hooks/view_users_contextual'

View File

@ -11,6 +11,15 @@ h3 = l(:label_setting_plural)
.info = t(:top_rules_help)
br
p
= content_tag(:label, l(:label_new_issue_on_profile))
= check_box_tag 'settings[new_issue_on_profile]', 1, @settings[:new_issue_on_profile].to_i == 1
p
= content_tag(:label, l(:label_issue_assign_to_me))
= check_box_tag 'settings[issue_assign_to_me]', 1, @settings[:issue_assign_to_me].to_i == 1
p
= content_tag(:label, l(:label_issue_change_status_in_sidebar))
= check_box_tag 'settings[issue_change_status_in_sidebar]', 1, @settings[:issue_change_status_in_sidebar].to_i == 1
p
= content_tag(:label, l(:label_issue_autowatch_involved))
= check_box_tag 'settings[issue_autowatch_involved]', 1, @settings[:issue_autowatch_involved].to_i == 1

View File

@ -0,0 +1 @@
= call_hook(:view_users_show_contextual, user: @user)

View File

@ -0,0 +1,4 @@
- if User.current.logged? && @issue.editable? && Additionals.setting?(:issue_assign_to_me) && \
@issue.assigned_to_id != User.current.id && @project.assignable_users.detect { |u| u.id == User.current.id }
= link_to(font_awesome_icon('far_user-circle', post_text: l(:button_assign_to_me)),
issue_assign_to_me_path(@issue), method: :put)

View File

@ -0,0 +1,16 @@
- if Additionals.setting?(:issue_change_status_in_sidebar) && @issue && User.current.allowed_to?(:edit_issues, @project)
- statuses = @issue.new_statuses_allowed_to(User.current)
- if statuses.present?
h3 = l(:label_issue_change_status)
ul.issue-status-change-sidebar
- statuses.each do |s|
- if s != @issue.status
li
- if s.is_closed?
= link_to(font_awesome_icon('fas_caret-square-left', post_text: s.name),
issue_change_status_path(@issue, new_status_id: s.id), method: :put)
- else
= link_to(font_awesome_icon('far_caret-square-left', post_text: s.name),
issue_change_status_path(@issue, new_status_id: s.id), method: :put)
h3 = l(:label_planning)

View File

@ -0,0 +1,4 @@
- if Additionals.setting?(:new_issue_on_profile) && \
User.current.allowed_to?(:edit_issues, nil, global: true) && \
user.allowed_to?(:edit_issues, nil, global: true)
= link_to(l(:label_issue_new), new_issue_path('issue[assigned_to_id]' => user.id), class: 'icon icon-add')

7
assets/javascripts/d3plus.full.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -18,6 +18,7 @@ de:
issue_changes_not_allowed: "Dieses Ticket ist geschlossenes und Sie besitzen keine Berechtigung es zu ändern."
account_login_info: "Dieser Text wir auf der Anmeldeseite angezeigt, um z.B. Informationen für die Anmeldung oder Registrierung zu hinterlegen. Diese Einstellung ist projektübergreifend und ist in allen Projekten aktiv."
add_go_to_top_info: 'Bei langen Seiten ist es hilfreich, wenn ein Link zur Verfügung steht, mit dem man zum Seitenanfang springen kann.'
button_assign_to_me: Mir zuweisen
custom_help_url_info_html: 'Diese URL wird für den <em>Hilfe</em> Eintrag im Topmenü verwendet. Um eine deutsche Hilfe zu benutzen, kann hier z.B. <a class="external" href="https://alphanodes.com/de/redmine-buch">https://alphanodes.com/de/redmine-buch</a> eingetragen werden. Wenn hier nichts eingetragen wird, wird die Standard URL verwendet.'
disabled_modules_info: "Module, die nicht zur Auswahl innerhalb der Projekte zur Verfügung stehen sollen. Sind in bestehenden Projekten schon diese Module aktiviert worden, werden die Einstellungen für diese Projekte erst nach erneuten Abspeichern der jeweiligen Projekteinstellungen aktiv."
errors_invalid_icon_format: ist ein ungültiger Font-Awesome Code
@ -70,7 +71,9 @@ de:
label_hour: Stunde
label_icon_color: Symbolfarbe
label_invisible_captcha: SPAM Schutz bei Registrierung
label_issue_assign_to_me: Ticket "Mir zuweisen" anzeigen
label_issue_autowatch_involved: Involvierte Benutzer automatisch als Beobachter hinzufügen
label_issue_change_status_in_sidebar: Ticketstatus über Sidebar
label_last_year: voriges Jahr
label_legacy_smiley_support: Smiley/Emoji Support
label_macro_na: N/V
@ -150,3 +153,6 @@ de:
wiki_pdf_header_info: Dieser Textblock wir auf der ersten Seite vor dem eigentlichen Inhalt der Wiki Seite in der PDF Ansicht angezeigt. Die Makros sind hier nur eingeschränkt einsetzbar.
wiki_pdf_remove_attachments_info: Wenn aktiv, werden die an der Wiki Seite angehängten Dateien nicht in der PDF Ansicht angezeigt.
wiki_pdf_remove_title_info: Wenn aktiv, wird der Wiki Titel nicht in der PDF Ansicht angezeigt.
label_issue_change_status: Status ändern
label_planning: Planung
label_new_issue_on_profile: Neues Ticket auf Benutzerprofil

View File

@ -18,6 +18,7 @@ en:
issue_changes_not_allowed: "This issue is closed, you do not have any right to change it."
account_login_info: "This text message will be shown at the login page and should be used for registration information. These settings are active in all projects."
add_go_to_top_info: 'If you have a lot of long pages, it is helpful to add a jump to top link.'
button_assign_to_me: Assign to me
custom_help_url_info_html: "If no URL is specified, the default help URL will be used."
disabled_modules_info: "Modules which should not be available for selection within the projects. If these modules already activated in existing projects, you will have to change and re-save the respective project settings first."
errors_invalid_icon_format: is an invalid font-awesome code
@ -70,7 +71,9 @@ en:
label_hour: hour
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: Add involved users as watcher automatically
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: previous year
label_legacy_smiley_support: Legacy smiley/emoji support
label_macro_na: N/A
@ -150,3 +153,6 @@ en:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

View File

@ -18,6 +18,7 @@ fr:
issue_changes_not_allowed: "Ce issue est clos, vous n'avez pas le droit de le modifier."
account_login_info: "Ce message texte sera affiché à la page de connexion et devrait être utilisé pour les informations d'inscription. Ces options sont actives dans tous les projets."
add_go_to_top_info: "Si vous avez beaucoup de pages longues, il est utile d'ajouter un saut au lien du haut."
button_assign_to_me: Assign to me
custom_help_url_info_html: "After changing this URL, you have to restart the application server to activate it. If no URL is specified, the default help URL will be used."
disabled_modules_info: "Modules which should not be available for selection within the projects. If these modules already activated in existing projects, you will have to change and re-save the respective project settings first."
errors_invalid_icon_format: is an invalid font-awesome code
@ -70,7 +71,9 @@ fr:
label_hour: Heure
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: Add involved users as watcher automatically
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: previous year
label_legacy_smiley_support: Legacy smiley/emoji support
label_macro_na: N/A
@ -150,3 +153,6 @@ fr:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

View File

@ -18,6 +18,7 @@ it:
issue_changes_not_allowed: "Questo issue è chiuso, non ha alcun diritto di modificarlo."
account_login_info: "This text message will be shown at the login page and should be used for registration information. These settings are active in all projects."
add_go_to_top_info: 'Se hai un sacco di pagine lunghe, è utile aggiungere un To top link principale.'
button_assign_to_me: Assign to me
custom_help_url_info_html: "After changing this URL, you have to restart the application server to activate it. If no URL is specified, the default help URL will be used."
disabled_modules_info: "Modules which should not be available for selection within the projects. If these modules already activated in existing projects, you will have to change and re-save the respective project settings first."
errors_invalid_icon_format: 'è un font-awesome codice non valido'
@ -70,7 +71,9 @@ it:
label_hour: ora
label_icon_color: Icon colore
label_invisible_captcha: Protezione SPAM per la pagina di registrazione
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: Add involved users as watcher automatically
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: l'anno scorso
label_legacy_smiley_support: Legacy smiley/emoji support
label_macro_na: N/A
@ -150,3 +153,6 @@ it:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

View File

@ -18,6 +18,7 @@ ja:
issue_changes_not_allowed: "This issue is closed, you do not have any right to change it."
account_login_info: "この文章は、ログイン画面で表示され、登録情報の掲載を目的にしています。これらの設定は全プロジェクトで有効です。"
add_go_to_top_info: '長いページが多い場合、「トップへ」のリンクは役立ちます。'
button_assign_to_me: Assign to me
custom_help_url_info_html: "このURLを変更した後、反映するためにウェブサーバを再起動しなければなりません。URLの指定がない場合、規程のヘルプURLが使用されます。"
disabled_modules_info: "プロジェクト内で選択させたくないモジュール。もしこのモジュールが既存のプロジェクトで既に有効な場合、設定変更した上で、ウェブサーバを再起動しなければなりません。"
errors_invalid_icon_format: is an invalid font-awesome code
@ -70,7 +71,9 @@ ja:
label_hour: hour
label_icon_color: Icon color
label_invisible_captcha: SPAM protection for registration
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: Add involved users as watcher automatically
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: previous year
label_legacy_smiley_support: Legacy smiley/emoji support
label_macro_na: N/A
@ -150,3 +153,6 @@ ja:
wiki_pdf_header_info: This text block will be displayed on the first page before the regular Wiki content in the PDF view. Macro use is very restricted, here.
wiki_pdf_remove_attachments_info: When active the attached Wiki files will not be displayed in PDF view.
wiki_pdf_remove_title_info: When active the Wiki title info will not be displayed in PDF view.
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

View File

@ -18,6 +18,7 @@
issue_changes_not_allowed: "議題已關閉,您無權修改該議題的內容。"
account_login_info: "在登入頁面顯示的註冊訊息。該選項是通用選項。"
add_go_to_top_info: "如果你有很長的頁面,建議增加 \"回到頁首\" 的按鈕。"
button_assign_to_me: Assign to me
custom_help_url_info_html: "修改連結後您必須重啟redmine。若未設定連結將使用預設的幫助連結。"
disabled_modules_info: "專案中無法選擇模組。如果這些模組已經在現有專案中啟用,必須先變更對應的專案設定。"
errors_invalid_icon_format: "無效的 font-awesome 代碼。"
@ -70,7 +71,9 @@
label_hour: 小時
label_icon_color: 圖示顏色
label_invisible_captcha: "註冊SPAM保護"
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: "自動設定參與者為監看者"
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: 去年
label_legacy_smiley_support: 支援表情符號
label_macro_na: N/A
@ -150,3 +153,6 @@
wiki_pdf_header_info: "該訊息將顯示在PDF第一頁頁首。此處macros指令支援有限。"
wiki_pdf_remove_attachments_info: "當啟用時Wiki附件將不會顯示在PDF中。"
wiki_pdf_remove_title_info: "當啟用時Wiki標題訊息不會顯示在PDF中"
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

View File

@ -18,6 +18,7 @@ zh:
issue_changes_not_allowed: "问题已关闭,您无权修改该问题的内容。"
account_login_info: "该文本信息将在登录页作为注册信息展现。该选项是全局选项。"
add_go_to_top_info: '如果您有很长的页面,添加"回到页首"的功能将非常有用。'
button_assign_to_me: Assign to me
custom_help_url_info_html: "在修改了 URL 后,您必须重启服务以激活该配置。若未指定 URL则使用默认的帮助 URL 地址。"
disabled_modules_info: "项目中无法选择模块。如果这些模块已经在现有项目中激活,则必须首先更改并重新保存响应的项目设置。"
errors_invalid_icon_format: 无效的 Font-awesome 代码。
@ -70,7 +71,9 @@ zh:
label_hour: 小时
label_icon_color: 图标颜色
label_invisible_captcha: SPAM protection for registration
label_issue_assign_to_me: Show "Assign to me" on issue
label_issue_autowatch_involved: Add involved users as watcher automatically
label_issue_change_status_in_sidebar: Issue status on sidebar
label_last_year: 去年
label_legacy_smiley_support: 表情符号支持
label_macro_na: N/A
@ -150,3 +153,6 @@ zh:
wiki_pdf_header_info: 该文本快将显示在 PDF 视图中的常规 WIKI 内容之前的第一页上。此处宏命令的使用非常有限。
wiki_pdf_remove_attachments_info: 当启用时WIKI 附件将不会显示在PDF视图中。
wiki_pdf_remove_title_info: 当启用时WIKI 标题信息将不会显示在PDF视图中。
label_issue_change_status: Change status
label_planning: Planning
label_new_issue_on_profile: New issue on user profile

9
config/routes.rb Normal file
View File

@ -0,0 +1,9 @@
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
# Don't create routes for repositories resources with only: []
# to not override Redmine's routes.
resources :issues, only: [] do
resource 'assign_to_me', only: %i[update], controller: 'additionals_assign_to_me'
resource 'change_status', only: %i[update], controller: 'additionals_change_status'
end

View File

@ -12,16 +12,19 @@ global_wiki_sidebar: ''
google_maps_api_key: ''
invisible_captcha: 0
issue_assign_to_x: ''
issue_assign_to_me: 0
issue_auto_assign_role: ''
issue_auto_assign_status: ''
issue_auto_assign: 0
issue_autowatch_involved: 0
issue_change_status_in_sidebar: 0
issue_close_with_open_children: 0
issue_current_user_status: 0
issue_status_change: 0
issue_status_x: ''
issue_status_y: ''
legacy_smiley_support: 0
new_issue_on_profile: 0
new_ticket_message: "Don't forget to define acceptance criteria!"
overview_bottom: ''
overview_right: ''

View File

@ -127,6 +127,9 @@ Features
* change issue author
* spam protection on registration form
* add involved issue users as watcher automatically
* create issue on user profile
* "assign to me" link on issue
* change issue state on sidebar
* configurable issue rules
* closing issue with open sub issues
@ -149,7 +152,7 @@ It provides :
* `bootstrap 4.0.0 <https://getbootstrap.com>`_
* `d3 3.5.16 <https://d3js.org/>`_
* `d3plus 1.9.8 <http://d3plus.org/>`_
* `d3plus v2.0.0-alpha.16 <https://d3plus.org/>`_
* `jQuery TagIt 2.0 <http://aehlke.github.io/tag-it/>`_
* `FontAwesome 5.0.6 <https://fontawesome.com/>`_
* `nvd3 1.8.6 <https://github.com/novus/nvd3>`_

View File

@ -5,7 +5,7 @@ module Additionals
class << self
def setup
incompatible_plugins(%w[redmine_tweaks
common_libraries
redmine_issue_control_panel
redmine_editauthor
redmine_changeauthor
redmine_auto_watch

View File

@ -265,7 +265,7 @@ module Additionals
def additionals_load_d3plus
additionals_include_js('d3.min') +
additionals_include_js('d3plus.min')
additionals_include_js('d3plus.full.min')
end
def additionals_load_tooltips

View File

@ -12,12 +12,14 @@ module Additionals
render_on(:view_issues_bulk_edit_details_bottom, partial: 'change_author_bulk')
render_on(:view_issues_form_details_bottom, partial: 'change_author')
render_on(:view_issues_new_top, partial: 'new_ticket_message')
render_on(:view_issues_sidebar_issues_bottom, partial: 'additionals_sidebar')
render_on(:view_issues_sidebar_queries_bottom, partial: 'additionals/global_sidebar')
render_on(:view_projects_show_right, partial: 'project_overview')
render_on(:view_projects_show_sidebar_bottom, partial: 'additionals/global_sidebar')
render_on(:view_welcome_index_right, partial: 'overview_right')
render_on(:view_my_account_preferences, partial: 'users/autowatch_involved_issue')
render_on(:view_users_form_preferences, partial: 'users/autowatch_involved_issue')
render_on(:view_users_show_contextual, partial: 'users/additionals_contextual')
def helper_issues_show_detail_after_setting(context = {})
d = context[:detail]

View File

@ -4,14 +4,14 @@ module Additionals
module Patches
module WikiControllerPatch
def self.included(base)
base.send(:include, InstanceMethodsForAdditionalsWikiController)
base.send(:include, InstanceMethods)
base.class_eval do
alias_method_chain :respond_to, :additionals
end
end
end
module InstanceMethodsForAdditionalsWikiController
module InstanceMethods
def respond_to_with_additionals(&block)
if @project && @content
if @_action_name == 'show'

View File

@ -0,0 +1,11 @@
require File.expand_path('../../test_helper', __FILE__)
class RoutingTest < Redmine::RoutingTest
def test_issue_assign_to_me
should_route 'PUT /issues/1/assign_to_me' => 'additionals_assign_to_me', id: '1'
end
def test_issue_change_status
should_route 'PUT /issues/1/change_status' => 'additionals_change_status', id: '1'
end
end