Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienGasser committed Dec 2, 2024
1 parent 7c45833 commit 922f594
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion server/articleViewModel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type articleViewModel struct {
Suggestions []*cache.Article
LikeURL *url.URL
UpdateLikeURL *url.URL
TestURL *url.URL
Likes *likes.ArticleLikes
}

Expand Down
1 change: 0 additions & 1 deletion server/handleArticle.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func handleArticle(w http.ResponseWriter, r *http.Request) {
Suggestions: suggestions,
LikeURL: likeURL,
UpdateLikeURL: updateLikeURL,
TestURL: mustGetURL("articles", lang),
Likes: likes,
}
vm.Body = &articleVM
Expand Down
6 changes: 5 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ var isLocalEnvironment bool
// Listen ...
func Listen(port int, isLocal bool) {
isLocalEnvironment = isLocal
schemes := []string{"https", "http"}
if isLocal {
schemes = []string{"http"}
}

router = mux.NewRouter().
Schemes("http", "https").
Schemes(schemes...).
Host(getHost(isLocal, port)).
Subrouter()

Expand Down
5 changes: 2 additions & 3 deletions server/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ <h1 class="uk-article-title uk-margin uk-margin-small">{{ .Title }}</h1>

</article>

<!-- <p uk-margin>
<p uk-margin>
<a class="uk-button uk-button-default" href="#modal-group-prompt-username" uk-toggle onclick="onClickLike()">{{ $.T "This article helped me" }}</a>
</p>
<p>
<span id="like-count">{{ $viewModel.LikesText $.Meta.Lang }}</span>
</p> -->
</p>

{{- if $viewModel.Suggestions }}
<h4 class="uk-heading-divider" style="margin-top: 20px">{{ $.T "You may also like" }}</h4>
Expand Down Expand Up @@ -118,7 +118,6 @@ <h4 class="uk-heading-divider" style="margin-top: 20px">{{ $.T "You may also lik
let randomNumber = -1;

function onClickLike() {
var url = "{{ $viewModel.TestURL }}";
var url = "{{ $viewModel.LikeURL }}";
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
Expand Down

0 comments on commit 922f594

Please sign in to comment.