Skip to content

Commit

Permalink
update review
Browse files Browse the repository at this point in the history
  • Loading branch information
khw7096 committed Jun 25, 2023
1 parent 3da1b19 commit 8f7b088
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 28 deletions.
2 changes: 1 addition & 1 deletion assets/template/navbar-bootstrap5.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><span class="dropdown-item finger" data-bs-toggle="modal" data-bs-target="#modal-addreview-statusmode">Add Review</span></li>
<li><a class="dropdown-item" href="/daily-review-status">Daily</a></li>
<li><a class="dropdown-item" href="/reviewstatus">Review</a></li>
</ul>
</li>
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion assets/template/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<span class="dropdown-item finger" data-toggle="modal" data-target="#modal-addreview-statusmode">Add Review</span>
<a class="dropdown-item" href="/daily-review-status">Daily</a>
<a class="dropdown-item" href="/reviewstatus">Review</a>
</div>
</li>
{{end}}
Expand Down
44 changes: 26 additions & 18 deletions assets/template/reviewstatus.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@
<div class="container-fluid">
<form class="d-flex w-100" role="search" action="/review-status-submit" method="POST">
<div class="input-group p-1">
<select name="reviewproject" class="form-select custom-select rounded-start" id="review-searchbox-project">
<option value="">All</option>
<select name="reviewproject" class="form-select custom-select" id="review-searchbox-project">
<option value="">All-Project</option>
{{range .Projectlist}}
<option value="{{.}}" {{if eq . $.Project}}selected{{end}}>{{.}}</option>
{{end}}
</select>
<select name="itemstatus" class="form-select custom-select" id="review-searchbox-itemstatus">
<option value="" {{if eq "" $.ItemStatus}}selected{{end}}>All</option>
<option value="" {{if eq "" $.ItemStatus}}selected{{end}}>All-Status</option>
{{range .Status}}
<option value="{{.ID}}" {{if eq $.ItemStatus .ID}}selected{{end}}>{{.ID}}</option>
{{end}}
</select>
</select>
<select name="review-task" class="form-select custom-select" id="review-searchbox-task">
<option value="" {{if eq "" $.Task}}selected{{end}}>All-Task</option>
{{range .TasksettingNames}}
<option value="{{.}}" {{if eq $.Task .}}selected{{end}}>{{.}}</option>
{{end}}
</select>

<input type="date" name="review-createtime" class="form-control form-control-sm" id="review-searchbox-createtime" value="{{$.Createtime}}" placeholder="YYYY-MM-DD" >
<input type="search" name="searchword" class="form-control form-darkmode" placeholder="Search" value="{{.Searchword}}">
<button class="btn btn-outline-success" id="button">Search</button>
<button class="btn btn-outline-success rounded-0" id="button">Search</button>
</div>
</form>
</div>
Expand All @@ -36,20 +44,20 @@
<div class="overflow-auto" style="height: 77vh; overflow-y: scroll; scrollbar-color: #6d6d6d #2d2d2d;">
{{range .Reviews}}
<div class="row p-2 m-1 {{if eq .ID.Hex $.CurrentReview.ID.Hex}}selectreviewitem border border-warning{{else}}reviewitem{{end}} finger" name="reviewitem" id="review-{{.ID.Hex}}">
<div class="col-11 p-0" onclick="window.location.replace('/reviewstatus?searchword={{$.Searchword}}&id={{.ID.Hex}}&project={{.Project}}&itemstatus={{.ItemStatus}}')">
<div class="col-11 p-0" onclick="window.location.replace('/reviewstatus?searchword={{$.Searchword}}&id={{.ID.Hex}}&project={{.Project}}&itemstatus={{.ItemStatus}}&createtime={{ToNormalTime .Createtime}}')">
<span class="text-muted" id="{{.ID.Hex}}-project">{{.Project}}</span>
<span class="text-darkmode" id="{{.ID.Hex}}-name">{{.Name}}</span>
<span class="ms-1 badge badge-secondary" id="{{.ID.Hex}}-task">{{.Task}}</span>
<span class="ms-1 badge badge-secondary">{{.AuthorNameKor}}</span>
<span class="ms-1 badge badge-secondary rounded-0" id="{{.ID.Hex}}-task">{{.Task}}</span>
<span class="ms-1 badge badge-secondary rounded-0">{{.AuthorNameKor}}</span>
{{if gt .MainVersion 0 }} <!-- MainVersion 값이 0 이상이면 보인다.-->
<span class="ms-1 badge badge-darkmode" id="{{.ID.Hex}}-mainversion">v{{ProductionVersionFormat .MainVersion}}</span>
<span class="ms-1 badge badge-darkmode rounded-0" id="{{.ID.Hex}}-mainversion">v{{ProductionVersionFormat .MainVersion}}</span>
{{end}}
{{if gt .SubVersion 0 }} <!-- SubVersion 값이 0 이상이면 보인다.-->
<span class="ms-1 badge badge-darkmode" id="{{.ID.Hex}}-subversion">w{{ProductionVersionFormat .SubVersion}}</span>
<span class="ms-1 badge badge-darkmode rounded-0" id="{{.ID.Hex}}-subversion">w{{ProductionVersionFormat .SubVersion}}</span>
{{end}}
<span id="review-itemstatus-{{.ID.Hex}}" class="ms-1 badge badge-{{.ItemStatus}}">{{.ItemStatus}}</span>
<span id="review-itemstatus-{{.ID.Hex}}" class="ms-1 badge badge-{{.ItemStatus}} rounded-0">{{.ItemStatus}}</span>
{{if ne .ProcessStatus "done"}}
<span id="review-processstatus-{{.ID.Hex}}" class="ms-1 badge badge-danger">{{.ProcessStatus}}</span>
<span id="review-processstatus-{{.ID.Hex}}" class="ms-1 badge badge-danger rounded-0">{{.ProcessStatus}}</span>
{{end}}

</div>
Expand Down Expand Up @@ -111,37 +119,37 @@ <h5>Description</h5>
</div>
<!--comment input-->
<div style="height: 33vh">
<textarea class="form-control form-control-sm no-resize" id="review-comment" rows="3" placeholder="리뷰내용을 작성해주세요."></textarea>
<textarea class="form-control form-control-sm no-resize rounded-0" id="review-comment" rows="3" placeholder="리뷰내용을 작성해주세요."></textarea>
<div class="pt-1 row">
<div class="col-7">
<input type="text" class="form-control form-control-sm w-100" id="review-media" placeholder="첨부할 Media: {{$.Setting.Protocol}}:// or rvlink://">
<input type="text" class="form-control form-control-sm w-100 rounded-0" id="review-media" placeholder="첨부할 Media: {{$.Setting.Protocol}}:// or rvlink://">
</div>
<div class="col-5 ps-0">
<div class="form-check">
<input type="checkbox" id="review-framecomment" class="form-check-input">
<input type="checkbox" id="review-framecomment" class="form-check-input rounded-0">
<label class="form-check-label" for="review-framecomment">Frame Comment</label>
</div>
</div>

</div>
<div class="pt-1 row">
<div class="col pe-0">
<select class="form-control form-control-sm" id="current-review-itemstatus" onchange="setReviewItemStatus(this.value)">
<select class="form-control form-control-sm rounded-0" id="current-review-itemstatus" onchange="setReviewItemStatus(this.value)">
{{range .Status}}
<option value="{{.ID}}" {{if eq $.CurrentReview.ItemStatus .ID}}selected{{end}}>{{.ID}}</option>
{{end}}
</select>
</div>
<div class="col ps-0">
<span class="btn btn-sm btn-outline-warning w-100" onclick="clickReviewStatusModeCommentButton()">Comment</span>
<span class="btn btn-sm btn-outline-warning w-100 rounded-0" onclick="clickReviewStatusModeCommentButton()">Comment</span>
</div>

</div>
</div>
</div>
</div>
<div class="row ms-2 me-2">
<div class="col-12 border-darkmode text-center text-darkmode no-selection" style="height: 3.6vh;">
<div class="col-12 border-darkmode text-center text-darkmode no-selection">
<a href="/reviewdata?id={{$.CurrentReview.ID.Hex}}&ext={{$.CurrentReview.Ext}}" target="_blink" class="pe-2 text-decoration-none">
<span class="link-solid"></span>
</a>
Expand Down
11 changes: 6 additions & 5 deletions db_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,10 @@ func searchReview(session *mgo.Session, searchword string) ([]Review, error) {
continue
}
orQueries := []bson.M{}
if strings.HasPrefix(word, "daily:") {
if strings.TrimPrefix(word, "daily:") == "" {
return results, nil
if strings.HasPrefix(word, "createtime:") {
if strings.TrimPrefix(word, "createtime:") != "" {
orQueries = append(orQueries, bson.M{"createtime": &bson.RegEx{Pattern: strings.TrimPrefix(word, "createtime:")}})
}
orQueries = append(orQueries, bson.M{"createtime": &bson.RegEx{Pattern: strings.TrimPrefix(word, "daily:")}})
} else if strings.HasPrefix(word, "status:") {
orQueries = append(orQueries, bson.M{"status": &bson.RegEx{Pattern: strings.TrimPrefix(word, "status:")}})
} else if strings.HasPrefix(word, "itemstatus:") {
Expand All @@ -126,12 +125,14 @@ func searchReview(session *mgo.Session, searchword string) ([]Review, error) {
orQueries = append(orQueries, bson.M{"project": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"name": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"task": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"createtime": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"updatetime": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"author": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"path": &bson.RegEx{Pattern: word}})
orQueries = append(orQueries, bson.M{"description": &bson.RegEx{Pattern: word}})
}
if len(orQueries) == 0 {
return results, nil
}
allQueries = append(allQueries, bson.M{"$or": orQueries})
}
q := bson.M{"$and": allQueries}
Expand Down
15 changes: 12 additions & 3 deletions handler_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func handleDailyReviewStatus(w http.ResponseWriter, r *http.Request) {
}
today := time.Now().Format("2006-01-02")
// 오늘날짜를 구하고 리다이렉트한다.
http.Redirect(w, r, "/reviewstatus?searchword=daily:"+today, http.StatusSeeOther)
http.Redirect(w, r, "/reviewstatus?searchword=createtime:"+today, http.StatusSeeOther)
}

// handleReviewData 함수는 리뷰 영상데이터를 전송한다.
Expand Down Expand Up @@ -92,7 +92,9 @@ func handleReviewStatusSubmit(w http.ResponseWriter, r *http.Request) {
searchword := r.FormValue("searchword")
reviewProject := r.FormValue("reviewproject")
itemStatus := r.FormValue("itemstatus")
redirectURL := fmt.Sprintf("/reviewstatus?searchword=%s&project=%s&itemstatus=%s", searchword, reviewProject, itemStatus)
createtime := r.FormValue("review-createtime")
task := r.FormValue("review-task")
redirectURL := fmt.Sprintf("/reviewstatus?searchword=%s&project=%s&itemstatus=%s&createtime=%s&task=%s", searchword, reviewProject, itemStatus, createtime, task)
http.Redirect(w, r, redirectURL, http.StatusSeeOther)
}

Expand Down Expand Up @@ -277,12 +279,17 @@ func handleReviewStatus(w http.ResponseWriter, r *http.Request) {
TasksettingNames []string
Project string
ItemStatus string
Createtime string
Task string
Setting
}
rcp := recipe{}
rcp.Setting = CachedAdminSetting
rcp.Project = q.Get("project")
rcp.ItemStatus = q.Get("itemstatus")
rcp.Createtime = q.Get("createtime")
rcp.Task = q.Get("task")

rcp.Searchword = q.Get("searchword")
id := q.Get("id")
err = rcp.SearchOption.LoadCookie(session, r)
Expand Down Expand Up @@ -313,7 +320,9 @@ func handleReviewStatus(w http.ResponseWriter, r *http.Request) {
}
rcp.Searchword = setSearchFilter(rcp.Searchword, "project", rcp.Project)
rcp.Searchword = setSearchFilter(rcp.Searchword, "itemstatus", rcp.ItemStatus)

rcp.Searchword = setSearchFilter(rcp.Searchword, "task", rcp.Task)
rcp.Searchword = setSearchFilter(rcp.Searchword, "createtime", rcp.Createtime)

rcp.Reviews, err = searchReview(session, rcp.Searchword)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 8f7b088

Please sign in to comment.