summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-08-19 18:02:55 +0000
committerRuben Davila <rdavila84@gmail.com>2016-08-19 15:20:04 -0500
commit41a19f01c5a9ab5dccd93d51703872cc3dcdb4e6 (patch)
tree44f4c28f177623c1dec19c265e032a4e7fe12a7e
parent95cf5a09e8ca0482f01f09eb9fd321595f1eabe3 (diff)
downloadgitlab-ce-41a19f01c5a9ab5dccd93d51703872cc3dcdb4e6.tar.gz
Merge branch 'issue-boards-label-text-color' into 'master'
Added text color to issues labels in issue board lists ## What does this MR do? Adds the text color for labels in the response. The frontend was already setup to handle this, just needed the data from the backend. See merge request !5898
-rw-r--r--app/assets/javascripts/boards/models/label.js.es61
-rw-r--r--app/controllers/projects/boards/issues_controller.rb2
-rw-r--r--spec/fixtures/api/schemas/issue.json40
3 files changed, 26 insertions, 17 deletions
diff --git a/app/assets/javascripts/boards/models/label.js.es6 b/app/assets/javascripts/boards/models/label.js.es6
index e81e91fe972..583829552cd 100644
--- a/app/assets/javascripts/boards/models/label.js.es6
+++ b/app/assets/javascripts/boards/models/label.js.es6
@@ -3,6 +3,7 @@ class ListLabel {
this.id = obj.id;
this.title = obj.title;
this.color = obj.color;
+ this.textColor = obj.text_color;
this.description = obj.description;
this.priority = (obj.priority !== null) ? obj.priority : Infinity;
}
diff --git a/app/controllers/projects/boards/issues_controller.rb b/app/controllers/projects/boards/issues_controller.rb
index 2d894b3dd4a..1a4f6b50e8f 100644
--- a/app/controllers/projects/boards/issues_controller.rb
+++ b/app/controllers/projects/boards/issues_controller.rb
@@ -12,7 +12,7 @@ module Projects
only: [:iid, :title, :confidential],
include: {
assignee: { only: [:id, :name, :username], methods: [:avatar_url] },
- labels: { only: [:id, :title, :description, :color, :priority] }
+ labels: { only: [:id, :title, :description, :color, :priority], methods: [:text_color] }
})
end
diff --git a/spec/fixtures/api/schemas/issue.json b/spec/fixtures/api/schemas/issue.json
index 299e4675d6f..532ebb9640e 100644
--- a/spec/fixtures/api/schemas/issue.json
+++ b/spec/fixtures/api/schemas/issue.json
@@ -10,23 +10,31 @@
"title": { "type": "string" },
"confidential": { "type": "boolean" },
"labels": {
- "type": ["array"],
- "required": [
- "id",
- "color",
- "description",
- "title",
- "priority"
- ],
- "properties": {
- "id": { "type": "integer" },
- "color": {
- "type": "string",
- "pattern": "^#[0-9A-Fa-f]{3}{1,2}+$"
+ "type": "array",
+ "items": {
+ "type": "object",
+ "required": [
+ "id",
+ "color",
+ "description",
+ "title",
+ "priority"
+ ],
+ "properties": {
+ "id": { "type": "integer" },
+ "color": {
+ "type": "string",
+ "pattern": "^#[0-9A-Fa-f]{3}{1,2}+$"
+ },
+ "description": { "type": ["string", "null"] },
+ "text_color": {
+ "type": "string",
+ "pattern": "^#[0-9A-Fa-f]{3}{1,2}+$"
+ },
+ "title": { "type": "string" },
+ "priority": { "type": ["integer", "null"] }
},
- "description": { "type": ["string", "null"] },
- "title": { "type": "string" },
- "priority": { "type": ["integer", "null"] }
+ "additionalProperties": false
}
},
"assignee": {