more styling

This commit is contained in:
Brad Rydzewski 2015-07-29 23:45:06 -07:00
parent 647831bc85
commit 18d7f7b241
11 changed files with 87 additions and 10 deletions

View file

@ -8,6 +8,7 @@
<link rel="stylesheet" href="/static/styles/alert.css" />
<link rel="stylesheet" href="/static/styles/blankslate.css" />
<link rel="stylesheet" href="/static/styles/list.css" />
<link rel="stylesheet" href="/static/styles/label.css" />
<link rel="stylesheet" href="/static/styles/range.css" />
<link rel="stylesheet" href="/static/styles/switch.css" />
<link rel="stylesheet" href="/static/styles/main.css" />

View file

@ -9,6 +9,8 @@
var name = $stateParams.name;
var fullName = owner + '/' + name;
$scope.loading=true;
// Gets the currently authenticated user
users.getCached().then(function (payload) {
$scope.user = payload.data;
@ -17,6 +19,7 @@
// Gets a repository
repos.get(fullName).then(function (payload) {
$scope.repo = payload.data;
$scope.loading=false;
}).catch(function (err) {
$scope.error = err;
});

View file

@ -58,6 +58,7 @@
$scope.add = function(event, login) {
$scope.error = undefined;
$scope.new_user = undefined;
if (event.which && event.which !== 13) {
return;
}
@ -67,6 +68,7 @@
$scope.users.push(payload.data);
$scope.search_text=undefined;
$scope.waiting = false;
$scope.new_user = payload.data;
}).catch(function (err) {
$scope.error = err;
$scope.waiting = false;
@ -75,11 +77,21 @@
}
$scope.toggle = function(user) {
if (user.login === $scope.user.login) {
// cannot revoke admin privilege for self
$scope.error = {}; // todo display an actual error here
return;
}
user.admin = !user.admin;
users.put(user);
}
$scope.remove = function(user) {
if (user.login === $scope.user.login) {
// cannot delete self
$scope.error = {}; // todo display an actual error here
return;
}
users.delete(user).then(function(){
var index = $scope.users.indexOf(user);
$scope.users.splice(index, 1);

View file

@ -8,7 +8,7 @@
*/
function gravatar() {
return function(hash) {
if (hash === undefined) { return ""; }
if (!hash) { return "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y"; }
return "https://secure.gravatar.com/avatar/"+hash+"?s=48&d=mm";
}
}
@ -19,7 +19,7 @@
*/
function gravatarLarge() {
return function(hash) {
if (hash === undefined) { return ""; }
if (!hash) { return "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y"; }
return "https://secure.gravatar.com/avatar/"+hash+"?s=128&d=mm";
}
}

View file

@ -2,7 +2,7 @@
<article>
<section class="search">
<input type="search" spellcheck="false" placeholder="Filter commits for {{ repo.full_name}}" />
<input type="search" spellcheck="false" placeholder="Filter commits for {{ repo.full_name}}" spellcheck="false" ng-model="search_text"/>
<menu>
<button type="button" ng-click="unwatch(repo)" ng-if="repo.starred && user">
<i class="material-icons">visibility</i>
@ -28,7 +28,7 @@
<div>
<div class="list">
<a ng-repeat="build in builds | orderBy:'-number'" ng-href="/{{ repo.full_name }}/{{ build.number}}">
<a ng-repeat="build in builds | orderBy:'-number' | filter: search_text" ng-href="/{{ repo.full_name }}/{{ build.number}}">
<div class="column-status">
<div class="status {{ build.status }}"></div>
</div>

View file

@ -24,7 +24,7 @@
</div>
<ul class="list cozy" ng-show="!waiting && !error">
<a class="row row-repo" ng-repeat="repo in repos" ng-href="/{{ repo.full_name }}">
<a class="row row-repo" ng-repeat="repo in repos | filter: search_text" ng-href="/{{ repo.full_name }}">
<div class="column-avatar">
<img ng-src="https://avatars1.githubusercontent.com/u/2181346" />
</div>

View file

@ -16,13 +16,28 @@
<span>Press &lt;enter&gt; to add <em>{{search_text}}</em></span>
</div>
<ul class="list cozy">
<li class="row row-user" ng-repeat="user in users">
<div class="alert alert-success" ng-show="new_user">
<span>Successfully added user account <em>{{new_user.login}}</em>.</span>
</div>
<div class="alert alert-error" ng-show="!!error">
<i class="material-icons">error_outline</i>
<span>There was an error adding the user account.</span>
</div>
<ul class="list cozy user-list">
<li class="row row-user" ng-repeat="user in users | filter: search_text">
<div class="column-avatar">
<img ng-src="{{ user.gravatar_id | gravatar }}" />
</div>
<div class="column-fill">
<h2>{{ user.login }}</h2>
<h2>{{ user.login }} <small ng-if="user.admin" class="label label-success">Admin</small></h2>
<menu>
<button ng-click="toggle(user)" ng-if="!user.admin" class="button success">Grant Admin</button>
<button ng-click="toggle(user)" ng-if="user.admin" class="button danger">Revoke Admin</button>
<button ng-click="remove(user)" class="button danger">Delete</button>
</menu>
</div>
</li>
</ul>

View file

@ -24,6 +24,11 @@
color: #fff;
line-height:24px;
}
.alert-success {
background: #a3be8c;
color: #fff;
line-height:24px;
}
.alert-create-not-found {
color: rgba(255,255,255,0.95);
background:#59abe3;
@ -33,6 +38,7 @@
width:100%;
font-family: Roboto;
}
.alert-success em,
.alert-error em,
.alert-create-not-found em {
font-weight: bold;

View file

@ -0,0 +1,17 @@
.label {
color: #FFF;
background:#8fa1b3;
font-size: 10px;
text-transform: uppercase;
padding: 4px 8px;
vertical-align: middle;
border-radius: 2px;
margin-left: 15px;
}
.label-success {
background: #a3be8c;
}
.label-failure {
background: #bf616a;
}

View file

@ -68,4 +68,4 @@
.list em,
.list em {
color:#65737e;
}
}

View file

@ -342,6 +342,10 @@ li menu {
position:absolute;
top:15px;
right:0px;
display:none;
}
li:hover menu {
display:inline-block;
}
li menu .button {
border-radius:50%;
@ -352,6 +356,21 @@ li menu .button {
color:#dfe1e8;
background: #fff;
border:1px solid #FFF;
outline:none;
cursor:pointer;
width: auto;
text-transform: uppercase;
padding: 0px 10px;
border-radius: 2px;
font-size: 11px;
line-height: 30px;
height: auto;
margin-left: 10px;
}
li menu .button:hover {
border:1px solid #a7adba;
@ -369,8 +388,10 @@ li menu .button.success {
color: #a3be8c;
background:#FFF;
}
li menu .button.danger:hover {
li menu .button.danger {
color: #FFF;
background: #bf616a;
@ -379,6 +400,8 @@ li menu .button.danger:hover {
border:1px solid #bf616a;
}
/*
* Tail button to follow a build
*/