diff --git a/project/.jshintrc b/project/.jshintrc index 2d54134..a8ab044 100644 --- a/project/.jshintrc +++ b/project/.jshintrc @@ -1,35 +1,35 @@ { - "boss": true, - "browser": true, - "curly": true, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "indent": 2, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "quotmark": "single", - "smarttabs": true, - "strict": true, - "sub": true, - "trailing": true, - "undef": true, - "globals": { - "jQuery": true, - "angular": true, - "console": true, - "$": true, - "_": true, - "moment": true, - "describe": true, - "beforeEach": true, - "module": true, - "inject": true, - "it": true, - "expect": true, - "xdescribe": true, - "xit": true, - "spyOn": true - } + "boss": true, + "browser": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "immed": true, + + "latedef": "nofunc", + "newcap": true, + "noarg": true, + "quotmark": "single", + "smarttabs": true, + "strict": true, + "sub": true, + "trailing": true, + "undef": true, + "globals": { + "jQuery": true, + "angular": true, + "console": true, + "$": true, + "_": true, + "moment": true, + "describe": true, + "beforeEach": true, + "module": true, + "inject": true, + "it": true, + "expect": true, + "xdescribe": true, + "xit": true, + "spyOn": true + } } diff --git a/project/app.js b/project/app.js index d535909..da4b6c4 100644 --- a/project/app.js +++ b/project/app.js @@ -1,4 +1,4 @@ -(function() { +(function () { 'use strict'; angular.module('daproject', [ @@ -20,14 +20,41 @@ controller: 'HomeCtrl', controllerAs: 'home', }) - .otherwise({redirectTo:'/'}); + .when('/exo03', { + templateUrl: 'src/app/exo03/exo03.html', + controller: 'exo03Ctrl', + controllerAs: 'exo03', + }) + .when('/exo03/detail-partial', { + templateUrl: 'src/app/exo03/detail-partial/detail.html', + controller: 'detailCtrl', + controllerAs: 'detail', + }) + .when('/exo04', { + templateUrl: 'src/app/exo04/exo04.html', + controller: 'exo04Ctrl', + controllerAs: 'exo04', + }) + .when('/more', { + templateUrl: 'src/app/more/more.html', + controller: 'moreCtrl', + controllerAs: 'more', + }) + .when('/final', { + templateUrl: 'src/app/final/final.html', + controller: 'finalCtrl', + controllerAs: 'final', + }) + .otherwise({ + redirectTo: '/' + }); } function RunUtils($rootScope) { - $rootScope.safeApply = function(fn) { + $rootScope.safeApply = function (fn) { var phase = $rootScope.$$phase; if (phase === '$apply' || phase === '$digest') { - if (fn && (typeof(fn) === 'function')) { + if (fn && (typeof (fn) === 'function')) { fn(); } } else { diff --git a/project/app.less b/project/app.less index bf7b7df..ca3c1bd 100644 --- a/project/app.less +++ b/project/app.less @@ -3,9 +3,17 @@ @import "variables.less"; /* Add App LESS files below */ + @import "src/app/home/home.less"; +@import "src/app/exo03/exo03.less"; +@import "src/app/exo03/detail-partial/detail.less"; +@import "src/app/exo04/exo04.less"; +@import "src/app/more/more.less"; +@import "src/app/final/final.less"; + /* Add Fonts below */ + @fa-font-path: "bower_components/font-awesome/fonts"; body { @@ -39,4 +47,10 @@ body { } /* Required for Angular UI Bootstrap */ -.nav, .pagination, .carousel, .panel-title a { cursor: pointer; } + +.nav, +.pagination, +.carousel, +.panel-title a { + cursor: pointer; +} diff --git a/project/img/baniere.jpg b/project/img/baniere.jpg new file mode 100644 index 0000000..17eb1d9 Binary files /dev/null and b/project/img/baniere.jpg differ diff --git a/project/img/bg.jpg b/project/img/bg.jpg new file mode 100644 index 0000000..f736c58 Binary files /dev/null and b/project/img/bg.jpg differ diff --git a/project/index.html b/project/index.html index 2421968..f9d612c 100644 --- a/project/index.html +++ b/project/index.html @@ -1,14 +1,16 @@ + Find The Word - Yet another AngularJS experiment - + + @@ -29,10 +31,19 @@ + + + + + + + +
+ diff --git a/project/src/app/exo03/detail-partial/detail.controller.js b/project/src/app/exo03/detail-partial/detail.controller.js new file mode 100644 index 0000000..fbdd50b --- /dev/null +++ b/project/src/app/exo03/detail-partial/detail.controller.js @@ -0,0 +1,22 @@ +(function () { + 'use strict'; + + function DetailCtrl($location) { + var vm = this; + vm.msg = 'Welcome All!'; + vm.subMsg = 'A seed Project'; + vm.goToExo = goToExo; + + function goToExo(exoNumber) { + if (exoNumber === 3) { + $location.path('/exo03/detail-partial'); + } + } + } + + DetailCtrl.$inject = ['$location']; + + angular.module('daproject') + .controller('detailCtrl', DetailCtrl); + +})(); diff --git a/project/src/app/exo03/detail-partial/detail.html b/project/src/app/exo03/detail-partial/detail.html new file mode 100644 index 0000000..73be1c5 --- /dev/null +++ b/project/src/app/exo03/detail-partial/detail.html @@ -0,0 +1,3 @@ +
+

Ah que COUCOU!

+
diff --git a/project/src/app/exo03/detail-partial/detail.less b/project/src/app/exo03/detail-partial/detail.less new file mode 100644 index 0000000..97326c6 --- /dev/null +++ b/project/src/app/exo03/detail-partial/detail.less @@ -0,0 +1,23 @@ + #container { + display: flex; + height: 100%; //width: 200px; + } + + .smallBox { + background-color: darkorange; + flex-grow: 1; + height: 500px; + margin: 2px; + + } + + p { + text-align: center; + color: aliceblue; + font-size: 2em; + } + + + html { + height: 100%; + } diff --git a/project/src/app/exo03/exo03.controller.js b/project/src/app/exo03/exo03.controller.js new file mode 100644 index 0000000..70aa432 --- /dev/null +++ b/project/src/app/exo03/exo03.controller.js @@ -0,0 +1,41 @@ +(function () { + 'use strict'; + + function Exo03Ctrl($location) { + var vm = this; + + vm.films = [ + { + name: 'Fast and Furious', + img: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/AkSMd8AXSpA1L1SbBPc2AfVJfmE.jpg', + year: 2001 + }, + { + name: '2 Fast 2 Furious', + img: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/u1Snfl40rXmAJNiMyZUczUyFVuf.jpg', + year: 2003 + }, + { + name: 'Fast & Furious: Tokyo Drift', + img: 'https://image.tmdb.org/t/p/w600_and_h900_bestv2/4ceW7kWPAc2uFG5WzYDbP8Od3gw.jpg', + year: 2006 + } + ]; + + vm.select = select; + + function select(film) { + vm.selected = film; + console.log("le film selectionné est " + film.name + " sorti en " + film.year); + } + + } + + + + Exo03Ctrl.$inject = ['$location']; + + angular.module('daproject') + .controller('exo03Ctrl', Exo03Ctrl); + +})(); diff --git a/project/src/app/exo03/exo03.html b/project/src/app/exo03/exo03.html new file mode 100644 index 0000000..e252c17 --- /dev/null +++ b/project/src/app/exo03/exo03.html @@ -0,0 +1,12 @@ +
+ +
+ + +
+
+ diff --git a/project/src/app/exo03/exo03.less b/project/src/app/exo03/exo03.less new file mode 100644 index 0000000..89f1208 --- /dev/null +++ b/project/src/app/exo03/exo03.less @@ -0,0 +1,48 @@ +#container { + padding: 0; + margin: 0; + list-style: none; + + display: -webkit-box; + display: -moz-box; + display: -ms-flexbox; + display: -webkit-flex; + display: flex; + + -webkit-flex-flow: row wrap; + justify-content: space-around; +} + +.listeFilms, +.detailFilm { + background: gray; + padding: 5px; + width: 40%; + height: 50%; + margin-top: 10px; + + line-height: 50px; + color: white; + font-weight: bold; + font-size: 3em; + text-align: center; +} + +#film { + padding: 0; + + li { + list-style: none; + } +} + +.superClass { + border: 5px solid pink; + +} + +img { + width: 140px; + height: auto; + margin: 5px; +} diff --git a/project/src/app/exo04/exo04.controller.js b/project/src/app/exo04/exo04.controller.js new file mode 100644 index 0000000..0df4aeb --- /dev/null +++ b/project/src/app/exo04/exo04.controller.js @@ -0,0 +1,26 @@ +(function () { + 'use strict'; + + function Exo04Ctrl($location, settingService) { + var vm = this; + vm.input = 'input'; + vm.superService = settingService; + vm.consol = consol; + + function consol(input) { + vm.superService.city = input; + console.log(vm.superService.city); + } + + + + } + Exo04Ctrl.$inject = ['$location', 'settingService']; + + + angular.module('daproject') + .controller('exo04Ctrl', Exo04Ctrl); + + + +})(); diff --git a/project/src/app/exo04/exo04.html b/project/src/app/exo04/exo04.html new file mode 100644 index 0000000..789e187 --- /dev/null +++ b/project/src/app/exo04/exo04.html @@ -0,0 +1,6 @@ +
+ + + +
+
Ville : {{exo04.superService.city}}
diff --git a/project/src/app/exo04/exo04.less b/project/src/app/exo04/exo04.less new file mode 100644 index 0000000..f6fc2d9 --- /dev/null +++ b/project/src/app/exo04/exo04.less @@ -0,0 +1,4 @@ +#input { + margin-top: 250px; + text-align: center; +} diff --git a/project/src/app/final/final.controller.js b/project/src/app/final/final.controller.js new file mode 100644 index 0000000..89f5b2f --- /dev/null +++ b/project/src/app/final/final.controller.js @@ -0,0 +1,22 @@ +(function () { + 'use strict'; + + function finalCtrl($location, searchConfig, cocktailSearch) { + var vm = this; + vm.cocktailSearch = cocktailSearch; + vm.searchConfig = searchConfig; + vm.text = ''; + vm.afficherText = afficherText; + + function afficherText() { + vm.searchConfig.ingredient = vm.text; + vm.cocktailSearch.getCocktail(); + } + } + + finalCtrl.$inject = ['$location', 'searchConfig', 'cocktailSearch']; + + angular.module('daproject') + .controller('finalCtrl', finalCtrl); + +})(); diff --git a/project/src/app/final/final.html b/project/src/app/final/final.html new file mode 100644 index 0000000..cd1f2a3 --- /dev/null +++ b/project/src/app/final/final.html @@ -0,0 +1,7 @@ +
+ + +
+
+ {{final.searchConfig.ingredient}} +

{{final.cocktailSearch.cocktailList[0].strDrink}}

diff --git a/project/src/app/final/final.less b/project/src/app/final/final.less new file mode 100644 index 0000000..3e6d6dd --- /dev/null +++ b/project/src/app/final/final.less @@ -0,0 +1,13 @@ +.input { + height: 300px; + + background-image: url("/img/bg.jpg"); + background-position: center; + +} + +.inputDisplay { + + font-size: 2em; + color: seashell; +} diff --git a/project/src/app/home/home.html b/project/src/app/home/home.html index d56df2f..15b0073 100644 --- a/project/src/app/home/home.html +++ b/project/src/app/home/home.html @@ -6,8 +6,8 @@
{{home.subMsg}}
Exo03 - Exo05 - Exo06 + Exo04 + Finale
diff --git a/project/src/app/home/home.less b/project/src/app/home/home.less index fe916e2..5a991fc 100644 --- a/project/src/app/home/home.less +++ b/project/src/app/home/home.less @@ -17,11 +17,11 @@ .centralDiv { margin-left: auto; - margin-right:auto; - text-align:center; + margin-right: auto; + text-align: center; width: 740px; padding: 60px; - box-shadow: 0 0 20px rgba(0,0,0,0.5); + box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); } } diff --git a/project/src/app/more/more.controller.js b/project/src/app/more/more.controller.js new file mode 100644 index 0000000..fdac97d --- /dev/null +++ b/project/src/app/more/more.controller.js @@ -0,0 +1,7 @@ +(function () { + 'use strict'; + + function MoreCtrl($location) { + var vm = this; + } +})(); diff --git a/project/src/app/more/more.html b/project/src/app/more/more.html new file mode 100644 index 0000000..e69de29 diff --git a/project/src/app/more/more.less b/project/src/app/more/more.less new file mode 100644 index 0000000..fe916e2 --- /dev/null +++ b/project/src/app/more/more.less @@ -0,0 +1,27 @@ +#home-page { + display: table; + position: absolute; + height: 100%; + width: 100%; + + .gameTitle { + .title { + font-size: 42px; + } + } + + .vertical-center { + display: table-cell; + vertical-align: middle; + } + + .centralDiv { + margin-left: auto; + margin-right:auto; + text-align:center; + width: 740px; + padding: 60px; + box-shadow: 0 0 20px rgba(0,0,0,0.5); + } + +} diff --git a/project/src/components/cocktailSearch/cocktailSearch.service.js b/project/src/components/cocktailSearch/cocktailSearch.service.js new file mode 100644 index 0000000..26950cb --- /dev/null +++ b/project/src/components/cocktailSearch/cocktailSearch.service.js @@ -0,0 +1,29 @@ +(function() { + 'use strict'; + + function cocktailSearch(searchConfig, $http) { + var service = {}; + service.cocktailList = []; + service.searchConfig = searchConfig; + service.getCocktail = getCocktail; + + + function getCocktail(){ + return $http.get('http://www.thecocktaildb.com/api/json/v1/1/filter.php?i='+ service.searchConfig.ingredient) + .then(function(response){ + service.cocktailList = response.data.drinks; + }) + .catch(function(error){ + service.cocktailList = []; + }); + } + + return service; + } + + cocktailSearch.$inject = ['searchConfig','$http']; + + angular.module('daproject') + .factory('cocktailSearch', cocktailSearch); + +})(); \ No newline at end of file diff --git a/project/src/components/meteo/meteo.service.js b/project/src/components/meteo/meteo.service.js new file mode 100644 index 0000000..4e7d636 --- /dev/null +++ b/project/src/components/meteo/meteo.service.js @@ -0,0 +1,29 @@ +(function() { + 'use strict'; + + function meteoService($http, settingService) { + var service = {}; + + service.meteoListe = []; + service.settingService = settingService; + service.getMeteo = getMeteo; + + function getMeteo(){ + return $http.get('http://api.openweathermap.org/data/2.5/forecast?q='+service.settingService.city+'&APPID=7e9ea8dd319731b1cb24bb7e37012e91&units=metric') + .then(function(response){ + service.meteoListe = response.data.list; + }) + .catch(function(error){ + service.meteoListe = []; + }); + } + + return service; + } + + meteoService.$inject = ['$http', 'settingService']; + + angular.module('daproject') + .factory('meteoService', meteoService); + +})(); \ No newline at end of file diff --git a/project/src/components/meteo/meteoService .js b/project/src/components/meteo/meteoService .js new file mode 100644 index 0000000..bd34bdf --- /dev/null +++ b/project/src/components/meteo/meteoService .js @@ -0,0 +1,15 @@ +(function () { + 'use strict'; + + function meteoService() { + var meteoListe = []; + + + } + + settingService.$inject = []; + + angular.module('daproject') + .factory('settingService', settingService); + +})(); diff --git a/project/src/components/searchConfig/searchConfig.service.js b/project/src/components/searchConfig/searchConfig.service.js new file mode 100644 index 0000000..80271b8 --- /dev/null +++ b/project/src/components/searchConfig/searchConfig.service.js @@ -0,0 +1,15 @@ +(function () { + 'use strict'; + + function searchConfig() { + var service = {}; + service.ingredient = ''; + return service; + } + + searchConfig.$inject = []; + + angular.module('daproject') + .factory('searchConfig', searchConfig); + +})(); diff --git a/project/src/components/setting/setting.service.js b/project/src/components/setting/setting.service.js new file mode 100644 index 0000000..6e18f88 --- /dev/null +++ b/project/src/components/setting/setting.service.js @@ -0,0 +1,18 @@ +(function () { + 'use strict'; + + function settingService() { + var service = {}; + service.ingredient = ''; + + + console.log(service.ingredient); + return service; + } + + settingService.$inject = []; + + angular.module('daproject') + .factory('settingService', settingService); + +})(); diff --git a/project/src/components/weather/weather.controller.js b/project/src/components/weather/weather.controller.js new file mode 100644 index 0000000..9c872eb --- /dev/null +++ b/project/src/components/weather/weather.controller.js @@ -0,0 +1,16 @@ +(function() { + 'use strict'; + + function WeatherCtrl($location,meteoService) { + var vm = this; + vm.meteoService = meteoService; + + + } + + WeatherCtrl.$inject = ['$location','meteoService']; + + angular.module('daproject') + .controller('WeatherCtrl', WeatherCtrl); + +})(); diff --git a/project/src/components/weather/weather.directive.js b/project/src/components/weather/weather.directive.js new file mode 100644 index 0000000..196c2fa --- /dev/null +++ b/project/src/components/weather/weather.directive.js @@ -0,0 +1,18 @@ +(function() { + 'use strict'; + + angular.module('daproject') + .directive('weather', function() { + return { + templateUrl: 'src/components/weather/weather.html', + restrict: 'E', + bindToController: { + meteoElement: '=', + }, + scope: {}, + controller: 'WeatherCtrl', + controllerAs: 'weather' + }; + }); + +})(); \ No newline at end of file diff --git a/project/src/components/weather/weather.html b/project/src/components/weather/weather.html new file mode 100644 index 0000000..9f8d745 --- /dev/null +++ b/project/src/components/weather/weather.html @@ -0,0 +1,12 @@ +
+ +
+ +
+
+ {{weather.meteoElement.main.temp}} +
+
+ {{weather.meteoElement.dt_txt}} +
+
\ No newline at end of file