Skip to content

Commit d78bc34

Browse files
author
Okeanij
committed
Add CustomCss tab at Skins Admin.
1 parent d7c4d38 commit d78bc34

File tree

7 files changed

+28
-13
lines changed

7 files changed

+28
-13
lines changed

Client/src/admin/skins/CustomCssAdmin.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
<template>
22
<div class="custom-css-admin q-gutter-y-md">
3-
<q-input
4-
filled
5-
input-class="custom-css-admin__text-area"
6-
type="textarea"
7-
v-model="customCss"
8-
/>
9-
<div class="clear"></div>
103
<div class="flex">
114
<q-btn
125
no-caps
@@ -24,6 +17,13 @@
2417
:label="$tl('refreshBtn')"
2518
/>
2619
</div>
20+
<q-input
21+
filled
22+
:label="$tl('cssInput')"
23+
input-class="custom-css-admin__text-area"
24+
type="textarea"
25+
v-model="customCss"
26+
/>
2727
</div>
2828
</template>
2929

Client/src/i18n/en-us/admin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ export default {
489489
},
490490
CustomCssAdmin: {
491491
title: "Custom CSS",
492+
cssInput: "Custom CSS",
492493
saveBtn: "@:Global.btn.save",
493494
refreshBtn: "Reload from server",
494495
reloadSuccessNotify: "Css reloaded from server",

Client/src/i18n/ru/admin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,7 @@ export default {
528528
},
529529
CustomCssAdmin: {
530530
title: "Произвольный CSS",
531+
cssInput: "Произвольный CSS",
531532
saveBtn: "@:Global.btn.save",
532533
refreshBtn: "Перегрузить с сервера",
533534
reloadSuccessNotify: "Данные перезагружены с сервера",

Client/src/statics/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ else if (config.Global.SiteUrl.startsWith("https://"))
6565
config.Global.SiteSchema = "https://";
6666
else throw "SiteUrl in config.js have to start with 'http://' or 'https://'.";
6767

68-
document.writeln(`<link href="${config.Global.CustomCssUrl}" rel="stylesheet" />`);
68+
document.writeln(`<link href="${config.Global.CustomCssUrl}?customcssver=111111" rel="stylesheet" />`);
6969

Config.template/Init/Materials/index-page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ <h1 class="index-page__header index-page__demo-header">Sun<wbr/>Engine
5151
<span class="index-page__info-block-accent">Moderator</span>,
5252
<span class="index-page__info-block-accent">Admin</span>.</p>
5353
<p>Пароль: <span class="index-page__info-block-accent">password</span>.</p>
54-
<p class="index-page__version">Версия: <span class="num">v2.1.3</span></p>
54+
<p class="index-page__version">Версия: <span class="num">v2.2.0</span></p>
5555
</div>
5656
</div>

Server/SunEngine.Admin/Services/ConfigurationAdminService.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class ConfigurationAdminService
1616
protected IConfigurationRoot configurationRoot { get; }
1717
protected IOptionsMonitor<GlobalOptions> globalOptions { get; }
1818

19+
protected Random ran = new Random();
20+
1921
public ConfigurationAdminService(
2022
IPathService pathService,
2123
IConfigurationRoot configurationRoot)
@@ -89,18 +91,27 @@ public void UpdateClientScripts()
8991
$"// auto-start\n{json}\n // auto-end", RegexOptions.Singleline);
9092
File.WriteAllText(configJsPath, configJs);
9193

92-
UpdateScriptsVersion();
94+
UpdateConfigVersion();
9395
}
9496

95-
protected void UpdateScriptsVersion()
97+
public void UpdateConfigVersion()
9698
{
97-
var ran = new Random();
98-
9999
var indexHtmlPath = pathService.Combine(PathNames.WwwRootDirName, "index.html");
100100
string text = File.ReadAllText(indexHtmlPath);
101101
Regex reg = new Regex("configver=\\d+\"");
102102
text = reg.Replace(text, $"configver={ran.Next()}\"");
103103
File.WriteAllText(indexHtmlPath, text);
104104
}
105+
106+
public void UpdateCustomCssVersion()
107+
{
108+
UpdateConfigVersion();
109+
110+
var configJsPath = pathService.Combine(PathNames.WwwRootDirName,"statics" ,"config.js");
111+
string text = File.ReadAllText(configJsPath);
112+
Regex reg = new Regex("customcssver=\\d+\"");
113+
text = reg.Replace(text, $"customcssver={ran.Next()}\"");
114+
File.WriteAllText(configJsPath, text);
115+
}
105116
}
106117
}

Server/SunEngine.Admin/Services/SkinsAdminService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ public void UpdateCustomCss(string cssText)
193193
File.Delete(customCssPath);
194194

195195
File.WriteAllText(customCssPath, cssText);
196+
197+
configurationAdminService.UpdateCustomCssVersion();
196198
}
197199

198200
public List<SkinInfo> GetAllSkins(SkinType skinType)

0 commit comments

Comments
 (0)