Fix Flowr support and generic event framework
This commit is contained in:
@ -31,6 +31,10 @@ var CodeOceanEditor = {
|
|||||||
|
|
||||||
<% self.class.include Rails.application.routes.url_helpers %>
|
<% self.class.include Rails.application.routes.url_helpers %>
|
||||||
<% @config ||= CodeOcean::Config.new(:code_ocean).read(erb: false) %>
|
<% @config ||= CodeOcean::Config.new(:code_ocean).read(erb: false) %>
|
||||||
|
// Important notice: Changing the config values requires any content-wise
|
||||||
|
// modification for this file in the development environment. Lacking to do so
|
||||||
|
// will result in the old, server-side cached serving of this file even across
|
||||||
|
// server restarts!
|
||||||
sendEvents: <%= @config['codeocean_events'] ? @config['codeocean_events']['enabled'] : false %>,
|
sendEvents: <%= @config['codeocean_events'] ? @config['codeocean_events']['enabled'] : false %>,
|
||||||
eventURL: "<%= @config['codeocean_events'] ? events_path : '' %>",
|
eventURL: "<%= @config['codeocean_events'] ? events_path : '' %>",
|
||||||
fileTypeURL: "<%= file_types_path %>",
|
fileTypeURL: "<%= file_types_path %>",
|
||||||
|
@ -21,7 +21,7 @@ CodeOceanEditorFlowr = {
|
|||||||
getInsights: function () {
|
getInsights: function () {
|
||||||
<% self.class.include Rails.application.routes.url_helpers %>
|
<% self.class.include Rails.application.routes.url_helpers %>
|
||||||
var flowrUrl = '<%= insights_path %>';
|
var flowrUrl = '<%= insights_path %>';
|
||||||
var stackOverflowUrl = 'http://api.stackexchange.com/2.2/search/advanced';
|
var stackOverflowUrl = 'https://api.stackexchange.com/2.2/search/advanced';
|
||||||
|
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
@ -78,7 +78,7 @@ CodeOceanEditorFlowr = {
|
|||||||
category: eventType,
|
category: eventType,
|
||||||
data: data,
|
data: data,
|
||||||
exercise_id: $('#editor').data('exercise-id'),
|
exercise_id: $('#editor').data('exercise-id'),
|
||||||
file_id: null
|
file_id: CodeOceanEditor.active_file.id,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
class EventsController < ApplicationController
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class EventsController < ApplicationController
|
||||||
def authorize!
|
def authorize!
|
||||||
authorize(@event || @events)
|
authorize(@event || @events)
|
||||||
end
|
end
|
||||||
@ -20,9 +21,10 @@ class EventsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def event_params
|
def event_params
|
||||||
|
# The file ID processed here is the context of the exercise (template),
|
||||||
|
# not in the context of the submission!
|
||||||
params[:event]&.permit(:category, :data, :exercise_id, :file_id)
|
params[:event]&.permit(:category, :data, :exercise_id, :file_id)
|
||||||
&.merge(user_id: current_user&.id, user_type: current_user&.class.name)
|
&.merge(user_id: current_user&.id, user_type: current_user&.class&.name)
|
||||||
end
|
end
|
||||||
private :event_params
|
private :event_params
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -4,6 +4,8 @@ default: &default
|
|||||||
answers_per_query: 3
|
answers_per_query: 3
|
||||||
code_pilot:
|
code_pilot:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
codeocean_events:
|
||||||
|
enabled: false
|
||||||
|
|
||||||
development:
|
development:
|
||||||
flowr:
|
flowr:
|
||||||
|
@ -5,3 +5,5 @@ test:
|
|||||||
enabled: false
|
enabled: false
|
||||||
codeharbor:
|
codeharbor:
|
||||||
url: http://test.url
|
url: http://test.url
|
||||||
|
codeocean_events:
|
||||||
|
enabled: false
|
||||||
|
Reference in New Issue
Block a user