Skip to content

Commit 804af9c

Browse files
committed
Merge branch 'staging' of https://github.com/OpenDSA/OpenDSA-LTI into staging
2 parents 03a4e74 + 7661341 commit 804af9c

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/assets/javascripts/textbooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
messages = check_completeness(true);
193193
if (messages.length !== 0) {
194194
form_alert(messages);
195-
$('#btn-gen-textbook').prop('disabled', false);
195+
$('#btn-gen-textbook').attr('disabled', false);
196196
return;
197197
}
198198
organization_id = $('#organization-select').val();

app/models/inst_exercise.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class InstExercise < ApplicationRecord
3030
#~ Hooks ....................................................................
3131
#~ Class methods ............................................................
3232
def self.save_data_from_json(book, inst_section, exercise_name, exercise_obj, update_mode = false)
33-
# puts "inst_exercises"
3433
require 'json'
3534
ex = InstExercise.find_by short_name: exercise_name
3635
if !ex and exercise_obj.is_a?(Hash)
@@ -87,6 +86,16 @@ def self.save_data_from_json(book, inst_section, exercise_name, exercise_obj, up
8786
end
8887

8988
book_sec_ex.save
89+
90+
if exercise_obj.key?('url')
91+
ex.update(
92+
short_name: exercise_name,
93+
name: exercise_obj['long_name'],
94+
av_address: exercise_obj['url'],
95+
width: exercise_obj['width'],
96+
height: exercise_obj['height']
97+
)
98+
end
9099
end
91100

92101
def self.get_av_dimensions(av_path)

app/views/courses/show.html.haml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@
6464
- course = Course.find_by(id:offering.course_id)
6565
- organization = Organization.find_by(id:course.organization_id)
6666
- term = Term.find_by(id:offering.term_id)
67-
- if ENV["opendsa_branch"] == "staging"
68-
= link_to "Textbook URL", "https://opendsax.cs.vt.edu/ODSA/" + "/Books/#{organization.slug}/#{course.slug}/#{term.slug}/#{offering.label}/html/"
67+
- route = "Books/#{organization.slug}/#{course.slug}/#{term.slug}/#{offering.label}/html/".gsub(" ","_")
68+
- if ENV["host_url"].include? "localhost"
69+
- route = ENV["host_url"].gsub("-lti","") +"/" + route + "index.html"
70+
- elsif ENV["opendsa_branch"] == "staging"
71+
- route = "https://opendsax.cs.vt.edu/ODSA/" + route
6972
- elsif ENV["opendsa_branch"] == "master"
70-
= link_to "Textbook URL", "https://opendsa-server.cs.vt.edu/ODSA/" + "/Books/#{organization.slug}/#{course.slug}/#{term.slug}/#{offering.label}/html/"
71-
- else
72-
= link_to "Textbook URL", ENV["config_api_link"].gsub("/api/configure/","/Books/#{organization.slug}/#{course.slug}/#{term.slug}/#{offering.label}/html/index.html")
73+
- route = "https://opendsa-server.cs.vt.edu/ODSA/" + route
74+
= link_to "Textbook URL", route
7375
%td
7476
- inst_book = InstBook.find_by(course_offering_id:offering.id)
7577
- form_name = 'compile_book_' + inst_book.id.to_s

0 commit comments

Comments
 (0)