Skip to content

Commit

Permalink
auto save when repo form data is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed May 27, 2015
1 parent eede3b1 commit d36af9f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cmd/drone-server/static/scripts/views/repos_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ <h2>Hooks</h2>
<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>
Expand All @@ -47,14 +47,14 @@ <h2>Advanced</h2>
<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>
Expand Down
9 changes: 8 additions & 1 deletion cmd/drone-server/static/styles/drone.css
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1618,7 +1620,7 @@ article {
*/

.slider-label {
display:none;
display:inline-block;
margin-left:10px;
}
input[type="range"]:focus ~ .slider-label {
Expand All @@ -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;
}
Expand All @@ -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%;
Expand All @@ -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;
}
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d36af9f

Please sign in to comment.