Commit 69f541e6 authored by Markus Koller's avatar Markus Koller
Browse files

Merge branch 'features/unsaved-form-changes' into 'develop'

Confirm navigation with unsaved form changes

See merge request !609
parents 4b268da3 8e80eab4
Pipeline #18770 passed with stage
in 39 minutes and 58 seconds
......@@ -44,7 +44,6 @@ gem 'selectize-rails'
gem 'simple_form'
gem 'slim-rails'
gem 'sprockets-es6'
gem 'turbolinks'
gem 'uglifier'
gem 'wicked_pdf'
gem 'will-paginate-i18n'
......
......@@ -395,9 +395,6 @@ GEM
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.0)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.4)
thread_safe (~> 0.1)
uglifier (4.1.4)
......@@ -485,7 +482,6 @@ DEPENDENCIES
slim-rails
spring
sprockets-es6
turbolinks
uglifier
wicked_pdf
will-paginate-i18n
......
$(() => $(document).on('turbolinks:render, turbolinks:load', () => {
$(() => {
truncateModal();
dateTimePicker();
conditionalField();
......@@ -6,4 +6,4 @@ $(() => $(document).on('turbolinks:render, turbolinks:load', () => {
volunteerForm();
groupOfferForm();
assigmentForm();
}));
});
......@@ -11,7 +11,6 @@
// about supported directives.
//
//= require rails-ujs
//= require turbolinks
//= require jquery
//= require jquery-ui
//= require bootstrap-sprockets
......
......@@ -3,7 +3,7 @@ function assigmentForm() {
event.preventDefault();
event.stopPropagation();
let newWindow = undefined;
let newWindow = window;
let href = $(event.currentTarget).attr('href');
let target = $(event.currentTarget).attr('target')
......@@ -12,11 +12,7 @@ function assigmentForm() {
}
submitForm().then((data) => {
if (target === '_blank') {
newWindow.location = href;
} else {
Turbolinks.visit(href);
}
newWindow.location.href = href;
});
});
......
$(document).on('turbolinks:load', () => {
$(() => {
$("input[data-autocomplete]").each((_index, input) => {
$(input).autocomplete({
source: $(input).data('autocomplete'),
......
$(() => {
$(document).on('turbolinks:render, turbolinks:load', () => {
const select_selector = '#event_volunteer_volunteer_id';
$(select_selector).selectize();
});
const select_selector = '#event_volunteer_volunteer_id';
$(select_selector).selectize();
});
$(() => {
let formSubmitting = false, formData = $('form').serialize();
$(window).on('beforeunload', (event) => {
if (!formSubmitting && ($('.has-error').length || formData !== $('form').serialize())) {
event.returnValue = "Möchten Sie Ihre ungespeicherten Änderungen verwerfen?";
return event.returnValue;
}
});
$(document).on('submit', 'form', () => {
formSubmitting = true;
});
});
......@@ -3,7 +3,7 @@ h1= t_title(:new)
= render 'form'
javascript:
$(document).on('turbolinks:render, turbolinks:load', function () {
$(function () {
var templateVarnames = #{EmailTemplate.template_varnames.to_json.html_safe}
var templateStrings = #{EmailTemplate.active_as_hash.to_json.html_safe}
......
......@@ -26,7 +26,7 @@ table.table.table-striped.group-assignments-table
title: 'Herunterladen'
- if policy(group_assignment.group_offer).change_active_state?
= button_link navigation_glyph(group_assignment.group_offer.active? ? :deactivate : :activate),
change_active_state_group_offer_path(group_assignment.group_offer), method: :put, remote: :true,
change_active_state_group_offer_path(group_assignment.group_offer), method: :put,
title: (group_assignment.group_offer.active? ? 'Deaktivieren' : 'Aktivieren')
td
- if group_assignment.group_offer
......
......@@ -53,7 +53,7 @@ table.table.table-striped
= button_link navigation_glyph(:download), group_offer_path(offer, format: :pdf), title: 'Herunterladen'
- if offer.period_end.blank?
= button_link navigation_glyph(offer.active? ? :deactivate : :activate),
change_active_state_group_offer_path(offer), method: :put, remote: :true,
change_active_state_group_offer_path(offer), method: :put,
title: (offer.active? ? 'Deaktivieren' : 'Aktivieren')
- if policy(offer).initiate_termination? && offer.terminatable?
= button_link navigation_glyph(:terminate),
......
......@@ -8,8 +8,8 @@ html
title= t('voluntary_platform')
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'application'
= favicon_link_tag 'favicon.ico'
- if params[:print] == 'true'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment