Merged UI and backend
This commit is contained in:
BIN
app/._app.css
BIN
app/._app.css
Binary file not shown.
BIN
app/._app.js
BIN
app/._app.js
Binary file not shown.
Binary file not shown.
BIN
app/._index.html
BIN
app/._index.html
Binary file not shown.
70
app/app.css
70
app/app.css
@@ -1,70 +0,0 @@
|
||||
/* app css stylesheet */
|
||||
|
||||
.menu {
|
||||
list-style: none;
|
||||
border-bottom: 0.1em solid black;
|
||||
margin-bottom: 2em;
|
||||
padding: 0 0 0.5em;
|
||||
}
|
||||
|
||||
.menu:before {
|
||||
content: "[";
|
||||
}
|
||||
|
||||
.menu:after {
|
||||
content: "]";
|
||||
}
|
||||
|
||||
.menu > li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.menu > li:before {
|
||||
content: "|";
|
||||
padding-right: 0.3em;
|
||||
}
|
||||
|
||||
.menu > li:nth-child(1):before {
|
||||
content: "";
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.stbody
|
||||
{
|
||||
min-height:70px;
|
||||
|
||||
}
|
||||
.stbody
|
||||
{
|
||||
min-height:70px;
|
||||
margin-bottom:10px;
|
||||
border-bottom:dashed 1px #cc0000;
|
||||
}
|
||||
.stimg
|
||||
{
|
||||
float:left;
|
||||
height:50px;
|
||||
width:50px;
|
||||
border:solid 1px #dedede;
|
||||
padding:5px;
|
||||
}
|
||||
.sttext
|
||||
{
|
||||
margin-left:70px;
|
||||
|
||||
min-height:50px;
|
||||
word-wrap:break-word;
|
||||
overflow:hidden;
|
||||
padding:5px;
|
||||
display:block;
|
||||
font-family:'Georgia', Times New Roman, Times, serif
|
||||
}
|
||||
.sttime
|
||||
{
|
||||
font-size:11px;
|
||||
color:#999;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
margin-top:5px;
|
||||
}
|
||||
12
app/app.js
12
app/app.js
@@ -1,12 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
// Declare app level module which depends on views, and components
|
||||
angular.module('ngSocial', [
|
||||
'ngRoute',
|
||||
'ngSocial.view1',
|
||||
'ngSocial.view2',
|
||||
'ngSocial.facebook'
|
||||
]).
|
||||
config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.otherwise({redirectTo: '/facebook'});
|
||||
}]);
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,59 +0,0 @@
|
||||
<div class="row" ng-controller="FacebookCtrl">
|
||||
<div class="col-md-4">
|
||||
<h4>{{welcomeMsg}}</h4>
|
||||
<div ng-if="isLoggedIn == true">
|
||||
<a href="{{userInfo.link}}" target="_blank"><img ng-src="{{picture}}"></a>
|
||||
</div>
|
||||
<br>
|
||||
<div ng-if="isLoggedIn == false">
|
||||
<button type="button" class="btn btn-default" ng-click="login()">Login</button>
|
||||
</div>
|
||||
<div ng-if="isLoggedIn == true">
|
||||
<button type="button" class="btn btn-default" ng-click="logout()">Logout</button>
|
||||
</div>
|
||||
<br><br>
|
||||
<div ng-if="isLoggedIn == true" class="well">
|
||||
<h4>User Info</h4>
|
||||
<ul>
|
||||
<li>ID: {{userInfo.id}}</li>
|
||||
<li>First Name: {{userInfo.first_name}}</li>
|
||||
<li>Last Name: {{userInfo.last_name}}</li>
|
||||
<li>Email: {{userInfo.email}}</li>
|
||||
<li>Gender: {{userInfo.gender}}</li>
|
||||
<li>Locale: {{userInfo.locale}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<br>
|
||||
<div class="well" ng-if="isLoggedIn == true">
|
||||
<h4>Permissions</h4>
|
||||
<ul>
|
||||
<li ng-repeat="permission in permissions">{{permission.permission}} - {{permission.status}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<h3>Welcome to Facebook!</h3>
|
||||
<div ng-if="isLoggedIn == true">
|
||||
<form ng-submit="postStatus()">
|
||||
<div class="form-group">
|
||||
<label>Status Update</label>
|
||||
<textarea ng-model="body" class="form-control"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-default">Submit</button>
|
||||
</form>
|
||||
<br><br>
|
||||
<div ng-repeat="post in posts" class="stbody">
|
||||
<div class="stimg">
|
||||
<img ng-src="{{picture}}">
|
||||
</div>
|
||||
<div class="sttext">
|
||||
{{post.message}}
|
||||
<div class="sttime">{{post.updated_time}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="isLoggedIn == false">
|
||||
<p>You need to login to post</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,75 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('ngSocial.facebook', ['ngRoute','ngFacebook'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/facebook', {
|
||||
templateUrl: 'facebook/facebook.html',
|
||||
controller: 'FacebookCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.config( function( $facebookProvider ) {
|
||||
$facebookProvider.setAppId('846149575421651');
|
||||
$facebookProvider.setPermissions("email,public_profile, user_posts, publish_actions, user_photos");
|
||||
})
|
||||
|
||||
.run(function($rootScope){
|
||||
(function(d, s, id){
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
})
|
||||
|
||||
.controller('FacebookCtrl', ['$scope', '$facebook', function($scope, $facebook) {
|
||||
$scope.isLoggedIn = false;
|
||||
|
||||
$scope.login = function(){
|
||||
$facebook.login().then(function(){
|
||||
$scope.isLoggedIn = true;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.logout = function(){
|
||||
$facebook.logout().then(function(){
|
||||
$scope.isLoggedIn = false;
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
|
||||
function refresh(){
|
||||
$facebook.api("/me").then(function(response){
|
||||
$scope.welcomeMsg = "Welcome "+ response.name;
|
||||
$scope.isLoggedIn = true;
|
||||
$scope.userInfo = response;
|
||||
$facebook.api('/me/picture').then(function(response){
|
||||
$scope.picture = response.data.url;
|
||||
$facebook.api('/me/permissions').then(function(response){
|
||||
$scope.permissions = response.data;
|
||||
$facebook.api('/me/posts').then(function(response){
|
||||
console.log(response.data);
|
||||
$scope.posts = response.data;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
function(err){
|
||||
$scope.welcomeMsg = "Please Log In";
|
||||
});
|
||||
}
|
||||
|
||||
$scope.postStatus = function(){
|
||||
var body = this.body;
|
||||
$facebook.api('/me/feed', 'post', {message: body}).then(function(response){
|
||||
$scope.msg = 'Thanks for Posting';
|
||||
refresh();
|
||||
});
|
||||
}
|
||||
|
||||
refresh();
|
||||
}]);
|
||||
@@ -1,58 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
|
||||
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
|
||||
<style>
|
||||
[ng-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
|
||||
<script>
|
||||
// include angular loader, which allows the files to load in any order
|
||||
//@@NG_LOADER_START@@
|
||||
// You need to run `npm run update-index-async` to inject the angular async code here
|
||||
//@@NG_LOADER_END@@
|
||||
|
||||
// include a third-party async loader library
|
||||
/*!
|
||||
* $script.js v1.3
|
||||
* https://github.com/ded/script.js
|
||||
* Copyright: @ded & @fat - Dustin Diaz, Jacob Thornton 2011
|
||||
* Follow our software http://twitter.com/dedfat
|
||||
* License: MIT
|
||||
*/
|
||||
!function(a,b,c){function t(a,c){var e=b.createElement("script"),f=j;e.onload=e.onerror=e[o]=function(){e[m]&&!/^c|loade/.test(e[m])||f||(e.onload=e[o]=null,f=1,c())},e.async=1,e.src=a,d.insertBefore(e,d.firstChild)}function q(a,b){p(a,function(a){return!b(a)})}var d=b.getElementsByTagName("head")[0],e={},f={},g={},h={},i="string",j=!1,k="push",l="DOMContentLoaded",m="readyState",n="addEventListener",o="onreadystatechange",p=function(a,b){for(var c=0,d=a.length;c<d;++c)if(!b(a[c]))return j;return 1};!b[m]&&b[n]&&(b[n](l,function r(){b.removeEventListener(l,r,j),b[m]="complete"},j),b[m]="loading");var s=function(a,b,d){function o(){if(!--m){e[l]=1,j&&j();for(var a in g)p(a.split("|"),n)&&!q(g[a],n)&&(g[a]=[])}}function n(a){return a.call?a():e[a]}a=a[k]?a:[a];var i=b&&b.call,j=i?b:d,l=i?a.join(""):b,m=a.length;c(function(){q(a,function(a){h[a]?(l&&(f[l]=1),o()):(h[a]=1,l&&(f[l]=1),t(s.path?s.path+a+".js":a,o))})},0);return s};s.get=t,s.ready=function(a,b,c){a=a[k]?a:[a];var d=[];!q(a,function(a){e[a]||d[k](a)})&&p(a,function(a){return e[a]})?b():!function(a){g[a]=g[a]||[],g[a][k](b),c&&c(d)}(a.join("|"));return s};var u=a.$script;s.noConflict=function(){a.$script=u;return this},typeof module!="undefined"&&module.exports?module.exports=s:a.$script=s}(this,document,setTimeout)
|
||||
|
||||
// load all of the dependencies asynchronously.
|
||||
$script([
|
||||
'bower_components/angular/angular.js',
|
||||
'bower_components/angular-route/angular-route.js',
|
||||
'app.js',
|
||||
'view1/view1.js',
|
||||
'view2/view2.js',
|
||||
'components/version/version.js',
|
||||
'components/version/version-directive.js',
|
||||
'components/version/interpolate-filter.js'
|
||||
], function() {
|
||||
// when all is done, execute bootstrap angular application
|
||||
angular.bootstrap(document, ['myApp']);
|
||||
});
|
||||
</script>
|
||||
<title>My AngularJS App</title>
|
||||
<link rel="stylesheet" href="app.css">
|
||||
</head>
|
||||
<body ng-cloak>
|
||||
<ul class="menu">
|
||||
<li><a href="#/view1">view1</a></li>
|
||||
<li><a href="#/view2">view2</a></li>
|
||||
</ul>
|
||||
|
||||
<div ng-view></div>
|
||||
|
||||
<div>Angular seed app: v<span app-version></span></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,64 +0,0 @@
|
||||
<html>
|
||||
<head><!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||
|
||||
<!-- Optional theme -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script></head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Welcome to Mini Amazon</h1>
|
||||
|
||||
<!--<div class="d-inline bg-success container">-->
|
||||
<!--<a href="admin.html" >if you are an admin</a><br>-->
|
||||
<!--<a href=search.html >if you want to search</a>-->
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="modal fade" id="myModal" role="dialog">-->
|
||||
<!--<div class="modal-dialog">-->
|
||||
|
||||
<!--<!– Modal content–>-->
|
||||
<!--<div class="modal-content">-->
|
||||
<!--<div class="modal-header">-->
|
||||
<!--<button type="button" class="close" data-dismiss="modal">×</button>-->
|
||||
<!--<h4 class="modal-title">Error!</h4>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="modal-body">-->
|
||||
<!--<p>{{ message }}</p>-->
|
||||
<!--</div>-->
|
||||
<!--<div class="modal-footer">-->
|
||||
<!--<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<b style="color:red"><h3>{{ message }}</h3></b>
|
||||
<div class="panel panel-primary" style="width:300px; float:left; margin-right:20px">
|
||||
<div class="panel-heading"><h2>Login</h2></div>
|
||||
<div class="panel-body">
|
||||
<form action="/api/user/login" method="POST">
|
||||
Username: <input type="text" name="username" required><br>
|
||||
Password: <input type="password" name="password" required><br><br>
|
||||
<input type="submit" name="Login" class="btn btn-info btn-lg" required>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<b style="color:red"><h3>{{ user_exists_msg }}</h3></b>
|
||||
<div class="panel panel-primary" style="width:300px; float:left; margin-right:20px">
|
||||
<div class="panel-heading"><h2>Sign Up</h2></div>
|
||||
<div class="panel-body">
|
||||
<form action="/api/user/signup" method="POST">
|
||||
Name: <input type="text" name="name" required><br>
|
||||
Email: <input type="email" name="email" required><br>
|
||||
Username: <input type="text" name="username" required><br>
|
||||
Password: <input type="password" name="password" required><br><br>
|
||||
<input type="submit" name="Sign Up!" class="btn btn-info btn-lg" required>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user