From f260139b2d595865974d198b616e0b3ded162b61 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 5 Apr 2021 15:07:18 +0800 Subject: [PATCH] [temp]Ajax request of happening now JSON in progress --- app/controllers/conferences_controller.rb | 3 +++ app/views/conferences/show.html.haml | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 02d869f4..cf5fd04a 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -69,6 +69,9 @@ class ConferencesController < ApplicationController ).order('sponsorship_levels.position ASC', 'sponsors.name') @sponsors = @conference.sponsors end + if splashpage.include_happening_now + @happening_now_url = happening_now_conference_schedule_path(conference_id: @conference.short_title, format: :json) + end end def calendar diff --git a/app/views/conferences/show.html.haml b/app/views/conferences/show.html.haml index 0cb00f30..8d24a439 100644 --- a/app/views/conferences/show.html.haml +++ b/app/views/conferences/show.html.haml @@ -46,8 +46,7 @@ -# happening now events - if @conference.splashpage.include_happening_now - = 'Hello Word' - + = 'test' -# calls for content, or program - if @conference.splashpage.include_cfp = render 'call_for_content', conference: @conference, @@ -86,3 +85,22 @@ - if @conference.contact.has_social_media? = render 'social_media', contact: @conference.contact = render 'footer' + +:javascript + var loadData = function() { + $.ajax({ + type: 'GET', + contentType: 'application/json; charset=utf-8', + url: '#{@happening_now_url}', + dataType: 'json', + success: renderTemplate, + failure: function(){ + console.log('error'); + } + }); + }; + + var renderTemplate = function(data) { + console.log(data); + console.log("template rendered"); + } \ No newline at end of file