Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More change vieweing functionality.

  • Loading branch information...
commit 54e0ef9a3dc4a5bcc35357230060713580841dcb 1 parent 3a20e11
@coreh authored
View
36 client/css/style.css
@@ -397,12 +397,22 @@ body {
width: 100%;
}
+#content .changes {
+ background: #eed;
+ padding: 0 0 10px;
+ margin: 30px 0;
+ box-shadow: 0 1px 0 rgba(0,0,0,0.15) inset, 0 -1px 0 rgba(0,0,0,0.15) inset, 0 2px 20px -15px black, 0 15px 20px -10px white inset;
+ text-shadow: 0 1px rgba(255,255,255,0.8)
+}
+
#content .change {
padding: 4px;
margin: 4px 8px;
- background: #fafafa;
+ background: #fafaea;
border-radius: 4px;
box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 0 5px 15px white inset, 0 2px 4px rgba(0,0,0,0.05);
+ font-size: 110%;
+ color: #333311;
}
#content .change label {
@@ -419,18 +429,22 @@ body {
#content .change-viewer form input[type='text'], #content .change-viewer form textarea {
display: block;
- width: 99%;
- max-width: 99%;
+ width: 98%;
+ max-width: 98%;
margin: 2px auto;
font-family: inherit;
font-size: 120%;
- padding: 4px;
+ padding: 8px;
-webkit-box-sizing: content-box;
border: none;
box-shadow: 0 2px 3px rgba(0,0,0,0.2) inset, 0 0 0 1px rgba(0,0,0,0.1) inset;
border-radius: 3px;
}
+#content .change-viewer form textarea {
+ height: 100px;
+}
+
#lightbox {
position: absolute;
@@ -503,6 +517,10 @@ body {
margin-top: 10px;
}
+.actions.right-aligned {
+ text-align: right;
+}
+
.popup-menu {
position: absolute;
margin: 0;
@@ -576,4 +594,14 @@ body {
float: right;
position: relative;
left: 1px;
+}
+
+#changes {
+ display: none;
+}
+
+.clip {
+ position: absolute;
+ margin-top: -45px;
+ right: 0;
}
View
BIN  client/img/clip.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  client/index.html
@@ -40,7 +40,7 @@
<div id="sidebar">
<input type="search" id="search-field" placeholder="Filter Files by Name">
<ul>
- <li class="root" id="project"><img src="img/project.png">Project <span class="badge" id="changes">26<span class="description"> uncomitted changes</span></span>
+ <li class="root" id="project"><img src="img/project.png">Project <span class="badge" id="changes">0<span class="description"> uncomitted changes</span></span>
<div id="files">
<ul>
<li><img src="img/ajax-loader.gif">Loading project...
View
38 client/js/ChangeViewer.js
@@ -13,18 +13,50 @@ var ChangeViewer = function(entry) {
editor.className = 'change-viewer'
var actionsBar = document.createElement('div')
actionsBar.className = 'actions'
- actionsBar.innerHTML = '<button>Commit</button> <button class="right">Reset Changes</button>'
+ actionsBar.innerHTML = '<button>Reset All Changes</button> <button class="right">Commit and <span style="line-height: 1em;">⬆</span> Push to Origin </button> <button class="right">Commit</button>'
editor.appendChild(actionsBar)
var messageForm = document.createElement('form')
- messageForm.innerHTML = '<input type="text" placeholder="Commit Summary"><textarea placeholder="Extended Description"></textarea>'
+ messageForm.innerHTML = '<input type="text" placeholder="Commit Summary" class="commit-summary"><textarea placeholder="Extended Description" class="extended-description"></textarea>'
+ $(".extended-description", messageForm).hide()
editor.appendChild(messageForm)
+ var additionalOptions = document.createElement('div')
+ additionalOptions.innerHTML = '<label><input type="checkbox" checked> Clean up auto-save versions on commit</label>'
+ additionalOptions.className = 'actions right-aligned'
+ editor.appendChild(additionalOptions)
var changesDiv = document.createElement('div')
+ changesDiv.className = 'changes'
+ var changesDivActionsBar = document.createElement('div')
+ changesDivActionsBar.className = 'actions'
+ changesDivActionsBar.innerHTML = '<img src="img/clip.png" class="clip"><b>Files to be commited</b> <button>Check/Uncheck All</button>'
+ changesDiv.appendChild(changesDivActionsBar);
for (var i = 0; i < changes.length; i++) {
var changeDiv = document.createElement('div')
changeDiv.className = 'change'
- changeDiv.innerHTML = '<label><input type="checkbox"> ' + changes[i].sourceFile + '</label>'
+ var labelText = changes[i].sourceFile;
+ var disabled = ""
+ if (changes[i].destinationFile) {
+ labelText += '' + changes[i].destinationFile;
+ disabled = "disabled"
+ }
+ if (changes[i].index == 'D') {
+ disabled = "disabled"
+ labelText += ' <b>(deleted)</b>'
+ }
+ if (changes[i].index == '?') {
+ labelText += ' <b>(new)</b>'
+ }
+ changeDiv.innerHTML = '<label><input type="checkbox" checked ' + disabled +'> ' + labelText + '</label>'
changesDiv.appendChild(changeDiv)
}
editor.appendChild(changesDiv)
+
+ $(".commit-summary", messageForm).focus(function(){
+ $(".extended-description", messageForm).slideDown();
+ })
+ $(".commit-summary", messageForm).blur(function(){
+ if (this.value == '') {
+ $(".extended-description", messageForm).slideUp();
+ }
+ })
return editor
}
View
78 server/project.js
@@ -57,6 +57,8 @@ exports.start = function() {
exports.shouldDisplayWelcome = false
+exports.shouldUseGit = true
+
exports.init = function() {
try {
fs.mkdirSync('.nide', '755')
@@ -227,15 +229,35 @@ exports.remove = function(path) {
ee.emit('error', 'Invalid Path')
})
} else {
- exec('rm -rf -- ' + process.cwd() + path, function(err) {
- if (!err) {
- // Invalidate file list cache
- listCache = undefined
- ee.emit('success')
- } else {
- ee.emit('err', err)
- }
- })
+ if (exports.shouldUseGit) {
+ exec('git rm -rf -- "' + process.cwd() + path + '"', function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ exec('rm -rf -- "' + process.cwd() + path + '"', function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ ee.emit('err', err)
+ }
+ })
+ }
+ })
+ } else {
+ exec('rm -rf -- "' + process.cwd() + path + '"', function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ ee.emit('err', err)
+ }
+ })
+ }
}
return ee;
}
@@ -249,15 +271,35 @@ exports.rename = function(oldpath, newpath) {
ee.emit('error', 'Invalid Path')
})
} else {
- fs.rename(process.cwd() + oldpath, process.cwd() + newpath, function(err) {
- if (!err) {
- // Invalidate file list cache
- listCache = undefined
- ee.emit('success')
- } else {
- ee.emit('err', err)
- }
- })
+ if (exports.shouldUseGit) {
+ exec('git mv -- "' + process.cwd() + oldpath + '" "' + process.cwd() + newpath + '"', function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ fs.rename(process.cwd() + oldpath, process.cwd() + newpath, function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ ee.emit('err', err)
+ }
+ })
+ }
+ })
+ } else {
+ fs.rename(process.cwd() + oldpath, process.cwd() + newpath, function(err) {
+ if (!err) {
+ // Invalidate file list cache
+ listCache = undefined
+ ee.emit('success')
+ } else {
+ ee.emit('err', err)
+ }
+ })
+ }
}
return ee;
}
View
1  server/server.js
@@ -126,6 +126,7 @@ exports.listen = function(port) {
.on('success', function(file) {
listFilesAndUpdateClient()
listChangesAndUpdateClient()
+ socket.emit('rename-success', { path: data.newpath })
})
.on('error', function(err) {
socket.emit('rename-error', { path: data.oldpath, error: err })
Please sign in to comment.
Something went wrong with that request. Please try again.