Commit 1f3cf0f6 authored by Mihkel Putrinš's avatar Mihkel Putrinš

cleanup and nicer progressbar

parent 04404871
......@@ -23,9 +23,9 @@ if (IS_DEV) {
}
app.on('ready', function() {
var home_path = app.getPath('home')
USER_PATH = path.join(home_path, 'user.json')
USER_PATH = path.join(app.getPath('temp'), 'user.json')
// windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, "web-preferences": {partition: ''} })
windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, "web-preferences": {partition: "persist:panustaja (build " + (pjson.build) + ")"} })
var title = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '') + ' | Logi sisse'
windows['authWindow'].center()
......@@ -49,14 +49,14 @@ app.on('ready', function() {
// + '\n"' + user_url + '"'
// , buttons:['ok']
// })
// require('dialog').showMessageBox({type:'info', message:'HOME: ' + home_path, buttons:['ok']})
// console.log(windows['authWindow'].webContents.session.cookies);
windows['authWindow'].webContents.savePage(USER_PATH, 'HTMLOnly', function(err) {
if (err) {
require('dialog').showMessageBox({type:'info', message:'peale salvestamist: katki' + err, buttons:['ok']})
console.log("Error:", err)
process.exit()
} else {
var view_path = path.join(__dirname, 'views', 'main.jade')
var view_path = path.join(app.getAppPath(), 'code', 'views', 'main.jade')
// require('dialog').showMessageBox({type:'info', message:'peale salvestamist: korras\n'
// + 'Laen lehte: file://' + view_path, buttons:['ok']})
mainWindow.webContents.loadUrl('file://' + view_path)
......
......@@ -17,9 +17,6 @@ var pjson = require(path.join(__dirname, '..', '..', 'package.json'))
UPLOADER_VERSION = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '')
var ipc = require('ipc')
// ipc.send('userdata-query')
// ipc.on('userdata-reply', function(user_data) {
// })
var b2s = require(path.join(__dirname, '..', 'bytesToSize.js'))
......@@ -31,11 +28,11 @@ var dom_resource_stats = document.getElementById('resourceStats')
var renderer_interval
setTimeout(function () {
var home_path = app.getPath('home')
USER_PATH = path.join(home_path, 'user.json')
// dialog.showMessageBox({type:'info', message:'loeme faili: ' + USER_PATH, buttons:['ok']})
USER_PATH = path.join(app.getPath('temp'), 'user.json')
fs.readFile(USER_PATH, 'utf8', function(err, data_json) {
if (err) throw (err)
// dialog.showMessageBox({type:'info', message:'fail avatud: ' + USER_PATH, buttons:['ok']})
// dialog.showMessageBox({type:'info', message:data_json, buttons:['ok']})
var data = JSON.parse(data_json)
if (op.get(data, 'result.user_id', false)) {
user_data['user_id'] = op.get(data, 'result.user_id')
......@@ -44,6 +41,7 @@ setTimeout(function () {
document.getElementById('userName').innerHTML = user_data.name
var title = UPLOADER_VERSION + ' | ' + user_data['name']
ipc.send('setTitle', title)
setFormState('select')
} else {
ipc.send('log', 'User data incomplete.')
ipc.send('data', data)
......@@ -177,6 +175,8 @@ var setFormState = function setFormState(state) {
document.getElementById('uploading').setAttribute('hidden', '')
document.getElementById('uploadResource').setAttribute('hidden', '')
document.getElementById('resourceName').setAttribute('hidden', '')
// ---
// document.getElementById('uploading').removeAttribute('hidden')
break
case 'loading':
document.getElementById('loading').removeAttribute('hidden')
......@@ -219,4 +219,3 @@ var setFormState = function setFormState(state) {
break
}
}
setFormState('select')
#resourceProgressbarOuter {
width: 100%;
border-radius: 25px;
height: 6px;
background-color: #cdf;
height: 9px;
background-color: #E8E8C3;
border: 0px solid black;
}
#resourceProgressbarInner {
width: 0%;
border-radius: 25px;
height: 100%;
background-color: #79b;
background-color: #92CC6F;
/*border: 0px solid green;*/
}
#fileProgressbarOuter {
width: 100%;
border-radius: 25px;
height: 6px;
height: 9px;
background-color: #cdf;
border: 0px solid black;
}
......@@ -23,6 +23,6 @@
width: 0%;
border-radius: 25px;
height: 100%;
background-color: #79b;
background-color: #0065CA;
/*border: 0px solid green;*/
}
......@@ -9,7 +9,7 @@ html
body
h1#userName() Tere
div#selectLocal
div#selectLocal(hidden)
p#selectLocalMessage Palun vali fail(id) ja/või kataloog(id), mida soovid üles laadida.
button#selectLocalButton(onclick='selectLocal()') Vali
div#resourceName(hidden='')
......@@ -32,12 +32,12 @@ html
span#uploadTotalResources 0
div#resourceProgressbarOuter
div#resourceProgressbarInner
div#fileProgressbarInner
span= 'Failid: '
span#uploadedSize 0
span /
span#uploadTotalSize 0
div#fileProgressbarOuter
div#fileProgressbarInner
//- div#fileProgressbarOuter
pre#status
div#thankYou(hidden='') Aitäh!
......
......@@ -2,7 +2,7 @@
"name": "Panustaja",
"description": "Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse.",
"version": "1.0.1-d",
"build": 64,
"build": 88,
"main": "./code/app.js",
"license": "CC-SA",
"private": true,
......
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