aboutsummaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-10-13 20:00:08 +0000
committerElmar Ludwig <elmar.ludwig@uni-osnabrueck.de>2023-10-13 20:00:08 +0000
commit66490f667dee741072a8b06fbe3f0c99fd1f2ee7 (patch)
tree5570c481789bd9a2294ff6da2569f834a897eda8 /resources
parent737c0b2ade4ea92ea85ad9c536553abfcbc96877 (diff)
drop unused code, fixes #3351
Closes #3351 Merge request studip/studip!2277
Diffstat (limited to 'resources')
-rw-r--r--resources/assets/javascripts/bootstrap/news.js24
-rw-r--r--resources/assets/javascripts/entry-base.js1
-rw-r--r--resources/assets/javascripts/init.js2
-rw-r--r--resources/assets/javascripts/lib/news.js118
4 files changed, 0 insertions, 145 deletions
diff --git a/resources/assets/javascripts/bootstrap/news.js b/resources/assets/javascripts/bootstrap/news.js
deleted file mode 100644
index aa2dc98..0000000
--- a/resources/assets/javascripts/bootstrap/news.js
+++ /dev/null
@@ -1,24 +0,0 @@
-STUDIP.domReady(() => {
- STUDIP.News.dialog_width = window.innerWidth * (1 / 2);
- STUDIP.News.dialog_height = window.innerHeight - 60;
- if (STUDIP.News.dialog_width < 550) {
- STUDIP.News.dialog_width = 550;
- }
- if (STUDIP.News.dialog_height < 400) {
- STUDIP.News.dialog_height = 400;
- }
- STUDIP.News.pending_ajax_request = false;
-
- // open/close categories without ajax-request
- $(document).on('click', '.news_category_header', function(event) {
- event.preventDefault();
- STUDIP.News.toggle_category_view(
- $(this)
- .parent('div')
- .attr('id')
- );
- });
- $(document).on('click', '.news_category_header input[type=image]', function(event) {
- event.preventDefault();
- });
-});
diff --git a/resources/assets/javascripts/entry-base.js b/resources/assets/javascripts/entry-base.js
index 82e5640..7ba4f45 100644
--- a/resources/assets/javascripts/entry-base.js
+++ b/resources/assets/javascripts/entry-base.js
@@ -30,7 +30,6 @@ import "./bootstrap/personal_notifications.js"
import "./bootstrap/dialog.js"
import "./bootstrap/jsupdater.js"
import "./bootstrap/files.js"
-import "./bootstrap/news.js"
import "./bootstrap/messages.js"
import "./bootstrap/quick_search.js"
import "./bootstrap/multi_select.js"
diff --git a/resources/assets/javascripts/init.js b/resources/assets/javascripts/init.js
index 8ea0a27..27039d6 100644
--- a/resources/assets/javascripts/init.js
+++ b/resources/assets/javascripts/init.js
@@ -46,7 +46,6 @@ import Messages from './lib/messages.js';
import MultiPersonSearch from './lib/multi_person_search.js';
import MultiSelect from './lib/multi_select.js';
import NavigationShrinker from './lib/navigation_shrinker.js';
-import News from './lib/news.js';
import OER from './lib/oer.js';
import OldUpload from './lib/old_upload.js';
import Overlapping from './lib/overlapping.js';
@@ -136,7 +135,6 @@ window.STUDIP = _.assign(window.STUDIP || {}, {
MultiPersonSearch,
MultiSelect,
NavigationShrinker,
- News,
OER,
OldUpload,
Overlapping,
diff --git a/resources/assets/javascripts/lib/news.js b/resources/assets/javascripts/lib/news.js
deleted file mode 100644
index 71d221f..0000000
--- a/resources/assets/javascripts/lib/news.js
+++ /dev/null
@@ -1,118 +0,0 @@
-import { $gettext } from '../lib/gettext.js';
-
-const News = {
- /**
- * (Re-)initialise news-page, f.e. to stay in dialog
- */
- init (id) {
- $('.add_toolbar').addToolbar();
- STUDIP.i18n.init(`#${id}`);
-
- // prevent forms within dialog from reloading whole page, and reload dialog instead
- $(`#${id} form`).on('click', function (event) {
- $(this).data('clicked', $(event.target));
- }).on('submit', function (event) {
- event.preventDefault();
-
- var textarea, button, form_route, form_data;
- if (STUDIP.editor_enabled) {
- textarea = $('textarea.news_body');
- // wysiwyg is active, ensure HTML markers are set
- textarea.each(function () {
- $(this).val(STUDIP.wysiwyg.markAsHtml($(this).val()));
- });
- }
-
- button = $(this).data('clicked').attr('name');
- form_route = $(this).attr('action');
- form_data = $(this).serialize() + '&' + button + '=1';
-
- $(this).find(`input[name=${button}]`).showAjaxNotification('left');
- News.update_dialog(id, form_route, form_data);
- });
-
- $(document).on('change', `#${id} form .news_date`, function () {
- // This is neccessary since datepickers are initialiszed on focus
- // which might not have occured yet
- STUDIP.UI.Datepicker.init();
-
- var start = $('#news_startdate').blur().datepicker('getDate'),
- duration,
- end,
- result;
- if ($(this).is('#news_duration')) {
- // datepicker assumes beginning of day (00:00), but the duration includes the end date (until 23:59)
- duration = window.parseInt(this.value, 10) - 1;
- result = new Date(start);
- result.setDate(result.getDate() + duration);
-
- $('#news_enddate').datepicker('setDate', result);
- } else {
- start = $('#news_startdate').datepicker('getDate');
- end = $('#news_enddate').datepicker('getDate');
- // datepicker assumes beginning of day (see above) and we need to add a day to the duration
- duration = Math.round((end - start) / (24 * 60 * 60 * 1000)) + 1;
- duration = Math.max(0, duration);
-
- $('#news_duration').val(duration);
- }
- });
- },
-
-
- update_dialog (id, route, form_data) {
- if (!News.pending_ajax_request) {
- News.pending_ajax_request = true;
-
- $.post(route, form_data, 'html').done(function (html) {
- var obj;
-
- News.pending_ajax_request = false;
- if (html.length > 0) {
- $(`#${id}`).html(html);
- $(`#${id}_content`).css({
- height : (News.dialog_height - 120) + 'px',
- maxHeight: (News.dialog_height - 120) + 'px'
- });
- // scroll to anker
- obj = $('a[name=anker]');
- if (obj.length > 0) {
- $(`#${id}_content`).scrollTop(obj.position().top);
- }
- } else {
- $(`#${id}`).dialog('close');
- obj = $('#admin_news_form');
- if (obj.length > 0) {
- $('#admin_news_form').submit();
- } else {
- location.replace(STUDIP.URLHelper.getURL(location.href, {nsave: 1}));
- }
- }
-
- News.init(id);
- }).fail(function () {
- News.pending_ajax_request = false;
- window.alert($gettext('Fehler beim Aufruf des News-Controllers'));
- });
- }
- },
-
- toggle_category_view (id) {
- if ($(`input[name=${id}_js]`).val() === 'toggle') {
- $(`input[name=${id}_js]`).val('');
- } else {
- $(`input[name=${id}_js]`).val('toggle');
- }
- if ($(`#${id}_content`).is(':visible')) {
- $(`#${id}_content`).slideUp(400);
- $(`#${id} input[type=image]:first`)
- .attr('src', STUDIP.ASSETS_URL + 'images/icons/blue/arr_1right.svg');
- } else {
- $(`#${id}_content`).slideDown(400);
- $(`#${id} input[type=image]:first`)
- .attr('src', STUDIP.ASSETS_URL + 'images/icons/blue/arr_1down.svg');
- }
- }
-};
-
-export default News;