Commit f92f5bb4 authored by LianaHus's avatar LianaHus

fixed upload gist

parent 2c0e911e
...@@ -218,12 +218,12 @@ function fileExplorer (localRegistry, files, menuItems) { ...@@ -218,12 +218,12 @@ function fileExplorer (localRegistry, files, menuItems) {
} else { } else {
const folderPath = extractExternalFolder(key) const folderPath = extractExternalFolder(key)
if (folderPath === 'browser/gists') { if (folderPath === 'browser/gists') {
const id = key.substr(key.lastIndexOf('/'), key.length - 1)
actions['Push changes to gist'] = () => { actions['Push changes to gist'] = () => {
const id = key.substr(key.lastIndexOf('/') + 1, key.length - 1)
modalDialogCustom.confirm( modalDialogCustom.confirm(
'Push back to Gist', 'Push back to Gist',
'Are you sure you want to push all your changes back to Gist?', 'Are you sure you want to push all your changes back to Gist?',
() => { this.toGist(id) }, () => { self.toGist(id) },
() => {} () => {}
) )
} }
...@@ -430,6 +430,7 @@ fileExplorer.prototype.toGist = function (id) { ...@@ -430,6 +430,7 @@ fileExplorer.prototype.toGist = function (id) {
let proccedResult = function (error, data) { let proccedResult = function (error, data) {
if (error) { if (error) {
modalDialogCustom.alert('Failed to manage gist: ' + error) modalDialogCustom.alert('Failed to manage gist: ' + error)
console.log('Failed to manage gist: ' + error)
} else { } else {
if (data.html_url) { if (data.html_url) {
modalDialogCustom.confirm('Gist is ready', `The gist is at ${data.html_url}. Would you like to open it in a new window?`, () => { modalDialogCustom.confirm('Gist is ready', `The gist is at ${data.html_url}. Would you like to open it in a new window?`, () => {
...@@ -513,13 +514,13 @@ fileExplorer.prototype.packageFiles = function (filesProvider, callback) { ...@@ -513,13 +514,13 @@ fileExplorer.prototype.packageFiles = function (filesProvider, callback) {
else { else {
async.eachSeries(Object.keys(files), (path, cb) => { async.eachSeries(Object.keys(files), (path, cb) => {
filesProvider.get(path, (error, content) => { filesProvider.get(path, (error, content) => {
if (/^\s+$/.test(content) || !content.length) {
content = '// this line is added to create a gist. Empty file is not allowed.'
}
if (error) cb(error) if (error) cb(error)
else { else if (/^\s+$/.test(content) || !content.length) {
ret[path] = { content } content = '// this line is added to create a gist. Empty file is not allowed.'
cb() if (!error) {
ret[path] = { content }
cb()
}
} }
}) })
}, (error) => { }, (error) => {
...@@ -559,16 +560,6 @@ fileExplorer.prototype.copyFiles = function () { ...@@ -559,16 +560,6 @@ fileExplorer.prototype.copyFiles = function () {
} }
} }
// ------------------ gist publish --------------
fileExplorer.prototype.updateGist = function () {
const gistId = this.files.id
if (!gistId) {
tooltip('no gist content is currently loaded.')
} else {
this.toGist(gistId)
}
}
fileExplorer.prototype.createNewFile = function () { fileExplorer.prototype.createNewFile = function () {
let self = this let self = this
modalDialogCustom.prompt('Create new file', 'File Path (Untitled.sol, Folder1/Untitled.sol)', 'Untitled.sol', (input) => { modalDialogCustom.prompt('Create new file', 'File Path (Untitled.sol, Folder1/Untitled.sol)', 'Untitled.sol', (input) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment