Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
0987c5f9
Unverified
Commit
0987c5f9
authored
Jan 18, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
#4
parent
93ac213c
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
69 additions
and
1324 deletions
+69
-1324
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+12
-2
src/main/java/org/b3log/solo/service/DataModelService.java
src/main/java/org/b3log/solo/service/DataModelService.java
+6
-0
src/main/java/org/b3log/solo/service/InitService.java
src/main/java/org/b3log/solo/service/InitService.java
+7
-1
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+11
-1
src/main/resources/admin/admin-preference.ftl
src/main/resources/admin/admin-preference.ftl
+6
-0
src/main/resources/js/admin/admin.min.js
src/main/resources/js/admin/admin.min.js
+1
-420
src/main/resources/js/admin/preference.js
src/main/resources/js/admin/preference.js
+2
-0
src/main/resources/js/pjax.js
src/main/resources/js/pjax.js
+17
-0
src/main/resources/lang_en_US.properties
src/main/resources/lang_en_US.properties
+1
-0
src/main/resources/lang_zh_CN.properties
src/main/resources/lang_zh_CN.properties
+1
-0
src/main/resources/skins/Bubble/js/common.min.js
src/main/resources/skins/Bubble/js/common.min.js
+1
-180
src/main/resources/skins/Casper/js/common.min.js
src/main/resources/skins/Casper/js/common.min.js
+1
-180
src/main/resources/skins/Finding/js/common.min.js
src/main/resources/skins/Finding/js/common.min.js
+1
-180
src/main/resources/skins/Pinghsu/js/common.min.js
src/main/resources/skins/Pinghsu/js/common.min.js
+1
-180
src/main/resources/skins/yilia/js/common.min.js
src/main/resources/skins/yilia/js/common.min.js
+1
-180
No files found.
src/main/java/org/b3log/solo/model/Option.java
View file @
0987c5f9
...
...
@@ -26,7 +26,7 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/hzchendou">hzchendou</a>
* @version 1.6.0.
2, Aug 18, 2019
* @version 1.6.0.
3, Jan 18, 2020
* @since 0.6.0
*/
public
final
class
Option
{
...
...
@@ -52,6 +52,11 @@ public final class Option {
public
static
final
String
OPTION_CATEGORY
=
"optionCategory"
;
// oId constants
/**
* Key of code block line num show flag. 支持代码块行号显示 https://github.com/88250/solo/issues/4
*/
public
static
final
String
ID_C_SHOW_CODE_BLOCK_LN
=
"showCodeBlockLn"
;
/**
* Key of hljs theme. 在设置中可选择语法高亮主题 https://github.com/b3log/solo/issues/12722
*/
...
...
@@ -300,11 +305,16 @@ public final class Option {
* Default preference.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.3.0.
3, Sep 18, 2019
* @version 2.3.0.
4, Jan 18, 2020
* @since 0.3.1
*/
public
static
final
class
DefaultPreference
{
/**
* Default show code block line num.
*/
public
static
final
String
DEFAULT_SHOW_CODE_BLOCK_LN
=
"false"
;
/**
* Default hljs theme.
*/
...
...
src/main/java/org/b3log/solo/service/DataModelService.java
View file @
0987c5f9
...
...
@@ -520,6 +520,12 @@ public class DataModelService {
}
dataModel
.
put
(
Option
.
ID_C_HLJS_THEME
,
hljsTheme
);
String
showCodeBlockLn
=
preference
.
optString
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
if
(
StringUtils
.
isBlank
(
showCodeBlockLn
))
{
showCodeBlockLn
=
Option
.
DefaultPreference
.
DEFAULT_SHOW_CODE_BLOCK_LN
;
}
dataModel
.
put
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
,
showCodeBlockLn
);
dataModel
.
put
(
Common
.
COMMENTABLE
,
preference
.
optBoolean
(
Option
.
ID_C_COMMENTABLE
));
dataModel
.
put
(
"staticSite"
,
Solos
.
GEN_STATIC_SITE
);
...
...
src/main/java/org/b3log/solo/service/InitService.java
View file @
0987c5f9
...
...
@@ -53,7 +53,7 @@ import java.util.List;
* Solo initialization service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.3
6, Dec 28, 2019
* @version 1.5.2.3
7, Jan 18, 2020
* @since 0.4.0
*/
@Service
...
...
@@ -472,6 +472,12 @@ public class InitService {
private
void
initOptions
(
final
JSONObject
requestJSONObject
)
throws
Exception
{
LOGGER
.
debug
(
"Initializing preference...."
);
final
JSONObject
showCodeBlockLnOpt
=
new
JSONObject
();
showCodeBlockLnOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_VALUE
,
DefaultPreference
.
DEFAULT_SHOW_CODE_BLOCK_LN
);
optionRepository
.
add
(
showCodeBlockLnOpt
);
final
JSONObject
hljsThemeOpt
=
new
JSONObject
();
hljsThemeOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_HLJS_THEME
);
hljsThemeOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
0987c5f9
...
...
@@ -20,6 +20,7 @@ package org.b3log.solo.service;
import
org.apache.logging.log4j.Level
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Latkes
;
import
org.b3log.latke.ioc.Inject
;
import
org.b3log.latke.repository.Transaction
;
...
...
@@ -38,7 +39,7 @@ import java.util.Locale;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.
2, Aug 18, 2019
* @version 1.4.0.
3, Jan 18, 2020
* @since 0.4.0
*/
@Service
...
...
@@ -219,6 +220,15 @@ public class PreferenceMgmtService {
hljsThemeOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_HLJS_THEME
));
optionRepository
.
update
(
Option
.
ID_C_HLJS_THEME
,
hljsThemeOpt
);
JSONObject
showCodeBlockLnOpt
=
optionRepository
.
get
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
if
(
null
==
showCodeBlockLnOpt
)
{
showCodeBlockLnOpt
=
new
JSONObject
();
showCodeBlockLnOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
}
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
));
optionRepository
.
update
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
,
showCodeBlockLnOpt
);
final
JSONObject
customVarsOpt
=
optionRepository
.
get
(
Option
.
ID_C_CUSTOM_VARS
);
customVarsOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_CUSTOM_VARS
));
optionRepository
.
update
(
Option
.
ID_C_CUSTOM_VARS
,
customVarsOpt
);
...
...
src/main/resources/admin/admin-preference.ftl
View file @
0987c5f9
...
...
@@ -177,6 +177,12 @@
<input id="pullGitHub" type="checkbox" class="normalInput"/>
</div>
</label>
<label>
<div class="fn__flex-inline">
${showCodeBlockLnLabel}
<input id="showCodeBlockLn" type="checkbox" class="normalInput"/>
</div>
</label>
</div>
<div class="fn__margin12"></div>
<div class="fn__flex-1">
...
...
src/main/resources/js/admin/admin.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
src/main/resources/js/admin/preference.js
View file @
0987c5f9
...
...
@@ -77,6 +77,7 @@ admin.preference = {
'
true
'
===
preference
.
commentable
?
$
(
'
#commentable
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
commentable
'
).
removeAttr
(
'
checked
'
)
'
true
'
===
preference
.
syncGitHub
?
$
(
'
#syncGitHub
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
syncGitHub
'
).
removeAttr
(
'
checked
'
)
'
true
'
===
preference
.
pullGitHub
?
$
(
'
#pullGitHub
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
pullGitHub
'
).
removeAttr
(
'
checked
'
)
'
true
'
===
preference
.
showCodeBlockLn
?
$
(
'
#showCodeBlockLn
'
).
attr
(
'
checked
'
,
'
checked
'
)
:
$
(
'
showCodeBlockLn
'
).
removeAttr
(
'
checked
'
)
admin
.
preference
.
locale
=
preference
.
localeString
...
...
@@ -226,6 +227,7 @@ admin.preference = {
'
faviconURL
'
:
$
(
'
#faviconURL
'
).
val
(),
'
syncGitHub
'
:
$
(
'
#syncGitHub
'
).
prop
(
'
checked
'
),
'
pullGitHub
'
:
$
(
'
#pullGitHub
'
).
prop
(
'
checked
'
),
'
showCodeBlockLn
'
:
$
(
'
#showCodeBlockLn
'
).
prop
(
'
checked
'
),
'
commentable
'
:
$
(
'
#commentable
'
).
prop
(
'
checked
'
),
'
customVars
'
:
$
(
'
#customVars
'
).
val
(),
},
...
...
src/main/resources/js/pjax.js
View file @
0987c5f9
/*
* Solo - A small and beautiful blogging system written in Java.
* Copyright (c) 2010-present, b3log.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import
$
from
'
jquery
'
const
pjaxUtil
=
{
support
:
{
...
...
src/main/resources/lang_en_US.properties
View file @
0987c5f9
...
...
@@ -24,6 +24,7 @@
# Author: Dongxu Wang
#
showCodeBlockLnLabel
=
Show code block line num:
siteURLLabel
=
Site URL:
siteGenedLabel
=
Site generated, target dir is [{dir}]
generateLabel
=
Gen
...
...
src/main/resources/lang_zh_CN.properties
View file @
0987c5f9
...
...
@@ -24,6 +24,7 @@
# Author: Dongxu Wang
#
showCodeBlockLnLabel
=
\u
4EE3
\u7801\u5757\u
663E
\u
793A
\u
884C
\u
53F7
\u
FF1A
siteURLLabel
=
\u
7AD9
\u
70B9
\u5730\u5740\u
FF1A
siteGenedLabel
=
\u
7AD9
\u
70B9
\u
751F
\u6210\u
5B8C
\u
6BD5
\u
FF0C
\u
8BF7
\u
67E5
\u
770B
\u
76EE
\u
5F55 [{dir}]
generateLabel
=
\u
751F
\u6210
...
...
src/main/resources/skins/Bubble/js/common.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
src/main/resources/skins/Casper/js/common.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
src/main/resources/skins/Finding/js/common.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
src/main/resources/skins/Pinghsu/js/common.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
src/main/resources/skins/yilia/js/common.min.js
View file @
0987c5f9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment