Commit fb625a65a351fee79c400010ebd44b585a96d250

Authored by Leonardo Merlin
1 parent 4dc642ee

Remove restangular

@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 "angular-sanitize": "~1.4.0", 8 "angular-sanitize": "~1.4.0",
9 "angular-ui-router": "~0.2.15", 9 "angular-ui-router": "~0.2.15",
10 "jquery": "~2.1.4", 10 "jquery": "~2.1.4",
11 - "restangular": "~1.5.1",  
12 "bootstrap-sass-official": "~3.3.4", 11 "bootstrap-sass-official": "~3.3.4",
13 "animate.css": "~3.3.0", 12 "animate.css": "~3.3.0",
14 "angular": "~1.4.0", 13 "angular": "~1.4.0",
src/app/index.config.js
@@ -3,16 +3,9 @@ @@ -3,16 +3,9 @@
3 3
4 angular 4 angular
5 .module('dialoga') 5 .module('dialoga')
6 - .config(configRestangular)  
7 .config(config); 6 .config(config);
8 7
9 /** @ngInject */ 8 /** @ngInject */
10 - function configRestangular(RestangularProvider, api) {  
11 - RestangularProvider.setBaseUrl(api.host);  
12 - RestangularProvider.setDefaultRequestParams({ apiKey: api.token });  
13 - }  
14 -  
15 - /** @ngInject */  
16 function config($logProvider) { 9 function config($logProvider) {
17 // Enable log 10 // Enable log
18 $logProvider.debugEnabled(true); 11 $logProvider.debugEnabled(true);
src/app/index.module.js
@@ -2,6 +2,6 @@ @@ -2,6 +2,6 @@
2 'use strict'; 2 'use strict';
3 3
4 angular 4 angular
5 - .module('dialoga', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'restangular', 'ui.router']); 5 + .module('dialoga', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ui.router']);
6 6
7 })(); 7 })();
src/app/partials/article/article.service.js
@@ -6,15 +6,14 @@ @@ -6,15 +6,14 @@
6 .factory('ArticleService', ArticleService); 6 .factory('ArticleService', ArticleService);
7 7
8 /** @ngInject */ 8 /** @ngInject */
9 - function ArticleService(Restangular, api, $log) { 9 + function ArticleService($http, $q, api, $log) {
10 $log.debug('ArticleService'); 10 $log.debug('ArticleService');
11 11
12 - var articlesRest = Restangular.all('articles');  
13 - 12 + var idArticleHome = '103358';
14 var _savedAbstract = null; 13 var _savedAbstract = null;
15 14
16 var service = { 15 var service = {
17 - getList: articlesRest.getList, 16 + apiArticles: api.host + 'articles/',
18 getHome: getHome, 17 getHome: getHome,
19 setHomeAbstract: setHomeAbstract, 18 setHomeAbstract: setHomeAbstract,
20 getHomeAbstract: getHomeAbstract 19 getHomeAbstract: getHomeAbstract
@@ -23,7 +22,11 @@ @@ -23,7 +22,11 @@
23 return service; 22 return service;
24 23
25 function getHome () { 24 function getHome () {
26 - return articlesRest.get(api.articleId.home, { 25 + return getArticleById(idArticleHome);
  26 + }
  27 +
  28 + function getArticleById (articleId) {
  29 + return $http.get(service.apiArticles + articleId, {
27 private_token: api.token, 30 private_token: api.token,
28 fields: 'id,children,categories,abstract,title,image,url,setting,position' 31 fields: 'id,children,categories,abstract,title,image,url,setting,position'
29 }); 32 });
src/app/partials/inicio/inicio.controller.js
@@ -32,10 +32,10 @@ @@ -32,10 +32,10 @@
32 hideBackground(2000); 32 hideBackground(2000);
33 } 33 }
34 34
35 - vm.ArticleService.getHome().then(function(homeArticle) {  
36 - vm.article = homeArticle.article; 35 + vm.ArticleService.getHome().then(function(result) {
  36 + vm.article = result.data.article;
37 }, function(error) { 37 }, function(error) {
38 - vm.$log.error(error); 38 + vm.$log.error('Error on getHome article.', error);
39 }); 39 });
40 }; 40 };
41 41
src/app/partials/inicio/inicio.html
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div class="embed-responsive embed-responsive-16by9"> 3 <div class="embed-responsive embed-responsive-16by9">
4 <div class="js-iframe" ng-show="inicio.content" ng-bind-html="inicio.content"></div> 4 <div class="js-iframe" ng-show="inicio.content" ng-bind-html="inicio.content"></div>
5 <div class="video-background" ng-click="inicio.showVideo()"> 5 <div class="video-background" ng-click="inicio.showVideo()">
6 - <div class="video-thumbnail" style="background-image:url(/assets/images/youtube-background.webp)"></div> 6 + <div class="video-thumbnail" style="background-image:url(/assets/images/youtube-background.png)"></div>
7 <button class="video-play-button" aria-live="assertive" aria-label="Assistir o vídeo tutorial Dialoga Brasil"> 7 <button class="video-play-button" aria-live="assertive" aria-label="Assistir o vídeo tutorial Dialoga Brasil">
8 <svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9"></path><path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff"></path><path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc"></path></svg> 8 <svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9"></path><path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff"></path><path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc"></path></svg>
9 </button> 9 </button>
src/assets/images/youtube-background.png 0 → 100644

64.1 KB