Skip to content

Commit 3e683a6

Browse files
Bootstrap v4 fixes (#26)
* Accordion and modals fixed. * Added missing border * Another IE compatibility fix Co-authored-by: Sarmishta Velury <[email protected]> Co-authored-by: isc-tleavitt <[email protected]>
1 parent a704a55 commit 3e683a6

File tree

4 files changed

+56
-45
lines changed

4 files changed

+56
-45
lines changed

git-webui/release/share/git-webui/webui/css/git-webui.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ body {
103103
color: inherit;
104104
}
105105

106-
.accordion-item {
106+
.custom-card, .card {
107107
background-color:inherit !important;
108108
color: inherit !important;
109109
padding-bottom:1%;
110110
margin: 0%;
111111
border: none;
112112
}
113113

114-
.accordion-header {
114+
.card-header {
115115
padding: 1% 2% 0% 14%;
116116
background-color: inherit !important;
117117
color: inherit !important;
@@ -388,6 +388,9 @@ body {
388388
border: 0;
389389
margin: 0;
390390
}
391+
.panel-heading {
392+
border-bottom: 1px solid #dddddd !important;
393+
}
391394
.diff-view-container .panel-heading {
392395
margin: 0;
393396
padding: 5px 16px;

git-webui/release/share/git-webui/webui/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<div class="modal-content">
3636
<div class="modal-header">
3737
<h4 class="modal-title">Error</h4>
38-
<button type="button" class="btn btn-default close" data-bs-dismiss="modal">
38+
<button type="button" class="btn btn-default close" data-dismiss="modal">
3939
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
4040
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.854 2.146a.5.5 0 0 1 0 .708l-11 11a.5.5 0 0 1-.708-.708l11-11a.5.5 0 0 1 .708 0Z" fill="#000"></path>
4141
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.146 2.146a.5.5 0 0 0 0 .708l11 11a.5.5 0 0 0 .708-.708l-11-11a.5.5 0 0 0-.708 0Z" fill="#000"></path>

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade"
3939

4040

4141
webui.showError = function(message) {
42-
webui.errorMessage = message;
4342
$("#error-modal .alert").text(message);
4443
$("#error-modal").modal('show');
4544
}
@@ -48,7 +47,7 @@ webui.showWarning = function(message) {
4847
var messageBox = $("#message-box");
4948
messageBox.empty();
5049
$( '<div class="alert alert-warning alert-dismissible" role="alert">' +
51-
'<button type="button" class="btn btn-default close" data-bs-dismiss="alert">' +
50+
'<button type="button" class="btn btn-default close" data-dismiss="alert">' +
5251
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">'+
5352
'<path fill-rule="evenodd" clip-rule="evenodd" d="M13.854 2.146a.5.5 0 0 1 0 .708l-11 11a.5.5 0 0 1-.708-.708l11-11a.5.5 0 0 1 .708 0Z" fill="#000"/>'+
5453
'<path fill-rule="evenodd" clip-rule="evenodd" d="M2.146 2.146a.5.5 0 0 0 0 .708l11 11a.5.5 0 0 0 .708-.708l-11-11a.5.5 0 0 0-.708 0Z" fill="#000"/>'+
@@ -199,7 +198,7 @@ webui.SideBarView = function(mainView) {
199198
'<div class="modal-content">' +
200199
'<div class="modal-header">' +
201200
'<h4 class="modal-title">' + title + '</h4>' +
202-
'<button type="button" class="btn btn-default close" data-bs-dismiss="modal">'+
201+
'<button type="button" class="btn btn-default close" data-dismiss="modal">'+
203202
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">'+
204203
'<path fill-rule="evenodd" clip-rule="evenodd" d="M13.854 2.146a.5.5 0 0 1 0 .708l-11 11a.5.5 0 0 1-.708-.708l11-11a.5.5 0 0 1 .708 0Z" fill="#000"/>'+
205204
'<path fill-rule="evenodd" clip-rule="evenodd" d="M2.146 2.146a.5.5 0 0 0 0 .708l11 11a.5.5 0 0 0 .708-.708l-11-11a.5.5 0 0 0-.708 0Z" fill="#000"/>'+
@@ -246,19 +245,19 @@ webui.SideBarView = function(mainView) {
246245
ref = ' ' + newref;
247246
}
248247
}
249-
var cardDiv = $('<div class="accordion-item custom-accordion">').appendTo(accordionDiv)[0];
248+
var cardDiv = $('<div class="card custom-card">').appendTo(accordionDiv)[0];
250249
if (id.indexOf("local-branches") > -1) {
251250
var refname = ref.substr(2);
252251
var itemId = refname + idPostfix;
253-
var cardHeader = $('<div class="accordion-header" id="heading-' + itemId + '">').appendTo(cardDiv);
254-
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
252+
var cardHeader = $('<div class="card-header" id="heading-' + itemId + '">').appendTo(cardDiv);
253+
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
255254
+ refname
256255
+ '</button>').appendTo(cardHeader);
257256

258257
if(ref[0] != "*") {
259-
var collapseDiv = $('<div id="collapse-'+ itemId +'" class="accordion-collapse collapse" aria-labelledby="heading-' + itemId +'" data-bs-parent="#accordion-'+id+'">').appendTo(cardDiv);
260-
var cardBody = $('<div class="accordion-body">' +
261-
'<div class="d-grid gap-2 col-10 mx-auto">'+
258+
var collapseDiv = $('<div id="collapse-'+ itemId +'" class="accordion-collapse collapse" aria-labelledby="heading-' + itemId +'" data-parent="#accordion-'+id+'">').appendTo(cardDiv);
259+
var cardBody = $('<div class="card-body">' +
260+
'<div class="d-grid gap-2 col-12 mx-auto">'+
262261
'<button class="btn btn-xs btn-primary btn-block btn-checkout-local-branch mt-1">Checkout Branch</button>'+
263262
'<button class="btn btn-xs btn-danger btn-block btn-delete-branch">Delete Branch</button>'+
264263
'</div>'+
@@ -277,12 +276,12 @@ webui.SideBarView = function(mainView) {
277276
} else {
278277
var refname = ref.replaceAll('/', '-');
279278
var itemId = refname + idPostfix;
280-
var cardHeader = $('<div class="accordion-header" id="heading-' + itemId +'">').appendTo(cardDiv);
281-
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
279+
var cardHeader = $('<div class="card-header" id="heading-' + itemId +'">').appendTo(cardDiv);
280+
var button = $('<button class="btn btn-sm btn-default btn-branch text-left" type="button" data-toggle="collapse" data-target="#collapse-' + itemId + '" aria-expanded="true" aria-controls="collapse-' + itemId + '">'
282281
+ ref //IMPORTANT: This has to be the original ref for selectRef to work
283282
+ '</button>').appendTo(cardHeader)
284283

285-
var collapseDiv = $('<div id="collapse-' + itemId + '" class="collapse" aria-labelledby="heading-' + itemId + '" data-bs-parent="#accordion-'+id+'">').appendTo(cardDiv);
284+
var collapseDiv = $('<div id="collapse-' + itemId + '" class="collapse" aria-labelledby="heading-' + itemId + '" data-parent="#accordion-'+id+'">').appendTo(cardDiv);
286285
var cardBody = $('<div class="card-body">' +
287286
'<div class="d-grid gap-2 col-12 mx-auto">'+
288287
'<button class="btn btn-xs btn-primary btn-block btn-checkout-remote-branch">Checkout Branch</button>'+
@@ -316,7 +315,12 @@ webui.SideBarView = function(mainView) {
316315
}
317316
var accordionDiv = self.buildAccordion(section, refs, id, maxRefsCount);
318317
if (refs.length > maxRefsCount) {
319-
var more = $('<div class="accordion-item custom-accordion"><div class="accordion-header">More ...</div></div>').appendTo(accordionDiv);
318+
var more = $('<div class="card custom-card">'+
319+
'<div class="card-header">'+
320+
'<button class="btn btn-sm btn-default btn-branch text-left" type="button">'+
321+
'More ...'+
322+
'</button>'+
323+
'</div></div>').appendTo(accordionDiv);
320324
more.click(function() {
321325
$(popup).modal('show');
322326
});
@@ -329,7 +333,7 @@ webui.SideBarView = function(mainView) {
329333

330334
self.mainView = mainView;
331335
self.element = $( '<div id="sidebar">' +
332-
'<a href="#" data-bs-toggle="modal" data-bs-target="#help-modal"><img id="sidebar-logo" src="img/git-logo.png"></a>' +
336+
'<a href="#" data-toggle="modal" data-target="#help-modal"><img id="sidebar-logo" src="img/git-logo.png"></a>' +
333337
'<div id="sidebar-content">' +
334338
'<section id="sidebar-workspace">' +
335339
'<h4>Workspace</h4>' +
@@ -1014,8 +1018,8 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent) {
10141018
if (! (parent instanceof webui.CommitExplorerView)) {
10151019
html +=
10161020
'<div class="panel-heading btn-toolbar" role="toolbar">' +
1017-
'<button type="button" class="btn btn-sm btn-default diff-ignore-whitespace" data-bs-toggle="button">Ignore Whitespace</button>' +
1018-
'<button type="button" class="btn btn-sm btn-default diff-context-all" data-bs-toggle="button">Complete file</button>' +
1021+
'<button type="button" class="btn btn-sm btn-default diff-ignore-whitespace" data-toggle="button">Ignore Whitespace</button>' +
1022+
'<button type="button" class="btn btn-sm btn-default diff-context-all" data-toggle="button">Complete file</button>' +
10191023
'<div class="btn-group btn-group-sm">' +
10201024
'<span></span>&nbsp;' +
10211025
'<button type="button" class="btn btn-default diff-context-remove">-</button>' +
@@ -1705,7 +1709,7 @@ webui.CommitMessageView = function(workspaceView) {
17051709
'<div class="panel-heading">' +
17061710
'<h5>Message</h5>' +
17071711
'<div class="btn-group btn-group-sm">' +
1708-
'<button type="button" class="btn btn-default commit-message-amend" data-bs-toggle="button">Amend</button>' +
1712+
'<button type="button" class="btn btn-default commit-message-amend" data-toggle="button">Amend</button>' +
17091713
'<button type="button" class="btn btn-default commit-message-commit">Commit</button>' +
17101714
'</div>' +
17111715
'</div>' +
@@ -1766,7 +1770,7 @@ $(document).ready(function () {
17661770
function updateSideBar () {
17671771
var sideBarView = $('#sidebar')[0];
17681772
MainUIObject.sideBarView = new webui.SideBarView(MainUIObject);
1769-
sideBarView.replaceWith(MainUIObject.sideBarView.element);
1773+
$(sideBarView).replaceWith(MainUIObject.sideBarView.element);
17701774
}
17711775

17721776
$(function () {
@@ -1806,7 +1810,7 @@ $(function () {
18061810
$(document).on('click', '.btn-checkout-local-branch', function(e) {
18071811
e.preventDefault();
18081812
var refName = $(this).parent().parent().parent().siblings(
1809-
".accordion-header").children("button").html();
1813+
".card-header").children("button").html();
18101814

18111815
webui.git("checkout " + refName, function() {
18121816
updateSideBar();
@@ -1816,7 +1820,7 @@ $(function () {
18161820
$(document).on('click', '.btn-delete-branch', function(e) {
18171821
e.preventDefault();
18181822
var refName = $(this).parent().parent().parent().siblings(
1819-
".accordion-header").children("button").html();
1823+
".card-header").children("button").html();
18201824

18211825
webui.git("branch -d " + refName, function() {
18221826
webui.showWarning("Local branch " + refName + " deleted.");
@@ -1827,7 +1831,7 @@ $(function () {
18271831
$(document).on('click', '.btn-checkout-remote-branch', function(e) {
18281832
e.preventDefault();
18291833
var refName = $(this).parent().parent().parent().siblings(
1830-
".accordion-header").children("button").html();
1834+
".card-header").children("button").html();
18311835

18321836
var remoteName = refName.split('/')[0];
18331837
var branchName = refName.split('/')[1];

0 commit comments

Comments
 (0)