diff --git a/src/index.php b/src/index.php index dac94d0..703b823 100644 --- a/src/index.php +++ b/src/index.php @@ -20,7 +20,7 @@ Online planning poker - + diff --git a/src/js/gitlab-plugin.js b/src/js/gitlab-plugin.js new file mode 100644 index 0000000..002e045 --- /dev/null +++ b/src/js/gitlab-plugin.js @@ -0,0 +1,53 @@ +/*globals scrum */ + +// Add a plugin for github integration +scrum.sources.push({ + // Fixed properties and methods + name: "Gitlab", + position: 4, + view: "templates/gitlab_source.html", + feedback: false, + // Feedback call for completed poll + completed: function(result) { + }, + + // Custom properties and methods + loaded: false, + server: 'https://gitlab.com/', + repo: '', + issues: [], + issue: {}, + + // Private repo + isPrivate: false, + token: '', + + // Load issues from github + load: function() { + var self = this; + + var headers = {}; + if(self.isPrivate) { + headers['Private-Token'] = this.token; + } + + // Build access URL. Gitlab is very picky about that! + var encodedRepo = encodeURIComponent(this.repo); + var uri = this.server; + if(uri.substr(-1) !== '/') + uri += '/'; + uri += 'api/v4/projects/' + encodedRepo + '/issues'; + this.parent.$http + .get(uri, { headers: headers }) + .then(function (response) { + // Convert markdown to HTML + var converter = new showdown.Converter(); + response.data.forEach(function(issue) { + issue.description = converter.makeHtml(issue.description); + }); + self.issues = response.data; + self.issue = self.issues[0]; + self.loaded = true; + }); + } +}); diff --git a/src/sample-config.php b/src/sample-config.php index 24f3300..d0449f0 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', + // Plugin to load issues from Gitlab + 'Gitlab' ]; // Configuration for the server side JIRA controller diff --git a/src/templates/gitlab_source.html b/src/templates/gitlab_source.html new file mode 100644 index 0000000..48b9016 --- /dev/null +++ b/src/templates/gitlab_source.html @@ -0,0 +1,68 @@ + +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+
+ + +
+
+ +
+
+
+ {{ master.current.issue.author.name }} +
+
+

#{{ master.current.issue.iid }}: {{ master.current.issue.title }}

+
+
+
+

{{ label.name }}

+
+ +
+
+ {{ master.current.issue.author.name }} created issue on {{ master.current.issue.created_at | date : "medium" }} +
+
+
+ + +
+
+