Skip to content

Commit 09634e8

Browse files
committed
Merge branch 'master' into staging
2 parents f51ff62 + 9abfb42 commit 09634e8

3 files changed

Lines changed: 64 additions & 42 deletions

File tree

‎app/controllers/embed_controller.rb‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ def show
2020
@message = "No resource found with the name \"#{params[:ex_short_name]}\""
2121
render 'lti/error' and return
2222
end
23-
if !@ex.av_address.blank?
24-
@ex_url = "#{request.protocol}#{request.host_with_port}/OpenDSA/#{@ex.av_address}"
23+
inlineav_path = @ex.av_address.presence || InstExercise.inlineav_metadata_path(@ex.short_name)
24+
if inlineav_path.present?
25+
@ex_url = "#{request.protocol}#{request.host_with_port}/OpenDSA/#{inlineav_path}"
2526
render 'embed_av', layout: 'embed_inlineav'
2627
elsif !@ex.learning_tool.blank?
2728
# external tool

‎app/models/inst_exercise.rb‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ def self.embed_code(host, short_name, av_address=nil, height=nil)
125125
return "<iframe src=\"#{url}\" height=\"600\" width=\"100%\"></iframe>"
126126
end
127127

128+
def self.inlineav_metadata_path(short_name)
129+
return nil if short_name.blank?
130+
opendsa_root = Rails.root.join(OpenDSA::OPENDSA_DIRECTORY)
131+
metadata_dir = opendsa_root.join('Metadata', 'inlineav')
132+
return nil unless metadata_dir.exist?
133+
match = Dir.glob(metadata_dir.join('**', "#{short_name}.html").to_s).first
134+
return nil if match.blank?
135+
Pathname.new(match).relative_path_from(opendsa_root).to_s
136+
end
137+
128138
#~ Instance methods .........................................................
129139

130140
def embed_url(host)

‎app/views/home/books.html.haml‎

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,6 @@
3232
content with annotations. Examples of these are shown in the
3333
supplemental section below.
3434

35-
%p
36-
Canvas versions (you will need to register for a free account at
37-
%a{ href: 'http://canvas.instructure.com', target: "_blank" }
38-
http://canvas.instructure.com
39-
to view):
40-
41-
%ul
42-
%li
43-
%a{ href: 'https://canvas.instructure.com/enroll/AA7HDH', target: "_blank" }
44-
An objects-first CS1 course
45-
46-
%li
47-
%a{ href: 'https://canvas.instructure.com/enroll/TXJGTB', target: "_blank" }
48-
Data Structures topics for a CS2-level course
49-
50-
%li
51-
%a{ href: 'https://canvas.instructure.com/enroll/JWADTJ', target: "_blank" }
52-
A post-CS2-level course
53-
on Data Structures (that we refer to as "CS3").
54-
55-
%li
56-
%a{ href: 'https://canvas.instructure.com/enroll/8PMDLD', target: "_blank" }
57-
A senior-level course on Algorithm Design and Analysis.
58-
59-
%li
60-
%a{ href: 'https://canvas.instructure.com/enroll/FYDK3F', target: "_blank" }
61-
All current OpenDSA content
62-
related to Data Structures and Algorithms.
63-
64-
%li
65-
%a{ href: 'https://canvas.instructure.com/enroll/MYGH4J', target: "_blank" }
66-
Programming Languages
67-
68-
%li
69-
%a{ href: 'https://canvas.instructure.com/enroll/HE9XXP', target: "_blank" }
70-
Formal Languages and Automata (Programmed Instruction Version)
71-
72-
%p
73-
<br/>
74-
7535
%p
7636
Supplemental reading versions and course slides/notes (directly accessible HTML pages):
7737

@@ -132,6 +92,57 @@
13292
%a{ href: url, target: "_blank" }
13393
Coursenotes form of presentation slides a Formal Languages and Automata course
13494

95+
%p
96+
<br/>
97+
98+
%p
99+
[SORRY: Instructure has turned off canvas.instructure.com for
100+
now. We will restore access to Canvas versions of these courses once
101+
Instructure comes up with an alternative public site.]
102+
103+
%p
104+
<br/>
105+
106+
%p
107+
Canvas versions (you will need to register for a free account at
108+
%a{ href: 'http://canvas.instructure.com', target: "_blank" }
109+
http://canvas.instructure.com
110+
to view):
111+
112+
%ul
113+
%li
114+
%a{ href: 'https://canvas.instructure.com/enroll/AA7HDH', target: "_blank" }
115+
An objects-first CS1 course
116+
117+
%li
118+
%a{ href: 'https://canvas.instructure.com/enroll/TXJGTB', target: "_blank" }
119+
Data Structures topics for a CS2-level course
120+
121+
%li
122+
%a{ href: 'https://canvas.instructure.com/enroll/JWADTJ', target: "_blank" }
123+
A post-CS2-level course
124+
on Data Structures (that we refer to as "CS3").
125+
126+
%li
127+
%a{ href: 'https://canvas.instructure.com/enroll/8PMDLD', target: "_blank" }
128+
A senior-level course on Algorithm Design and Analysis.
129+
130+
%li
131+
%a{ href: 'https://canvas.instructure.com/enroll/FYDK3F', target: "_blank" }
132+
All current OpenDSA content
133+
related to Data Structures and Algorithms.
134+
135+
%li
136+
%a{ href: 'https://canvas.instructure.com/enroll/MYGH4J', target: "_blank" }
137+
Programming Languages
138+
139+
%li
140+
%a{ href: 'https://canvas.instructure.com/enroll/HE9XXP', target: "_blank" }
141+
Formal Languages and Automata (Programmed Instruction Version)
142+
143+
%p
144+
<br/>
145+
135146
%p
136147
WARNING TO INSTRUCTORS: Some instructors like to give their students
137148
access to these public instances of our materials. That is fine so

0 commit comments

Comments
 (0)