auto save when repo form data is changed

This commit is contained in:
Brad Rydzewski 2015-05-26 23:25:47 -07:00
parent eede3b1613
commit d36af9f646
3 changed files with 14 additions and 7 deletions

View file

@ -29,14 +29,14 @@
<div class="row">
<div>Post Commit Hooks</div>
<div>
<input id="post_commits" type="checkbox" hidden="hidden" ng-model="repo.post_commits" />
<input id="post_commits" type="checkbox" hidden="hidden" ng-model="repo.post_commits" ng-change="save(repo)" />
<label for="post_commits" class="switch"></label>
</div>
</div>
<div class="row">
<div>Pull Request Hooks</div>
<div>
<input id="pull_requests" type="checkbox" hidden="hidden" ng-model="repo.pull_requests" />
<input id="pull_requests" type="checkbox" hidden="hidden" ng-model="repo.pull_requests" ng-change="save(repo)" />
<label for="pull_requests" class="switch"></label>
</div>
</div>
@ -47,14 +47,14 @@
<div class="row">
<div>Trusted (Evelvate Privilege)</div>
<div>
<input id="trusted" type="checkbox" hidden="hidden" ng-model="repo.trusted" />
<input id="trusted" type="checkbox" hidden="hidden" ng-model="repo.trusted" ng-change="save(repo)" />
<label for="trusted" class="switch"></label>
</div>
</div>
<div class="row">
<div>Timeout in minutes</div>
<div>
<input type="range" ng-model="repo.timeout" min="0" max="900" />
<input type="range" ng-model="repo.timeout" min="0" max="900" ng-blur="save(repo)" />
<span class="slider-label">{{ repo.timeout }} minutes</span>
</div>
</div>

View file

@ -1560,10 +1560,12 @@ http://codepen.io/batazor/pen/KwKryj
}
input:checked + .switch {
background: rgba(0,150,136,0.5);
background: rgba(102, 187, 106, 0.5);
}
input:checked + .switch::before {
left: 26.562499999999996px;
background: #009688;
background: #66bb6a;
}
input:checked + .switch:active::before {
box-shadow: 0 2px 10.416666666666668px rgba(0,0,0,0.28), 0 0 0 25px rgba(0,150,136,0.2);
@ -1618,7 +1620,7 @@ article {
*/
.slider-label {
display:none;
display:inline-block;
margin-left:10px;
}
input[type="range"]:focus ~ .slider-label {
@ -1641,6 +1643,7 @@ input[type=range]::-webkit-slider-runnable-track {
animate: 0.2s;
box-shadow: none;
background: rgba(0,150,136,0.5);
background: rgba(102, 187, 106, 0.5);
border-radius: 5px;
border: none;
}
@ -1651,12 +1654,14 @@ input[type=range]::-webkit-slider-thumb {
width: 26px;
border-radius: 50px;
background: #009688;
background: #66bb6a;
cursor: pointer;
-webkit-appearance: none;
margin-top: -10px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: rgba(0,150,136,0.5);
background: rgba(102, 187, 106, 0.5);
}
input[type=range]::-moz-range-track {
width: 100%;
@ -1665,6 +1670,7 @@ input[type=range]::-moz-range-track {
animate: 0.2s;
box-shadow: none;
background: rgba(0,150,136,0.5);
background: rgba(102, 187, 106, 0.5);
border-radius: 5px;
border: none;
}
@ -1675,6 +1681,7 @@ input[type=range]::-moz-range-thumb {
width: 26px;
border-radius: 50px;
background: #009688;
background: #66bb6a;
cursor: pointer;
}
input[type=range]::-ms-track {

View file

@ -33,7 +33,7 @@ type repoResp struct {
type repoReq struct {
PostCommit *bool `json:"post_commits"`
PullRequest *bool `json:"pull_requests"`
Trusted *bool `json:"privileged"`
Trusted *bool `json:"trusted"`
Timeout *int64 `json:"timeout"`
// optional private parameters can only be
@ -98,7 +98,7 @@ func PutRepo(c *gin.Context) {
}
if in.PostCommit != nil {
repo.PullRequest = *in.PullRequest
repo.PostCommit = *in.PostCommit
}
if in.PullRequest != nil {
repo.PullRequest = *in.PullRequest