diff --git a/code/modules/client/preference_setup/general/05_background.dm b/code/modules/client/preference_setup/general/05_background.dm index 7733b1e7b7b..69bd4d5a111 100644 --- a/code/modules/client/preference_setup/general/05_background.dm +++ b/code/modules/client/preference_setup/general/05_background.dm @@ -102,11 +102,11 @@ dat += "You are banned from using character records.
" else dat += "Medical Records:
" - dat += "[TextPreview(pref.med_record,40)]

" + dat += "[TextPreview(pref.med_record,40)]Clear

" dat += "Employment Records:
" - dat += "[TextPreview(pref.gen_record,40)]

" + dat += "[TextPreview(pref.gen_record,40)]Clear

" dat += "Security Records:
" - dat += "[TextPreview(pref.sec_record,40)]
" + dat += "[TextPreview(pref.sec_record,40)]Clear
" . = dat.Join() @@ -144,22 +144,36 @@ else if(href_list["set_medical_records"]) var/new_medical = sanitize(input(user,"Enter medical information here.","Character Preference", html_decode(pref.med_record)) as message|null, MAX_PAPER_MESSAGE_LEN, extra = 0) - if(!jobban_isbanned(user, "Records") && CanUseTopic(user)) + if(!isnull(new_medical) && !jobban_isbanned(user, "Records") && CanUseTopic(user)) pref.med_record = new_medical return TOPIC_REFRESH else if(href_list["set_general_records"]) var/new_general = sanitize(input(user,"Enter employment information here.","Character Preference", html_decode(pref.gen_record)) as message|null, MAX_PAPER_MESSAGE_LEN, extra = 0) - if(!jobban_isbanned(user, "Records") && CanUseTopic(user)) + if(!isnull(new_general) && !jobban_isbanned(user, "Records") && CanUseTopic(user)) pref.gen_record = new_general return TOPIC_REFRESH else if(href_list["set_security_records"]) var/sec_medical = sanitize(input(user,"Enter security information here.","Character Preference", html_decode(pref.sec_record)) as message|null, MAX_PAPER_MESSAGE_LEN, extra = 0) - if(!jobban_isbanned(user, "Records") && CanUseTopic(user)) + if(!isnull(sec_medical) && !jobban_isbanned(user, "Records") && CanUseTopic(user)) pref.sec_record = sec_medical return TOPIC_REFRESH + else if(href_list["clear"]) + if(!jobban_isbanned(user, "Records") && CanUseTopic(user)) + if(alert(user, "Are you sure you wish to clear the [capitalize(href_list["clear"])] record?", "Clear Record Confirmation","Yes","No") == "No") + return TOPIC_NOACTION + switch(href_list["clear"]) + if("medical") + pref.med_record = "" + if("general") + pref.gen_record = "" + if("security") + pref.sec_record = "" + return TOPIC_REFRESH + + return ..() /datum/category_item/player_setup_item/general/background/proc/show_citizenship_menu(mob/user, selected_citizenship) diff --git a/html/changelogs/record_clear_button.yml b/html/changelogs/record_clear_button.yml new file mode 100644 index 00000000000..86e69b5088f --- /dev/null +++ b/html/changelogs/record_clear_button.yml @@ -0,0 +1,6 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Character setup record setting options now have a clear button, submitting a blank record or clicking cancel will no longer clear it." \ No newline at end of file