dark mode is ON!

pull/40/head
Akhil Gupta 4 years ago
parent caf197e79d
commit b0c070d840

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Add Podcast - PodGrab</title> <title>Add Podcast - PodGrab</title>
{{template "commoncss"}} {{template "commoncss" .}}
<style> <style>
[v-cloak] { [v-cloak] {
display: none; display: none;
@ -33,7 +33,7 @@
<input <input
type="submit" type="submit"
value="Add Podcast" value="Add Podcast"
class="u-full-width button-primary" class="u-full-width button"
/> />
</div> </div>
</form> </form>
@ -72,7 +72,7 @@
<input <input
type="submit" type="submit"
value="Upload" value="Upload"
class="u-full-width button-primary" class="u-full-width button"
/> />
</div> </div>
</form> </form>
@ -101,7 +101,7 @@
<input <input
type="submit" type="submit"
value="Search" value="Search"
class="u-full-width button-primary" class="u-full-width button"
/> />
</div> </div>
</form> </form>
@ -126,7 +126,7 @@
<button <button
v-if="!item.already_saved" v-if="!item.already_saved"
v-on:click="addPodcast(item)" v-on:click="addPodcast(item)"
class="button button-primary" class="button button"
> >
+ Add + Add
</button> </button>

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PodGrab</title> <title>PodGrab</title>
{{template "commoncss"}} {{template "commoncss" .}}
<style> <style>
.button-delete{ .button-delete{
background-color: indianred; background-color: indianred;

@ -7,6 +7,37 @@
/> />
<link rel="stylesheet" href="/webassets/fa/fontawesome.min.css" /> <link rel="stylesheet" href="/webassets/fa/fontawesome.min.css" />
<link rel="stylesheet" href="/webassets/fa/solid.min.css" /> <link rel="stylesheet" href="/webassets/fa/solid.min.css" />
{{if .setting.DarkMode}}
<style>
html{
--text-color: #eeeeee;
--background: #121212;
--overlay:#000;
}
</style>
{{else}}
<style>
html{
--text-color: #222;
--background: #fff;
--overlay:#ccc;
}
</style>
{{end}}
<style>
*{
background: var(--background);
color: var(--text-color);
}
.button,input[type=submit],input[type=email],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=url],select,textarea,button,a{
background-color: inherit;
color: inherit;
}
</style>
<style> <style>
.container { .container {

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{.title}} - PodGrab</title> <title>{{.title}} - PodGrab</title>
{{template "commoncss"}} {{template "commoncss" .}}
<style> <style>
img { img {
display: none; display: none;
@ -120,7 +120,7 @@
{{else}} {{if not $setting.AutoDownload}} {{else}} {{if not $setting.AutoDownload}}
<a <a
class="button button-primary" class="button button"
onclick="downloadToDisk('{{.ID}}')" onclick="downloadToDisk('{{.ID}}')"
title="Download to server" title="Download to server"
download download
@ -128,7 +128,7 @@
></a> ></a>
{{else}} {{if eq .DownloadStatus 3}} {{else}} {{if eq .DownloadStatus 3}}
<a <a
class="button button-primary" class="button button"
onclick="downloadToDisk('{{.ID}}')" onclick="downloadToDisk('{{.ID}}')"
title="Download to server" title="Download to server"
download download
@ -153,13 +153,13 @@
{{if .previousPage }} {{if .previousPage }}
<a <a
href="?page={{.previousPage}}&downloadedOnly={{.downloadedOnly}}" href="?page={{.previousPage}}&downloadedOnly={{.downloadedOnly}}"
class="button button-primary" class="button"
>Newer</a >Newer</a
> >
{{end}} {{if .nextPage }} {{end}} {{if .nextPage }}
<a <a
href="?page={{.nextPage}}&downloadedOnly={{.downloadedOnly}}" href="?page={{.nextPage}}&downloadedOnly={{.downloadedOnly}}"
class="button button-primary" class="button"
>Older</a >Older</a
> >
{{end}} {{end}}

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PodGrab</title> <title>PodGrab</title>
{{template "commoncss"}} {{template "commoncss" .}}
<style> <style>
.button-delete { .button-delete {
color: #d11a2a; color: #d11a2a;

@ -10,7 +10,7 @@
display: block; display: block;
width: 100%; width: 100%;
height: 6.5rem; height: 6.5rem;
background: #fff; background:var(--background);
z-index: 99; z-index: 99;
border-top: 1px solid #eee; border-top: 1px solid #eee;
border-bottom: 1px solid #eee; } border-bottom: 1px solid #eee; }
@ -33,7 +33,7 @@
margin-right: 35px; margin-right: 35px;
text-decoration: none; text-decoration: none;
line-height: 6.5rem; line-height: 6.5rem;
color: #222; } color: var(--text-color);}
.navbar-link.active { .navbar-link.active {
color: #33C3F0; } color: #33C3F0; }
.has-docked-nav .navbar { .has-docked-nav .navbar {
@ -62,7 +62,6 @@
z-index: 1000; z-index: 1000;
top: 0; top: 0;
left: -160px; left: -160px;
background-color: #fff;
overflow-x: hidden; overflow-x: hidden;
padding-top: 20px; padding-top: 20px;
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
@ -87,11 +86,11 @@
font-weight: 600; font-weight: 600;
letter-spacing: .2rem; letter-spacing: .2rem;
line-height: 2.5rem; line-height: 2.5rem;
color: #222;
} }
div#overlay{ div#overlay{
background-color: #ccc; background-color: var(--overlay);
opacity: 0.5; opacity: 0.5;
height: 100%; height: 100%;
width: 100%; width: 100%;
@ -110,13 +109,13 @@ div#overlay{
#burger div{ #burger div{
width: 30px; width: 30px;
height: 2px; height: 2px;
background-color: black; background-color: var(--text-color);;
margin: 6px 0; margin: 6px 0;
} }
.bar1, .bar2, .bar3 { .bar1, .bar2, .bar3 {
width: 15px; width: 15px;
height: 2px; height: 2px;
background-color: #333; background-color: var(--text-color);;
margin: 6px 0; margin: 6px 0;
} }
#closeDrawer{ #closeDrawer{

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PodGrab</title> <title>PodGrab</title>
{{template "commoncss"}} {{template "commoncss" .}}
<style> <style>
.button-delete{ .button-delete{
background-color: indianred; background-color: indianred;
@ -78,7 +78,12 @@
<span class="label-body">Append episode number to episode file name</span> <span class="label-body">Append episode number to episode file name</span>
</label> </label>
<input type="submit" value="Save" class="button button-primary"> <label for="darkMode">
<input type="checkbox" name="darkMode" v-model="darkMode">
<span class="label-body">Use Dark Mode</span>
</label>
<input type="submit" value="Save" class="button">
</form> </form>
</div> </div>
</div> </div>
@ -116,7 +121,9 @@
var app = new Vue({ var app = new Vue({
delimiters: ['${', '}'], delimiters: ['${', '}'],
el: '#app', el: '#app',
mounted(){
this.originalThemeSetting= this.darkMode;
},
methods:{ methods:{
saveSettings:function(e){ saveSettings:function(e){
e.preventDefault(); e.preventDefault();
@ -127,7 +134,8 @@ var app = new Vue({
initialDownloadCount:self.initialDownloadCount, initialDownloadCount:self.initialDownloadCount,
autoDownload:self.autoDownload, autoDownload:self.autoDownload,
appendDateToFileName:self.appendDateToFileName, appendDateToFileName:self.appendDateToFileName,
appendEpisodeNumberToFileName:self.appendEpisodeNumberToFileName appendEpisodeNumberToFileName:self.appendEpisodeNumberToFileName,
darkMode:self.darkMode
}) })
.then(function(response){ .then(function(response){
@ -137,8 +145,10 @@ var app = new Vue({
position: "top-right", position: "top-right",
duration : 5000 duration : 5000
}) })
console.log(self.originalThemeSetting);
if(self.originalThemeSetting!= self.darkMode){
window.location.reload()
}
}) })
.catch(function(error){ .catch(function(error){
if(error.response){ if(error.response){
@ -163,8 +173,9 @@ var app = new Vue({
initialDownloadCount: {{ .setting.InitialDownloadCount }}, initialDownloadCount: {{ .setting.InitialDownloadCount }},
autoDownload: {{ .setting.AutoDownload }}, autoDownload: {{ .setting.AutoDownload }},
appendDateToFileName: {{ .setting.AppendDateToFileName }}, appendDateToFileName: {{ .setting.AppendDateToFileName }},
appendEpisodeNumberToFileName:{{ .setting.AppendEpisodeNumberToFileName }} appendEpisodeNumberToFileName:{{ .setting.AppendEpisodeNumberToFileName }},
darkMode:{{ .setting.DarkMode }},
originalThemeSetting:{{ .setting.DarkMode }}
}, },
}) })

@ -25,16 +25,18 @@ type SettingModel struct {
AutoDownload bool `form:"autoDownload" json:"autoDownload" query:"autoDownload"` AutoDownload bool `form:"autoDownload" json:"autoDownload" query:"autoDownload"`
AppendDateToFileName bool `form:"appendDateToFileName" json:"appendDateToFileName" query:"appendDateToFileName"` AppendDateToFileName bool `form:"appendDateToFileName" json:"appendDateToFileName" query:"appendDateToFileName"`
AppendEpisodeNumberToFileName bool `form:"appendEpisodeNumberToFileName" json:"appendEpisodeNumberToFileName" query:"appendEpisodeNumberToFileName"` AppendEpisodeNumberToFileName bool `form:"appendEpisodeNumberToFileName" json:"appendEpisodeNumberToFileName" query:"appendEpisodeNumberToFileName"`
DarkMode bool `form:"darkMode" json:"darkMode" query:"darkMode"`
} }
func AddPage(c *gin.Context) { func AddPage(c *gin.Context) {
setting := c.MustGet("setting").(*db.Setting)
c.HTML(http.StatusOK, "addPodcast.html", gin.H{"title": "Add Podcast"}) c.HTML(http.StatusOK, "addPodcast.html", gin.H{"title": "Add Podcast", "setting": setting})
} }
func HomePage(c *gin.Context) { func HomePage(c *gin.Context) {
//var podcasts []db.Podcast //var podcasts []db.Podcast
podcasts := service.GetAllPodcasts("") podcasts := service.GetAllPodcasts("")
c.HTML(http.StatusOK, "index.html", gin.H{"title": "Podgrab", "podcasts": podcasts}) setting := c.MustGet("setting").(*db.Setting)
c.HTML(http.StatusOK, "index.html", gin.H{"title": "Podgrab", "podcasts": podcasts, "setting": setting})
} }
func PodcastPage(c *gin.Context) { func PodcastPage(c *gin.Context) {
var searchByIdQuery SearchByIdQuery var searchByIdQuery SearchByIdQuery

@ -258,7 +258,7 @@ func UpdateSetting(c *gin.Context) {
if err == nil { if err == nil {
err = service.UpdateSettings(model.DownloadOnAdd, model.InitialDownloadCount, model.AutoDownload, model.AppendDateToFileName, model.AppendEpisodeNumberToFileName) err = service.UpdateSettings(model.DownloadOnAdd, model.InitialDownloadCount, model.AutoDownload, model.AppendDateToFileName, model.AppendEpisodeNumberToFileName, model.DarkMode)
if err == nil { if err == nil {
c.JSON(200, gin.H{"message": "Success"}) c.JSON(200, gin.H{"message": "Success"})

@ -68,6 +68,7 @@ type Setting struct {
AutoDownload bool `gorm:"default:true"` AutoDownload bool `gorm:"default:true"`
AppendDateToFileName bool `gorm:"default:false"` AppendDateToFileName bool `gorm:"default:false"`
AppendEpisodeNumberToFileName bool `gorm:"default:false"` AppendEpisodeNumberToFileName bool `gorm:"default:false"`
DarkMode bool `gorm:"default:false"`
} }
type Migration struct { type Migration struct {
Base Base

@ -532,7 +532,7 @@ func GetSearchFromItunes(pod model.ItunesSingleResult) *model.CommonSearchResult
return p return p
} }
func UpdateSettings(downloadOnAdd bool, initialDownloadCount int, autoDownload bool, appendDateToFileName bool, appendEpisodeNumberToFileName bool) error { func UpdateSettings(downloadOnAdd bool, initialDownloadCount int, autoDownload bool, appendDateToFileName bool, appendEpisodeNumberToFileName bool, darkMode bool) error {
setting := db.GetOrCreateSetting() setting := db.GetOrCreateSetting()
setting.AutoDownload = autoDownload setting.AutoDownload = autoDownload
@ -540,6 +540,7 @@ func UpdateSettings(downloadOnAdd bool, initialDownloadCount int, autoDownload b
setting.InitialDownloadCount = initialDownloadCount setting.InitialDownloadCount = initialDownloadCount
setting.AppendDateToFileName = appendDateToFileName setting.AppendDateToFileName = appendDateToFileName
setting.AppendEpisodeNumberToFileName = appendEpisodeNumberToFileName setting.AppendEpisodeNumberToFileName = appendEpisodeNumberToFileName
setting.DarkMode = darkMode
return db.UpdateSettings(setting) return db.UpdateSettings(setting)
} }

Loading…
Cancel
Save