From bddf65c48ff6b825b0a230d2fd873369c9d07ffd Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Fri, 9 Jun 2017 22:29:46 +0200 Subject: [PATCH 1/3] Display related issues on changesets list page --- Source/Source.ViewAPI.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/Source.ViewAPI.php b/Source/Source.ViewAPI.php index 6aa5d3836..b1dfe026f 100644 --- a/Source/Source.ViewAPI.php +++ b/Source/Source.ViewAPI.php @@ -26,6 +26,7 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru $t_repo = $t_repos[ $t_changeset->repo_id ]; $t_vcs = SourceVCS::repo( $t_repo ); + $t_changeset->load_bugs(); $t_changeset->load_files(); $t_author = Source_View_Author( $t_changeset, false ); @@ -63,7 +64,7 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru -message ) ) ) ) ); -?> + ?> + + + + +
+ bugs ); + echo $t_bugs ? implode( ', ', $t_bugs ) : lang_get( 'none' ); + ?> + + files as $t_file ) { ?> From 3433e49952708986860abe77b197289063b2bcc6 Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Fri, 9 Jun 2017 22:55:25 +0200 Subject: [PATCH 2/3] Allow attaching issues from changeset list page If there are no issues linked to the changeset, display an input field and button to allow the user to add links without having to open the changeset view page. --- Source/Source.ViewAPI.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/Source/Source.ViewAPI.php b/Source/Source.ViewAPI.php index b1dfe026f..1c9c36782 100644 --- a/Source/Source.ViewAPI.php +++ b/Source/Source.ViewAPI.php @@ -79,24 +79,36 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru ?> - - -
- bugs ); - echo $t_bugs ? implode( ', ', $t_bugs ) : lang_get( 'none' ); - ?> - + + if( $t_bugs ) { + echo '', + plugin_lang_get( 'affected_issues' ), + '
'; + echo '', implode( ', ', $t_bugs ), ''; + } else { +?> +
+ + +
+ + +
+ files as $t_file ) { ?> show_file( $t_repo, $t_changeset, $t_file ) ) ?> - + url_diff( $t_repo, $t_changeset, $t_file ) ) { ?> From 875c09242873fb55d29fc4778becaa6df5b13a5f Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Sat, 10 Jun 2017 00:27:43 +0200 Subject: [PATCH 3/3] Redirect back to list page after linking issues Use changeset's revision id as anchor in the changesets list, and use that as a new 'redirect' parameter for the attach page so it returns straight to the changeset list's row that called it. If the new param is not specified, the behavior is as it was before, i.e. redirect to view page. --- Source/Source.ViewAPI.php | 6 ++++-- Source/pages/attach.php | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Source.ViewAPI.php b/Source/Source.ViewAPI.php index 1c9c36782..39da71d50 100644 --- a/Source/Source.ViewAPI.php +++ b/Source/Source.ViewAPI.php @@ -36,6 +36,7 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru +

name . ': ' : '' ) . $t_vcs->show_changeset( $t_repo, $t_changeset ) @@ -93,11 +94,12 @@ function Source_View_Changesets( $p_changesets, $p_repos=null, $p_show_repos=tru

+
+ class="btn btn-sm btn-primary btn-white btn-round" + value="" />
load_bugs(); @@ -30,5 +31,16 @@ $t_changeset->save_bugs( $t_user_id ); form_security_purge( 'plugin_Source_attach' ); -print_successful_redirect( plugin_page( 'view', true ) . '&id=' . $t_changeset->id ); +# If a redirection id was provided, return to the corresponding anchor on +# changeset list page, otherwise go to view page +if( $f_redirect ) { + $t_redirect_url = plugin_page( 'list', true ) + . '&id=' . $t_changeset->repo_id + . '#' . string_attribute( $f_redirect ); +} else { + $t_redirect_url = plugin_page( 'view', true ) + . '&id=' . $t_changeset->id; +} + +print_successful_redirect( $t_redirect_url );