-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
F/#153 create breadcrumbs widget
- Loading branch information
Showing
11 changed files
with
91 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
define ['cs!widget'], (Widget) -> | ||
class BreadcrumbsWidget extends Widget | ||
subscribed_channels: ['/subjects', '/assignments','/submissions'] | ||
template_name: 'templates/breadcrumbs_widget.hjs' | ||
|
||
aggregated_channels:{get_subjects_and_assignments: ['/subjects', '/assignments', | ||
'/submissions']} | ||
|
||
get_subjects_and_assignments: (subjects_params, assignments_params, submissions_params) => | ||
base_url = Utils.current_url() | ||
output = [ {url:base_url, name: "Dashboard"}] | ||
current_url = window.location.href.split("/") | ||
id = current_url[current_url.length - 1] | ||
current_page = current_url[current_url.length - 2] | ||
current_page = current_page.substr(1) | ||
if current_page is "submissions" | ||
aux = submissions_params.collection.get(id) | ||
assignment_id = aux.attributes.assignment_id | ||
|
||
if assignment_id | ||
submission_id = id | ||
id = assignment_id | ||
|
||
if current_page is "assignments" or assignment_id | ||
aux = assignments_params.collection.get(id) | ||
assignment = aux.attributes.name | ||
subject_id = aux.attributes.subject_id | ||
|
||
if current_page is "subjects" | ||
subject_id = id | ||
|
||
if subject_id | ||
aux = subjects_params.collection.get(subject_id) | ||
subject = aux.attributes.name | ||
|
||
if subject_id | ||
output.push({url: base_url + "#subjects/" + subject_id,name: subject}) | ||
|
||
if assignment_id | ||
output.push({url: base_url + "#assignments/" + assignment_id,name: assignment}) | ||
|
||
if submission_id | ||
output.push({url: base_url + "#submissions/" + submission_id,name: "Submission"}) | ||
|
||
params= | ||
output: output | ||
@renderLayout(params, false) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
<div class="mozaic-widget" data-widget="breadcrumbs" data-params="{{breadcrumbs_params}}"></div> | ||
<div class="mozaic-widget" data-widget="assignment_details" data-params="{{assignments_params}}"></div> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{#each output}} | ||
<a href="{{url}}">{{name}}</a> | ||
{{/each}} | ||
<br> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<h1>Dashboard</h1> | ||
<div class="mozaic-widget" data-widget="breadcrumbs" data-params="{{breadcrumbs_params}}"></div> | ||
<table class="mozaic-widget" data-widget="list" data-params="{{list_params}}"></table> | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<div class="mozaic-widget" data-widget="breadcrumbs" data-params="{{breadcrumbs_params}}"></div> | ||
<div class="mozaic-widget" data-widget="subject_details" data-params="{{subjects_params}}"></div> | ||
<table class="mozaic-widget" data-widget="assignments" data-params="{{assignments_params}}"></table> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
<div class="mozaic-widget" data-widget="breadcrumbs" data-params="{{breadcrumbs_params}}"></div> | ||
<div class="mozaic-widget" data-widget="submission_details" data-params="{{submissions_params}}"></div> |