Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


19 changes: 19 additions & 0 deletions codetest/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "frontend-interview-test-long",
"version": "1.0.0",
"homepage": "https://github.com/FrickenHamster/frontend-interview-test-long",
"authors": [
"Alexander Yan <[email protected]>"
],
"description": "A cool interview project",
"dependencies":
{
"angular": "1.2.x",
"angular-route": "1.2.x",
"angular-loader": "1.2.x",
"angular-mocks": "~1.2.x",
"angular-ui": null,
"angular-bootstrap": "~0.12.0",
"bootstrap": "~3.1.1"
}
}
63 changes: 42 additions & 21 deletions codetest/index.html
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
<!DOCTYPE HTML >
<html>
<html ng-app="OntraApp">
<head>
<title>The network</title>

<link rel="stylesheet" type="text/css" href="normalize.css"/>
<link rel="stylesheet" type="text/css" href="bower_components/angular-ui/build/angular-ui.css"/>
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="styles.css"/>
<link rel="stylesheet" type="text/css" href="modal.css"/>

<link rel="stylesheet" type="text/css" href="normalize.css" />
<link rel="stylesheet" type="text/css" href="styles.css" />

<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-ui/build/angular-ui.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/TickerController.js"></script>
<script src="js/services/services.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="resources/jstorage.js"></script>
</head>
<body>

<div id="header">
<div id="logo">
<img src="images/logo.png" alt="the network"/>
</div>
<div id="search">
<form method="get" action="#">
<input type="search" name="terms" placeholder="Search...."/>
<input type="submit" value="Go"/>
</form>
</div>
</div>

<div id="page">

<div id="header" ng-controller="HeaderController">
<div id="logo">
<img src="images/logo.png" alt="the network"/>
</div>

<div>
<p>This is a footer mesage</p>
<div id="search">
<form method="get" action="#">
<input type="search" name="terms" placeholder="Search...."/>
<input type="submit" value="Go"/>
</form>
</div>

<!--<span style="vertical-align: middle; height: 100%; float:right; margin-right: 30px; margin-left: 20px; display: inline-block"></span>-->
<div id="headPicContainer">
<span class="vertImgHelper"></span> <img ng-src="{{profilePic}}" id="headerPic">
</div>
<a href ng-click="openPostModal()" class="topLink">Post an Update</a>
<a href="" class="topLink">Home</a>
</div>

<div ng-view id="page">

</div>

<div style="margin-left: auto; margin-right: auto; width: 200px;">
<p>This is a footer mesage</p>
</div>

</body>
</html>
20 changes: 20 additions & 0 deletions codetest/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Created by Hamster on 3/20/2015.
*/
'use strict';

var ontra = angular.module('OntraApp',
[
'OntraApp.controllers',
'OntraApp.services',
'ngRoute',
'ui.bootstrap'
]).
config(['$routeProvider', function ($routeProvider)
{
$routeProvider.
when("/ticker", {templateUrl: "views/ticker.html", controller: "TickerController"}).
when('/clear', {templateUrl: "views/clear.html", controller: "ClearController"}).
otherwise({redirectTo: '/ticker/'});
}]);

134 changes: 134 additions & 0 deletions codetest/js/controllers/TickerController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/**
* Created by Hamster on 3/21/2015.
*/
'use strict'


var ontraContollers = angular.module('OntraApp.controllers', []);

//controller for main ticker page
ontraContollers.controller('TickerController', ['$scope', 'UserService', 'PostService',
function ($scope, UserService, PostService)
{
//bound values
$scope.users = UserService.users;
$scope.userImageURL = $scope.users[UserService.getCurrentUser()].pic;
$scope.userName = $scope.users[UserService.getCurrentUser()].username;
$scope.postSets = [PostService.posts, PostService.localPosts];

/*
* Add post from comment box by pressing enter
* */
$scope.submitComment = function(keyEvent, postId, content)
{
if (keyEvent.which === 13)
{
PostService.addComment(UserService.getCurrentUser(), postId, content.content);
content.content = "";
}
}
}]
);

//Controller for layout header
ontraContollers.controller('HeaderController',
['$scope', '$modal', 'UserService',
function ($scope, $modal, UserService)
{
$scope.users = UserService.users;

/*
* opens new post modal open
* called when Submit Post is pressed
* */
$scope.openPostModal = function ()
{
$modal.open({
templateUrl: 'views/post-modal.html',
controller: 'PostModalController',
windowClass: 'postModelWindow',
resolve: {
currentUser: function ()
{
return UserService.getCurrentUser();
}
}
})
}
//only one page so no binding for home
}
]
);

//modal window controller
ontraContollers.controller('PostModalController',
['$scope', '$modalInstance', 'PostService', "currentUser",
function ($scope, $modalInstance, PostService, currentUser)
{
//bound variables;
$scope.postInput = "";
$scope.currentUser = currentUser;

/*
* enter pressed on modal window
* submits new post
* */
$scope.postModalKeyPress = function (keyEvent)
{
if (keyEvent.which === 13)
{
submitPost();
}
};

//set initial focus
$("#postModalInput").focus();

/*
* submit a new post
* closes modal window
* */
function submitPost()
{
PostService.makeLocalPost($scope.currentUser, $scope.postInput);

$modalInstance.dismiss('submitted post');
}

}
]
);

//helper directive to focus textarea when modal window opened
ontraContollers.directive('focusMe', function ($timeout)
{
return {
scope: {trigger: '@focusMe'},
link: function (scope, element)
{
scope.$watch('trigger', function (value)
{
if (value === "true")
{
$timeout(function ()
{
element[0].focus();
});
}
});
}
};
});

//controller to clear local storage
ontraContollers.controller('ClearController',
['$location', '$timeout',
function ($location, $timeout)
{
$timeout(function(){

$location.path('./#/ticket');
}, 1000);
$.jStorage.flush();

}]);
Loading