Add helper for color picker links

master
Ben Moon 2016-07-08 10:40:22 +01:00
parent 772e6c8542
commit 1251912976
2 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<a href='/?q=color%20picker%20%23{{result_color.hex}}' class='rgb_color--box circle' style='background:#{{result_color.hex}}'/>
<a href='{{colorPickerLink result_color.hex}}' class='rgb_color--box circle' style='background:#{{result_color.hex}}'/>
<div class='column1 tx-clr--dk2'>
<p class='hex tx-clr--dk zci__caption'>{{result_color.hex_disp}}</p>
<p class='no_vspace'>{{result_color.rgb_disp}}</p>
@ -9,21 +9,21 @@
<span class='separator'> | </span>
<a href='http://www.color-hex.com/color/{{result_color.hex}}' title='Tints, information and similar colors on color-hex.com' class='tx-clr--dk2'>Info</a>
<span class='separator'> | </span>
<a href='/?q=color%20picker%20%23{{result_color.hex}}' class='tx-clr--dk2'>Picker</a>
<a href='{{colorPickerLink result_color.hex}}' class='tx-clr--dk2'>Picker</a>
</p>
</div>
<div class='column2 tx-clr--dk2'>
<div>
<div class='cols_column'>
{{#each input_colors}}
<a href='/?q=color%20picker%20%23{{this.hex}}' class='mini-color circle' style='background: #{{this.hex}}'> </a>
<a href='{{colorPickerLink this.hex}}' class='mini-color circle' style='background: #{{this.hex}}'> </a>
{{/each}}
</div>
<div class='desc_column'>
<p class='no_vspace'>{{subtitle_prefix}}</p>
<p class='no_vspace'>
{{#each input_colors}}
<a onclick='document.x.q.value=#{{this.hex}} document.x.q.focus();' href='javascript:' class='tx-clr--lt'>{{this.hex}}</a>
<a href='{{colorPickerLink this.hex}}' class='tx-clr--lt'>{{this.hex}}</a>
{{/each}}
</p>
</div>

View File

@ -20,3 +20,7 @@ Handlebars.registerHelper('color', function(color) {
var body = '<span>' + amountText + hexBody + ' ' + boxBody + '</span>';
return body;
});
Handlebars.registerHelper('colorPickerLink', function(hex) {
return '/?q=' + encodeURIComponent('color picker #' + hex);
});