From 86cb6d84f5f69c5481df888417ab24d13dee9a43 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 24 Aug 2023 21:12:33 -0400 Subject: [PATCH 1/2] docs --- app/controllers/pages_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) From 9d9fca3a336349b6714510e7124a2967359683c8 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Fri, 25 Aug 2023 07:15:00 -0400 Subject: [PATCH 2/2] Smarter messaging after you create a book... Fixes #796. --- app/models/book.rb | 3 +++ app/views/books/_case.html.erb | 2 +- .../judgements/_moar_judgements_needed.html.erb | 12 ++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) 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 %>