Skip to content

Commit 5efc7c6

Browse files
feat(hackathon): Add Aviary API, still buggy
1 parent 6109ed7 commit 5efc7c6

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
use App\Http\Requests;
8+
use App\Http\Controllers\Controller;
9+
10+
class AviaryController extends Controller
11+
{
12+
/**
13+
* Return all data to the Aviary API dashboard
14+
* @return mixed
15+
*/
16+
public function getPage()
17+
{
18+
return view('api.aviary');
19+
}
20+
}

app/Http/routes.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@
109109
'middleware' => ['auth']
110110
]);
111111

112+
Route::get('/api/aviary', [
113+
'uses' => 'AviaryController@getPage',
114+
'as' => 'api.aviary',
115+
'middleware' => ['auth']
116+
]);
117+
112118
Route::post('/tweet/new', [
113119
'uses' => 'TwitterController@sendTweet',
114120
'as' => 'tweet.new',

resources/views/api/aviary.blade.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
@extends('layouts.master')
2+
3+
@section('content')
4+
<div class="main-container">
5+
@include('layouts.partials.alerts')
6+
7+
<div class="page-header">
8+
<h2><i class="fa fa-picture-o"></i> Aviary API</h2>
9+
</div>
10+
11+
<div class="btn-group btn-group-justified">
12+
<a href="http://developers.aviary.com/docs/web/setup-guide#constructor" target="_blank" class="btn btn-primary">
13+
<i class="fa fa-check-square-o"></i> API Overview
14+
</a>
15+
<a href="http://developers.aviary.com/docs/web/setup-guide#saving" target="_blank" class="btn btn-primary">
16+
<i class="fa fa-save"></i> Saving Images
17+
</a>
18+
<a href="http://developers.aviary.com/docs/web/setup-guide#styling" target="_blank" class="btn btn-primary">
19+
<i class="fa fa-flask"></i> CSS Styling
20+
</a>
21+
</div>
22+
23+
<br>
24+
25+
<p>
26+
<button onclick="return launchEditor(&quot;myimage&quot;, &quot;https://31.media.tumblr.com/d4411b4c0b41d9c7a73fbcdb1054cb5c/tumblr_n3fyfbZVud1tsaz7eo1_500.jpg&quot;);" class="btn btn-success"><i class="fa fa-magic"></i>Edit Photo
27+
</button>
28+
</p>
29+
30+
<img id="myimage" src="https://31.media.tumblr.com/d4411b4c0b41d9c7a73fbcdb1054cb5c/tumblr_n3fyfbZVud1tsaz7eo1_500.jpg" width="250">
31+
32+
</div>
33+
<script src="http://feather.aviary.com/js/feather.js"></script>
34+
<script>var featherEditor = new Aviary.Feather({
35+
apiKey: 'your-api-key',
36+
apiVersion: 3,
37+
theme: 'dark',
38+
tools: 'all',
39+
appendTo: '',
40+
onSave: function(imageID, newURL) {
41+
var img = document.getElementById(imageID);
42+
img.src = newURL;
43+
},
44+
onError: function(errorObj) {
45+
alert(errorObj.message);
46+
}
47+
});
48+
function launchEditor(id, src) {
49+
featherEditor.launch({
50+
image: id,
51+
url: src
52+
});
53+
return false;
54+
}
55+
</script>
56+
@stop

0 commit comments

Comments
 (0)