Skip to content

Commit

Permalink
Convert changelog to TGUI (tgstation#58593)
Browse files Browse the repository at this point in the history
This pull request converts the changelog to TGUI. 
Note: Old unused changelog files will be automatically removed on the next changelog run
Why It's Good For The Game

More consistent UI, ability to view all historic logs.
Changelog

cl Celotajs
refactor: Converted the changelog popup to TGUI
/cl
  • Loading branch information
celotajstg authored Apr 26, 2021
1 parent d59baec commit 76fb2e1
Show file tree
Hide file tree
Showing 53 changed files with 486 additions and 9,411 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@
## Force tab indents on dm files
*.dm whitespace=indent-with-non-tab

## Force changelog merging to use union
html/changelog.html text eol=lf merge=union
2 changes: 1 addition & 1 deletion .github/workflows/compile_changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: "Compile"
if: steps.value_holder.outputs.CL_ENABLED
run: |
python tools/ss13_genchangelog.py html/changelog.html html/changelogs
python tools/ss13_genchangelog.py html/changelogs
- name: "Convert Lineendings"
if: steps.value_holder.outputs.CL_ENABLED
run: |
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/tgui.dm
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GLOBAL_DATUM(crew_manifest_tgui, /datum/crew_manifest)
GLOBAL_DATUM(changelog_tgui, /datum/changelog)
32 changes: 32 additions & 0 deletions code/datums/changelog/changelog.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/datum/changelog
var/static/list/changelog_items = list()

/datum/changelog/ui_state()
return GLOB.always_state

/datum/changelog/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "Changelog")
ui.open()

/datum/changelog/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
if(action == "get_month")
var/datum/asset/changelog_item/changelog_item = changelog_items[params["date"]]
if (!changelog_item)
changelog_item = new /datum/asset/changelog_item(params["date"])
changelog_items[params["date"]] = changelog_item
return ui.send_asset(changelog_item)

/datum/changelog/ui_static_data()
var/list/data = list( "dates" = list() )
var/regex/ymlRegex = regex(@"\.yml", "g")

for(var/archive_file in flist("[global.config.directory]/../html/changelogs/archive/"))
var/archive_date = ymlRegex.Replace(archive_file, "")
data["dates"] = list(archive_date) + data["dates"]

return data
3 changes: 2 additions & 1 deletion code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ GLOBAL_VAR(restart_counter)
start_log(GLOB.tgui_log)
start_log(GLOB.world_shuttle_log)

GLOB.changelog_hash = md5('html/changelog.html') //for telling if the changelog has changed recently
var/latest_changelog = file("[global.config.directory]/../html/changelogs/archive/" + time2text(world.timeofday, "YYYY-MM") + ".yml")
GLOB.changelog_hash = fexists(latest_changelog) ? md5(latest_changelog) : 0 //for telling if the changelog has changed recently
if(fexists(GLOB.config_error_log))
fcopy(GLOB.config_error_log, "[GLOB.log_directory]/config_error.log")
fdel(GLOB.config_error_log)
Expand Down
18 changes: 18 additions & 0 deletions code/modules/asset_cache/asset_list.dm
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,24 @@ GLOBAL_LIST_EMPTY(asset_datums)
#undef SPRSZ_STRIPPED


/datum/asset/changelog_item
_abstract = /datum/asset/changelog_item
var/item_filename

/datum/asset/changelog_item/New(date)
item_filename = sanitize_filename("[date].yml")
SSassets.transport.register_asset(item_filename, file("html/changelogs/archive/" + item_filename))

/datum/asset/changelog_item/send(client)
if (!item_filename)
return
. = SSassets.transport.send_assets(client, item_filename)

/datum/asset/changelog_item/get_url_mappings()
if (!item_filename)
return
. = list("[item_filename]" = SSassets.transport.get_asset_url(item_filename))

/datum/asset/spritesheet/simple
_abstract = /datum/asset/spritesheet/simple
var/list/assets
Expand Down
25 changes: 0 additions & 25 deletions code/modules/asset_cache/asset_list_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,6 @@
/datum/asset/simple/irv
)

/datum/asset/simple/namespaced/changelog
assets = list(
"88x31.png" = 'html/88x31.png',
"bug-minus.png" = 'html/bug-minus.png',
"cross-circle.png" = 'html/cross-circle.png',
"hard-hat-exclamation.png" = 'html/hard-hat-exclamation.png',
"image-minus.png" = 'html/image-minus.png',
"image-plus.png" = 'html/image-plus.png',
"music-minus.png" = 'html/music-minus.png',
"music-plus.png" = 'html/music-plus.png',
"tick-circle.png" = 'html/tick-circle.png',
"wrench-screwdriver.png" = 'html/wrench-screwdriver.png',
"spell-check.png" = 'html/spell-check.png',
"burn-exclamation.png" = 'html/burn-exclamation.png',
"chevron.png" = 'html/chevron.png',
"chevron-expand.png" = 'html/chevron-expand.png',
"scales.png" = 'html/scales.png',
"coding.png" = 'html/coding.png',
"ban.png" = 'html/ban.png',
"chrome-wrench.png" = 'html/chrome-wrench.png',
"changelog.css" = 'html/changelog.css'
)
parents = list("changelog.html" = 'html/changelog.html')


/datum/asset/simple/jquery
legacy = TRUE
assets = list(
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mob/dead/crew_manifest.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
ui.open()

/datum/crew_manifest/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
if (..())
. = ..()
if(.)
return

/datum/crew_manifest/ui_data(mob/user)
Expand Down
Binary file removed html/88x31.png
Binary file not shown.
9,051 changes: 0 additions & 9,051 deletions html/archivedchangelog.html

This file was deleted.

Binary file removed html/ban.png
Binary file not shown.
Binary file removed html/bug-minus.png
Binary file not shown.
Binary file removed html/burn-exclamation.png
Binary file not shown.
42 changes: 0 additions & 42 deletions html/changelog.css

This file was deleted.

16 changes: 7 additions & 9 deletions html/changelogs/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# Valid Prefixes:
# bugfix
# - (fixes bugs)
# wip
# - (work in progress)
# tweak
# - (tweaks something)
# qol
# - (quality of life)
# soundadd
# - (adds a sound)
# sounddel
# - (removes a sound)
# rscdel
# - (adds a feature)
# rscadd
# - (adds a feature)
# rscdel
# - (removes a feature)
# imageadd
# - (adds an image or sprite)
Expand All @@ -29,8 +29,6 @@
# - (fixes spelling or grammar)
# experiment
# - (experimental change)
# tgs
# - (TGS change)
# balance
# - (balance changes)
# code_imp
Expand All @@ -45,7 +43,7 @@
# - (miscellaneous changes to server)
#################################

# Your name.
# Your name.
author: "
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
Expand All @@ -56,6 +54,6 @@ delete-after: True
# SCREW THIS UP AND IT WON'T WORK.
# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit.
# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog.
changes:
changes:
- rscadd: "Added a changelog editing system that should cause fewer conflicts and more accurate timestamps."
- rscdel: "Killed innocent kittens."
Binary file removed html/chrome-wrench.png
Binary file not shown.
Binary file removed html/coding.png
Binary file not shown.
Binary file removed html/cross-circle.png
Binary file not shown.
Binary file removed html/hard-hat-exclamation.png
Binary file not shown.
Binary file removed html/image-minus.png
Binary file not shown.
Binary file removed html/image-plus.png
Binary file not shown.
Binary file removed html/music-minus.png
Binary file not shown.
Binary file removed html/music-plus.png
Binary file not shown.
Binary file removed html/scales.png
Binary file not shown.
Binary file removed html/spell-check.png
Binary file not shown.
13 changes: 0 additions & 13 deletions html/templates/footer.html

This file was deleted.

53 changes: 0 additions & 53 deletions html/templates/header.html

This file was deleted.

Binary file removed html/tick-circle.png
Binary file not shown.
Binary file removed html/wrench-screwdriver.png
Binary file not shown.
7 changes: 4 additions & 3 deletions interface/interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@
/client/verb/changelog()
set name = "Changelog"
set category = "OOC"
var/datum/asset/simple/namespaced/changelog = get_asset_datum(/datum/asset/simple/namespaced/changelog)
changelog.send(src)
src << browse(changelog.get_htmlloader("changelog.html"), "window=changes;size=675x650")
if(!GLOB.changelog_tgui)
GLOB.changelog_tgui = new /datum/changelog()

GLOB.changelog_tgui.ui_interact(usr)
if(prefs.lastchangelog != GLOB.changelog_hash)
prefs.lastchangelog = GLOB.changelog_hash
prefs.save_preferences()
Expand Down
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@
#include "code\datums\brain_damage\severe.dm"
#include "code\datums\brain_damage\special.dm"
#include "code\datums\brain_damage\split_personality.dm"
#include "code\datums\changelog\changelog.dm"
#include "code\datums\components\_component.dm"
#include "code\datums\components\acid.dm"
#include "code\datums\components\anti_magic.dm"
Expand Down
30 changes: 1 addition & 29 deletions tgui/packages/tgfont/icons/air-tank-slash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 1 addition & 26 deletions tgui/packages/tgfont/icons/air-tank.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tgui/packages/tgfont/icons/image-minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tgui/packages/tgfont/icons/image-plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 76fb2e1

Please sign in to comment.