From c16345ab128288b92023e789f09cabb5197d1181 Mon Sep 17 00:00:00 2001 From: Jason Croft Date: Thu, 12 May 2016 11:19:14 -0400 Subject: Can now select from available projects and snippets to build import URL. --- public/css/index.css | 5 +++++ public/js/index.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ public/views/body.ejs | 20 ++++++++++++++++++-- 3 files changed, 74 insertions(+), 2 deletions(-) (limited to 'public') diff --git a/public/css/index.css b/public/css/index.css index fdfae0ac..aaf84a04 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -328,6 +328,11 @@ div[contenteditable]:empty:not(:focus):before{ border-bottom: 1px solid #ccc; } +.snippet-import-or { + text-align: center; + width: 100%; +} + .status-bar { background: #1c1c1e; border-top: 1px solid #343434; diff --git a/public/js/index.js b/public/js/index.js index 7b22f7fa..199c678e 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -552,6 +552,10 @@ var ui = { codemirrorSizer: $(".ui-edit-area .CodeMirror .CodeMirror-sizer"), codemirrorSizerInner: $(".ui-edit-area .CodeMirror .CodeMirror-sizer > div"), markdown: $(".ui-view-area .markdown-body") + }, + modal: { + snippetProjects: $("#snippetImportModalProjects"), + snippetSnippets: $("#snippetImportModalSnippets") } }; @@ -1209,6 +1213,17 @@ ui.toolbar.import.snippet.click(function () { $("#snippetImportModalConfirm").prop('disabled', false); $("#snippetImportModalLoading").hide(); $("#snippetImportModal").modal('toggle'); + $("#snippetImportModalProjects").find('option').remove().end().append(''); + if (data.projects) { + data.projects.sort(function(a,b) { + return (a.path_with_namespace < b.path_with_namespace) ? -1 : ((a.path_with_namespace > b.path_with_namespace) ? 1 : 0); + }); + data.projects.forEach(function(project) { + $(''); + data.forEach(function(snippet) { + $('