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/alert.css" />
<link rel="stylesheet" href="/static/styles/blankslate.css" /> <link rel="stylesheet" href="/static/styles/blankslate.css" />
<link rel="stylesheet" href="/static/styles/list.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/range.css" />
<link rel="stylesheet" href="/static/styles/switch.css" /> <link rel="stylesheet" href="/static/styles/switch.css" />
<link rel="stylesheet" href="/static/styles/main.css" /> <link rel="stylesheet" href="/static/styles/main.css" />

View file

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

View file

@ -58,6 +58,7 @@
$scope.add = function(event, login) { $scope.add = function(event, login) {
$scope.error = undefined; $scope.error = undefined;
$scope.new_user = undefined;
if (event.which && event.which !== 13) { if (event.which && event.which !== 13) {
return; return;
} }
@ -67,6 +68,7 @@
$scope.users.push(payload.data); $scope.users.push(payload.data);
$scope.search_text=undefined; $scope.search_text=undefined;
$scope.waiting = false; $scope.waiting = false;
$scope.new_user = payload.data;
}).catch(function (err) { }).catch(function (err) {
$scope.error = err; $scope.error = err;
$scope.waiting = false; $scope.waiting = false;
@ -75,11 +77,21 @@
} }
$scope.toggle = function(user) { $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; user.admin = !user.admin;
users.put(user); users.put(user);
} }
$scope.remove = function(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(){ users.delete(user).then(function(){
var index = $scope.users.indexOf(user); var index = $scope.users.indexOf(user);
$scope.users.splice(index, 1); $scope.users.splice(index, 1);

View file

@ -8,7 +8,7 @@
*/ */
function gravatar() { function gravatar() {
return function(hash) { 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"; return "https://secure.gravatar.com/avatar/"+hash+"?s=48&d=mm";
} }
} }
@ -19,7 +19,7 @@
*/ */
function gravatarLarge() { function gravatarLarge() {
return function(hash) { 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"; return "https://secure.gravatar.com/avatar/"+hash+"?s=128&d=mm";
} }
} }

View file

@ -2,7 +2,7 @@
<article> <article>
<section class="search"> <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> <menu>
<button type="button" ng-click="unwatch(repo)" ng-if="repo.starred && user"> <button type="button" ng-click="unwatch(repo)" ng-if="repo.starred && user">
<i class="material-icons">visibility</i> <i class="material-icons">visibility</i>
@ -28,7 +28,7 @@
<div> <div>
<div class="list"> <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="column-status">
<div class="status {{ build.status }}"></div> <div class="status {{ build.status }}"></div>
</div> </div>

View file

@ -24,7 +24,7 @@
</div> </div>
<ul class="list cozy" ng-show="!waiting && !error"> <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"> <div class="column-avatar">
<img ng-src="https://avatars1.githubusercontent.com/u/2181346" /> <img ng-src="https://avatars1.githubusercontent.com/u/2181346" />
</div> </div>

View file

@ -16,13 +16,28 @@
<span>Press &lt;enter&gt; to add <em>{{search_text}}</em></span> <span>Press &lt;enter&gt; to add <em>{{search_text}}</em></span>
</div> </div>
<ul class="list cozy"> <div class="alert alert-success" ng-show="new_user">
<li class="row row-user" ng-repeat="user in users"> <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"> <div class="column-avatar">
<img ng-src="{{ user.gravatar_id | gravatar }}" /> <img ng-src="{{ user.gravatar_id | gravatar }}" />
</div> </div>
<div class="column-fill"> <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> </div>
</li> </li>
</ul> </ul>

View file

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

@ -342,6 +342,10 @@ li menu {
position:absolute; position:absolute;
top:15px; top:15px;
right:0px; right:0px;
display:none;
}
li:hover menu {
display:inline-block;
} }
li menu .button { li menu .button {
border-radius:50%; border-radius:50%;
@ -352,6 +356,21 @@ li menu .button {
color:#dfe1e8; color:#dfe1e8;
background: #fff; 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 { li menu .button:hover {
border:1px solid #a7adba; border:1px solid #a7adba;
@ -369,8 +388,10 @@ li menu .button.success {
color: #a3be8c; color: #a3be8c;
background:#FFF; background:#FFF;
} }
li menu .button.danger:hover { li menu .button.danger {
color: #FFF; color: #FFF;
background: #bf616a; background: #bf616a;
@ -379,6 +400,8 @@ li menu .button.danger:hover {
border:1px solid #bf616a; border:1px solid #bf616a;
} }
/* /*
* Tail button to follow a build * Tail button to follow a build
*/ */