diff --git a/module/story/css/batchcreate.css b/module/story/css/batchcreate.css index b748ec13a0..0cae942aed 100644 --- a/module/story/css/batchcreate.css +++ b/module/story/css/batchcreate.css @@ -10,3 +10,4 @@ #batchCreateForm .c-verify {width: 140px;} #batchCreateForm .c-keywords {width: 140px;} .body-modal .main-header > h2 {max-width: 80%;} +#batchCreateForm .reviewBox{width: 200px !important;} diff --git a/module/story/css/create.css b/module/story/css/create.css index fa75e956fd..1a2fa994f9 100644 --- a/module/story/css/create.css +++ b/module/story/css/create.css @@ -7,3 +7,6 @@ #source_chosen {min-width: 50px !important;} #feedbackBox > .input-group + #notifyEmailLabel {position: relative; width: 50%; left: 48%} #product + .picker{min-width: 400px} +#dataform .priBox, #dataform .estimateBox {width: 120px;} +#dataform .categoryBox {width: 150px;} +#dataform .needNotReviewBox {width: 130px;} diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index 5660e14ee6..585b1b2799 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -1,6 +1,47 @@ $(function() { if($('#batchCreateForm table thead tr th.col-name').width() < 200) $('#batchCreateForm table thead tr th.col-name').width(200); + + $('#customField').click(function() + { + hiddenRequireFields(); + }); + + /* Implement a custom form without feeling refresh. */ + $('#formSettingForm .btn-primary').click(function() + { + var fields = ''; + $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function() + { + fields += ',' + $(this).val(); + }); + + var link = createLink('custom', 'ajaxSaveCustomFields', 'module=story§ion=custom&key=batchCreateFields'); + $.post(link, {'fields' : fields}, function() + { + showFields = fields; + showCheckedFields(fields); + $('#formSetting').parent().removeClass('open'); + + var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length; + $('.form-actions').attr('colspan', fieldCount); + + if(fieldCount > 8) + { + $('#batchCreateForm > .table-responsive').removeClass('scroll-none'); + $('#batchCreateForm > .table-responsive').css('overflow', 'auto'); + } + else + { + $('#batchCreateForm > .table-responsive').addClass('scroll-none'); + $('#batchCreateForm > .table-responsive').css('overflow', 'visible'); + } + + if($('#batchCreateForm table thead tr th.col-name').width() < 200) $('#batchCreateForm table thead tr th.col-name').width(200); + }); + + return false; + }); }); $(document).on('click', '.chosen-with-drop', function() { diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index 6847a40766..63eaea8a5d 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -46,6 +46,11 @@ $(function() // Init bactch action form $('#batchEditForm').batchActionForm(); + + $('#customField').click(function() + { + hiddenRequireFields(); + }); }); $(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value. diff --git a/module/story/js/common.js b/module/story/js/common.js index 8cc11344f3..69553dc63e 100644 --- a/module/story/js/common.js +++ b/module/story/js/common.js @@ -13,6 +13,14 @@ $(function() } }) +/** + * Get status. + * + * @param method $method + * @param params $params + * @access public + * @return void + */ function getStatus(method, params) { $.get(createLink('story', 'ajaxGetStatus', "method=" + method + '¶ms=' + params), function(status) @@ -20,3 +28,48 @@ function getStatus(method, params) $('form #status').val(status).change(); }); } + +/** + * Show checked fields. + * + * @param string fields + * @access public + * @return void + */ +function showCheckedFields(fields) +{ + var fieldList = ',' + fields + ','; + $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function() + { + var field = ',' + $(this).val() + ','; + var $field = config.currentMethod == 'create' ? $('#' + $(this).val()) : $('[name^=' + $(this).val() + ']'); + var required = ',' + requiredFields + ','; + var $fieldBox = $('.' + $(this).val() + 'Box' ); + if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0) + { + $fieldBox.removeClass('hidden'); + $field.removeAttr('disabled'); + } + else if(!$fieldBox.hasClass('hidden')) + { + $fieldBox.addClass('hidden'); + $field.attr('disabled', true); + } + }); +} + +/** + * Hidden require field. + * + * @access public + * @return void + */ +function hiddenRequireFields() +{ + $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function() + { + var field = ',' + $(this).val() + ','; + var required = ',' + requiredFields + ','; + if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden'); + }); +} diff --git a/module/story/js/create.js b/module/story/js/create.js index 150abcd111..b9096a1397 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -46,6 +46,31 @@ $(function() $('#assignedToBox').attr('colspan', 2); } }); + + $('#customField').click(function() + { + hiddenRequireFields(); + }); + + /* Implement a custom form without feeling refresh. */ + $('#formSettingForm .btn-primary').click(function() + { + var fields = ''; + $('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function() + { + fields += ',' + $(this).val(); + }); + + var link = createLink('custom', 'ajaxSaveCustomFields', 'module=story§ion=custom&key=createFields'); + $.post(link, {'fields' : fields}, function() + { + showFields = fields; + showCheckedFields(fields); + $('#formSetting').parent().removeClass('open'); + }); + + return false; + }); }); /** diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index 108a37739d..64ca7535d5 100755 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -11,6 +11,8 @@ */ ?> + +story->create->requiredFields);?>

lang->story->subdivide : $this->lang->story->batchCreate;?>

@@ -47,23 +49,23 @@ - + - + type == 'kanban'):?> - - - - + + + + - - - - + + + + story->getFlowExtendFields(); foreach($extendFields as $extendField) @@ -76,9 +78,9 @@ - + - + type == 'kanban'):?> - - - - + + + + - - - + + - + loadModel('flow'); foreach($extendFields as $extendField) echo "control == 'select' or $extendField->control == 'multi-select') ? " style='overflow:visible'" : '') . ">" . $this->flow->getFieldControl($extendField, '', $extendField->field . '[$id]') . ""; @@ -144,6 +146,7 @@ $(function() idEnd: , rowCreator: function($row, index) { + itemIndex = index; // Set the index for the add element operation $row.find('select.chosen,select.picker-select').each(function() { var $select = $(this); @@ -162,6 +165,26 @@ $(function() { $row.find('.input-story-title').val(storyTitle).after(''); } + + /* Implement a custom form without feeling refresh. */ + var fieldList = ',' + showFields + ','; + $('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function() + { + var field = ',' + $(this).val() + ','; + var $field = $row.find('[name^=' + $(this).val() + ']'); + var required = ',' + requiredFields + ','; + var $fieldBox = $row.find('.' + $(this).val() + 'Box' ); + if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0) + { + $fieldBox.removeClass('hidden'); + $field.removeAttr('disabled'); + } + else if(!$fieldBox.hasClass('hidden')) + { + $fieldBox.addClass('hidden'); + $field.attr('disabled', true); + } + }) } }); diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index bd6870752e..b0050c2928 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -15,6 +15,7 @@ app->tab);?> +

diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index ef6586f763..23ae672d74 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -20,6 +20,14 @@ story->feedbackSource); ?> +story->create->requiredFields);?> +story->create->requiredFields) as $field) +{ + if($field and strpos($showFields, $field) === false) $showFields .= ',' . $field; +} +?> + @@ -32,12 +40,6 @@

- story->create->requiredFields) as $field) - { - if($field and strpos($showFields, $field) === false) $showFields .= ',' . $field; - } - ?>
'>product->branch;?> branchBox'>product->branch;?> '>story->module;?>'>story->plan;?> planBox'>story->plan;?> kanbancard->region;?> kanbancard->lane;?> story->title;?>'>story->spec;?>'>story->source;?>'>story->sourceNote;?>'>story->verify;?> specBox'>story->spec;?> sourceBox'>story->source;?> sourceBox'>story->sourceNote;?> verifyBox'>story->verify;?> story->category;?>'>story->pri;?>'>story->estimate;?>' style="width: 200px !important">story->reviewedBy;?>'>story->keywords;?> priBox'>story->pri;?> estimateBox'>story->estimate;?> reviewBox'>story->reviewedBy;?> keywordsBox'>story->keywords;?>
'> branchBox'> ' style='overflow:visible'> planBox' style='overflow:visible'> @@ -100,20 +102,20 @@ '>'>'>'> specBox'> sourceBox'> sourceBox'> verifyBox'> story->categoryList, 'feature', "class='form-control chosen'");?>' style='overflow:visible'>'>'> + priBox' style='overflow:visible'> estimateBox'> reviewBox'>
story->ditto;?>
'> keywordsBox'>
@@ -67,6 +69,7 @@ + @@ -86,8 +89,7 @@ ?> - - - @@ -109,7 +110,7 @@
PO : '', "class='form-control picker-select' multiple");?>
-
+
/> @@ -131,8 +132,7 @@
- -
- @@ -265,12 +262,11 @@ story->specTemplate . "\n" . $lang->noticePasteImg) . "'");?> - - + + - @@ -280,8 +276,8 @@ - - + + - - - + + -
story->planAB;?> +
story->source;?>
@@ -98,7 +100,6 @@
+
story->source;?>
@@ -142,7 +142,6 @@
story->verify;?>
story->status;?> story->legendAttatch;?> fetch('file', 'buildform');?>
story->mailto;?>
@@ -290,15 +286,13 @@
story->keywords;?>