Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CLC-853 - Add site_url property to myclasses feed

  • Loading branch information...
commit 3ea78b0486b9de1bcc9827b91342d5cb2c657cf7 1 parent 8edfde2
@christianv christianv authored
View
3  API.md
@@ -11,6 +11,7 @@ Projected endpoints:
```
/api/my/status :
is_logged_in: <boolean>
+ first_login_at: <datetime or nil when you have not logged in yet>
has_canvas_access_token: <boolean>
has_google_access_token: <boolean>
preferred_name: <string if exists else "">
@@ -21,7 +22,9 @@ Projected endpoints:
```
/api/my/classes :
course_code: <string identifying the course in campus data>
+ color_class: <string canvas-class or bspace-class>
emitter: "Canvas" or "bSpace"
id: <string used by Canvas or bSpace>
name: <string if exists else not included>
+ site_url: <string the URL for the class>
```
View
7 app/models/my_classes.rb
@@ -12,7 +12,8 @@ def get_feed_internal
course_code: course["course_code"],
id: course["id"].to_s,
emitter: CanvasProxy::APP_ID,
- color_class: 'canvas-class'
+ color_class: "canvas-class",
+ site_url: "https://ucberkeley.instructure.com/courses/#{course['id']}"
})
end
end
@@ -28,7 +29,9 @@ def get_feed_internal
course_code: site["title"],
id: site["id"],
emitter: "bSpace",
- color_class: 'bspace-class'
+ color_class: "bspace-class",
+ # Todo make this configurable
+ site_url: "https://sakai-dev.berkeley.edu/portal/site/#{site['id']}"
})
end
end
View
7 app/views/templates/_dashboard.html
@@ -179,12 +179,7 @@
</div>
<div class="seven mobile-two columns cc-widget-mygroups-myclasses-title-column">
- <a data-ng-show="class.emitter == 'Canvas'"
- data-ng-href="https://ucberkeley.instructure.com/courses/{{class.id}}"
- class="cc-ellipsis cc-myclasses-link-with-title">{{class.course_code}}
- </a>
- <a data-ng-show="class.emitter == 'bSpace'"
- data-ng-href="https://sakai-dev.berkeley.edu/portal/site/{{class.id}}"
+ <a data-ng-href="{{class.site_url}}"
class="cc-ellipsis cc-myclasses-link-with-title">{{class.course_code}}
</a>
<a class="cc-ellipsis cc-widget-mygroups-myclasses-title-link"
View
2  spec/controllers/my_groups_controller_spec.rb
@@ -22,7 +22,7 @@
json_response["groups"].each do |group_entry|
group_entry["id"].blank?.should_not == true
group_entry["site_url"].blank?.should_not == true
- (group_entry["emitter"] =~ (/(canvas|bspace)$/i)).should_not == nil?
+ (group_entry["emitter"] =~ (/(canvas|bspace)$/i)).should_not be_nil
end
end
View
2  spec/controllers/user_api_controller_spec.rb
@@ -28,7 +28,7 @@
response.status.should == 204
get :mystatus
json_response = JSON.parse(response.body)
- json_response["first_login_at"].should_not == nil
+ json_response["first_login_at"].should_not be_nil
end
end
View
10 spec/lib/sakai_proxy_spec.rb
@@ -8,17 +8,17 @@
it "should get the categorized sites from bspace" do
data = @client.get_categorized_sites "300939"
- data[:status_code].should_not == nil
+ data[:status_code].should_not be_nil
if data[:status_code] == 200
- data[:body]["principal"].should_not == nil
+ data[:body]["principal"].should_not be_nil
end
end
it "should get the unread sites from bspace" do
data = @client.get_unread_sites "300939"
- data[:status_code].should_not == nil
+ data[:status_code].should_not be_nil
if data[:status_code] == 200
- data[:body]["principal"].should_not == nil
+ data[:body]["principal"].should_not be_nil
end
end
@@ -33,7 +33,7 @@
it "should make sure there are project or 'other' sites from the bSpace proxy (for groups)" do
data = @client.get_categorized_sites "300939"
- data[:status_code].should_not == nil
+ data[:status_code].should_not be_nil
if data[:status_code] == 200 && data[:body]["categories"] != nil
if !data[:body]["categories"].empty?
non_course_categories = data[:body]["categories"].select do |category|
View
6 spec/models/my_classes_spec.rb
@@ -17,8 +17,9 @@
my_classes[:classes].size.should == @fake_canvas_courses.size
my_classes[:classes].each do |my_class|
my_class[:emitter].should == CanvasProxy::APP_ID
- my_class[:course_code].should_not == nil
+ my_class[:course_code].should_not be_nil
my_class[:id].instance_of?(String).should == true
+ my_class[:site_url].should_not be_nil
end
end
@@ -39,8 +40,9 @@
my_classes[:classes].size.should be > 0
my_classes[:classes].each do |my_class|
my_class[:emitter].should == "bSpace"
- my_class[:course_code].should_not == nil
+ my_class[:course_code].should_not be_nil
my_class[:id].instance_of?(String).should == true
+ my_class[:site_url].should_not be_nil
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.