1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Better merge-conflict commit button layout

This commit is contained in:
Nick O'Leary 2018-02-09 09:35:47 +00:00
parent aa1cf0b228
commit 9066cedc29
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -116,6 +116,18 @@ RED.sidebar.versionControl = (function() {
if (entry.label) { if (entry.label) {
row.addClass('node-info-none'); row.addClass('node-info-none');
container.text(entry.label); container.text(entry.label);
if (entry.button) {
container.css({
display: "inline-block",
maxWidth: "300px",
textAlign: "left"
})
var toolbar = $('<div style="float: right; margin: 5px; height: 50px;"></div>').appendTo(container);
$('<button class="editor-button editor-button-small"></button>').text(entry.button.label)
.appendTo(toolbar)
.click(entry.button.click);
}
return; return;
} }
@ -370,17 +382,17 @@ RED.sidebar.versionControl = (function() {
addButton: false, addButton: false,
scrollOnAdd: false, scrollOnAdd: false,
addItem: function(row,index,entry) { addItem: function(row,index,entry) {
createChangeEntry(row,entry,entry.treeStatus,'unmerged');
if (entry === emptyMergedItem) { if (entry === emptyMergedItem) {
var toolbar = $('<div style="text-align: center"></div>').appendTo(row); entry.button = {
$('<button class="editor-button editor-button-small">commit</button>') label: 'commit',
.appendTo(toolbar) click: function(evt) {
.click(function(evt) {
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
showCommitBox(); showCommitBox();
});
} }
}
}
createChangeEntry(row,entry,entry.treeStatus,'unmerged');
}, },
sort: function(A,B) { sort: function(A,B) {
if (A.treeStatus === '?' && B.treeStatus !== '?') { if (A.treeStatus === '?' && B.treeStatus !== '?') {
@ -453,7 +465,7 @@ RED.sidebar.versionControl = (function() {
commitBox = $('<div class="sidebar-version-control-slide-box sidebar-version-control-slide-box-bottom"></div>').hide().appendTo(localChanges.content); commitBox = $('<div class="sidebar-version-control-slide-box sidebar-version-control-slide-box-bottom"></div>').hide().appendTo(localChanges.content);
var commitMessage = $('<textarea>') var commitMessage = $('<textarea placeholder="Enter your commit message"></textarea>')
.appendTo(commitBox) .appendTo(commitBox)
.on("change keyup paste",function() { .on("change keyup paste",function() {
submitCommitButton.attr('disabled',$(this).val().trim()===""); submitCommitButton.attr('disabled',$(this).val().trim()==="");