Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save sgithens/c8017b923aedfcccb262512a966be4fb to your computer and use it in GitHub Desktop.

Select an option

Save sgithens/c8017b923aedfcccb262512a966be4fb to your computer and use it in GitHub Desktop.
Currently not showing unsupported entries in the PPT
<tbody>
{{#with options.solution}}
{{#each this.settingsHandlers}}
{{#each this.supportedSettings}}
<tr class="pmt-settings-table-row" data-term="{{@key}}">
<td id="a-{{../../../options.appId}}-{{@key}}">{{this.schema.title}}</td>
<td><!-- Space for product default column --></td>
{{#each ../../../model.prefsSetNames}}
<td class="pmt-value-display" data-name="{{../schema.title}}" data-prefsSet="{{this}}" data-product="{{../../../../options.appUri}}" data-term="{{@../key}}"
{{#compare (lookupProductPrefValue this ../../../../options.appUri @../key) "===" undefined}}
data-value=""><span> -- </span>
{{else}}
data-value="{{lookupProductPrefValue this ../../../../options.appUri @../key}}"><span>{{lookupProductPrefValue this ../../../../options.appUri @../key}}</span>
{{/compare}}
</td>
{{/each}}
</tr>
{{/each}}
{{/each}}
{{/with}}
{{! TODO This area needs to be fixed. Find a component level way to pull out all the settings keys across prefsSets
for a user, similar to gpii.devpmt.prefsSafeApplications, but just on a per product component level. }}
{{#each options.solution.settingKeys}}
{{#unless (checkForSupportedSetting ../options.solution this)}}
<tr>
<td>!! {{this}}</td>
{{#each ../prefsSetNames}}
<td class="pmt-value-display" data-name="{{../schema.title}}" data-prefsSet="{{this}}" data-product="{{../../uri}}" data-term="{{../this}}"
{{#with (lookup (lookup (lookup (lookup ../../flatPrefs.contexts this) "preferences") ../../this.uri) ../this) }}
data-value="{{this}}"><span>{{this}}</span>
{{else}}
data-value=""><span> -- </span>
{{/with}}
</td>
{{/each}}
<td></td>
</tr>
{{/unless}}
{{/each}}
</tbody>
/**
* checkForSupportedSetting Handlebars helper
* Takes a solutions registry entry and settingKey, then checks to see if
* it's a setting that the solution supports. This is primarily used to see
* if a generic preference setting is supported by the solution and used
* in one of it's transformations.
* The underlying functionality for this should be moved to a utility method
* with unit tests.
*
* @param {Object} solution - The solution registry entry.
* @param {String} settingKey - The generic pref setting key.
* @return {Boolean} Returns `true` if this solution supports the setting, otherwise `false`.
*/
Handlebars.registerHelper("checkForSupportedSetting", function (solution, settingKey) {
console.log("Is this actually getting called?");
var togo = false;
fluid.find
fluid.each(solution.settingsHandlers, function (i) {
fluid.each(i.supportedSettings, function (j, jkey) {
if (jkey === settingKey) {
togo = true;
}
});
});
return togo;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment