Weather and Category

This commit is contained in:
2024-01-31 12:37:55 +01:00
parent f4a2251178
commit 232df1e4e0
24 changed files with 370 additions and 351 deletions

View File

@@ -4,8 +4,7 @@
<body>
{{template "headerHTML" .}}
{{template "weatherHTML"}}
{{template "weatherwidgetHTML"}}
{{template "singleArticleHTML" .}}

View File

@@ -4,43 +4,8 @@
<body>
{{template "headerHTML" .}}
{{template "weatherHTML"}}
{{template "articlecategoryHTML" .}}
<h1>{{.Category}}</h1>
{{range .Articles}}
<article class="news-article">
<div class="article_content">
<div class="ar-title">
<a href="/{{.ID}}/{{.Slug}}">
{{.Title}}
</a>
</div>
</div>
<a href="/{{.ID}}/{{.Slug}}">
<div class="prewi" data-content="{{.Content}}" data-title="{{.Title}}" data-link="/{{.ID}}/{{.Slug}}"></div>
</a>
<div class="timestamp"> starenovine - {{ .FormatedCreatedAt }}</div>
</article>
{{else}}
<div class="empty">
Nema članaka za izabrani datum.
</div>
{{end}}
<script>
function createPreview(content) {
let slicedContent = content.slice(0,200);
if (content.length > 200){
slicedContent += '...'
}
}
let previewDiv = document.querySelectorAll(".prewi");
previewDivs.forEach(function (previewDiv) {
let content = document.getAttribute('data-content')
previewDiv.textContent = createPreview(content)
})
</script>
{{template "footerHTML" .}}
</body>
</html>

View File

@@ -4,7 +4,7 @@
<body>
{{template "headerHTML" .}}
{{template "weatherHTML"}}
{{template "weatherwidgetHTML"}}
{{template "articlesHTML" .}}

View File

@@ -1,10 +1,9 @@
{{define "homeHTML"}}
{{template "headHTML" .}}
<body>
{{template "headerHTML" .}}
{{template "weatherHTML"}}
{{template "weatherwidgetHTML" .}}
{{template "articlesHTML" .}}

View File

@@ -1,28 +1,10 @@
{{define "fullweatherHTML"}}
{{define "weatherHTML"}}
{{template "headHTML" .}}
<body>
{{template "headerHTML" .}}
<h2 class="w-title">{{.title}}</h2>
<div class="weather-container">
{{range .weatherInfo}}
<div class="weather-w">
<h3>{{.Name}}</h3>
{{with index .Weather 0}}
<div class="weather-info">Opis: {{.Description}}</div>
{{end}}
<div class="weather-info">Temperatura: {{.Main.Temp}}°C</div>
<div class="weather-info">Osecaj: {{.Main.FellsLike}}°C</div>
<div class="weather-info">Pritisak:{{.Main.Preassure}} hPa</div>
<div class="weather-info">Vlaznost: {{.Main.Humidity}}%</div>
<div class="weather-info">Min Temp: {{.Main.TempMin}}°C</div>
<div class="weather-info">Max Temp: {{.Main.TempMax}}°C</div>
<div class="weather-info">Vetar: {{.Wind.Speed}} m/s</div>
<div class="weather-info">Oblaci: {{.Clouds.All}}%</div>
</div>
{{end}}
</div>
{{template "fullweatherHTML" .}}
{{template "footerHTML" .}}
</body>