Skip to content

Commit

Permalink
csv fields applied, thumbnails fixed, app closing
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinrice committed Sep 30, 2018
1 parent ba18fa3 commit 5420b5c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 12 additions & 4 deletions js/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,12 @@ function loadHeader(project) {
document.getElementById("export" + project['name']).onclick = function() {
electron.remote.dialog.showSaveDialog(function(filename, bookmark) {
database.get_images_in_project(project['name'], function(projName, rows) {
database.get_metadata_fields(function(columns) {
database.get_favorite_fields(function(_, columns_dup) {
/* Create CSV Header. */
var csvString = "";
var columns = columns_dup.filter(function(item, pos) {
return columns_dup.indexOf(item) == pos;
})
columns.forEach(function(col) {
csvString += col + ", ";
});
Expand Down Expand Up @@ -502,7 +505,6 @@ function insertDetailTemplate(img_name, img_path, proj_name) {

function insertDetailTemplate__NEW(data, id, path, projname) {
data.displayName = withspaces(data.name)
insertIntoSlideMenu(data, id);
data.id = id;

if (data.error) {
Expand Down Expand Up @@ -558,12 +560,18 @@ function insertDetailTemplate__NEW(data, id, path, projname) {
var mediacontents
if (data.media != 'pdf') {
mediacontents = '<{{media}} class="img-responsive rounded" src="{{path}}" alt="' + data.sorry + '" controls>'
data.thumbcontents = '<{{media}} class="img-responsive rounded thumb" src="{{path}}" alt="{{displayName}}" controls>'
} else {
//mediacontents = '<object type="application/pdf" data="{{path}}"><p>' + data.sorry + '</p></object>'
var path_nospace = data.path.replace(/ /g, '%20')
console.log(path_nospace)
mediacontents = "<webview src='{{path}}' plugins></webview>"
mediacontents = '<webview src="{{path}}" plugins></webview>'
data.thumbcontents = '<webview src="{{path}}" class="thumb" plugins></webview>'
}

insertIntoSlideMenu(data, id);


var template = [
'<div class="col-md-4 col-xs-6">',
'<div class="row name-row">',
Expand Down Expand Up @@ -825,7 +833,7 @@ function insertIntoSlideMenu(data, id) {
'<div class="row thumb-row">',
'<input id="{{name}}check_thumb" type="checkbox" checked class="menu-check-thumb">',
'<div class="panel panel-defualt data-panel clearfix thumb-panel">',
'<img src="{{path}}" alt="{{name}}" class="thumb">',
data.thumbcontents,
'</div>',
'</div>',
].join('\n')
Expand Down
10 changes: 6 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ if (app) {

// Quit when all windows are closed.
app.on('window-all-closed', function () {
app.quit()
db.close()

// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
db.close()
}
// if (process.platform !== 'darwin') {
// app.quit()
// db.close()
// }
})

app.on('activate', function () {
Expand Down

0 comments on commit 5420b5c

Please sign in to comment.