diff --git a/Gruntfile.js b/Gruntfile.js index e8fbe5581..e12928caf 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -153,10 +153,10 @@ module.exports = function(grunt) { "editor/js/ui/typeSearch.js", "editor/js/ui/subflow.js", "editor/js/ui/userSettings.js", - "editor/js/ui/projects.js", - "editor/js/ui/projectSettings.js", - "editor/js/ui/projectUserSettings.js", - "editor/js/ui/tab-versionControl.js", + "editor/js/ui/projects/projects.js", + "editor/js/ui/projects/projectSettings.js", + "editor/js/ui/projects/projectUserSettings.js", + "editor/js/ui/projects/tab-versionControl.js", "editor/js/ui/touch/radialMenu.js" ], dest: "public/red/red.js" diff --git a/editor/js/ui/projectSettings.js b/editor/js/ui/projects/projectSettings.js similarity index 100% rename from editor/js/ui/projectSettings.js rename to editor/js/ui/projects/projectSettings.js diff --git a/editor/js/ui/projectUserSettings.js b/editor/js/ui/projects/projectUserSettings.js similarity index 100% rename from editor/js/ui/projectUserSettings.js rename to editor/js/ui/projects/projectUserSettings.js diff --git a/editor/js/ui/projects.js b/editor/js/ui/projects/projects.js similarity index 91% rename from editor/js/ui/projects.js rename to editor/js/ui/projects/projects.js index a535507c1..8dc3a715c 100644 --- a/editor/js/ui/projects.js +++ b/editor/js/ui/projects/projects.js @@ -42,17 +42,6 @@ RED.projects = (function() { $('
').text("To get started you can create your first project using your current flow files in a few easy steps.").appendTo(body); $('
').text("If you are not sure, you can skip this for now. You will still be able to create your first project from the 'Projects' menu option at any time.").appendTo(body); - // var buttons = $('
').appendTo(container); - // var createNew = $('').appendTo(buttons); - // createNew.click(function(e) { - // e.preventDefault(); - // show('create'); - // }); - // var openExisting = $('').appendTo(buttons); - // openExisting.click(function(e) { - // e.preventDefault(); - // show('open') - // }); return container; }, buttons: [ @@ -1075,87 +1064,96 @@ RED.projects = (function() { ] } })(), - 'open': { - content: function() { - return createProjectList({ - canSelectActive: false, - dblclick: function() { - $("#projects-dialog-open").click(); - }, - select: function() { - $("#projects-dialog-open").prop('disabled',false).removeClass('disabled ui-button-disabled ui-state-disabled'); - } - }) - }, - buttons: [ - { - // id: "clipboard-dialog-cancel", - text: RED._("common.label.cancel"), - click: function() { - $( this ).dialog( "close" ); - } + 'open': (function() { + var selectedProject; + return { + title: "Open a project", // TODO: NLS + content: function() { + return createProjectList({ + canSelectActive: false, + dblclick: function(project) { + selectedProject = project; + $("#projects-dialog-open").click(); + }, + select: function(project) { + selectedProject = project; + $("#projects-dialog-open").prop('disabled',false).removeClass('disabled ui-button-disabled ui-state-disabled'); + } + }) }, - { - id: "projects-dialog-open", - text: "Open project", // TODO: nls - class: "primary disabled", - disabled: true, - click: function() { - dialog.dialog( "close" ); - switchProject(selectedProject.name,function(err,data) { - if (err) { - if (err.error !== 'credentials_load_failed') { - console.log("unexpected_error",err) + buttons: [ + { + // id: "clipboard-dialog-cancel", + text: RED._("common.label.cancel"), + click: function() { + $( this ).dialog( "close" ); + } + }, + { + id: "projects-dialog-open", + text: "Open project", // TODO: nls + class: "primary disabled", + disabled: true, + click: function() { + dialog.dialog( "close" ); + switchProject(selectedProject.name,function(err,data) { + if (err) { + if (err.error !== 'credentials_load_failed') { + console.log("unexpected_error",err) + } } - } - }) - } - } - ] - }, - - 'delete': { - content: function() { - return createProjectList({ - canSelectActive: false, - dblclick: function() { - $("#projects-dialog-delete").click(); - }, - select: function() { - $("#projects-dialog-delete").prop('disabled',false).removeClass('disabled ui-button-disabled ui-state-disabled'); - } - }) - }, - buttons: [ - { - // id: "clipboard-dialog-cancel", - text: RED._("common.label.cancel"), - click: function() { - $( this ).dialog( "close" ); + }) + } } + ] + } + })(), + 'delete': (function() { + var selectedProject; + return { + content: function() { + return createProjectList({ + canSelectActive: false, + dblclick: function(project) { + selectedProject = project; + $("#projects-dialog-delete").click(); + }, + select: function(project) { + selectedProject = project; + $("#projects-dialog-delete").prop('disabled',false).removeClass('disabled ui-button-disabled ui-state-disabled'); + } + }) }, - { - id: "projects-dialog-delete", - text: "Delete project", // TODO: nls - class: "primary disabled", - disabled: true, - click: function() { - deleteProject(selectedProject.name,function(err,data) { - if (err) { - if (err.error === 'credentials_load_failed') { - dialog.dialog( "close" ); + buttons: [ + { + // id: "clipboard-dialog-cancel", + text: RED._("common.label.cancel"), + click: function() { + $( this ).dialog( "close" ); + } + }, + { + id: "projects-dialog-delete", + text: "Delete project", // TODO: nls + class: "primary disabled", + disabled: true, + click: function() { + deleteProject(selectedProject.name,function(err,data) { + if (err) { + if (err.error === 'credentials_load_failed') { + dialog.dialog( "close" ); + } else { + console.log("unexpected_error",err) + } } else { - console.log("unexpected_error",err) + dialog.dialog( "close" ); } - } else { - dialog.dialog( "close" ); - } - }) + }) + } } - } - ] - - } + ] + } + })() } } @@ -1222,15 +1220,107 @@ RED.projects = (function() { dialog.dialog({position: { 'my': 'center top', 'at': 'center top+10%', 'of': window }}); } - var selectedProject = null; - function createProjectList(options) { options = options||{}; var height = options.height || "300px"; - selectedProject = null; - var container = $('',{style:"min-height: "+height+"; height: "+height+";"}); + var container = $('',{class:"projects-dialog-project-list-container" }); + var filterTerm = ""; - var list = $('