Little refactoring of all assets. JS code better identing.

This commit is contained in:
Alexander Simonov 2015-07-12 22:32:46 +03:00
parent 78a30c8d59
commit 229e88a438
No known key found for this signature in database
GPG key ID: 5CCFFED829314C35
12 changed files with 2112 additions and 2064 deletions

View file

@ -32,13 +32,13 @@
repos.watch(repo.full_name).then(function (payload) {
$scope.repo.starred = true;
});
}
};
$scope.unwatch = function (repo) {
repos.unwatch(repo.full_name).then(function () {
$scope.repo.starred = false;
});
}
};
repos.subscribe(fullName, function (event) {
var added = false;
@ -132,7 +132,7 @@
$window.scrollTo(0, $window.document.body.scrollHeight);
}
});
}
};
// Gets the currently authenticated user
users.getCached().then(function (payload) {

View file

@ -69,7 +69,7 @@
}).catch(function (err) {
$scope.error = err;
});
}
};
$scope.delete = function (repo) {
repos.delete(repo).then(function (payload) {
@ -77,15 +77,15 @@
}).catch(function (err) {
$scope.error = err;
});
}
};
$scope.param={}
$scope.param = {};
$scope.addParam = function (param) {
if (!$scope.repo.params) {
$scope.repo.params = {}
}
$scope.repo.params[param.key] = param.value;
$scope.param={}
$scope.param = {};
// auto-update
repos.update($scope.repo).then(function (payload) {
@ -93,7 +93,7 @@
}).catch(function (err) {
$scope.error = err;
});
}
};
$scope.deleteParam = function (key) {
delete $scope.repo.params[key];

View file

@ -46,7 +46,7 @@
user: function (users) {
return users.getCached();
}
}
};
$stateProvider
.state('app', {
@ -57,12 +57,10 @@
controller: function ($scope, $routeParams, repos, users) {
users.getCached().then(function (payload) {
$scope.user = payload.data;
console.log(repos.list());
});
}
}
},
resolve: resolveUser
}
})
.state('app.index', {
url: '/',
@ -136,11 +134,18 @@
.state('app.repo_edit', {
url: '/:owner/:name/edit',
views: {
'toolbar': { templateUrl: '/static/scripts/views/repos/toolbar.html' },
'content': { templateUrl: '/static/scripts/views/repos/edit.html' }
},
'toolbar': {
templateUrl: '/static/scripts/views/repos/toolbar.html',
controller: 'RepoEditCtrl',
resolve: resolveUser
},
'content': {
templateUrl: '/static/scripts/views/repos/edit.html',
controller: 'RepoEditCtrl',
resolve: resolveUser
}
},
title: 'Edit Repository'
})
.state('app.repo.env', {
url: '/:owner/:name/edit/env',
@ -177,10 +182,10 @@
},
controller: 'BuildOutCtrl',
resolve: resolveUser
})
});
// Enables html5 mode
$locationProvider.html5Mode(true)
$locationProvider.html5Mode(true);
// Appends the Bearer token to authorize every
// outbound http request.
@ -204,14 +209,13 @@
});
}
function RouteChange($rootScope, repos, logs) {
$rootScope.$on('$stateChangeStart', function () {
repos.unsubscribe();
logs.unsubscribe();
// repos.unsubscribe();
// logs.unsubscribe();
});
$rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
$rootScope.$on('$stateChangeSuccess', function (event, current) {
if (current.title) {
document.title = current.title + ' · drone';
}

View file

@ -9,6 +9,7 @@
width: 100%;
height: 100%;
}
a.box {
background: #FFF;
width: 250px;
@ -20,15 +21,18 @@
text-decoration: none;
border-radius: 3px;
}
a.box:hover {
box-shadow: 7px 7px 0 rgba(255, 255, 255, 0.05);
}
div.logo {
background: url(/static/images/logo.svg) no-repeat center center;;
background: url(/static/images/logo.svg) no-repeat center center;
background-size: 72px;
height: 150px;
-webkit-transition: all .5s;
}
div.login {
text-align: center;
padding: 15px;
@ -40,6 +44,7 @@
background: #424242;
color: rgba(255, 255, 255, 0.7);
}
body > div {
width: 100%;
height: 100%;
@ -61,7 +66,9 @@
<div ng-switch-when="internal_error">Oops. There was an unexpected error. Please try again.</div>
<div ng-switch-when="user_not_found">There was an error authorizing your account.</div>
<div ng-switch-when="access_denied_org">Login is restricted to approved organization members only</div>
<div ng-switch-when="access_denied">Self-registration is disabled. Please contact the system admin to grant access.</div>
<div ng-switch-when="access_denied">Self-registration is disabled. Please contact the system admin to grant
access.
</div>
</div>
<div class="login">Login</div>
</a>

View file

@ -1,6 +1,7 @@
<article>
<section>
<h2>Settings</h2>
<div class="row">
<div>Post Commit Hooks</div>
<div>
@ -11,7 +12,8 @@
<div class="row">
<div>Pull Request Hooks</div>
<div>
<input id="pull_requests" type="checkbox" hidden="hidden" ng-model="repo.hooks.pull_request" ng-change="save(repo)" />
<input id="pull_requests" type="checkbox" hidden="hidden" ng-model="repo.hooks.pull_request"
ng-change="save(repo)"/>
<label for="pull_requests" class="switch"></label>
</div>
</div>
@ -29,6 +31,7 @@
<section ng-if="user.admin">
<h2>Admin settings</h2>
<div class="row">
<div>Trusted (Evelvate Privilege)</div>
<div>
@ -47,6 +50,7 @@
<section>
<h2>Badges</h2>
<div class="row">
<div>Markdown</div>
<div>
@ -63,6 +67,7 @@
<section>
<h2>Public Key</h2>
<div>
<pre class="snippet snippet-padding">{{ repo.keypair.public }}</pre>
</div>

View file

@ -1,5 +1,7 @@
<div class="breadcrumb" style="position:relative;top:0px;">
<a href="/{{ repo.full_name }}/edit" class="icon icon-home"></a>
<div class="breadcrumb">
<a href="/{{ repo.full_name }}/edit" class="icon icon-home">
<i class="material-icons md-18">home</i>
</a>
<a ng-href="/{{ repo.full_name }}">{{ repo.owner }} / {{ repo.name }}</a>
</div>

View file

@ -2,8 +2,12 @@
<section>
<form style="padding:30px">
<input type="text" ng-model="login" placeholder="i.e. octocat" style="font-size:14px;padding:10px 20px;width:400px;border: 1px solid #d9d9d9;outline:none;"/>
<button ng-click="add(login)" style="display: inline-block;background:#EEE;font-size:14px; padding:0px 20px;text-transform:uppercase;cursor:pointer;color:#616161;height:39px;line-height:41px;margin-left:10px;">Add User</button>
<input type="text" ng-model="login" placeholder="i.e. octocat"
style="font-size:14px;padding:10px 20px;width:400px;border: 1px solid #d9d9d9;outline:none;"/>
<button ng-click="add(login)"
style="display: inline-block;background:#EEE;font-size:14px; padding:0px 20px;text-transform:uppercase;cursor:pointer;color:#616161;height:39px;line-height:41px;margin-left:10px;">
Add User
</button>
</form>
</section>
@ -14,7 +18,9 @@
<img ng-src="{{ user.gravatar_id | gravatar }}"/>
</div>
<div>
<h3>{{ user.login }} <small ng-if="user.admin">Admin</small></h3>
<h3>{{ user.login }}
<small ng-if="user.admin">Admin</small>
</h3>
<p>{{ user.email }}</p>
<button ng-click="toggle(user)" ng-class="{'btn-admin':true, 'btn-checked': user.admin}">
<i class="material-icons md-18">account_circle</i>

View file

@ -3,11 +3,34 @@
/* RESETS */
html, body { margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, button, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; font-weight: normal; font-style: normal; font-size: 100%; line-height: 1; font-family: inherit; }
table { border-collapse: collapse; border-spacing: 0; }
ol, ul { list-style: none; }
q:before, q:after, blockquote:before, blockquote:after { content: ""; }
html, body {
margin: 0;
padding: 0;
}
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, cite, code, del, dfn, em, img, q, s, samp, small, strike, strong, sub, sup, tt, var, dd, dl, dt, li, ol, ul, fieldset, form, label, legend, button, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
font-weight: normal;
font-style: normal;
font-size: 100%;
line-height: 1;
font-family: inherit;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
ol, ul {
list-style: none;
}
q:before, q:after, blockquote:before, blockquote:after {
content: "";
}
* {
-webkit-box-sizing: border-box;
@ -15,7 +38,6 @@
box-sizing: border-box;
}
/* TRANSITIONS & ANIMATIONS */
.transition-fade {
@ -34,7 +56,6 @@
transition: all 0s ease-in;
}
/* FLEXBOX */
.flex-parent {
@ -63,7 +84,6 @@
flex: 1 1 auto;
}
/* TABLE MAGIC */
table {
@ -135,16 +155,6 @@
position: relative;
}
.status:before {
cursor: pointer;
width: 20px;
height: 20px;
color: #fff;
font-size: 14px;
font-family: "Material-Design-Iconic-Font";
opacity: 1;
}
.status.success:before {
font-size: 20px;
content: '\f084';
@ -160,7 +170,6 @@
opacity: 0.85;
}
/* CARD STUFF */
ul.cardset {
@ -262,7 +271,6 @@
color: #26A65B
}
.card.killed .time-ran,
.card.error .time-ran,
.card.failure .time-ran {
@ -335,7 +343,6 @@
color: #8a8a8a;
}
/* LIST */
.cardset.list {
@ -501,7 +508,6 @@
padding-left: 0;
}
.dummy .card {
background-color: rgba(255, 255, 255, 0.05);
box-shadow: none;
@ -689,8 +695,6 @@
}
.show section:first-of-type {
margin-top: 0px;
}
@ -724,6 +728,7 @@
margin-left: auto;
margin-right: auto;
}
/*
header {
height: 64px;
@ -773,7 +778,6 @@
margin-right: 10px;
}
.nav-item:hover {
opacity: 1;
}
@ -915,10 +919,21 @@
}
*/
.material-icons.md-18 { font-size: 18px; }
.material-icons.md-24 { font-size: 24px; }
.material-icons.md-36 { font-size: 36px; }
.material-icons.md-48 { font-size: 48px; }
.material-icons.md-18 {
font-size: 18px;
}
.material-icons.md-24 {
font-size: 24px;
}
.material-icons.md-36 {
font-size: 36px;
}
.material-icons.md-48 {
font-size: 48px;
}
.menu-item {
margin-right: 0;
@ -986,6 +1001,7 @@
top: 0px;
right: 25px;
}
/*
.breadcrumb {
padding: 0;
@ -1118,9 +1134,6 @@
}
*/
/* INFO PANE */
.banner {
@ -1159,12 +1172,15 @@
body {
background: #f5f5f5;
}
header {
background: #FFF;
}
header[show-nav] {
display: none;
}
section.central-container {
margin-top: 50px;
}
@ -1195,16 +1211,17 @@ header .logo {
position: sticky;
top: 0px;
z-index: 1;
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
box-shadow: none;
}
.toolbar .breadcrumb {
max-width: 900px;
margin: 0px auto;
line-height: 56px;
height: 56px;
}
.breadcrumb a {
color: #FFF;
font-size: 20px;
@ -1213,26 +1230,21 @@ header .logo {
text-decoration: none;
display: inline-block;
}
.breadcrumb span {
color: rgba(255, 255, 255, 0.749);
line-height: 56px;
height: 56px;
}
.breadcrumb span:before {
font-family: "Material-Design-Iconic-Font";
color: rgba(255,255,255,0.749);
line-height:56px;
content: "\f29c";
}
.breadcrumb a.icon-home {
position: absolute;
left: -50px;
}
.breadcrumb a.icon-home i {
/* line-height:56px; */
line-height:56px;
color: rgba(255, 255, 255, 0.749);
/* font-size:24px; */
vertical-align: middle;
}
@ -1242,7 +1254,6 @@ header .logo {
top: 0px;
}
pre.success {
border-left: 10px solid #81C784;
background: #424242;
@ -1255,7 +1266,6 @@ pre.failure {
background: #424242;
}
article > pre {
font-family: "Droid Sans Mono", "Roboto", "Arial";
font-size: 13px;
@ -1269,7 +1279,6 @@ article > pre {
border-radius: 2px;
}
article {
padding: 0px 20px;
max-width: 900px;
@ -1311,16 +1320,6 @@ section a.row:hover {
background: #FAFAFA;
}
section a.row:after {
content: "\f29c";
font-family: Material-Design-Iconic-Font;
line-height: 74px;
font-size: 26px;
color: rgb(204, 204, 204);
position: absolute;
right: 25px;
}
section .row > div:first-child {
padding: 30px 0px;
border-bottom: 1px solid #EEE;
@ -1368,6 +1367,7 @@ section .build-row .build-num.success:after {
font-size: 16px;
content: '\f084';
}
section .build-row .build-num.killed:after,
section .build-row .build-num.error:after,
section .build-row .build-num.failure:after {
@ -1382,10 +1382,10 @@ section .build-row .build-num.failure:after {
content: "\f082";
}
section .build-row > div:last-child {
padding-left: 0px;
}
section a.build-row:after {
content: "";
-line-height: 115px;
@ -1399,6 +1399,7 @@ section a.build-row:after {
.success {
background: #66BB6A;
}
.error,
.killed,
.failure {
@ -1428,6 +1429,7 @@ section .icon {
height: 36px;
line-height: 36px;
}
section .icon-repo:after {
font-size: 18px;
content: '\f001';
@ -1457,6 +1459,7 @@ section .build-row.sub-build-row > div {
padding-top: 20px;
padding-bottom: 20px;
}
section .build-row.sub-build-row h3 {
color: #212121;
font-size: 13px;
@ -1468,6 +1471,7 @@ section .build-row.sub-build-row h3 {
section .build-row.sub-build-row h3 > div {
margin-bottom: 7px;
}
section .build-row.sub-build-row h3 > div:last-child {
margin-bottom: 0px;
}
@ -1491,6 +1495,7 @@ section > .search a {
text-transform: uppercase;
font-size: 14px;
}
section > .search a:hover {
background: #00ACC1;
}
@ -1504,7 +1509,6 @@ pre.snippet {
font-family: "Droid Sans Mono", "Roboto", "Arial";
}
pre.snippet-padding {
padding: 30px;
}
@ -1540,20 +1544,20 @@ textarea:focus, input:focus{
}
@media (max-width: 990px) {
.breadcrumb {
padding-left: 20px;
}
.breadcrumb a.icon-home {
position: static;
padding-right: 20px;
padding-left:20px;
}
article {
padding-top: 0px;
margin-top: -5px;
}
}
/*
http://codepen.io/batazor/pen/KwKryj
*/
@ -1570,6 +1574,7 @@ http://codepen.io/batazor/pen/KwKryj
vertical-align: middle;
cursor: pointer;
}
.switch::before {
content: '';
position: absolute;
@ -1582,9 +1587,11 @@ http://codepen.io/batazor/pen/KwKryj
-webkit-transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch:active::before {
box-shadow: 0 2px 10.416666666666668px rgba(0, 0, 0, 0.28), 0 0 0 25px rgba(0, 0, 0, 0.1);
}
input {
font-size: 14px;
padding: 10px 20px;
@ -1597,11 +1604,13 @@ 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);
}
@ -1615,6 +1624,7 @@ input:checked + .switch:active::before {
.row.row-user div:last-child {
position: relative;
}
.row-user img {
background: #E0E0E0;
border-radius: 50%;
@ -1622,6 +1632,7 @@ input:checked + .switch:active::before {
height: 36px;
border: none;
}
.row-user h3 {
white-space: nowrap;
color: #212121;
@ -1629,6 +1640,7 @@ input:checked + .switch:active::before {
margin-bottom: 10px;
margin-top: 4px;
}
.row-user small {
background: #4CAF50;
color: #FFF;
@ -1649,10 +1661,12 @@ input:checked + .switch:active::before {
font-family: 'Droid Sans Mono', 'Roboto', 'Arial';
font-size: 14px;
}
.row-env span {
color: #2196F3;
display: inline-block;
}
.row-env div {
display: inline-block;
}
@ -1671,11 +1685,11 @@ input:checked + .switch:active::before {
vertical-align: middle;
}
.btn-remove:hover {
background: #EF5350;
color: #FFF;
}
.btn-admin.btn-checked,
.btn-admin:hover {
background: #4CAF50;
@ -1687,11 +1701,13 @@ input:checked + .switch:active::before {
right: 0px;
top: 12px;
}
.row-user .btn-remove {
position: absolute;
right: 0px;
top: 40px;
}
.row-user .btn-admin {
position: absolute;
right: 40px;
@ -1702,19 +1718,21 @@ input:checked + .switch:active::before {
display: inline-block;
margin-left: 10px;
}
input[type="range"]:focus ~ .slider-label {
display: inline-block;
}
input[type=range] {
-webkit-appearance: none;
margin: 6px 0;
width: 200px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 8px;
@ -1726,6 +1744,7 @@ input[type=range]::-webkit-slider-runnable-track {
border-radius: 5px;
border: none;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: none;
border: none;
@ -1738,10 +1757,12 @@ input[type=range]::-webkit-slider-thumb {
-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%;
height: 8px;
@ -1753,6 +1774,7 @@ input[type=range]::-moz-range-track {
border-radius: 5px;
border: none;
}
input[type=range]::-moz-range-thumb {
box-shadow: none;
border: none;
@ -1763,6 +1785,7 @@ input[type=range]::-moz-range-thumb {
background: #66bb6a;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 8.4px;
@ -1773,18 +1796,21 @@ input[type=range]::-ms-track {
border-width: 16px 0;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #2a6495;
border: 0.2px solid #010101;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-fill-upper {
background: #3071a9;
border: 0.2px solid #010101;
border-radius: 2.6px;
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
}
input[type=range]::-ms-thumb {
box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;
border: 1px solid #000000;
@ -1794,17 +1820,15 @@ input[type=range]::-ms-thumb {
background: #ffffff;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: #3071a9;
}
input[type=range]:focus::-ms-fill-upper {
background: #367ebd;
}
/*
header {
background:transparent;