-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #12 refactoring properties * #12 add simple template theme support * #12 template loader for themes, priority in site templates * #12 add theme support * #12 add theme support * #12 add theme support * #12 add theme support * #12 add theme support * #12 theme example * #12 add js and style to theme rendering * #12 load extensions from theme * #12 some code clean up * #12 some code clean up * #12 more code cleanup and simplification * add changelog * Update README.md * #12 update readme * update release version * prepare release 2.7.0 --------- Co-authored-by: Thorsten Marx <t.marx@eggheads.de>
- Loading branch information
Showing
122 changed files
with
2,240 additions
and
1,391 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
# java based flat file cms | ||
# cms | ||
|
||
cms is a simple java based flat file content management system. | ||
see wiki for more information: [wiki](https://github.com/thmarx/cms/wiki) | ||
|
||
|
||
# changelog | ||
|
||
## 2.7.0 | ||
|
||
* theme support [#12](https://github.com/thmarx/cms/issues/12) | ||
* legacy server implementation removed [#68](https://github.com/thmarx/cms/issues/68) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
cms-api/src/main/java/com/github/thmarx/cms/api/Media.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.github.thmarx.cms.api; | ||
|
||
/*- | ||
* #%L | ||
* cms-api | ||
* %% | ||
* Copyright (C) 2023 Marx-Software | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
|
||
/** | ||
* | ||
* @author thmar | ||
*/ | ||
public class Media { | ||
|
||
public enum Format { | ||
PNG, | ||
JPEG, | ||
WEBP; | ||
} | ||
|
||
public static Format format4String(final String format) { | ||
return switch (format) { | ||
case "webp" -> | ||
Format.WEBP; | ||
case "jpeg" -> | ||
Format.JPEG; | ||
case "png" -> | ||
Format.PNG; | ||
default -> | ||
throw new RuntimeException("unknown image format"); | ||
}; | ||
} | ||
|
||
public static String mime4Format(final Format format) { | ||
return switch (format) { | ||
case JPEG -> | ||
"image/jpeg"; | ||
case PNG -> | ||
"image/png"; | ||
case WEBP -> | ||
"image/webp"; | ||
default -> | ||
throw new RuntimeException("unknown image format"); | ||
}; | ||
} | ||
|
||
public static String fileending4Format(final Format format) { | ||
return switch (format) { | ||
case JPEG -> | ||
".jpeg"; | ||
case PNG -> | ||
".png"; | ||
case WEBP -> | ||
".webp"; | ||
default -> | ||
throw new RuntimeException("unknown image format"); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
cms-api/src/main/java/com/github/thmarx/cms/api/ThemeProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.github.thmarx.cms.api; | ||
|
||
/*- | ||
* #%L | ||
* cms-server | ||
* %% | ||
* Copyright (C) 2023 Marx-Software | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* | ||
* @author t.marx | ||
*/ | ||
public class ThemeProperties extends YamlProperties { | ||
|
||
public ThemeProperties (final Map<String, Object> properties) { | ||
super(properties); | ||
} | ||
|
||
public String templateEngine () { | ||
return (String)getSubMap("template").getOrDefault("engine", "freemarker"); | ||
} | ||
|
||
public List<String> activeModules () { | ||
return (List<String>)getSubMap("modules").getOrDefault("active", List.of()); | ||
} | ||
|
||
public Map<String, MediaFormat> getMediaFormats() { | ||
Map<String, MediaFormat> mediaFormats = new HashMap<>(); | ||
Map<String, Object> media = (Map<String, Object>) properties.getOrDefault("media", Collections.emptyMap()); | ||
List<Map<String, Object>> formats = (List<Map<String, Object>>) media.getOrDefault("formats", Collections.emptyList()); | ||
formats.forEach(map -> { | ||
var mediaFormat = new MediaFormat( | ||
(String) map.get("name"), | ||
(int) map.get("width"), | ||
(int) map.get("height"), | ||
Media.format4String((String) map.get("format")), | ||
(boolean) map.get("compression") | ||
); | ||
mediaFormats.put(mediaFormat.name(), mediaFormat); | ||
}); | ||
|
||
return mediaFormats; | ||
} | ||
|
||
public static record MediaFormat(String name, int width, int height, Media.Format format, boolean compression) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.