From 7c1fce2fc9cdee442891799bc1ff0174e534501b Mon Sep 17 00:00:00 2001 From: Toxantron Date: Sun, 30 Apr 2017 21:39:02 +0200 Subject: [PATCH] Parse csv in client --- src/controllers/issue.php | 20 ++++++++++++++++++++ src/js/csv-plugin.js | 35 +++++++++++++++++++++++++++++++++++ src/sample-config.php | 4 +++- src/templates/csv_source.html | 27 +++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/controllers/issue.php create mode 100644 src/js/csv-plugin.js create mode 100644 src/templates/csv_source.html diff --git a/src/controllers/issue.php b/src/controllers/issue.php new file mode 100644 index 0000000..da37413 --- /dev/null +++ b/src/controllers/issue.php @@ -0,0 +1,20 @@ +id = $id; + $this->topic = $topic; + } +} diff --git a/src/js/csv-plugin.js b/src/js/csv-plugin.js new file mode 100644 index 0000000..73768ab --- /dev/null +++ b/src/js/csv-plugin.js @@ -0,0 +1,35 @@ +/*globals scrum */ + +// Add a plugin for github integration +scrum.sources.push({ + // Fixed properties and methods + name: "CSV", + position: 5, + view: "templates/csv_source.html", + feedback: false, + // Feedback call for completed poll + completed: function(result) { + }, + + // Custom properties and methods + loaded: false, + format: '', + + // Issues after parsing the file + issues: [], + issue: {}, + event: ['poll', 'start', 'CSV'], + + // Load issues from github + load: function() { + var self = this; + // Upload file http://stackoverflow.com/a/22538760 + var file = document.getElementById('csv_issues').files[0]; + var reader = new FileReader(); + reader.addEventListener("load", function (event) { + var textFile = event.target; + var content = textFile.result; + }); + reader.readAsText(file); + } +}); diff --git a/src/sample-config.php b/src/sample-config.php index 24f3300..47ebca5 100644 --- a/src/sample-config.php +++ b/src/sample-config.php @@ -40,7 +40,9 @@ // Plugin to load issues from github 'GitHub', // Plugin to load issues from JIRA - 'JIRA' + 'JIRA', + // Import issues from CSV file + 'CSV', ]; // Configuration for the server side JIRA controller diff --git a/src/templates/csv_source.html b/src/templates/csv_source.html new file mode 100644 index 0000000..06c8119 --- /dev/null +++ b/src/templates/csv_source.html @@ -0,0 +1,27 @@ + +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+
+ + +
+
+ +
+