parent
ae90053312
commit
26684a2dd9
@ -25,6 +25,7 @@ This plugin uses [FontAwesome icons](http://fontawesome.io/)
|
|||||||
|
|
||||||
### Changelog
|
### Changelog
|
||||||
|
|
||||||
|
* **v.0.6.5** : Checklists plugin support (and all other plugins that compute fields when there's an issue update) (Github requests #26 and #28) + custom url support (Github request #29)
|
||||||
* **v.0.6.4** : version field with checkbox display is now supported, Target version and Assignee fields are also supported (Github request #24)
|
* **v.0.6.4** : version field with checkbox display is now supported, Target version and Assignee fields are also supported (Github request #24)
|
||||||
* **v 0.6.3** : fixed Github issue #22 : DatepickerFallback raised an error
|
* **v 0.6.3** : fixed Github issue #22 : DatepickerFallback raised an error
|
||||||
* **v 0.6.2** : fixed Github issue #22 : long description is now supported (no more 414 errors)
|
* **v 0.6.2** : fixed Github issue #22 : long description is now supported (no more 414 errors)
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
/* Allow inclusion from other page */
|
||||||
|
var LOCATION_HREF = typeof custom_location_href !== 'undefined' ? custom_location_href : window.location.href;
|
||||||
|
|
||||||
/* FontAwesome inclusion */
|
/* FontAwesome inclusion */
|
||||||
var cssId = 'fontAwesome';
|
var cssId = 'fontAwesome';
|
||||||
if (!document.getElementById(cssId))
|
if (!document.getElementById(cssId))
|
||||||
@ -155,7 +158,8 @@ function initEditFields()
|
|||||||
if(info.field_format == "date")
|
if(info.field_format == "date")
|
||||||
{
|
{
|
||||||
if( $('body').find('#dynamic_issue_custom_field_values_' + info.id).length
|
if( $('body').find('#dynamic_issue_custom_field_values_' + info.id).length
|
||||||
&& $('body').find('#dynamic_issue_custom_field_values_' + info.id).datepickerFallback instanceof Function)
|
&& $('body').find('#dynamic_issue_custom_field_values_' + info.id).datepickerFallback instanceof Function
|
||||||
|
&& typeof datepickerOptions !== 'undefined')
|
||||||
{
|
{
|
||||||
$('body').find('#dynamic_issue_custom_field_values_' + info.id).datepickerFallback(datepickerOptions);
|
$('body').find('#dynamic_issue_custom_field_values_' + info.id).datepickerFallback(datepickerOptions);
|
||||||
}
|
}
|
||||||
@ -176,7 +180,9 @@ function updateRequiredFields(reqFieldsArray)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRequiredFields(JSON.parse($('#required_field_array').html()));
|
if($('#required_field_array').length) {
|
||||||
|
updateRequiredFields(JSON.parse($('#required_field_array').html()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$('body.controller-issues.action-show').on('click', '.btn.close', function(e){
|
$('body.controller-issues.action-show').on('click', '.btn.close', function(e){
|
||||||
@ -185,6 +191,26 @@ $('body.controller-issues.action-show').on('click', '.btn.close', function(e){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getLastLockVersion() {
|
||||||
|
var token = $("meta[name=csrf-token]").attr('content');
|
||||||
|
var lock_version = $('#issue_lock_version').val();
|
||||||
|
jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: LOCATION_HREF,
|
||||||
|
data: { "authenticity_token" : token },
|
||||||
|
crossDomain: true,
|
||||||
|
async: false,
|
||||||
|
beforeSend: function(xhr) {
|
||||||
|
xhr.setRequestHeader("authenticity_token", token);
|
||||||
|
},
|
||||||
|
success: function(msg) {
|
||||||
|
parsed = $.parseHTML(msg);
|
||||||
|
lock_version = $(parsed).find('#issue_lock_version').val();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return lock_version;
|
||||||
|
}
|
||||||
|
|
||||||
function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
||||||
|
|
||||||
/* hide edit field */
|
/* hide edit field */
|
||||||
@ -219,11 +245,14 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
|||||||
var token = $("meta[name=csrf-token]").attr('content');
|
var token = $("meta[name=csrf-token]").attr('content');
|
||||||
|
|
||||||
$('#issue-form').find("#issue_" + field_name).val(field_value).css({"display": "inline-block"});
|
$('#issue-form').find("#issue_" + field_name).val(field_value).css({"display": "inline-block"});
|
||||||
|
// avoid conflict revision
|
||||||
|
var lastLockVersion = getLastLockVersion();
|
||||||
|
$('#issue_lock_version').val(lastLockVersion);
|
||||||
var formData = $('#issue-form').serialize();
|
var formData = $('#issue-form').serialize();
|
||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: _BASE_REDMINE_PATH + '/issues/' + _ISSUE_ID,
|
url: LOCATION_HREF,
|
||||||
data: formData,
|
data: formData,
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function(xhr) {
|
||||||
xhr.setRequestHeader("authenticity_token", token);
|
xhr.setRequestHeader("authenticity_token", token);
|
||||||
@ -254,7 +283,7 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
|||||||
|
|
||||||
jQuery.ajax({
|
jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: window.location.href,
|
url: LOCATION_HREF,
|
||||||
data: { "authenticity_token" : token },
|
data: { "authenticity_token" : token },
|
||||||
crossDomain: true,
|
crossDomain: true,
|
||||||
async: false,
|
async: false,
|
||||||
@ -287,7 +316,9 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
|||||||
initEditFields();
|
initEditFields();
|
||||||
initEditFieldListeners();
|
initEditFieldListeners();
|
||||||
|
|
||||||
updateRequiredFields(JSON.parse($(parsed).find('#required_field_array').html()));
|
if($(parsed).find('#required_field_array').length) {
|
||||||
|
updateRequiredFields(JSON.parse($(parsed).find('#required_field_array').html()));
|
||||||
|
}
|
||||||
|
|
||||||
/* we update the history list */
|
/* we update the history list */
|
||||||
$('#history').append($(parsed).find('#history .journal.has-details:last-child'));
|
$('#history').append($(parsed).find('#history .journal.has-details:last-child'));
|
||||||
@ -302,7 +333,8 @@ function issueDynamicUpdate(field_name, field_value, type, cssClass){
|
|||||||
|
|
||||||
//set datepicker fallback for input type date
|
//set datepicker fallback for input type date
|
||||||
if( $('body').find('input[type=date]').length
|
if( $('body').find('input[type=date]').length
|
||||||
&& $('body').find('input[type=date]').datepickerFallback instanceof Function)
|
&& $('body').find('input[type=date]').datepickerFallback instanceof Function
|
||||||
|
&& typeof datepickerOptions !== 'undefined')
|
||||||
{
|
{
|
||||||
$('body').find('input[type=date]').datepickerFallback(datepickerOptions);
|
$('body').find('input[type=date]').datepickerFallback(datepickerOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
2
init.rb
2
init.rb
@ -6,7 +6,7 @@ Redmine::Plugin.register :redmine_issue_dynamic_edit do
|
|||||||
name 'Redmine Dynamic edit Issue plugin'
|
name 'Redmine Dynamic edit Issue plugin'
|
||||||
author 'Hugo Zilliox'
|
author 'Hugo Zilliox'
|
||||||
description 'Allows users to dynamically update issue attributes in detailed view without refreshing the page (JIRA style)'
|
description 'Allows users to dynamically update issue attributes in detailed view without refreshing the page (JIRA style)'
|
||||||
version '0.6.4'
|
version '0.6.5'
|
||||||
url 'https://github.com/ilogeek/redmine_issue_dynamic_edit'
|
url 'https://github.com/ilogeek/redmine_issue_dynamic_edit'
|
||||||
author_url 'https://hzilliox.fr'
|
author_url 'https://hzilliox.fr'
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,7 +5,7 @@ class DetailsIssueHooks < Redmine::Hook::ViewListener
|
|||||||
end
|
end
|
||||||
|
|
||||||
def current_is_detail_page(context)
|
def current_is_detail_page(context)
|
||||||
ret = context[:controller] && context[:controller].is_a?(IssuesController) && context[:request].original_url.rindex(/\/issues\/\d+/)
|
ret = context[:controller] && context[:controller].is_a?(IssuesController) && context[:request].original_url.rindex(/\/issues\/\S+/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def view_layouts_base_html_head(context)
|
def view_layouts_base_html_head(context)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user