Skip to content

Commit 11901dc

Browse files
committed
Merge branch '6.0/load-main-content' into 6.0-trunk
2 parents 1f38e9d + 5cc6331 commit 11901dc

File tree

11 files changed

+1320
-1339
lines changed

11 files changed

+1320
-1339
lines changed

lib/RT/Interface/Web.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ sub SquishedJS {
141141

142142
sub JSFiles {
143143
return qw{
144-
htmx.min.js
145144
jquery-3.6.0.min.js
146145
jquery_noconflict.js
146+
init.js
147+
htmx.min.js
147148
tom-select.complete.min.js
148149
popper.min.js
149150
bootstrap.min.js

share/html/Asset/Create.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
%# those contributions and any derivatives thereof.
4646
%#
4747
%# END BPS TAGGED BLOCK }}}
48-
<& /Elements/Header, Title => loc("Create a new asset in catalog [_1]", $catalog->Name), &>
48+
<& /Elements/Header, Title => loc("Create a new asset in catalog [_1]", $catalog->Name), LoadMainContent => 1, &>
4949
<& /Elements/Tabs &>
5050

5151
<& /Elements/ListActions, actions => \@results &>

share/html/Asset/Display.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Title => loc("Asset #[_1]: [_2]", $asset->id, $asset->Name),
5050
TitleTrigger => 'assetNameChanged from:body',
5151
TitleSource => RT->Config->Get('WebPath') . '/Views/Asset/Title?id=' . $asset->Id,
52+
LoadMainContent => 1,
5253
&>
5354
<& /Elements/Tabs &>
5455

share/html/Elements/Header

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<div id="main-navigation" tabindex="-1"><& /Elements/Menu, menu => Menu(), id => 'app-nav' &></div>
107107
% }
108108

109-
% if ( $ShowMenu
109+
% if ( !$LoadMainContent && $ShowMenu
110110
% && RT::Interface::Web->ModernClient()
111111
% && ( $DECODED_ARGS->{ModernClient} // 1 )
112112
% && !RT::Interface::Web::RequestENV('HTTP_HX_REQUEST')
@@ -247,4 +247,5 @@ $BodyClass => undef
247247
$MainContainerClass => undef
248248
$TitleTrigger => ''
249249
$TitleSource => ''
250+
$LoadMainContent => undef
250251
</%ARGS>

share/html/Ticket/Create.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
%# END BPS TAGGED BLOCK }}}
4848
<& /Elements/Header,
4949
Title => $title,
50+
LoadMainContent => 1,
5051
&>
5152
<& /Elements/Tabs &>
5253

share/html/Ticket/Display.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Title => $title,
5050
TitleTrigger => 'ticketSubjectChanged from:body',
5151
TitleSource => RT->Config->Get('WebPath') . '/Views/Ticket/Title?id=' . $TicketObj->Id,
52+
LoadMainContent => 1,
5253
LinkRel => \%link_rel &>
5354
<& /Elements/Tabs &>
5455

share/html/Ticket/Update.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
%# those contributions and any derivatives thereof.
4646
%#
4747
%# END BPS TAGGED BLOCK }}}
48-
<& /Elements/Header, Title => $title &>
48+
<& /Elements/Header, Title => $title, LoadMainContent => 1, &>
4949
<& /Elements/Tabs &>
5050

5151
% $m->callback(CallbackName => 'BeforeActionList', ARGSRef => \%ARGS, Ticket => $TicketObj, results => \@results);

share/static/js/assets.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,4 @@ htmx.onLoad(function(elt) {
1212
}
1313
});
1414
});
15-
jQuery(elt).find(".asset-create-linked-ticket").click(function(ev){
16-
ev.preventDefault();
17-
var url = this.href.replace(/\/Asset\/CreateLinkedTicket\.html\?/g,
18-
'/Asset/Helpers/CreateLinkedTicket?');
19-
20-
htmx.ajax('GET', url, '#dynamic-modal').then(() => {
21-
bootstrap.Modal.getOrCreateInstance('#dynamic-modal').show();
22-
});
23-
});
24-
jQuery(elt).find("#bulk-update-create-linked-ticket").click(function(ev){
25-
ev.preventDefault();
26-
var chkArray = [];
27-
28-
jQuery("input[name='UpdateAsset']:checked").each(function() {
29-
chkArray.push(jQuery(this).val());
30-
});
31-
32-
var selected = '';
33-
for (var i = 0; i < chkArray.length; i++) {
34-
selected += 'Asset=' + chkArray[i] + '&';
35-
}
36-
/* selected = chkArray.join(','); */
37-
var url = RT.Config.WebHomePath + '/Asset/Helpers/CreateLinkedTicket?' + selected;
38-
htmx.ajax('GET', url, '#dynamic-modal').then(() => {
39-
bootstrap.Modal.getOrCreateInstance('#dynamic-modal').show();
40-
});
41-
});
4215
});

share/static/js/event-registration.js

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
// Disable chosing individual objects when a scrip is applied globally
2-
htmx.onLoad(function(elt) {
3-
var global_checkboxes = [
4-
"form[name=AddRemoveScrip] input[type=checkbox][name^=AddScrip-][value=0]",
5-
"form input[type=checkbox][name^=AddCustomField-][value=0]"
6-
];
7-
jQuery(elt).find(global_checkboxes.join(", "))
8-
.change(function(){
9-
var self = jQuery(this);
10-
var checked = self.prop("checked");
11-
12-
self.closest("form")
13-
.find("table.collection input[type=checkbox]")
14-
.prop("disabled", checked);
15-
});
16-
});
17-
181
// Replace user references in history with the HTML versions
192
function ReplaceUserReferences(elt) {
203
var users = jQuery(elt).find(".user[data-replace=user]");
@@ -118,71 +101,3 @@ htmx.onLoad(function(elt) {
118101
}
119102
});
120103
});
121-
122-
htmx.onLoad( function(elt) {
123-
jQuery(elt).find("input[type=file]").change( function() {
124-
var input = jQuery(this);
125-
var warning = input.next(".invalid");
126-
127-
if ( !input.val().match(/"/) ) {
128-
warning.hide();
129-
} else {
130-
if (warning.length) {
131-
warning.show();
132-
} else {
133-
input.val("");
134-
jQuery("<span class='invalid'>")
135-
.text(loc_key("quote_in_filename"))
136-
.insertAfter(input);
137-
}
138-
}
139-
});
140-
});
141-
142-
htmx.onLoad(function(elt) {
143-
jQuery(elt).find("#UpdateType").change(function(ev) {
144-
jQuery(".messagebox-container")
145-
.removeClass("action-response action-private")
146-
.addClass("action-"+ev.target.value);
147-
});
148-
});
149-
150-
htmx.onLoad(function(elt) {
151-
jQuery(elt).find('.toggle-txn-details:not(.toggle-txn-details-registered)').click(function () {
152-
return toggleTransactionDetails.apply(this);
153-
}).addClass('toggle-txn-details-registered');
154-
});
155-
156-
const article_link_focus_handler = function() {
157-
// if input focus in last row add another row of inputs
158-
const link_div = jQuery(this).parent().parent();
159-
const links_div = link_div.parent();
160-
if ( link_div.attr('data-link-number') == links_div.attr('data-link-count') ) {
161-
const link_count = parseInt( links_div.attr('data-link-count') ) + 1;
162-
links_div.attr( 'data-link-count', link_count );
163-
let new_link_div = link_div.clone();
164-
new_link_div.attr( 'data-link-number', link_count );
165-
new_link_div.find('[name^="article-link-"]').each(function(){
166-
var oldName = jQuery(this).attr('name');
167-
var newName = oldName.replace( /-\d+$/, '-' + link_count );
168-
jQuery(this).attr( 'name', newName );
169-
});
170-
new_link_div.find('[name^="article-link-"]').on( "focus", article_link_focus_handler );
171-
links_div.append(new_link_div);
172-
}
173-
};
174-
htmx.onLoad(function(elt) {
175-
jQuery('[name^="article-link-"]').on( "focus", article_link_focus_handler );
176-
});
177-
htmx.onLoad(function(elt) {
178-
jQuery(elt).find('.article-basics [name="Type"]').change(function(ev) {
179-
if ( jQuery(this).val() == 'Content' ) {
180-
jQuery('#article-type-links').addClass('hidden');
181-
jQuery('#article-type-content').removeClass('hidden');
182-
}
183-
else {
184-
jQuery('#article-type-content').addClass('hidden');
185-
jQuery('#article-type-links').removeClass('hidden');
186-
}
187-
});
188-
});

0 commit comments

Comments
 (0)