Skip to content

Commit

Permalink
Issue #1013: Make the buttons work. Fix scroll behaviour for added el…
Browse files Browse the repository at this point in the history
…ements.
  • Loading branch information
Sven committed Nov 1, 2021
1 parent 9c44153 commit adec23d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Kernel/Modules/CustomerTicketZoom.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,8 @@ sub _Mask {
$LayoutObject->Block(
Name => 'ProcessActivity',
Data => {
ActivityHTML => $ActivityHTML,
ActivityHTML => $ActivityHTML,
ActivityDialogEntityID => $NextActivityDialogs->{$NextActivityDialogKey},
},
);
}
Expand Down
6 changes: 3 additions & 3 deletions Kernel/Output/HTML/Templates/Standard/CustomerTicketZoom.tt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
[% RenderBlockStart("NextActivities") %]
<div id="NextActivities">
[% RenderBlockStart("ActivityDialog") %]
<button id="Button_[% Data.ActivityDialogEntityID | uri %]" title="[% Data.Name | html %]" class="oooM">[% Data.Name | html %]</button>
<button id="Button_[% Data.ActivityDialogEntityID | uri %]" title="[% Data.Name | html %]" class="oooM ActivityStartButton">[% Data.Name | html %]</button>
[% RenderBlockEnd("ActivityDialog") %]
</div>
[% RenderBlockEnd("NextActivities") %]
Expand All @@ -53,12 +53,12 @@
</ul>
<ul id='oooArticleListExpanded'>
[% RenderBlockStart("ProcessActivity") %]
<li id="Process_[% Data.ActivityDialogEntityID | uri %]" class="">
<li id="Process_[% Data.ActivityDialogEntityID | uri %]" class="Activity">
[% Data.ActivityHTML %]
</li>
[% RenderBlockEnd("ProcessActivity") %]
[% RenderBlockStart("FollowUp") %]
<li id="FollowUp" class="[% Data.FollowUpVisible | html %]">
<li id="FollowUp" class="[% Data.FollowUpVisible | html %] Activity">
<form action="[% Env("CGIHandle") %]#FollowUp" method="post" enctype="multipart/form-data" name="compose" id="ReplyCustomerTicket" class="Validate PreventMultipleSubmits">
<input type="hidden" name="Action" value="CustomerTicketZoom" />
<input type="hidden" name="Subaction" value="Store" />
Expand Down
34 changes: 25 additions & 9 deletions var/httpd/htdocs/js/Core.Customer.TicketZoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Core.Customer.TicketZoom = (function (TargetNS) {
* This function activates attachments, replybutton, info, and builds the article list.
*/
function BuildArticles(){
$('#oooArticleListExpanded > li:not(#FollowUp)').each( function() {
$('#oooArticleListExpanded > li:not(.Activity)').each( function() {
var Article = $(this);
var Header = Article.children('.MessageHeader').first();

Expand Down Expand Up @@ -252,7 +252,9 @@ Core.Customer.TicketZoom = (function (TargetNS) {
ZoomExpand = $('#ZoomExpand').val(),
$Form,
FieldID,
DynamicFieldNames = Core.Config.Get('DynamicFieldNames');
DynamicFieldNames = Core.Config.Get('DynamicFieldNames'),
ActivityCount = $('#oooArticleListExpanded > .Activity').length;


// otobo
BuildArticles();
Expand All @@ -267,12 +269,27 @@ Core.Customer.TicketZoom = (function (TargetNS) {
$('#ReplyButton').hide();
}
});
$('#CloseButton').on('click', function(Event){

$('.ActivityStartButton').on('click', function(Event){
Event.preventDefault();
var DialogEntityID = $(this).attr('id').replace( /^Button_/, '' ),
$DialogWidget = $( '#Process_' + DialogEntityID );

$DialogWidget.show();
$DialogWidget.addClass('Visible');
Core.UI.InputFields.Activate();
$('html').css({scrollTop: $('#Body').height()});
});

$('.CloseButton').on('click', function(Event){
Event.preventDefault();
$FollowUp.hide();
$FollowUp.removeClass('Visible');
var ParentWidget = $(this).closest('li');
ParentWidget.hide();
ParentWidget.removeClass('Visible');
$('html').css({scrollTop: $('#Body').height()});
$('#ReplyButton').show();
if ( ParentWidget.attr('id') === 'FollowUp' ) {
$('#ReplyButton').show();
}
});

// scroll events
Expand All @@ -292,7 +309,7 @@ Core.Customer.TicketZoom = (function (TargetNS) {
}

// track active article
var ActiveIndex = $('#oooArticleList > .oooActive').index() + 2,
var ActiveIndex = $('#oooArticleList > .oooActive').index() + 1 + ActivityCount,
StartIndex = ActiveIndex,
ActiveChild = $('#oooArticleListExpanded > li:nth-child(' + ActiveIndex + ')');

Expand All @@ -318,8 +335,7 @@ Core.Customer.TicketZoom = (function (TargetNS) {
PrevChild = $('#oooArticleListExpanded > li:nth-child(' + ( ActiveIndex - 1 ) + ')');
}
}

$('#oooArticleList > li:nth-child(' + ( ActiveIndex - 1 ) +')').addClass('oooActive');
$('#oooArticleList > li:nth-child(' + ( ActiveIndex - ActivityCount ) +')').addClass('oooActive');
if ( ActiveIndex !== StartIndex ) {
$('#oooArticleList').scrollTop( $('#oooArticleList > .oooActive').position().top );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
background-color: var(--colBGLight);
}

#FollowUp {
.Activity {
display: none;
}

Expand Down

0 comments on commit adec23d

Please sign in to comment.