Add info modal for pair programming
This commit is contained in:

committed by
Sebastian Serth

parent
883169121c
commit
5da871a0e9
@@ -17,10 +17,9 @@ $(document).on('turbolinks:load', function () {
|
||||
|
||||
const editor = $('#editor');
|
||||
const exercise_id = editor.data('exercise-id');
|
||||
const current_contributor_id = editor.data('contributor-id');
|
||||
const session_id = generateUUID();
|
||||
|
||||
if ($.isController('exercises') && current_user.id !== current_contributor_id) {
|
||||
if ($.isController('exercises') && is_other_user(current_contributor)) {
|
||||
|
||||
App.synchronized_editor = App.cable.subscriptions.create({
|
||||
channel: "SynchronizedEditorChannel", exercise_id: exercise_id
|
||||
|
25
app/assets/javascripts/programming_groups.js
Normal file
25
app/assets/javascripts/programming_groups.js
Normal file
@@ -0,0 +1,25 @@
|
||||
var ProgrammingGroups = {
|
||||
getStoredViewedPPInfo: function () {
|
||||
return localStorage.getItem('viewed_pp_info')
|
||||
},
|
||||
|
||||
setStoredViewedPPInfo: function () {
|
||||
localStorage.setItem('viewed_pp_info', 'true')
|
||||
},
|
||||
|
||||
|
||||
initializeEventHandler: function () {
|
||||
$('#dont_show_info_pp_modal_again').on('click', this.setStoredViewedPPInfo.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on('turbolinks:load', function () {
|
||||
const modal = $('#modal-info-pair-programming');
|
||||
if (modal.isPresent()) {
|
||||
ProgrammingGroups.initializeEventHandler();
|
||||
|
||||
if (ProgrammingGroups.getStoredViewedPPInfo() !== 'true' && !_.isEqual(current_user, current_contributor)) {
|
||||
new bootstrap.Modal(modal).show();
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user