diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 61e1b2001..5b652e349 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -10,14 +10,15 @@ class PagesController < ApplicationController # end # this is how we deal with the ACE editor wanting this specific file. - # There is another mode-json.js file that it wants from /assets/mode-json.js, - # and that we are able to just add to /app/assets/javascripts. + def theme_textmate path = 'node_modules/ace-builds/src-min-noconflict/theme-textmate.js' file_contents = File.read(path) render js: file_contents, content_type: Mime::Type.lookup('application/javascript') end - + + # In production this route kicks in, and in dev we load /assets/mode-json.js from + # the /app/assets/javascripts/mode-json.js location.. def mode_json path = 'node_modules/ace-builds/src-min-noconflict/mode-json.js' file_contents = File.read(path) diff --git a/app/models/book.rb b/app/models/book.rb index 9da528b61..59ad0d61f 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -29,6 +29,9 @@ class Book < ApplicationRecord has_many :judgements, -> { order('query_doc_pair_id') }, through: :query_doc_pairs, dependent: :destroy + + has_many :cases, dependent: :nullify + scope :for_user, ->(user) { joins(' LEFT OUTER JOIN `teams` ON `teams`.`id` = `books`.`team_id` diff --git a/app/views/books/_case.html.erb b/app/views/books/_case.html.erb index b47c4c140..16e5b2a66 100644 --- a/app/views/books/_case.html.erb +++ b/app/views/books/_case.html.erb @@ -1 +1 @@ -<%= link_to kase.case_name, case_core_path(kase.id) %> +<%= link_to kase.case_name, case_core_path(kase.id, kase.last_try_number) %> diff --git a/app/views/judgements/_moar_judgements_needed.html.erb b/app/views/judgements/_moar_judgements_needed.html.erb index d7d80968d..835fc6581 100644 --- a/app/views/judgements/_moar_judgements_needed.html.erb +++ b/app/views/judgements/_moar_judgements_needed.html.erb @@ -4,8 +4,16 @@ <% elsif book.query_doc_pairs.empty? %> <% else %>