Skip to content

Commit

Permalink
refactor collectionimagerouter
Browse files Browse the repository at this point in the history
  • Loading branch information
zincarla committed Mar 8, 2021
1 parent ecd49b4 commit 0eeb3db
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 91 deletions.
5 changes: 3 additions & 2 deletions gib.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,9 @@ func main() {
requestRouter.HandleFunc("/images", routers.AccountRequiredMiddleWare(routers.ImageQueryRouter)).Methods("GET")
requestRouter.HandleFunc("/collectionorder", routers.AccountRequiredMiddleWare(routers.CollectionImageOrderGetRouter)).Methods("GET")
requestRouter.HandleFunc("/collectionorder", routers.AccountRequiredMiddleWare(routers.CollectionImageOrderPostRouter)).Methods("POST")
requestRouter.HandleFunc("/collectionimages", routers.AccountRequiredMiddleWare(routers.CollectionImageRouter)) //TODO: Split Needed
requestRouter.HandleFunc("/collections", routers.AccountRequiredMiddleWare(routers.CollectionsRouter)) //TODO: Split Needed
requestRouter.HandleFunc("/collectionimages", routers.AccountRequiredMiddleWare(routers.CollectionImageGetRouter)).Methods("GET")
requestRouter.HandleFunc("/collectionimages", routers.AccountRequiredMiddleWare(routers.CollectionImagePostRouter)).Methods("POST")
requestRouter.HandleFunc("/collections", routers.AccountRequiredMiddleWare(routers.CollectionsRouter)) //TODO: Split Needed
requestRouter.HandleFunc("/images/{file}", routers.AccountRequiredMiddleWare(routers.ResourceImageRouter)).Methods("GET")
requestRouter.HandleFunc("/thumbs/{file}", routers.AccountRequiredMiddleWare(routers.ThumbnailRouter)).Methods("GET")
requestRouter.HandleFunc("/image", routers.AccountRequiredMiddleWare(routers.ImageRouter)) //TODO: Split Needed
Expand Down
16 changes: 14 additions & 2 deletions http/collection.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ <h3>{{.CollectionInfo.Name}}</h3>
Go to this post
</a>
{{if and $UserNotNull $HasRemoveFromPermissions}}
<a href="/collectionimages?command=delete&ID={{$CollectionID}}&ImageID={{.ID}}&SearchTerms={{$OldQuery}}" onclick="return confirm('Are you sure you want to remove this from the collection?');"><div class="removeCollectionButton"><span></span></div></a>
<form action="/collectionimages" method="POST">
<input type="hidden" name="command" value="delete" />
<input type="hidden" name="ID" value="{{$CollectionID}}" />
<input type="hidden" name="ImageID" value="{{.ID}}" />
<input type="hidden" name="SearchTerms" value="{{$OldQuery}}" />
<button type="submit" class="removeCollectionButton" onclick="return confirm('Are you sure you want to remove this from the collection?');"><span></span></button>
</form>
{{end}}
</div>
{{else}}
Expand All @@ -84,7 +90,13 @@ <h3>{{.CollectionInfo.Name}}</h3>
<div class="imageResultOverlay overlay{{.Location | getimagetype}}"></div>
</a>
{{if and $UserNotNull $HasRemoveFromPermissions}}
<a href="/collectionimages?command=delete&ID={{$CollectionID}}&ImageID={{.ID}}&SearchTerms={{$OldQuery}}" onclick="return confirm('Are you sure you want to remove this from the collection?');"><div class="removeCollectionButton"><span></span></div></a>
<form action="/collectionimages" method="POST">
<input type="hidden" name="command" value="delete" />
<input type="hidden" name="ID" value="{{$CollectionID}}" />
<input type="hidden" name="ImageID" value="{{.ID}}" />
<input type="hidden" name="SearchTerms" value="{{$OldQuery}}" />
<button type="submit" class="removeCollectionButton" onclick="return confirm('Are you sure you want to remove this from the collection?');"><span></span></button>
</form>
{{end}}
</div>
{{end}}
Expand Down
6 changes: 6 additions & 0 deletions http/resources/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ video, audio {
height: 1em;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
margin: 0px;
font-size: 1em;
border: none;
padding: 0px;
line-height: 1em;
cursor: pointer;
}
.removeCollectionButton:not(:hover) span:after {
content: "X";
Expand Down
Loading

0 comments on commit 0eeb3db

Please sign in to comment.