Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1d60a74

Browse files
committedSep 8, 2017
Add source chooser
Add package lock back in
1 parent a12cfad commit 1d60a74

File tree

9 files changed

+824
-113
lines changed

9 files changed

+824
-113
lines changed
 

‎.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ build
55
*.iml
66
/test
77
/.gradle/buildOutputCleanup
8-
package-lock.json
98
/libs

‎TODO.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# TODO List
22
- Add the ability to load extension sources
33
- Dialog polyfill may not be loaded on all pages where it is required. Breaks app on firefox.
4-
- Filter sidebar does not render correctly in Firefox
5-
- Filter sidebar expansion button disappears randomly
4+
5+
- Library updates page is missing
6+
- Recently read page is missing
7+
- Latest updates page is missing
8+
- Source chooser is incomplete
9+

‎TachiServer/src/main/java/xyz/nulldev/ts/api/http/catalogue/ListSourcesRoute.kt

+10
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import spark.Request
2424
import spark.Response
2525
import xyz.nulldev.ts.api.http.TachiWebRoute
2626
import xyz.nulldev.ts.ext.kInstanceLazy
27+
import java.util.*
2728

2829
/**
2930
* List the available sources.
@@ -40,6 +41,11 @@ class ListSourcesRoute : TachiWebRoute() {
4041
val sourceObj = JSONObject()
4142
sourceObj.put(KEY_ID, source.id)
4243
sourceObj.put(KEY_NAME, source.name)
44+
val langObj = JSONObject()
45+
langObj.put(KEY_LANG_NAME, source.lang)
46+
langObj.put(KEY_LANG_DISPLAY_NAME, Locale(source.lang).displayName)
47+
sourceObj.put(KEY_LANG, langObj)
48+
sourceObj.put(KEY_SUPPORTS_LATEST, source.supportsLatest)
4349
if (source is LoginSource) {
4450
sourceObj.put(KEY_LOGGED_IN, source.isLogged())
4551
}
@@ -53,6 +59,10 @@ class ListSourcesRoute : TachiWebRoute() {
5359
val KEY_CONTENT = "content"
5460
val KEY_NAME = "name"
5561
val KEY_ID = "id"
62+
val KEY_LANG = "lang"
63+
val KEY_LANG_NAME = "name"
64+
val KEY_LANG_DISPLAY_NAME = "display_name"
65+
val KEY_SUPPORTS_LATEST = "supports_latest"
5666
val KEY_LOGGED_IN = "logged_in"
5767
}
5868
}

‎tachiwebui/src/main/resources/tachiweb-ui/css/options.css

+36-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,39 @@
1616

1717
.mdl-radio {
1818
display: block;
19-
}
19+
}
20+
21+
/** Sources styles **/
22+
.sources-wrapper {
23+
user-select: none;
24+
}
25+
26+
.sources-group {
27+
border-bottom: 1px solid #bdbdbd;
28+
}
29+
30+
.sources-item {
31+
position: relative;
32+
height: 40px;
33+
padding: 0 16px;
34+
}
35+
36+
.sources-item-wrapper {
37+
font-weight: bold;
38+
}
39+
40+
.sources-item-label {
41+
height: 40px;
42+
line-height: 40px;
43+
}
44+
45+
.sources-source-label {
46+
padding-left: 8px;
47+
}
48+
49+
.sources-item-switch {
50+
position: absolute;
51+
top: 50%;
52+
right: 16px;
53+
transform: translateY(-50%);
54+
}

‎tachiwebui/src/main/resources/tachiweb-ui/js/options.js

+337-107
Large diffs are not rendered by default.

‎tachiwebui/src/main/resources/tachiweb-ui/options.html

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<!-- Material Lite -->
88
<link href="css/material.min.css" rel="stylesheet">
99
<script src="bower_components/material-design-lite/material.min.js"></script>
10+
<!-- MDC Web -->
11+
<link href="node_modules/material-components-web/dist/material-components-web.min.css" rel="stylesheet">
12+
<script src="node_modules/material-components-web/dist/material-components-web.min.js"></script>
1013
<!-- Material Fonts -->
1114
<link href="bower_components/material-design-icons/iconfont/material-icons.css" rel="stylesheet">
1215
<!-- Dialog Polyfill -->

‎tachiwebui/src/main/resources/tachiweb-ui/package-lock.json

+413
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎tachiwebui/src/main/resources/tachiweb-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"license": "Apache-2.0",
1818
"dependencies": {
1919
"css-prefix": "0.0.2",
20-
"material-components-web": "^0.10.0"
20+
"material-components-web": "^0.20.0"
2121
}
2222
}

‎tachiwebui/src/main/resources/tachiweb-ui/prefs/schema.json

+18-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,24 @@
6969
{
7070
"label": "Sources",
7171
"type": "nested",
72-
"prefs": []
72+
"prefs": [
73+
{
74+
"key": [
75+
"source_languages",
76+
"hidden_catalogues"
77+
],
78+
"type": "sources",
79+
"pref_types": {
80+
"source_languages": "string_set",
81+
"hidden_catalogues": "string_set"
82+
},
83+
"error_message": "Unable to fetch source list!",
84+
"default": {
85+
"source_languages": ["en"],
86+
"hidden_catalogues": []
87+
}
88+
}
89+
]
7390
},
7491
{
7592
"label": "Sync",

0 commit comments

Comments
 (0)
Please sign in to comment.