Skip to content

Commit

Permalink
Merge pull request #35 from OblivionCloudControl/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jakubnakielskixebia authored Nov 29, 2023
2 parents 10f9fcd + 9f93d51 commit c77fa77
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 20 deletions.
4 changes: 4 additions & 0 deletions src/xebia_email_signature/new_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ def add_social_media(contact_details: dict) -> dict:
if v and v[:8] != 'https://':
v = 'https://' + v
formatted_social_media[int(split_key[1][:-1])][split_key[2][:-1]] = v
formatted_social_media = [
sm for sm in formatted_social_media
if any(sm.values()) and sm.get('icon') and sm.get('link')
]
result["social_media"] = formatted_social_media
return result

Expand Down
59 changes: 41 additions & 18 deletions src/xebia_email_signature/templates/new_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ <h1 class="site-title">Email Signature Generator</h1>
</div>

<div class="form-group">
<label for="unit"
>Unit
<span
>Optional: If you leave this blank, this field is not going to
appear</span
></label
>
<label for="unit">
Unit
<span>
Optional: If you leave this blank, this field is not going to
appear
</span>
</label>
<input
type="text"
id="unit"
Expand All @@ -86,7 +86,13 @@ <h1 class="site-title">Email Signature Generator</h1>
</div>

<div class="form-group">
<label for="phone">Phone</label>
<label for="phone">
Phone
<span>
Optional: If you leave this blank, this field is not going to
appear
</span>
</label>
<input
type="text"
id="phone"
Expand Down Expand Up @@ -127,7 +133,7 @@ <h1 class="site-title">Email Signature Generator</h1>
type="text"
id="sm-0-link"
name="sm[0][link]"
placeholder="https://www.linkedin.com/company/profile"
placeholder="https://www.linkedin.com/in/username/"
/>
<div id="sm-link-error" class="error"></div>
</div>
Expand Down Expand Up @@ -162,12 +168,7 @@ <h1 class="site-title">Email Signature Generator</h1>

<div>
<div>
<label for="cta-0-desc">
Call to action
<span
>By default is generated this placeholder information</span
>
</label>
<label for="cta-0-desc">Call to action</label>
<div class="js-form-cta" data-clone-count="0">
<div class="form-wrapper flex flex-column mb-4">
<div class="form-section">
Expand Down Expand Up @@ -198,12 +199,12 @@ <h1 class="site-title">Email Signature Generator</h1>
>
My articles in the blog
</option>
<option
<!-- <option
data-custom-properties="/static/cta-icon-meeting.png"
value="meeting"
>
Schedule a meeting
</option>
</option> -->
<option
data-custom-properties="/static/cta-icon-event.png"
value="event"
Expand Down Expand Up @@ -261,7 +262,7 @@ <h1 class="site-title">Email Signature Generator</h1>
data-clone-max-items="2"
>
<img src="static/icon-btn-add.svg" alt="Icon add" />
Add another Call to Action
Add Call to Action
</button>
</div>
</div>
Expand Down Expand Up @@ -399,6 +400,7 @@ <h2 class="preview-header">Preview:</h2>
cloneRemoveBtnInit(removeBtn);
}

onSmSelectChangeInit();
allMaxCharsCounterInit();
allSelectInit();
}
Expand Down Expand Up @@ -655,12 +657,33 @@ <h2 class="preview-header">Preview:</h2>
phoneEl.value = phoneVal.replace(/[^\d\+]/g, '');
}

function onSmSelectChangeInit() {
let smSelects = document.querySelectorAll('select[name^=sm]');
smSelects.forEach((smSelect) => {
smSelect.addEventListener('change', (e) =>
handleSmSelectChange(smSelect)
);
});
}

function handleSmSelectChange(smSelect) {
let linkFieldName = smSelect.name.replace('icon', 'link');
let linkField = document.querySelector(`[name="${linkFieldName}"]`);

if (smSelect.value === 'linkedin') {
linkField.placeholder = 'https://www.linkedin.com/in/username/';
} else if (smSelect.value === 'x') {
linkField.placeholder = 'https://x.com/profil';
}
}

(() => {
allCloneInit();
allSelectInit();
allMaxCharsCounterInit();
signatureCopyInit();
iframePrepareInit();
onSmSelectChangeInit();
})();
</script>
</body>
Expand Down
8 changes: 6 additions & 2 deletions src/xebia_email_signature/templates/new_signature.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
<table summary="contact details">
<tr style="line-height: 1">
<td style="padding-right: 10px">
<img width="75" height="70" alt="Xebia logo bulb"
src="{{ url_for('static', _external=True, _scheme=data['scheme'], filename='xebia-bulb.png') }}" />
<a href="https://xebia.com/" title="Website" style="text-decoration: none;">
<span style="text-decoration: none;">
<img width="75" height="70" alt="Xebia logo bulb"
src="{{ url_for('static', _external=True, _scheme=data['scheme'], filename='xebia-bulb.png') }}" />
</span>
</a>
</td>
<td colspan="2" style="
vertical-align: top;
Expand Down

0 comments on commit c77fa77

Please sign in to comment.