2017-08-20 12:55:35 +02:00
|
|
|
angular.
|
|
|
|
module('catalog').
|
|
|
|
component('anList',{
|
2017-11-09 19:40:49 +01:00
|
|
|
templateUrl : localized.partials + 'catalog.template.html',
|
|
|
|
//'<a ng-repeat="item in $ctrl.catalog" class="square" style="background-image:url(\'{{item.img}}\');" ng-href="#!/catalog/{{item.id}}"></a>',
|
2018-02-23 01:59:35 +01:00
|
|
|
controller :
|
|
|
|
function($scope, $http, $routeParams, $rootScope) {
|
|
|
|
$rootScope.lanEs = "http://es.anorgatarrak.eus/catalog/";
|
|
|
|
$rootScope.lanEu = "http://anorgatarrak.eus/catalog2/";
|
|
|
|
|
2018-02-15 19:26:12 +01:00
|
|
|
$http.get('wp-json/wp/v2/entrevista/?per_page=100').then(function(res) {
|
|
|
|
$scope.entrevistas = res.data;
|
|
|
|
console.log(res);
|
2017-11-09 19:40:49 +01:00
|
|
|
});
|
|
|
|
}
|
2017-08-20 12:55:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
angular.
|
|
|
|
module('catalog').
|
|
|
|
component('anHome',{
|
2017-11-09 19:40:49 +01:00
|
|
|
templateUrl: localized.partials + 'home.template.html',
|
2017-12-15 01:17:46 +01:00
|
|
|
controller: function($scope, $rootScope, $http, $routeParams) {
|
2018-02-23 01:59:35 +01:00
|
|
|
$rootScope.lanEs = "http://es.anorgatarrak.eus";
|
|
|
|
$rootScope.lanEu = "http://anorgatarrak.eus";
|
2017-12-15 01:17:46 +01:00
|
|
|
console.log($rootScope.loading);
|
|
|
|
$scope.loading = true;
|
|
|
|
window.scrollTo(0,0);
|
2017-11-09 19:40:49 +01:00
|
|
|
$http.get('wp-json/wp/v2/slideshow').then(function(res) {
|
|
|
|
$scope.slides = res.data;
|
2017-12-15 01:17:46 +01:00
|
|
|
$scope.loading = false;
|
2017-11-09 19:40:49 +01:00
|
|
|
});
|
|
|
|
}
|
2017-08-20 12:55:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
angular.
|
|
|
|
module('catalog').
|
|
|
|
component('anContact',{
|
2017-11-09 19:40:49 +01:00
|
|
|
templateUrl: localized.partials + 'contact.template.html'
|
2017-08-20 12:55:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
angular.
|
|
|
|
module('catalog').
|
|
|
|
component('anInfo',{
|
2018-02-23 01:59:35 +01:00
|
|
|
templateUrl: localized.partials + 'info.template.html',
|
|
|
|
controller: function($rootScope) {
|
|
|
|
|
|
|
|
}
|
2017-11-09 19:40:49 +01:00
|
|
|
});
|
|
|
|
|
2018-02-23 01:59:35 +01:00
|
|
|
angular.
|
|
|
|
module('catalog').
|
|
|
|
component('anLanguage', {
|
|
|
|
templateUrl: localized.partials + 'language.template.html',
|
|
|
|
controller: function($scope,$http,$routeParams,$sce,$rootScope,$location) {
|
|
|
|
|
|
|
|
console.log($rootScope);
|
|
|
|
$scope.lan = function (l) {
|
|
|
|
|
|
|
|
if (l=='es') {
|
|
|
|
window.location.assign($rootScope.lanEs);
|
|
|
|
} else {
|
|
|
|
window.location.assign($rootScope.lanEu);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
//console.log("anLanguage:"+$routeParams);
|
|
|
|
//$http.get('wp-json/anorgatarrak/v1/link/'+$routeParams.slug).then(function(res) {
|
|
|
|
// data = res.data;
|
|
|
|
// console.log(data);
|
|
|
|
//jQuery('#lan_link_eus').attr('href',data[1][1]);
|
|
|
|
//jQuery('#lan_link_es').attr('href',data[0][1]);
|
|
|
|
//});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-11-09 19:40:49 +01:00
|
|
|
angular
|
|
|
|
.module('catalog')
|
|
|
|
.component('anContent',{
|
|
|
|
templateUrl: localized.partials + 'content.template.html',
|
2018-02-15 19:26:12 +01:00
|
|
|
controller: function($scope, $http, $routeParams, $sce,$rootScope) {
|
|
|
|
$rootScope.startLoading();
|
2017-11-09 19:40:49 +01:00
|
|
|
console.log($routeParams.slug);
|
2017-12-15 01:17:46 +01:00
|
|
|
window.scrollTo(0,0);
|
2018-02-15 19:26:12 +01:00
|
|
|
$http.get('wp-json/wp/v2/pages/?slug='+$routeParams.slug).then(function(res) {
|
2018-02-23 01:59:35 +01:00
|
|
|
$scope.post = res.data[0];
|
|
|
|
console.log($scope.post.link_es);
|
2018-02-15 19:26:12 +01:00
|
|
|
$scope.content = $sce.trustAsHtml($scope.post.content.rendered);
|
2018-02-23 01:59:35 +01:00
|
|
|
//console.log('llamamos el cambi ode idioma');
|
|
|
|
$rootScope.lanEs = $scope.post.link_es;
|
|
|
|
$rootScope.lanEu = $scope.post.link_eu;
|
|
|
|
//jQuery('#lan_link_eus').attr('href',"/"+$scope.post.link_eu); //.on('click',function() { alert('sss'); });
|
|
|
|
//jQuery('#lan_link_es').attr('href',"/"+$scope.post.link_es);
|
2018-02-15 19:26:12 +01:00
|
|
|
$rootScope.stopLoading();
|
2018-02-23 01:59:35 +01:00
|
|
|
});
|
2017-11-09 19:40:49 +01:00
|
|
|
}
|
2017-08-20 12:55:35 +02:00
|
|
|
});
|