Skip to content

Commit

Permalink
Remove content for frontends (#2054)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Dec 8, 2023
1 parent 83f7bff commit 2c07ca0
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 71 deletions.
2 changes: 1 addition & 1 deletion config/database_versions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used for automatic database upgrades and database version checks
DATABASE_VERSIONS = [
'7.18.0',
'8.0.0',
'7.17.0',
'7.16.0',
'7.15.0',
Expand Down
2 changes: 1 addition & 1 deletion install/3_data_web.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ INSERT INTO web.user (username, password, active, email, group_id) VALUES (
(SELECT id FROM web.group WHERE name = 'admin'));

INSERT INTO web.settings (name, value) VALUES
('database_version', '7.18.0'),
('database_version', '8.0.0'),
('api_public', ''),
('default_language', 'en'),
('table_rows', '25'),
Expand Down
5 changes: 0 additions & 5 deletions install/data_test_api.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

-- Content example for API
INSERT INTO web.i18n (name, language, text) VALUES ('intro_for_frontend', 'en', 'This is English');
INSERT INTO web.i18n (name, language, text) VALUES ('intro_for_frontend', 'de', 'Das ist Deutsch');

INSERT INTO model.entity (
cidoc_class_code, openatlas_class_name, name, description, begin_from, begin_to, begin_comment,
end_from, end_to, end_comment, created, modified
Expand Down
14 changes: 0 additions & 14 deletions install/upgrade/7.18.0.sql

This file was deleted.

21 changes: 21 additions & 0 deletions install/upgrade/8.0.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Upgrade 7.17.x to 8.0.0
-- Be sure to backup the database and read the upgrade notes before executing.

BEGIN;

-- Raise database version
UPDATE web.settings SET value = '8.0.0' WHERE name = 'database_version';

-- #2054: Remove content for presentation sites
DELETE FROM web.i18n WHERE name IN (
'contact_for_frontend',
'intro_for_frontend',
'legal_notice_for_frontend',
'site_name_for_frontend');

-- #2096: Add presentation site link in backend
INSERT INTO web.settings (name, value) VALUES
('frontend_website_url', ''),
('frontend_resolver_url', '');

END;
24 changes: 0 additions & 24 deletions install/upgrade/bookworm_upgrade.md

This file was deleted.

8 changes: 6 additions & 2 deletions install/upgrade/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ then run the database upgrade script, then restart Apache:
sudo python3 install/upgrade/database_upgrade.py
sudo service apache2 restart

### 7.17.x to 7.18
7.18.0.sql is needed but will be taken care of by the database upgrade script.
### 7.17.x to 8.0.0

This is a major upgrade which utilizes newer versions of underlying software.
Please consult the install.md about package installation.

8.0.0.sql is needed but will be taken care of by the database upgrade script.

### 7.16.x to 7.17.0
7.17.0.sql is needed but will be taken care of by the database upgrade script.
Expand Down
12 changes: 1 addition & 11 deletions openatlas/models/content.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Optional

from flask import g, session

from openatlas import app
Expand All @@ -8,15 +6,7 @@

def get_content() -> dict[str, dict[str, str]]:
content: dict[str, dict[str, str]] = {}
for name in [
'intro',
'legal_notice',
'contact',
'citation_example',
'intro_for_frontend',
'legal_notice_for_frontend',
'contact_for_frontend',
'site_name_for_frontend']:
for name in ['intro', 'legal_notice', 'contact', 'citation_example']:
content[name] = {lang: '' for lang in app.config['LANGUAGES']}
for row in Db.get_content():
content[row['name']][row['language']] = row['text']
Expand Down
9 changes: 1 addition & 8 deletions openatlas/views/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,11 @@ def admin_index(
@app.route('/admin/content/<string:item>', methods=['GET', 'POST'])
@required_group('manager')
def admin_content(item: str) -> Union[str, Response]:
# Translations of content items
_('intro_for_frontend')
_('legal_notice_for_frontend')
_('contact_for_frontend')
_('site_name_for_frontend')
for language in app.config['LANGUAGES']:
setattr(
ContentForm,
language,
StringField()
if item == 'site_name_for_frontend'
else TextAreaField(render_kw={'class': 'tinymce'}))
TextAreaField(render_kw={'class': 'tinymce'}))
setattr(ContentForm, 'save', SubmitField(_('save')))
form = ContentForm()
if form.validate_on_submit():
Expand Down
10 changes: 5 additions & 5 deletions openatlas/views/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ def index_changelog() -> str:


versions = {
'7.20.0': ['TBA', {
'feature': {
'2038': 'Update OpenAtlas software to Debian bookworm'}}],
'7.18.0': ['TBA', {
'8.0.0': ['TBA', {
'feature': {
'2038': 'Update OpenAtlas software to Debian bookworm',
'1834': 'Solve confusing actor relations at move event',
'2096': 'Add presentation site links in backend',
'2108': 'IIIF - check for orphaned files'}}],
'2108': 'IIIF - check for orphaned files',
'2054': 'Remove content for presentation sites',
'2112': 'Refactor and minor improvements'}}],
'7.17.4': ['2023-11-17', {
'fix': {
'2124': 'No modifications at preceding event'}}],
Expand Down

0 comments on commit 2c07ca0

Please sign in to comment.