-
Notifications
You must be signed in to change notification settings - Fork 889
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
292 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,77 @@ | ||
$('.admin-nav a').click(function (e) { | ||
e.preventDefault(); | ||
$(this).tab('show'); | ||
}); | ||
function syncHash() { | ||
var url = document.location.toString(); | ||
if (url.match('#')) { | ||
$('.admin-nav a[href=#'+url.split('#')[1]+']').tab('show') ; | ||
} | ||
} | ||
|
||
var url = document.location.toString(); | ||
if (url.match('#')) { | ||
$('.admin-nav a[href=#'+url.split('#')[1]+']').tab('show') ; | ||
function appendModal(html, id) { | ||
$('body').append(html); | ||
var modal_ele = $('#' + id); | ||
modal_ele.append(html); | ||
modal_ele.modal(); | ||
$( "body" ).delegate( "#" + id, "hidden.bs.modal", function () { | ||
modal_ele.remove(); | ||
}); | ||
} | ||
|
||
$(function () { | ||
var modal_source = $("#modal-template").html(); | ||
var modal_template = Handlebars.compile(modal_source); | ||
|
||
$('.admin-nav a').click(function (e) { | ||
e.preventDefault(); | ||
$(this).tab('show'); | ||
}); | ||
syncHash(); | ||
|
||
$(window).on('hashchange',function(){ | ||
syncHash(); | ||
}); | ||
|
||
$('.activate-api-modal').click(function () { | ||
var te = $(this); | ||
var username = te.data('username'); | ||
var api_key = te.data('api-key'); | ||
var api_active = te.data('api-active'); | ||
var api_quota = te.data('api-quota'); | ||
|
||
var markup = ` | ||
<div> | ||
<p> | ||
<span>API Active</span>: | ||
{{#if api_active}} | ||
True | ||
{{else}} | ||
False | ||
{{/if}} | ||
- <a href='#' class='btn btn-xs btn-success'>Active (click to toggle)</a> | ||
</p> | ||
<p> | ||
<span>API Key: <code>{{api_key}}</code></span> | ||
</p> | ||
<p> | ||
<span>API Quota: <code>{{api_quota}}</code></span> | ||
</p> | ||
</div> | ||
`; | ||
var modal_id = "api-modal-" + username; | ||
var modal_context = { | ||
id: modal_id, | ||
api_key: api_key, | ||
api_active: api_active, | ||
api_quota: api_quota, | ||
title: "API Information for " + username, | ||
body: markup | ||
}; | ||
var mt_html = modal_template(modal_context); | ||
var compiled_mt = Handlebars.compile(mt_html); | ||
mt_html = compiled_mt(modal_context); | ||
appendModal(mt_html, modal_id); | ||
}); | ||
|
||
$('.activate-edit-modal').click(function () { | ||
// activate modal | ||
}); | ||
|
||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
Polr, a minimalist URL shortening platform. | ||
Copyright (C) 2013-2015 Chaoyi Zha | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Polr @yield('title')</title> | ||
@yield('css') | ||
</head> | ||
<body> | ||
<div class='container'> | ||
@yield('content') | ||
</div> | ||
@yield('js') | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@extends('layouts.minimal') | ||
|
||
@section('title') | ||
Setup | ||
@endsection | ||
|
||
@section('css') | ||
<link rel='stylesheet' href='/css/default-bootstrap.min.css' /> | ||
@endsection | ||
|
||
@section('content') | ||
<img src='/img/logo.png' /> | ||
<h1>Setup</h1> | ||
|
||
|
||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script id="modal-template" type="text/x-handlebars-template"> | ||
|
||
<div class="modal fade" id="@{{id}}" tabindex="-1" role="dialog"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
<h4 class="modal-title">@{{title}}</h4> | ||
</div> | ||
<div class="modal-body"> | ||
@{{{body}}} | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | ||
<!-- <button type="button" class="btn btn-primary">Save changes</button> --> | ||
</div> | ||
</div> <!-- /.modal-content --> | ||
</div> <!-- /.modal-dialog --> | ||
</div> <!-- /.modal --> | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<table class="table table-hover"> | ||
<tr> | ||
<th>Username</th> | ||
<th>Email</th> | ||
<th>Created At</th> | ||
<th>Activated</th> | ||
<th>API</th> | ||
<th>More</th> | ||
</tr> | ||
@foreach ($users as $user) | ||
<tr> | ||
<td>{{$user->username}}</td> | ||
<td>{{$user->email}}</td> | ||
<td>{{$user->created_at}}</td> | ||
<td>{{$user->active}}</td> | ||
{{-- <td>Active: {{$user->api_active}}</td> --}} | ||
<td> | ||
<a href='#' | ||
class='activate-api-modal btn btn-sm btn-info' | ||
|
||
data-api-active='{{$user->api_active}}' | ||
data-api-key='{{$user->api_key}}' | ||
data-api-quota='{{$user->api_quota}}' | ||
data-username='{{$user->username}}'> | ||
API info | ||
</a> | ||
</td> | ||
|
||
<td> | ||
<a href='#' | ||
class='activate-edit-modal btn btn-sm btn-success' | ||
|
||
data-username='{{$user->username}}'> | ||
Edit | ||
</a> | ||
</td> | ||
|
||
</tr> | ||
@endforeach | ||
</table> |