Created
February 10, 2015 07:12
-
-
Save marr/fae1b42e8ca51825fe51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/campaign.json b/campaign.json | |
index e69de29..dbe4cff 100644 | |
--- a/campaign.json | |
+++ b/campaign.json | |
@@ -0,0 +1,34 @@ | |
+{ | |
+ "campaign": { | |
+ "id": 1, | |
+ "guid": "CMP12345", | |
+ "title": "Senior Prank: Dumpsville College", | |
+ "description": "Let's get payback on that greedy shmuck!", | |
+ "questions": [ | |
+ { | |
+ "guid": "QUE12345", | |
+ "type": "dropdown", | |
+ "text": "What type of prank should we pull?", | |
+ "options": [ | |
+ { | |
+ "guid": "OPT12345", | |
+ "text": "Flood the library with crickets" | |
+ }, | |
+ { | |
+ "guid": "OPT23456", | |
+ "text": "Toilet paper the auditorium" | |
+ }, | |
+ { | |
+ "guid": "OPT45678", | |
+ "text": "Put the principal's car on the roof" | |
+ } | |
+ ] | |
+ }, | |
+ { | |
+ "guid": "QUE23456", | |
+ "type": "field", | |
+ "text": "How many hours can you dedicate this week?" | |
+ } | |
+ ] | |
+ } | |
+} | |
diff --git a/lib/Crowdtilt/Public/Site.pm b/lib/Crowdtilt/Public/Site.pm | |
index edc3d9b..ac5bda3 100644 | |
--- a/lib/Crowdtilt/Public/Site.pm | |
+++ b/lib/Crowdtilt/Public/Site.pm | |
@@ -1287,6 +1287,15 @@ get '/favicon.ico' => sub { | |
forward '/images/favicon.ico'; | |
}; | |
+get '/test' => sub { | |
+ #my $campaign = ct_api->get_campaign('questions'); | |
+ my $input_file = '/srv/www/current/campaign.json'; | |
+ open( my $input_fh, "<", $input_file ) || die "Can't open $input_file: $!"; | |
+ my $campaign = from_json(join('', <$input_fh>)); | |
+ debug $campaign; | |
+ template 'test.tt', $campaign; | |
+}; | |
+ | |
get '/token' => sub {}; | |
1; | |
diff --git a/views/test.tt b/views/test.tt | |
index 039727e..e552fd7 100644 | |
--- a/views/test.tt | |
+++ b/views/test.tt | |
@@ -1 +1,6 @@ | |
-lol | |
+[% PROCESS 'section/components.tt' %] | |
+ | |
+[% INCLUDE 'component' name = 'CampaignQuestions' props = { | |
+ questions => campaign.questions | |
+} %] | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment