X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Ftemplate%2Fauthorization-request-html.js;fp=src%2Ftemplate%2Fauthorization-request-html.js;h=3e312af683721642a18357b1a6e99084aa98daca;hp=0000000000000000000000000000000000000000;hb=b0103b0d496262c438b40bc20304081dbfe41e73;hpb=8ed81748bce7cea7904cac7225b20a60cafdfc16
diff --git a/src/template/authorization-request-html.js b/src/template/authorization-request-html.js
new file mode 100644
index 0000000..3e312af
--- /dev/null
+++ b/src/template/authorization-request-html.js
@@ -0,0 +1,376 @@
+'use strict';
+
+const th = require('./template-helper');
+
+
+/**
+ * @param {Object} hApp
+ * @param {Object} hApp.properties
+ * @param {String[]=} hApp.properties.url
+ * @param {String[]=} hApp.properties.summary
+ * @param {String[]=} hApp.properties.logo
+ * @param {String[]=} hApp.properties.name
+ * @returns {String}
+ */
+function renderClientIdentifierProperties(hApp) {
+ const properties = hApp.properties || {};
+ const parts = [];
+ let imgTitle = '';
+ const { url, summary, logo, name } = properties;
+
+ parts.push('');
+ if (url && url.length) {
+ parts.push(``);
+ }
+ if (summary && summary.length) {
+ imgTitle = ` title="${summary[0]}"`;
+ }
+ if (logo && logo.length) {
+ let src, alt;
+ if (typeof logo[0] === 'string') {
+ src = logo[0];
+ alt = 'Client Identifier Logo';
+ } else {
+ ({ value: src, alt } = logo[0]);
+ }
+ parts.push(``);
+ }
+ if (name && name.length) {
+ parts.push(properties['name'][0]);
+ }
+ if (url && url.length) {
+ parts.push('');
+ }
+ parts.push('');
+ return parts.join('');
+}
+
+
+/**
+ * @param {Object} clientIdentifier
+ * @param {Object[]} clientIdentifier.items
+ * @returns {String}
+ */
+function renderClientIdentifier(clientIdentifier) {
+ const hAppEntries = clientIdentifier && clientIdentifier.items || [];
+ return hAppEntries.map(renderClientIdentifierProperties).join('');
+}
+
+
+/**
+ * @param {String} profile
+ * @param {Boolean} selected
+ * @returns {String}
+ */
+function renderProfileOption(profile, selected) {
+ return ``;
+}
+
+
+/**
+ * @param {String[]} availableProfiles
+ * @param {String} hintProfile
+ * @returns {String}
+ */
+function renderProfileFieldset(availableProfiles, hintProfile) {
+ if (!availableProfiles || availableProfiles.length <= 1) {
+ const profile = availableProfiles && availableProfiles[0] || hintProfile;
+ return ``;
+ }
+ return `
+
+