{"id":10344,"date":"2016-12-16T11:03:03","date_gmt":"2016-12-16T11:03:03","guid":{"rendered":"https:\/\/passkit.com\/blog\/?p=10344"},"modified":"2016-12-16T11:03:03","modified_gmt":"2016-12-16T11:03:03","slug":"how-to-create-a-pass-rendering-page-without-coding-experience","status":"publish","type":"post","link":"https:\/\/passkit.com\/blog\/how-to-create-a-pass-rendering-page-without-coding-experience\/","title":{"rendered":"How To Create a Landing Page that renders your Passes without coding experience"},"content":{"rendered":"<p>Wanna be able to visualise or show how your passes looks like? In this blog post we&#8217;ll cover how to build a page that renders your passes step by step, with the assumption that the user doesn&#8217;t have any coding capabilities.<\/p>\n<h3>Step 1 &#8211; Create a folder<\/h3>\n<p>Create a folder on your computer and name it &#8216;PassDisplay&#8217;. It can be anywhere in your machine. If you don&#8217;t know where to create it, just do it on your Desktop.<br \/>\nFrom this point you have two options:<\/p>\n<ol>\n<li>You can <a href=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/16093423\/passDisplay.zip\" target=\"_blank\" rel=\"noopener\">download these files<\/a> directly into the folder you just created and skip the process to step 6. You can find the files by <a href=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/16093423\/passDisplay.zip\" target=\"_blank\" rel=\"noopener\">clicking here<\/a>.<\/li>\n<li>You can go to setp 2 and create the files yourself. If you decide to do so and know a bit of coding, you will also be able to play around with colours and shapes of the landing page.<\/li>\n<\/ol>\n<h3>Step 2 &#8211; Create two files called index.html and display.js<\/h3>\n<p>If you are a Mac user you can do this with <a href=\"http:\/\/www.barebones.com\/products\/TextWrangler\/\" target=\"_blank\" rel=\"noopener\">TextWrangler<\/a>. You can download TextWrangler from the App store. If you are using Windows, you can use <a href=\"https:\/\/www.sublimetext.com\/download\" target=\"_blank\" rel=\"noopener\">Sublime Text<\/a> instead. In this guide we&#8217;ll use TextWrangler.<br \/>\n<strong>NOTE<\/strong>: From this point onwards, if you are using Windows, each time you read &#8216;TextWrangler&#8217; please perform the same action with &#8216;Sublime Text&#8217; or the Windows version of the text editor of your choice.<br \/>\n<strong>Step 2.a) Create file index.html<\/strong><br \/>\nIn order to create the file index.html follow the instructions below:<\/p>\n<ul>\n<li>Open TextWrangler<\/li>\n<li>Click on &#8216;File&#8217; on the top right of your Mac<\/li>\n<li>Click on &#8216;save as&#8217;<\/li>\n<li>Change the file name into index.html and save it into the PassDisplay folder you created in step 1<\/li>\n<\/ul>\n<p><strong>Step 2.b) Create file display.js<\/strong><\/p>\n<ul>\n<li>Open TextWrangler<\/li>\n<li>Click on &#8216;File&#8217; on the top right of your Mac<\/li>\n<li>Click on &#8216;save as&#8217;<\/li>\n<li>Change the file name into display.js and save it into the PassDisplay folder you created in step 1<\/li>\n<\/ul>\n<p>Here&#8217;s how the &#8216;save as&#8217; window for display.js should look like:<\/p>\n<h1><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-10348\" src=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/14092122\/Screen-1.png\" alt=\"Screen 1\" width=\"1035\" height=\"320\" title=\"\"><\/h1>\n<h3>Step 3 &#8211; Copy the following codes in the respective file<\/h3>\n<p>In this step you need to open the files with TextWrangler. <strong>display.js file<\/strong>: For display.js copy and paste the following code:<br \/>\n<code><br \/>\n(function (angular, $, isMobile) {<br \/>\n\/\/ Main driver of Angular functionality<\/code><br \/>\n<code>angular.module(\"myApp\", [\"pk-pass-display\"])<br \/>\n.config([\"$locationProvider\", function($locationProvider) {<br \/>\n$locationProvider.html5Mode({enabled:true,requireBase:false});<br \/>\n}])<br \/>\n.controller(\"passCtrl\", [\"$scope\", \"$window\", \"$http\", \"$location\", passController]);<br \/>\n\/\/ This is the function that checks if your pass is valid and what type of device you are using<br \/>\nfunction passController($scope, $window, $http, $location) {<br \/>\n\/\/ This section checks the end of your url for the pass id<br \/>\nvar passId = $location.search().pid;<br \/>\n$scope.passId = passId;<br \/>\nconsole.log(passId);<\/code><br \/>\n<code>$scope.passDisplayError = passDisplayError;<br \/>\n$scope.passDisplayLoaded = passDisplayLoaded;<br \/>\n\/\/ The list below contains all of the initial true\/false values that can change in the function<br \/>\n$scope.passLoaded = false;<br \/>\n$scope.passValid = true;<br \/>\nvar bundleLink = \"https:\/\/api-pass.passkit.net\/v2\/passes\/\" + passId + \"\/bundle?static=true\";<br \/>\n$scope.passLinkIos = bundleLink;<br \/>\n$scope.passLinkPlayStore = \"https:\/\/play.google.com\/store\/apps\/details?id=com.passesalliance.wallet&amp;referrer=\" + encodeURIComponent(bundleLink);<br \/>\n$scope.androidIntent = function(){doIntent('pass2u', '\/\/import\/'+ encodeURIComponent(bundleLink), 'com.passesalliance.wallet');};<br \/>\n$scope.passLink = encodeURIComponent($location.absUrl());<br \/>\nfunction passDisplayError() {<br \/>\n$scope.passValid = false;<br \/>\n$scope.passLoaded = true;<br \/>\n}<br \/>\nfunction passDisplayLoaded(pass) {<br \/>\n$scope.passValid = !pass.isInvalid;<br \/>\n$scope.passLoaded = true;<br \/>\n}<br \/>\n}<\/code><br \/>\n<code>\/\/ Copy and paste this section directly<br \/>\nfunction doIntent(intentScheme, intentCommand, intentPackage) {<br \/>\n\/\/ do the intent<br \/>\nif (navigator.userAgent.match(\/Android\/)) {<br \/>\nvar intentUrl = intentScheme + \":\" + intentCommand;<br \/>\nif (\/Chrome[\\\/\\s](\\d+\\.\\d+)\/.test(navigator.userAgent)) {<br \/>\nvar versionChrome=new Number(RegExp.$1);<br \/>\nif (\/OPR[\\\/\\s](\\d+\\.\\d+)\/.test(navigator.userAgent)) {<br \/>\nintentUrl = intentScheme + \":\" + intentCommand;<br \/>\n}else if(\/FBAV[\\\/\\s](\\d+\\.\\d+)\/.test(navigator.userAgent)){<br \/>\nintentUrl = intentScheme + \":\" + intentCommand;<br \/>\nwindow.location = intentUrl;<br \/>\n}else {<br \/>\nif (versionChrome &gt; 18) {<br \/>\nintentUrl = \"intent:\" + intentCommand + \"#Intent;scheme=\" + intentScheme + \";package=\" + intentPackage + \";end\";<br \/>\nwindow.location = intentUrl;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\nif ( intentUrl === intentScheme + \":\" + intentCommand) {<br \/>\nvar iframe = document.createElement(\"iframe\");<br \/>\niframe.style.border = \"none\";<br \/>\niframe.style.width = \"0\";<br \/>\niframe.style.height = \"0\";<br \/>\niframe.setAttribute(\"id\", intentPackage);<br \/>\niframe.src = intentUrl;<br \/>\ndocument.body.appendChild(iframe);<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n\/\/ detects what kind of device you are using<br \/>\n$( document ).ready(function() {<br \/>\n\/\/ detect iPhone<br \/>\nif (isMobile.apple.phone || isMobile.apple.ipod) {<br \/>\ndocument.getElementById(\"ios\").style.display=\"block\";<br \/>\nconsole.log(\"ios\");<br \/>\n}<br \/>\n\/\/ detect android<br \/>\nelse if (isMobile.android.phone || isMobile.android.tablet) {<br \/>\ndocument.getElementById(\"android\").style.display=\"block\";<br \/>\nconsole.log(\"android\");<br \/>\n} else {<br \/>\n\/\/ show desktop<br \/>\ndocument.getElementById(\"browser\").style.display=\"block\";<br \/>\nconsole.log(\"browser\");<br \/>\n}<br \/>\n});<br \/>\n})(window.angular, window.jQuery, window.isMobile);<\/code><br \/>\nHere&#8217;s how the code pasted into the file dispaly.js should look like:<\/p>\n<h1><img decoding=\"async\" class=\"aligncenter size-full wp-image-10349\" src=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/14092208\/Screen-2.png\" alt=\"Screen 2\" width=\"1280\" height=\"801\" title=\"\"><\/h1>\n<p><strong>Index.html<\/strong> File: For index.html\u00a0copy and paste the following code:<br \/>\n<code>&lt;!DOCTYPE html&gt;<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/css\/bootstrap.min.css\"&gt;<br \/>\n&lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"pk-pass-display.min.css\"&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;!--This line allows all of the Angular variables to be included in the rendering of the page--&gt;<br \/>\n&lt;body &gt;<br \/>\n&lt;!--This section validates your pass and the device your using--&gt;<br \/>\n&lt;div class=\"col-xs-12 center download-page\" &gt;<br \/>\n&lt;!--Checks that your pass is valid--&gt;<br \/>\n&lt;div data-ng-app=\"myApp\" data-ng-controller=\"passCtrl\" data-ng-show=\"passValid\"&gt;<br \/>\n&lt;pk-apple-pass pass-id=\"{{passId}}\" bg-color=\"#000\" language=\"{{language}}\" on-error=\"passDisplayError()\" on-loaded=\"passDisplayLoaded(pass)\"&gt;&lt;\/pk-apple-pass&gt;<br \/>\n&lt;\/div&gt;<\/code><br \/>\n<code>&lt;!--Checks that your pass is valid and if your device is Ios.--&gt;<\/code><br \/>\n<code>&lt;div id=\"ios\" style=\"display:none;\"&gt;<br \/>\n&lt;!--If your device is Ios then specific button links will be supplied--&gt;<br \/>\n&lt;a class=\"button-link\" ng-href=\"{{passLinkIos}}\"&gt;&lt;img ng-src=\"include\/images\/{{languageText[language].linkLang}}\/btn-applewallet.png\" alt=\"Add to Apple Wallet\" \/&gt;&lt;\/a&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;!--Checks that your pass is valid and if your device is Android--&gt;<\/code><br \/>\n<code>&lt;div id=\"android\" style=\"display:none;\"&gt;<br \/>\n&lt;!--If your device is Android then specific button links will be supplied--&gt;<br \/>\n&lt;div class=\"button-link\" ng-click=\"androidIntent()\"&gt;&lt;img ng-src=\"include\/images\/{{languageText[language].linkLang}}\/btn-pass2u.png\" alt=\"Add to Pass2U\" \/&gt;&lt;\/div&gt;<br \/>\n&lt;a class=\"button-link\" ng-href=\"{{passLinkPlayStore}}\"&gt;&lt;img ng-src=\"include\/images\/{{languageText[language].linkLang}}\/btn-googleplay.png\" alt=\"Get it on Google Play\" \/&gt;&lt;\/a&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;!--Checks that your pass is valid and if your device is a desktop using a browser--&gt;<br \/>\n&lt;div id=\"browser\" style=\"display:none;\"&gt;<br \/>\n&lt;!--If your device is a desktop using a browser, you will be shown a QR code--&gt;<br \/>\n&lt;div class=\"qr-code\"&gt;&lt;img ng-src=\"https:\/\/d1ye292yvr7tf6.cloudfront.net\/images\/barcode.php?m={{passLink}}&amp;f=qr&amp;e=UTF-8&amp;x2=1\" \/&gt;&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n&lt;!--These are all of the javascript libraries needed--&gt;<br \/>\n&lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.11.2\/jquery.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.6.0-rc.2\/angular.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"https:\/\/momentjs.com\/downloads\/moment-with-locales.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"isMobile.js\" charset=\"utf-8\" type=\"text\/javascript\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"display.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;script src=\"pk-pass-display.min.js\"&gt;&lt;\/script&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/code><br \/>\nHere&#8217;s how the code pasted into the file index.html should look like:<\/p>\n<h1><img decoding=\"async\" class=\"aligncenter size-full wp-image-10350\" src=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/14092240\/Screen-3.png\" alt=\"Screen 3\" width=\"1283\" height=\"783\" title=\"\"><\/h1>\n<h3>Step 4 &#8211;\u00a0download the pk-pass-display.min.css \/ pk-pass-display.min.js directly to your files<\/h3>\n<p>&nbsp;<br \/>\nIn order to perform this task, please follow the instructions below:<\/p>\n<ul>\n<li>Go to: https:\/\/github.com\/PassKitInc\/pk-pass-display<\/li>\n<li>Click &#8216;Clone or download&#8217;<\/li>\n<li>Click &#8216;download zip&#8217;<\/li>\n<li>Go to downloads<\/li>\n<li>Unzip pk-pass-display-dist.zip<\/li>\n<li>Open pk-pass-display-dist<\/li>\n<li>Open file &#8216;dist&#8217;<\/li>\n<li>Copy or move the files <strong>pk-pass-display.min.css<\/strong> and <strong>pk-pass-display.min.js<\/strong> directly to your PassDisplay folder created in step 1.<\/li>\n<\/ul>\n<p><strong>NOTE<\/strong>:\u00a0If you are adding the content of the index.html file to an already existing file, please pay close attention to the order of the &lt;link rel=&#8221;stylesheet&#8221; and &lt;script src= lines at the top and bottom of the file. Their order is important to the functionality of the program.<\/p>\n<h3>Step 5 &#8211; Create isMobile.js file<\/h3>\n<p>For this part, go to <a href=\"https:\/\/github.com\/kaimallea\/isMobile\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/kaimallea\/isMobile<\/a>\u00a0and follow the instructions below:<\/p>\n<ul>\n<li>Click the file named isMobile.js<\/li>\n<li>Click the button &#8220;Raw&#8221;<\/li>\n<li>Copy the file<\/li>\n<li>Create a file in your passDisplay folder called isMobile.js<\/li>\n<li>Paste what you copied into that file and save<\/li>\n<\/ul>\n<p>Here&#8217;s how the code pasted into the file isMobile.js should look like:<\/p>\n<h1><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10351\" src=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/14092307\/Screen-4.png\" alt=\"Screen 4\" width=\"1032\" height=\"799\" title=\"\"><\/h1>\n<p>At this stage your PassDisplay folder should contain five files (display.js, index.html, isMobile.js, pk-pass-display.min.css and pk-pass-display.min.js).<\/p>\n<h3>Step 6 &#8211; Open index.html in your browser<\/h3>\n<p>Once you are in the PassDisplay folder again, you can double click on index.html and you will notice that the page is blank. This is normal, as you\u00a0have not supplied a pass id for the program to read yet. In order to do so, please add the following piece of text to your URL and complete the next step:<\/p>\n<p style=\"text-align: center;\"><em>?pid=<\/em><\/p>\n<h3 style=\"text-align: left;\">Step 7 &#8211; Add your pass ID after the =<\/h3>\n<p>You need to have a pass id in order to complete this step. You can find pass id after you create a template and issue passes through\u00a0<a href=\"http:\/\/app.passkit.com\" target=\"_blank\" rel=\"noopener\">the PassKit Portal<\/a>. If you don&#8217;t have one pass id yet, you can use the following one as a test:<\/p>\n<p style=\"text-align: center;\"><em>i1BgjTJt6aYL37\u00a0<\/em><\/p>\n<p style=\"text-align: left;\">So your URL will look something like this:<\/p>\n<h6 style=\"text-align: center;\"><em>file:\/\/\/xxx\/yyy\/zzz\/passDisplay\/index.html?pid=i1BgjTJt6aYL37<\/em><\/h6>\n<p>And here&#8217;s an example of how your landing page could look like:<\/p>\n<h1><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-10352\" src=\"https:\/\/dxjl3qy52c1o9.cloudfront.net\/wp-content\/uploads\/2016\/12\/14092328\/Screen-5.png\" alt=\"Screen 5\" width=\"793\" height=\"501\" title=\"\"><\/h1>\n<h3>Now it&#8217;s your turn<\/h3>\n<p>Did you find this article useful? Are you going to create your own landing page? Please let us know if you have any doubts or questions in the comment section below.<br \/>\nYou might also want to read\u00a0<a href=\"https:\/\/passkit.com\/blog\/how-to-use-passkit-api-tips-and-instructions\/\">How To Use the PassKit API<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wanna be able to visualise or show how your passes looks like? In this blog post we&#8217;ll cover how to build a page that renders your passes step by step, with the assumption that the user doesn&#8217;t have any coding capabilities. Step 1 &#8211; Create a folder Create a folder on your computer and name [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":10378,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,18,31],"tags":[],"class_list":["post-10344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-cherrypie","category-mobile-wallet-2"],"_links":{"self":[{"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/posts\/10344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/comments?post=10344"}],"version-history":[{"count":0,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/posts\/10344\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/media\/10378"}],"wp:attachment":[{"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/media?parent=10344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/categories?post=10344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/passkit.com\/blog\/wp-json\/wp\/v2\/tags?post=10344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}