From 1eb79abdc1b7ddaa3fd7da1063dfd9c0a71081f8 Mon Sep 17 00:00:00 2001 From: Luca - Audio-lab Date: Fri, 15 Dec 2017 01:17:46 +0100 Subject: [PATCH] =?UTF-8?q?Quito=20slideshow,=20a=C3=B1ado=20multilanguage?= =?UTF-8?q?,=20falta=20solucionar=20problema=20con=20el=20bot=C3=B3n=20de?= =?UTF-8?q?=20idiomas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/anorgatarrak.js | 2 +- app/catalog/catalog.component.js | 12 +++--- app/catalog/catalog.config.js | 10 +++-- app/catalog/catalog.module.js | 1 + app/catalog/item.component.js | 20 ++++++--- app/catalog/item.module.js | 10 ++++- css/anorgatarrak.css | 9 +++++ functions.php | 32 ++++++++++++++- index.php | 35 +++++++++------- partials/catalog.template.html | 2 +- partials/content.template.html | 12 ++++-- partials/home.template.html | 23 ++++++++--- partials/item-detail.template.html | 65 ++++++++++++++++++++++++------ 13 files changed, 178 insertions(+), 55 deletions(-) diff --git a/app/anorgatarrak.js b/app/anorgatarrak.js index a8ccdd01..f39dc955 100644 --- a/app/anorgatarrak.js +++ b/app/anorgatarrak.js @@ -8,7 +8,7 @@ angular.module('anApp',[ jQuery(document).ready(function() { //console.log('ready'); - var slsh; + //var slsh; //var slsh = new SlideShow('.slideshow', {timeout: 5000}); }); diff --git a/app/catalog/catalog.component.js b/app/catalog/catalog.component.js index 772270a3..8d082acc 100644 --- a/app/catalog/catalog.component.js +++ b/app/catalog/catalog.component.js @@ -36,13 +36,14 @@ angular. module('catalog'). component('anHome',{ templateUrl: localized.partials + 'home.template.html', - controller: function($scope, $http, $routeParams) { + controller: function($scope, $rootScope, $http, $routeParams) { + 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; - //slsh = new SlideShow('.slideshow', {timeout: 4000}); - //console.log('content'); + $scope.loading = false; }); - //$http.get('wp-json/wp/v2/posts').then(function(res) { $scope.posts = res.data; }); } }); @@ -64,6 +65,7 @@ angular templateUrl: localized.partials + 'content.template.html', controller: function($scope, $http, $routeParams, $sce) { console.log($routeParams.slug); - $http.get('wp-json/wp/v2/pages/?slug='+$routeParams.slug).then(function(res) { $scope.post = res.data[0]; $scope.content = $sce.trustAsHtml($scope.post.content.rendered); }); + window.scrollTo(0,0); + $http.get('wp-json/wp/v2/pages/?slug='+$routeParams.slug).then(function(res) { $scope.post = res.data[0]; $scope.content = $sce.trustAsHtml($scope.post.content.rendered); }); } }); diff --git a/app/catalog/catalog.config.js b/app/catalog/catalog.config.js index 43ea431f..6a667374 100644 --- a/app/catalog/catalog.config.js +++ b/app/catalog/catalog.config.js @@ -4,17 +4,21 @@ angular. function config($locationProvider, $routeProvider) { //$locationProvider.hashPrefix('!'); $locationProvider.html5Mode(true); + var a = window.location.host.split('.')[0]; $routeProvider .when('/',{ template: ''}) .when('/catalog', { template: '' }) - .when('/catalog/:itemId', { + .when('/catalog/:slug', { template: '' }) .when('/info', {template: ''}) - .when('/contact', {template: ''}) + //.when('/contact', {template: ''}) .when('/:slug',{template: ''}) .otherwise({ redirectTo: '/'}); } - ]); + ]). + run(function($rootScope) { + $rootScope.loading = false; + }); diff --git a/app/catalog/catalog.module.js b/app/catalog/catalog.module.js index 20c72c87..4fb7c848 100644 --- a/app/catalog/catalog.module.js +++ b/app/catalog/catalog.module.js @@ -1,2 +1,3 @@ angular.module('catalog', [ 'ngRoute']); + diff --git a/app/catalog/item.component.js b/app/catalog/item.component.js index 10c1b770..3c993417 100644 --- a/app/catalog/item.component.js +++ b/app/catalog/item.component.js @@ -2,9 +2,19 @@ angular. module('item'). component('anDetail', { templateUrl: localized.partials + '/item-detail.template.html', - controller: ['$routeParams', - function ItemDetailController($routeParams) { - this.itemId = $routeParams.itemId; - } - ] + controller: function($scope, $http, $routeParams, $sce, SubdomainService) { + //console.log($routeParams.slug); + $scope.lang = SubdomainService.subdomain; + $http.get('wp-json/wp/v2/entrevista/?slug='+$routeParams.slug).then(function(res) { + //console.log(res.data[0]); + $scope.post = res.data[0]; + }); + } + + // controller: ['$routeParams', + // function ItemDetailController($routeParams) { + // this.itemId = $routeParams.itemId; +// $http.get('wp-json/wp/v2/entrevistas/?slug='+$routeParams.slug).then(function(res) { $scope.post = res.data[0]; $scope.content = $sce.trustAsHtml($scope.post.content.rendered); }); + // } + //] }); diff --git a/app/catalog/item.module.js b/app/catalog/item.module.js index 3d96c771..a0b6379d 100644 --- a/app/catalog/item.module.js +++ b/app/catalog/item.module.js @@ -1 +1,9 @@ -angular.module('item',['ngRoute']); +angular.module('item',['ngRoute']); +angular.module('item').factory('SubdomainService', [ + '$location', function($location) { + var service = {}; + service.subdomain = window.location.host.split('.')[0]; + if (window.location.host.split('.').length != 3) { service.subdomain = 'eus'; } + return service; + } +]); diff --git a/css/anorgatarrak.css b/css/anorgatarrak.css index 25a40f5d..5e6054c4 100644 --- a/css/anorgatarrak.css +++ b/css/anorgatarrak.css @@ -101,3 +101,12 @@ h2 {font-weight:bold; color: rgba(255,153,51.255);} } .slideshow img::before {display:none;} + +.navbar-header .navbar-collapse ul li.lang-item { float:left;} +.navbar-header .navbar-collapse ul { list-decoration:none;padding:0;} +.navbar-header .navbar-collapse ul li a { padding:10px 15px; } + +/* static slider */ + +.slideshow-static { padding:0; } +.slideshow-static li { list-style:none;} diff --git a/functions.php b/functions.php index 7995d1fb..3434dab8 100644 --- a/functions.php +++ b/functions.php @@ -73,13 +73,35 @@ function create_posttype() { function my_rest_prepare_slideshow($data,$post,$request) { $_data = $data->data; $thumbnail_id = get_post_thumbnail_id($post->ID); - $thumbnail = wp_get_attachment_image_src ($thumbnail_id,array(100,100),true); + #$thumbnail = wp_get_attachment_image_src ($thumbnail_id); + $thumbnail = wp_get_attachment_image_src ($thumbnail_id,'full',false); $_data['featured_image_thumbnail_url'] = $thumbnail[0]; $_data['excerpt_clean'] = strip_tags(get_the_excerpt($post->ID)); $data->data = $_data; return $data; } +function my_rest_prepare_entrevista($data,$post,$request) { + $_data = $data->data; + //thumbnail + $thumbnail_id = get_post_thumbnail_id($post->ID); + $thumbnail = wp_get_attachment_image_src ($thumbnail_id); + $_data['featured_image_thumbnail_url'] = $thumbnail[0]; + //category + $_data['category'] = wp_get_post_terms($post->ID,'termino'); + //acf + $_data['e_idioma'] = get_field('idioma',$post->ID); + $_data['e_informantes'] = get_field('informantes',$post->ID); + $_data['e_audiovisual'] = get_field('audiovisual',$post->ID); + $_data['e_transcripcion'] = get_field('transcripcion',$post->ID); + $_data['e_fecha_de_entrevista'] = get_field('fecha_de_entrevista',$post->ID); + $_data['e_localizacion'] = get_field('lugar',$post->ID); + $data->data = $_data; + return $data; + + +} + function anorgatarrak_metabox() { add_meta_box('entrevista-anorgatarrak-metabox',__('Datos entrevista'),'cd_metabox_entrevista', 'entrevista','normal','high'); } @@ -109,13 +131,19 @@ function create_anorgatarrak_tesaurus() { 'label' => __('Profesiones'), 'rewrite' => array('slug' => 'profesion'), )); + register_taxonomy('etapas','entrevista',array( + 'label' => _('Etapas del proyecto'), + 'rewrite' => array('slug' => 'etapas'), + )); } add_action( 'init', 'create_anorgatarrak_tesaurus' ); add_action( 'admin_menu', 'remove_menus' ); add_filter('rest_prepare_slideshow','my_rest_prepare_slideshow', 12, 3); -add_filter('rest_prepare_entrevista','my_rest_prepare_slideshow', 12, 3); +add_filter('rest_prepare_entrevista','my_rest_prepare_entrevista', 12, 3); +add_filter('rest_prepare_post','my_rest_prepare_slideshow', 12, 3); +add_filter('rest_prepare_page','my_rest_prepare_slideshow', 12, 3); add_theme_support( 'post-thumbnails' ); add_action('init','create_posttype'); diff --git a/index.php b/index.php index 501ca667..07080d58 100644 --- a/index.php +++ b/index.php @@ -4,6 +4,7 @@ +
+

+
- +
+ +
+
+
@@ -55,12 +57,15 @@
- 'menu_order' + ); + $pages = get_pages($args); foreach ($pages as $page) : ?> - -

post_title; ?>

post_excerpt; ?>
+ +

post_title; ?>

post_excerpt; ?>
+info
diff --git a/partials/catalog.template.html b/partials/catalog.template.html index 78829103..1f6b652c 100644 --- a/partials/catalog.template.html +++ b/partials/catalog.template.html @@ -1,5 +1,5 @@
- +
diff --git a/partials/content.template.html b/partials/content.template.html index 97ed1de9..715e915d 100644 --- a/partials/content.template.html +++ b/partials/content.template.html @@ -1,6 +1,12 @@
-
-

{{post.title.rendered}}

-
+
+
+

{{post.title.rendered}}

+
+
+
+
+
+
diff --git a/partials/home.template.html b/partials/home.template.html index 71bbbd77..3c17862b 100644 --- a/partials/home.template.html +++ b/partials/home.template.html @@ -1,10 +1,21 @@ -
    + -
  • - {{slide.excerpt_clean}} -
  • -
+ + +
+
+
+

{{slides[0].title.rendered}}

+

{{slides[0].excerpt_clean}}

+
+
+
+ + diff --git a/partials/item-detail.template.html b/partials/item-detail.template.html index bff06bd0..0b240c8f 100644 --- a/partials/item-detail.template.html +++ b/partials/item-detail.template.html @@ -1,22 +1,61 @@
+
-

Entrevista a Kontxi y María Dolores Elizegi

+

{{post.title.rendered}}

-
    -
  • MZP_IO_3332
  • -
  • EUS
  • + +
      +
    • {{post.e_idioma}}
    • +
    • {{post.e_localizacion.address}}
    • +
    • {{post.e_fecha_de_entrevista}}
    • +
    • +
        +
      • {{i.post_title}}
      • +
      +
    • +
    • +
        +
      • +
      +
    • +
    + + +
      +
    • {{post.e_idioma}}
    • +
    • {{post.e_localizacion.address}}
    • +
    • {{post.e_fecha_de_entrevista}}
    • +
    • +
        +
      • {{i.post_title}}
      • +
      +
    • +
    • +
        +
      • +
      +
    • +
    + +
+
+ + +
+
+
+
+
+
-
  • Antiguo, Donostia-San Sebastián, Guipúzcoa, País Vasco, España
  • -
  • 2017/03/01
  • -
  • -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel faucibus tortor, a condimentum nulla. Mauris rhoncus, lectus quis faucibus viverra, dui arcu tristique nulla, eu congue augue nulla a mauris. Etiam sed risus porta, consectetur diam et, commodo massa. In sit amet nunc ut risus hendrerit euismod. Quisque at lectus mauris. Phasellus sit amet egestas nisi, id consequat tellus. Donec iaculis eget nulla eu varius. Nullam sollicitudin est ut neque aliquam, id porta nulla pulvinar. Fusce malesuada lectus malesuada gravida tristique. Proin scelerisque porta luctus. Vestibulum dictum, nunc at congue eleifend, purus urna pharetra risus, ultricies iaculis sapien augue quis est. Maecenas porttitor pulvinar orci, et posuere neque semper sed. Maecenas consequat sed neque a finibus. Integer tristique massa condimentum ligula consequat blandit. Sed tincidunt leo eget convallis tincidunt. Curabitur eget blandit lorem.

    -

    Pellentesque eu ipsum leo. Vestibulum sit amet felis eu mauris ultrices ornare. Phasellus et turpis in urna interdum varius in sit amet nunc. Phasellus auctor purus eu enim mollis tempor. Sed et arcu sem. Maecenas lobortis lacinia nulla, et sagittis sapien vestibulum eu. Mauris varius dapibus purus et facilisis. Nullam placerat nisl vitae nisi euismod, dapibus pulvinar diam finibus.

    -

    Aenean vitae laoreet mauris. Nullam mauris dolor, egestas vel eleifend vitae, interdum sed ex. Sed fermentum ac velit vitae porttitor. Fusce porta dictum lobortis. Nulla est sapien, convallis nec laoreet nec, sodales quis ligula. In volutpat metus fermentum ante maximus imperdiet. Etiam dictum urna nec augue porta luctus. Vestibulum cursus tortor nec sem vulputate pulvinar. Vivamus posuere massa eu aliquet viverra. Quisque consequat egestas egestas. Donec vel eleifend diam, vitae sollicitudin dolor. Aenean et vehicula nulla. Ut eu felis sit amet sem molestie tincidunt sit amet non velit.

    -
  • -
    -