Skip to content

Instantly share code, notes, and snippets.

@MartinElvar
Last active October 17, 2015 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinElvar/a5f60f3fdf90e996e23c to your computer and use it in GitHub Desktop.
Save MartinElvar/a5f60f3fdf90e996e23c to your computer and use it in GitHub Desktop.
// 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