From b83f1b42df5e343dd420f4eaa9dc184d8f3e976c Mon Sep 17 00:00:00 2001 From: Tilman Liero Date: Tue, 24 Nov 2015 20:18:51 +0100 Subject: [PATCH] pt. 3a - AngularJS basic code --- src/main/resources/static/css/app.css | 12 ++++++++ src/main/resources/static/favicon.ico | Bin 0 -> 1150 bytes src/main/resources/static/index.html | 24 +++++++++++++++ src/main/resources/static/js/app.js | 13 +++++++++ src/main/resources/static/js/controllers.js | 29 +++++++++++++++++++ src/main/resources/static/partials/list.html | 19 ++++++++++++ src/main/resources/static/partials/tag.html | 15 ++++++++++ 7 files changed, 112 insertions(+) create mode 100644 src/main/resources/static/css/app.css create mode 100644 src/main/resources/static/favicon.ico create mode 100644 src/main/resources/static/index.html create mode 100644 src/main/resources/static/js/app.js create mode 100644 src/main/resources/static/js/controllers.js create mode 100644 src/main/resources/static/partials/list.html create mode 100644 src/main/resources/static/partials/tag.html diff --git a/src/main/resources/static/css/app.css b/src/main/resources/static/css/app.css new file mode 100644 index 0000000..0c5fdb0 --- /dev/null +++ b/src/main/resources/static/css/app.css @@ -0,0 +1,12 @@ +body { + padding-top: 20px; + font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; +} + +.burp { + margin-bottom: 2em; +} + +.burp .date { + text-decoration: underline overline; +} \ No newline at end of file diff --git a/src/main/resources/static/favicon.ico b/src/main/resources/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..d49b435a127462307abd8eb59a0085dad0e1d949 GIT binary patch literal 1150 zcmbW1OK1~O6o#)@&=MPBP>YD5h*Dj+QNb>(8x`upg%8Aqpr{}sE<|eu1>F>^Vq0sp zYN-!U)QY;$M(aX_CX?7EX%kZOveMGDd9-=IGn3zwNhZ`-EqE{Io;zpm$GLMJ!`M8U z3I(He6+2nM*fPdg4GEdZQm~U^jNU0_1reWVL2=}SEckQ?*;EjGQSy5s6QdJ3aYpzQ z!h8~ZPLQyYj(H8Rz1s`x>s>|JDQdg=5aK=)aVeZ~KF9vy2XG|3B~ID|M?Zp7RYBXn z5XQ&rV0yA1`n!wK*TOJqY{eA$-C}A+wXP9{=$M3+be`9#WH7&|MKb6>Chmpn({c3O zWN;5OBTXmO0V`hlO_Em8SN2cAaRnOi%(Jn z_gU{_wf-_D(qRcJ>6tvA3PGSdIzAj0{ZE?O5T}^$v36jk{u11jr}824cdF3exdJ~v zpN75XAjMAs%gb#@_|1q48Pr=;SgyN>u~eWOM}e0^+csZ}J9oPhTze(PzcnFO%=-@W zEmU)ja3%e-^QuJ{dbSCX2`#2wZzzWwpzly3^iz$HkVf553zl*h@ICJN3onDEdpp%% z2>E(+_8x_X^6$0WLxA|&!5dh@HNYHm&%pc@_BY#a`%U5WQo{cSWfL7_bdE;2H!|3dvPfZ^d97$2>rdXy7i0iU%C9?EA;|5eB} zXYn=U{DY7AjIg~wfZ?~hN$N}D>^*{Hz=i<%KjC;v{nLp-x?A}u^lyZEIQ*Lk*@SpB S-@(yh9 + + + + + +BURP: Bayer Ubiquitous Rating Platform + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/src/main/resources/static/js/app.js b/src/main/resources/static/js/app.js new file mode 100644 index 0000000..25fcc7d --- /dev/null +++ b/src/main/resources/static/js/app.js @@ -0,0 +1,13 @@ +var burpApp = angular.module('burpApp', ['ngRoute', 'burpControllers' ]); + +burpApp.config([ '$routeProvider', function($routeProvider) { + $routeProvider.when('/list', { + templateUrl : 'partials/list.html', + controller : 'BurpListCtrl' + }).when('/tag/:taggedBurps*', { + templateUrl : 'partials/tag.html', + controller : 'TagCtrl' + }).otherwise({ + redirectTo : '/list' + }); +} ]); diff --git a/src/main/resources/static/js/controllers.js b/src/main/resources/static/js/controllers.js new file mode 100644 index 0000000..2e8f68b --- /dev/null +++ b/src/main/resources/static/js/controllers.js @@ -0,0 +1,29 @@ +var burpControllers = angular.module('burpControllers', ['ngResource']); + +burpControllers.controller('BurpListCtrl', [ '$scope', '$resource', function($scope, $resource) { + + var burps = $resource('/burps/search/findFirst8ByOrderByTimestampDesc').get(); + + burps.$promise.then(function(data) { + $scope.burps = burps._embedded.burps; + + for (var i = 0; i < $scope.burps.length; i++) { + $scope.burps[i].user = $resource($scope.burps[i]._links.user.href).get(); + $scope.burps[i].tags = $resource($scope.burps[i]._links.tags.href).get(); + } + }); +} ]); + +burpControllers.controller('TagCtrl', [ '$scope', '$routeParams', '$resource', function($scope, $routeParams, $resource) { + + var burpsList = $resource($routeParams.taggedBurps).get(); + burpsList.$promise.then(function(data) { + $scope.burps = burpsList._embedded.burps; + + for (var i = 0; i < $scope.burps.length; i++) { + $scope.burps[i].user = $resource($scope.burps[i]._links.user.href).get(); + $scope.burps[i].tags = $resource($scope.burps[i]._links.tags.href).get(); + } + }); + +} ]); diff --git a/src/main/resources/static/partials/list.html b/src/main/resources/static/partials/list.html new file mode 100644 index 0000000..0486012 --- /dev/null +++ b/src/main/resources/static/partials/list.html @@ -0,0 +1,19 @@ +
+
+
+
+
{{burp.user.name}}
+
{{burp.timestamp | date:'HH:mm:ss dd.MM.yyyy'}}
+
{{burp.text}}
+ + #{{tag.name}} + +
+ +
+
{{burps | json}}
+
+ +
+
+
diff --git a/src/main/resources/static/partials/tag.html b/src/main/resources/static/partials/tag.html new file mode 100644 index 0000000..879d4a5 --- /dev/null +++ b/src/main/resources/static/partials/tag.html @@ -0,0 +1,15 @@ +
+
+
+
+
{{burp.user.name}}
+
{{burp.timestamp | date:'HH:mm:ss dd.MM.yyyy'}}
+
{{burp.text}}
+ + #{{tag.name}} + +
+
+
+
+ \ No newline at end of file