diff --git a/inkstitch/threads/color.py b/inkstitch/threads/color.py index 637e49006..ad3dc051a 100644 --- a/inkstitch/threads/color.py +++ b/inkstitch/threads/color.py @@ -34,7 +34,11 @@ class ThreadColor(object): return "ThreadColor" + repr(self.rgb) def to_hex_str(self): - return "#%02X%02X%02X" % self.rgb + return "#%s" % self.hex_digits + + @property + def hex_digits(self): + return "%02X%02X%02X" % self.rgb @property def rgb_normalized(self): diff --git a/print/resources/inkstitch.js b/print/resources/inkstitch.js index cb1e73c31..454c9ae27 100644 --- a/print/resources/inkstitch.js +++ b/print/resources/inkstitch.js @@ -48,13 +48,22 @@ $(function() { document.querySelectorAll('[contenteditable="true"]').forEach(function(elem) { elem.addEventListener('focusout', function() { var content = $(this).html(); - var style = $(this).attr('class'); - $('.' + style).html(content); + var field_name = $(this).attr('data-field-name'); + $('[data-field-name="' + field_name + '"]').html(content); }); }); - // Prevent line breaks in contenteditable fields - $('[contenteditable="true"]').keypress(function(e){ return e.which != 13; }); + $('[contenteditable="true"]').keypress(function(e) { + if (e.which == 13) { + // pressing enter defocuses the element + this.blur(); + + // also suppress the enter keystroke to avoid adding a new line + return false; + } else { + return true; + } + }); /* Settings Bar */ diff --git a/print/resources/style.css b/print/resources/style.css index 4c0ccf7de..36c482078 100644 --- a/print/resources/style.css +++ b/print/resources/style.css @@ -269,7 +269,7 @@ body { } [contenteditable=true]:empty::before{ - content: attr(placeholder); + content: attr(data-placeholder); color: rgb(200, 200, 200); font-weight: normal; display: inline-block; diff --git a/print/templates/color_swatch.html b/print/templates/color_swatch.html index e78f0e34a..35093de90 100644 --- a/print/templates/color_swatch.html +++ b/print/templates/color_swatch.html @@ -5,10 +5,7 @@ - {# We don't want to see empty color names #} - {% if color_block.color.thread_name %} - {{ _('Color') }}: {{ color_block.color.thread_name }} - {% endif %} + {{ _('Color') }}: {{ color_block.color.thread_name }} {# If color name is not empty, we don't want to see rgb if we have more than 7 colorSwatches #} {% if color_blocks|length < 7 or not color_block.color.thread_name %} {{ _('rgb') }}: {{ color_block.color.rgb }} @@ -39,8 +36,8 @@
-
-

{{ _('Color') }}:{{ color_block.color.thread_name }}

+
+

{{ _('Color') }}:{{ color_block.color.thread_name }}

{{ _('rgb') }}:{{ color_block.color.rgb }}

{{ _('thread used') }}:{{ color_block.color.thread_description }}

{{ _('# stitches') }}:{{ color_block.num_stitches }}

diff --git a/print/templates/headline.html b/print/templates/headline.html index 899943808..c97de178a 100644 --- a/print/templates/headline.html +++ b/print/templates/headline.html @@ -3,9 +3,9 @@
-

{{ job.title }}

+

{{ job.title }}

{{ _('CLIENT') }}:  - {{ client }} + {{ client }}

diff --git a/print/templates/operator_detailedview.html b/print/templates/operator_detailedview.html index 3e88c30cf..8b5e8ed83 100644 --- a/print/templates/operator_detailedview.html +++ b/print/templates/operator_detailedview.html @@ -51,8 +51,7 @@ {{ color_block.svg_preview|safe }}

- Thread Company Name - {{ color_block.color.thread_name }} + {{ color_block.color.thread_name }} {{ color_block.color.rgb }}