Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception when trying to save default show settings. Fixes #4002 #4027

Merged
merged 2 commits into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions themes-default/slim/static/js/add-show-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ $(document).ready(() => {
bestQualArray.push($(d).val());
});

// @TODO: Move this to API
$.get('config/general/saveAddShowDefaults', {
const data = {
defaultStatus: $('#statusSelect').val(),
allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase
preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase
defaultFlattenFolders: $('#flatten_folders').prop('checked'),
defaultFlattenFolders: !$('#season_folders').prop('checked'), // Flatten folders is the contrary of season folders!
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked'),
defaultStatusAfter: $('#statusSelectAfter').val()
});
};

// @TODO: Move this to API
$.get('config/general/saveAddShowDefaults', data);

$(event.currentTarget).prop('disabled', true);
new PNotify({ // eslint-disable-line no-new
Expand All @@ -29,7 +31,7 @@ $(document).ready(() => {
});
});

$(document.body).on('change', '#statusSelect, #qualityPreset, #flatten_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => {
$(document.body).on('change', '#statusSelect, #qualityPreset, #season_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => {
$('#saveDefaultsButton').prop('disabled', false);
});

Expand Down
40 changes: 1 addition & 39 deletions themes-default/slim/static/js/add-shows/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,46 +147,8 @@ MEDUSA.addShows.init = function() {
});
return false;
});

$('#saveDefaultsButton').on('click', function() {
const anyQualArray = [];
const bestQualArray = [];
$('#allowed_qualities option:selected').each((i, d) => {
anyQualArray.push($(d).val());
});
$('#preferred_qualities option:selected').each((i, d) => {
bestQualArray.push($(d).val());
});

$.get('config/general/saveAddShowDefaults', {
defaultStatus: $('#statusSelect').val(),
allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase
preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase
defaultFlattenFolders: $('#flatten_folders').prop('checked'),
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked'),
defaultStatusAfter: $('#statusSelectAfter').val()
});

$(this).prop('disabled', true);
new PNotify({ // eslint-disable-line no-new
title: 'Saved Defaults',
text: 'Your "add show" defaults have been set to your current selections.',
shadow: false
});
});

$('#statusSelect, #qualityPreset, #flatten_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter').on('change', () => {
$('#saveDefaultsButton').prop('disabled', false);
});

$('#qualityPreset').on('change', () => {
// Fix issue #181 - force re-render to correct the height of the outer div
$('span.prev').click();
$('span.next').click();
});
};

$.updateBlackWhiteList = function(showName) {
$('#white').children().remove();
$('#black').children().remove();
Expand Down
2 changes: 1 addition & 1 deletion themes-default/slim/views/editShow.mako
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const startVue = () => {
<label for="season_folders">
<span class="component-title">Season folders</span>
<span class="component-desc">
<input type="checkbox" id="season_folders" name="flatten_folders" ${'' if show.flatten_folders == 1 and not app.NAMING_FORCE_FOLDERS else 'checked="checked"'} ${'disabled="disabled"' if app.NAMING_FORCE_FOLDERS else ''}/> group episodes by season folder (uncheck to store in a single folder)
<input type="checkbox" id="season_folders" name="flatten_folders" ${'checked="checked"' if show.flatten_folders == 0 or app.NAMING_FORCE_FOLDERS else ''} ${'disabled="disabled"' if app.NAMING_FORCE_FOLDERS else ''}/> group episodes by season folder (uncheck to store in a single folder)
</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion themes-default/slim/views/inc_addShowOptions.mako
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<label for="season_folders" class="clearfix">
<span class="component-title">Season Folders</span>
<span class="component-desc">
<input type="checkbox" name="flatten_folders" id="season_folders" ${'' if app.FLATTEN_FOLDERS_DEFAULT and not app.NAMING_FORCE_FOLDERS else 'checked="checked"'} ${'disabled="disabled"' if app.NAMING_FORCE_FOLDERS else ''}/>
<input type="checkbox" name="flatten_folders" id="season_folders" ${'checked="checked"' if not app.FLATTEN_FOLDERS_DEFAULT or app.NAMING_FORCE_FOLDERS else ''} ${'disabled="disabled"' if app.NAMING_FORCE_FOLDERS else ''}/>
<p>Group episodes by season folder?</p>
</span>
</label>
Expand Down
12 changes: 7 additions & 5 deletions themes/dark/assets/js/add-show-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ $(document).ready(() => {
bestQualArray.push($(d).val());
});

// @TODO: Move this to API
$.get('config/general/saveAddShowDefaults', {
const data = {
defaultStatus: $('#statusSelect').val(),
allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase
preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase
defaultFlattenFolders: $('#flatten_folders').prop('checked'),
defaultFlattenFolders: !$('#season_folders').prop('checked'), // Flatten folders is the contrary of season folders!
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked'),
defaultStatusAfter: $('#statusSelectAfter').val()
});
};

// @TODO: Move this to API
$.get('config/general/saveAddShowDefaults', data);

$(event.currentTarget).prop('disabled', true);
new PNotify({ // eslint-disable-line no-new
Expand All @@ -29,7 +31,7 @@ $(document).ready(() => {
});
});

$(document.body).on('change', '#statusSelect, #qualityPreset, #flatten_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => {
$(document.body).on('change', '#statusSelect, #qualityPreset, #season_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter', () => {
$('#saveDefaultsButton').prop('disabled', false);
});

Expand Down
2 changes: 1 addition & 1 deletion themes/dark/assets/js/add-show-options.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 1 addition & 39 deletions themes/dark/assets/js/add-shows/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,46 +147,8 @@ MEDUSA.addShows.init = function() {
});
return false;
});

$('#saveDefaultsButton').on('click', function() {
const anyQualArray = [];
const bestQualArray = [];
$('#allowed_qualities option:selected').each((i, d) => {
anyQualArray.push($(d).val());
});
$('#preferred_qualities option:selected').each((i, d) => {
bestQualArray.push($(d).val());
});

$.get('config/general/saveAddShowDefaults', {
defaultStatus: $('#statusSelect').val(),
allowed_qualities: anyQualArray.join(','), // eslint-disable-line camelcase
preferred_qualities: bestQualArray.join(','), // eslint-disable-line camelcase
defaultFlattenFolders: $('#flatten_folders').prop('checked'),
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked'),
defaultStatusAfter: $('#statusSelectAfter').val()
});

$(this).prop('disabled', true);
new PNotify({ // eslint-disable-line no-new
title: 'Saved Defaults',
text: 'Your "add show" defaults have been set to your current selections.',
shadow: false
});
});

$('#statusSelect, #qualityPreset, #flatten_folders, #allowed_qualities, #preferred_qualities, #subtitles, #scene, #anime, #statusSelectAfter').on('change', () => {
$('#saveDefaultsButton').prop('disabled', false);
});

$('#qualityPreset').on('change', () => {
// Fix issue #181 - force re-render to correct the height of the outer div
$('span.prev').click();
$('span.next').click();
});
};

$.updateBlackWhiteList = function(showName) {
$('#white').children().remove();
$('#black').children().remove();
Expand Down
Loading