97 lines
2.9 KiB
JavaScript
97 lines
2.9 KiB
JavaScript
|
angular.
|
||
|
module('catalog').
|
||
|
component('anList',{
|
||
|
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>',
|
||
|
controller :
|
||
|
function($scope, $http, $routeParams, $rootScope) {
|
||
|
$rootScope.lanEs = "http://es.anorgatarrak.eus/catalog/";
|
||
|
$rootScope.lanEu = "http://anorgatarrak.eus/catalog2/";
|
||
|
|
||
|
$http.get('wp-json/wp/v2/entrevista/?per_page=100').then(function(res) {
|
||
|
$scope.entrevistas = res.data;
|
||
|
console.log(res);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
|
||
|
angular.
|
||
|
module('catalog').
|
||
|
component('anHome',{
|
||
|
templateUrl: localized.partials + 'home.template.html',
|
||
|
controller: function($scope, $rootScope, $http, $routeParams) {
|
||
|
$rootScope.lanEs = "http://es.anorgatarrak.eus";
|
||
|
$rootScope.lanEu = "http://anorgatarrak.eus";
|
||
|
console.log($rootScope.loading);
|
||
|
$scope.loading = true;
|
||
|
window.scrollTo(0,0);
|
||
|
$http.get('wp-json/wp/v2/slideshow').then(function(res) {
|
||
|
$scope.slides = res.data;
|
||
|
$scope.loading = false;
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
angular.
|
||
|
module('catalog').
|
||
|
component('anContact',{
|
||
|
templateUrl: localized.partials + 'contact.template.html'
|
||
|
});
|
||
|
|
||
|
angular.
|
||
|
module('catalog').
|
||
|
component('anInfo',{
|
||
|
templateUrl: localized.partials + 'info.template.html',
|
||
|
controller: function($rootScope) {
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
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]);
|
||
|
//});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
angular
|
||
|
.module('catalog')
|
||
|
.component('anContent',{
|
||
|
templateUrl: localized.partials + 'content.template.html',
|
||
|
controller: function($scope, $http, $routeParams, $sce,$rootScope) {
|
||
|
$rootScope.startLoading();
|
||
|
console.log($routeParams.slug);
|
||
|
window.scrollTo(0,0);
|
||
|
$http.get('wp-json/wp/v2/pages/?slug='+$routeParams.slug).then(function(res) {
|
||
|
$scope.post = res.data[0];
|
||
|
console.log($scope.post.link_es);
|
||
|
$scope.content = $sce.trustAsHtml($scope.post.content.rendered);
|
||
|
//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);
|
||
|
$rootScope.stopLoading();
|
||
|
});
|
||
|
}
|
||
|
});
|