forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change-Id: I01fdfda226ef3007b61f7b9071a67e17b4e2763d
- Loading branch information
Ryan Florence
committed
May 15, 2012
1 parent
4eb733f
commit d010385
Showing
68 changed files
with
1,843 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require [ | ||
'jquery' | ||
'Backbone' | ||
'compiled/home/views/DashboardView' | ||
'compiled/home/views/QuickStartBar/QuickStartBarView' | ||
'compiled/home/views/ActivityFeed/ActivityFeedView' | ||
'compiled/home/views/SideBar/SideBarView' | ||
'compiled/home/views/ActivityFeed/ActivityFeedFilterView' | ||
'compiled/home/views/ActivityFeed/ActivityFeedItemsView' | ||
'compiled/home/views/SideBar/TodoView' | ||
'compiled/home/views/SideBar/ComingUpView' | ||
], ($, {View}, DashboardView, QuickStartBarView, ActivityFeedView, SideBarView, ActivityFeedFilterView, ActivityFeedItemsView, TodoView, ComingUpView) -> | ||
|
||
$ -> | ||
@dashboard = new DashboardView | ||
|
||
el: document.getElementById('content') | ||
|
||
views: | ||
quickStartBar: new QuickStartBarView | ||
activityFeed: new ActivityFeedView | ||
views: | ||
activityFeedFilter: new ActivityFeedFilterView | ||
activityFeedItems: new ActivityFeedItemsView | ||
dashboardAside: new SideBarView | ||
views: | ||
todo: new TodoView | ||
comingUp: new ComingUpView | ||
|
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,70 @@ | ||
## | ||
# Controls the activity feed and the panel that filters it | ||
class ActivityFeedView extends View | ||
views: | ||
'.activityFeedFilter': ActivityFeedFilterView | ||
'.activityFeedItems' : ActivityFeedItemView | ||
|
||
## | ||
# Filters the activity feed | ||
class ActivityFeedFilterView extends DrawerView | ||
views: | ||
'.courseList' : CourseListView | ||
'.community' : CommunityView | ||
|
||
## | ||
# List of courses that filters the activity feed | ||
class CourseListView extends NavListView | ||
|
||
## | ||
# A course item in a CourseListView | ||
class CourseListItemView extends View | ||
|
||
## | ||
# Community items that filter the activity feed | ||
class CommunityView extends NavListView | ||
|
||
## | ||
# A group item the a CommunityView | ||
class GroupItemView extends NavListView | ||
|
||
## | ||
# Controls the items in an ActivityFeed | ||
class ActivityFeedItemsView extends View | ||
views: | ||
'.activityFeedItemsFilterView': ActivityFeedItemsFilterView | ||
|
||
## | ||
# Filters the items in an ActivityFeedItemsView | ||
class ActivityFeedItemsFilterView extends View | ||
|
||
## | ||
# Controls an activity feed item | ||
class ActivityFeedItemView extends View | ||
|
||
## | ||
# Controls the todos and coming up items on the dashboard | ||
class DashboardAsideView extends View | ||
views: | ||
'.todoView' : TodoView | ||
'.comingUpView': ComingUpView | ||
|
||
## | ||
# Controls the todo items on the Dashboard | ||
class TodoView extends AsideListView | ||
class TodoItemView extends AsideListItemView | ||
|
||
## | ||
# Controls the coming up items on the Dashboard | ||
class ComingUpView extends AsideListView | ||
class ComingUpItemView extends AsideListItemView | ||
|
||
## | ||
# Creates LMS objects quickly from one interface | ||
class QuickStartBarView | ||
|
||
## | ||
# Controls the global dashboard actions | ||
class DashboardActionsView | ||
|
||
|
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,6 @@ | ||
define ['Backbone'], ({Model, Collection}) -> | ||
|
||
class CourseCollection extends Collection | ||
model: Model.extend() | ||
url: 'api/v1/courses' | ||
|
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,6 @@ | ||
define ['Backbone'], ({Collection, Model}) -> | ||
|
||
class TodoCollection extends Collection | ||
url: '/api/v1/users/self/todo' | ||
model: Model.extend() | ||
|
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,12 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class QuickStartAssignment extends Model | ||
|
||
defaults: | ||
title: 'No Title' | ||
description: 'No Description' | ||
due_at: null | ||
points_possible: null | ||
grading_type: 'points' | ||
submission_types: 'online_upload,online_text_entry' | ||
|
4 changes: 4 additions & 0 deletions
4
app/coffeescripts/home/models/quickStartBar/Announcement.coffee
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 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class Announcement extends Model | ||
|
12 changes: 12 additions & 0 deletions
12
app/coffeescripts/home/models/quickStartBar/Assignment.coffee
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,12 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class Assignment extends Model | ||
|
||
defaults: | ||
title: 'No Title' | ||
description: 'No Description' | ||
due_at: null | ||
points_possible: null | ||
grading_type: 'points' | ||
submission_types: 'online_upload,online_text_entry' | ||
|
4 changes: 4 additions & 0 deletions
4
app/coffeescripts/home/models/quickStartBar/Discussion.coffee
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 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class Discussion extends Model | ||
|
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 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class Message extends Model | ||
|
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 @@ | ||
define ['Backbone'], ({Model}) -> | ||
|
||
class Pin extends Model | ||
|
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,13 @@ | ||
## | ||
# Exports all the form templates for the quick start bar | ||
# as an object. | ||
|
||
define [ | ||
'jst/quickStartBar/assignment' | ||
'jst/quickStartBar/announcement' | ||
'jst/quickStartBar/message' | ||
'jst/quickStartBar/pin' | ||
], (assignment, announcement, message, pin) -> | ||
|
||
{assignment, announcement, message, pin} | ||
|
19 changes: 19 additions & 0 deletions
19
app/coffeescripts/home/util/activityFeedItemViewFactory.coffee
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,19 @@ | ||
define [ | ||
'compiled/home/views/ActivityFeed/items/ActivityFeedItemView' | ||
'compiled/home/views/ActivityFeed/items/Announcement' | ||
'compiled/home/views/ActivityFeed/items/Collaboration' | ||
'compiled/home/views/ActivityFeed/items/Conference' | ||
'compiled/home/views/ActivityFeed/items/Conversation' | ||
'compiled/home/views/ActivityFeed/items/DiscussionTopic' | ||
'compiled/home/views/ActivityFeed/items/Message' | ||
'compiled/home/views/ActivityFeed/items/Submission' | ||
], (ActivityFeedItemView) -> | ||
|
||
activityFeedItemViewFactory = (activityFeedItem) -> | ||
type = activityFeedItem.toJSON().type | ||
View = ActivityFeedItemView[type] | ||
if View | ||
new View model: activityFeedItem | ||
else | ||
new ActivityFeedItemView model: activityFeedItem | ||
|
58 changes: 58 additions & 0 deletions
58
app/coffeescripts/home/views/ActivityFeed/ActivityFeedFilterView.coffee
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,58 @@ | ||
define [ | ||
'Backbone' | ||
'compiled/home/collections/CourseCollection' | ||
], ({View}, CourseCollection) -> | ||
|
||
class ActivityFeedFilterView extends View | ||
|
||
events: | ||
'click a': 'clickFilter' | ||
|
||
initialize: -> | ||
@courseCollection = new CourseCollection | ||
@courseCollection.on 'add', @addCourse | ||
@courseCollection.on 'reset', => @courseCollection.each @addCourse | ||
@courseCollection.fetch | ||
# remove the "loading..." indicator element | ||
success: => @$('.courseList li:first').remove() | ||
|
||
clickFilter: (event) -> | ||
event.preventDefault() | ||
$el = $ event.target | ||
value = $el.data 'value' | ||
@filterFeed value | ||
|
||
filterFeed: (query) -> | ||
console.log "clicked: #{query}" | ||
|
||
addCourse: (course) => | ||
id = course.get 'id' | ||
course_code = course.get 'course_code' | ||
@$('.courseList').append "<li><a href='#' data-value='course:#{id}'>#{course_code}</a></li>" | ||
|
||
render: -> | ||
@$el.html """ | ||
<header class="toolbar"> </header> | ||
<div class="list-view"> | ||
<ul class="filterList"> | ||
<li><a href="#" class="selected" data-value="everything">Everything</a> | ||
</ul> | ||
<header>Courses</header> | ||
<ul class="courseList"> | ||
<li><a>Loading...</a></li> | ||
</ul> | ||
<header>Canvas Network</header> | ||
<ul class="community"> | ||
<li><a href="#" data-value="peopleIFollow">People I Follow</a> | ||
<li><a href="#" data-value="popular">Popular</a> | ||
<li><a href="#" data-value="questions">Questions</a> | ||
</ul> | ||
<ul class="communityUserCommunities filterList"> | ||
<li><a href="#">TODO: fake data</a> | ||
</ul> | ||
</div> | ||
""" | ||
super | ||
|
50 changes: 50 additions & 0 deletions
50
app/coffeescripts/home/views/ActivityFeed/ActivityFeedItemsView.coffee
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,50 @@ | ||
define [ | ||
'Backbone' | ||
'compiled/home/util/activityFeedItemViewFactory' | ||
], ({View, Collection, Model}, activityFeedItemViewFactory) -> | ||
|
||
class ActivityFeedItemsCollection extends Collection | ||
model: Model.extend() | ||
url: '/api/v1/users/self/activity_stream' | ||
|
||
class ActivityFeedItemsView extends View | ||
|
||
initialize: -> | ||
@collection ?= new ActivityFeedItemsCollection | ||
@collection.on 'add', @addActivityFeedItem | ||
@collection.on 'reset', @resetActivityFeedItems | ||
@collection.fetch() | ||
|
||
addActivityFeedItem: (activityFeedItem) => | ||
view = activityFeedItemViewFactory activityFeedItem | ||
view.render() | ||
@$itemList.append view.el | ||
|
||
resetActivityFeedItems: => | ||
@collection.each @addActivityFeedItem | ||
|
||
render: -> | ||
@$el.html """ | ||
<header class="activityFeedItemsToolbar toolbar border border-trbl border-round-t"> | ||
<div class="row-fluid"> | ||
<div class="span5"> | ||
<h2 class="header"><i class="icon-drawer-toggle">☭</i>Recent Activity</h2> | ||
</div> | ||
<div class="span7"> | ||
<ul class="activityFeedItemsFilter nav nav-links"> | ||
<li><a href="#" class="active">All</a> | ||
<li><a href="#">Announcements</a> | ||
<li><a href="#">Discussions</a> | ||
<li><a href="#">Messages</a> | ||
</ul> | ||
</div> | ||
</div> | ||
</header> | ||
<ul class="activityFeedItemsList"></ul> | ||
""" | ||
@cacheElements() | ||
super | ||
|
||
cacheElements: -> | ||
@$itemList = @$ '.activityFeedItemsList' | ||
|
19 changes: 19 additions & 0 deletions
19
app/coffeescripts/home/views/ActivityFeed/ActivityFeedView.coffee
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,19 @@ | ||
define ['Backbone'], ({View}) -> | ||
|
||
## | ||
# Controls the activity feed and the panel that filters it | ||
class ActivityFeedView extends View | ||
|
||
events: | ||
'click .icon-drawer-toggle': 'toggleDrawer' | ||
|
||
toggleDrawer: -> | ||
@$el.toggleClass 'drawerClosed' | ||
|
||
render: -> | ||
@$el.html """ | ||
<div class="activityFeedFilter content-box border border-tbl border-round-tl"></div> | ||
<div class="activityFeedItems content-box border border-trbl border-round-t box-shadow"></div> | ||
""" | ||
super | ||
|
Oops, something went wrong.