Last active
October 17, 2015 17:09
-
-
Save MartinElvar/a5f60f3fdf90e996e23c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find all assignments & views. | |
var assignments = App.__container__.lookup('store:main').all("assignment"); | |
var views = App.__container__.lookup("component:assignment-frame")._viewRegistry; | |
$.each(views, function(i, view) { | |
// If the view is empty, or does not have a controller context, skip. | |
if (view == null || view._controller.model == null) { | |
return; | |
} | |
// Get the id controller context model. | |
var context_id = view._controller.model.id; | |
assignments.forEach(function(assignment) { | |
// If the view, and the assigment share the same id, we got a match, else skip. | |
if (assignment.id != context_id) { | |
return | |
} | |
// Gray the assignment if the assignment note contains our keyword. | |
if (assignment.get("notes") != null && assignment.get("notes").indexOf("#skygge") !=-1) { | |
$(view.element).removeClass("gray orange red green aqua"); | |
$(view.element).addClass("gray"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment