Why isn't jekyll showing comments? - github

Why isn't jekyll showing comments?
I have the code:
{% if site.data.comments[page.slug] %}
<h3>
{% if site.data.comments[page.slug].size > 1 %}
{{ site.data.comments[page.slug] | size }}
{% endif %}
Komentarze:
</h3>
{% assign comments = site.data.comments[page.slug] | sort %}
{% for comment in comments %}
<label>
<strong>{{ comment[1].name }}</strong>
</a>
</label>
<em>{{ comment[1].date | date: "%B %d, %Y" }}</em>
<p>{{ comment[1].message | markdownify }}</p>
{% endfor %}
{% endif %}
<form method="post" action="{{ site.staticman_url }}">
<h3>Napisz komentarz:</h3>
<input name="options[redirect]" type="hidden" value="{{ post.url }}">
<input name="options[slug]" type="hidden" value="{{ page.slug }}">
<label>Imię (Wyświetlane, wymagane)</label>
<input name="fields[name]" type="text" required placeholder="Jan Kowalski" title="To pole jest wymagane">
<label>E-mail (Ukryte, wymagane)</label>
<input name="fields[email]" type="email" required placeholder="jan#kowalski.com" title="To pole jest wymagane">
<label>Wiadomość (Wyświetlane, wymagane)</label>
<textarea style="width:100%" name="fields[message]" rows="5" required placeholder="Twoja wiadomość" title="To pole jest wymagane"></textarea>
<p>Komentarze pojawią się po zaakceptowaniu przez moderatora.</p>
<button type="submit">Wyślij komentarz</button>
</form>
Which works, comments are sent to the staticman-app and I get a pull request, I click accept in the repository the comment file appears correctly, but why does this code not show the comment itself? I can't even see it in .html (so it's not CSS's fault), I've been working on it for several hours and I can't find a solution. For more questions please write a comment :)

Based on the screenshot below, it looks like the comments are rendered as expected..

Related

Front-end form with Craft CMS for users to submit entries not working?

I've put together an entry form to allow registered users to submit content. I followed the example given in the Craft 3 Docs but it still doesn't seem to work. Was hoping someone could see what I can't. Here is the code I'm using for my form.
{% macro errorList(errors) %}
{% if errors %}
<ul class="errors">
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{% from _self import errorList %}
<form method="post" accept-charset="UTF-8">
{{ csrfInput() }}
<input type="hidden" name="action" value="entries/save-entry">
{{ redirectInput('viewentry/{slug}') }}
<input type="hidden" name="work" value="2">
<input type="hidden" name="enabled" value="1">
<label for="title">Title</label>
<input id="title" type="text" name="title"
{%- if entry is defined %} value="{{ entry.title }}"{% endif -%}>
{% if entry is defined %}
{{ errorList(entry.getErrors('title')) }}
{% endif %}
<label for="fields-projectDescription">Project Description</label>
<textarea id="fields-projectDescription" name="fields[projectDescription]">
{%- if entry is defined %}{{ entry.projectDescription }}{% endif -%}
</textarea>
<input type="submit" value="Publish">
</form>
The error I recieve when this form is submitted is:
Bad Request Request - missing required body param
Screenshot of Error
I though this could mean I was required to keep the 'body' field form the example. eg.
<label for="body">Body</label>
<textarea id="body" name="fields[body]">
{%- if entry is defined %}{{ entry.body }}{% endif -%}
</textarea>
{% if entry is defined %}
{{ errorList(entry.getErrors('body')) }}
{% endif %}
However, adding this in made no difference.
Any help appreciated.
You are missing sectionId in your form:
<input type="hidden" name="sectionId" value="{{ craft.sections.getSectionByHandle('sectionHandle').id }}">

How to close newsletter popup automatically after signup - Shopify

I am not a programming expert so bear with me.
I have put up a shopify site with the template Icon-Christian. It comes with newsletter popup. The thing is that after signing up, the popup window doesn't close automatically. How can I edit the code?
{% if settings.popup %}
<script type="text/javascript">
if($(window).width() > 500){
// Fancybox Join our mailing list popup
$(document).ready(function(){
var check_cookie = $.cookie('mailing_list_delay_popup');
if(check_cookie == null){
$.cookie('mailing_list_delay_popup', 'expires_seven_days', { expires: 7 });
//fire your fancybox here
setTimeout(function(){
$.fancybox({
href: "#subscribe_popup"
});
}, 3000);
}
});
};
</script>
{% endif %}
<div style="display:none">
<div id="subscribe_popup" class="row">
{% if settings.email_popup_image %}
<div class="left fifty">
<img src="{{ 'popup-image.jpg' | asset_url }}">
</div>
{% endif %}
<div class="right fifty">
<h3>{{ 'layout.homepage.mailing_list_join' | t }}</h3>
<p>{{ 'layout.homepage.mailing_list_text' | t }}</p>
<!-- BEGIN #subs-container -->
<div id="subs-container" class="clearfix">
<div id="mc_embed_signup">
<form action="{{ settings.mailchimp }}" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank">
<input value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="{{ 'general.newsletter_form.newsletter_email' | t }}" required="" type="email">
<input value="{{ 'general.newsletter_form.submit' | t }}" name="subscribe" id="mc-embedded-subscribe" class="button" type="submit">
</form>
</div>
</div>
<div class="clear"></div>
<ul id="footer-icons">
{% if settings.show_facebook %}<li><i class="icon-facebook icon-2x"></i></li>{% endif %}
{% if settings.show_twitter %}<li><i class="icon-twitter icon-2x"></i></li>{% endif %}
{% if settings.show_pinterest %}<li><i class="icon-pinterest icon-2x"></i></li>{% endif %}
{% if settings.show_tumblr %}<li><i class="icon-tumblr icon-2x"></i></li>{% endif %}
{% if settings.show_youtube %}<li><i class="icon-youtube icon-2x"></i></li>{% endif %}
{% if settings.show_googleplus %}<li><i class="icon-google-plus icon-2x"></i></li>{% endif %}
{% if settings.show_instagram %}<li><i class="icon-instagram icon-2x"></i></li>{% endif %}
</ul>
</div>
</div>
</div>

Create form in popup in Shopify (callback function)

I added form to button (in left top in header) https://en.partizanstore.eu/
I checked form in page and it works, but when I added form to snippet and to button, it dont work, dont send letter.
Can anybody help?
And by the way, can I create form anywhere, except on pages?
{% capture contact_form %}
<div class="contact">
{% form 'contact', class: 'contact__form' %}
{% if form.posted_successfully? %}
<div class="alert alert--success">
<span class="alert-title">{{ 'contact.form.successfully_sent' | t }}</span>
</div>
{% endif %}
{% if form.errors %}
<div class="alert alert--error">
<span class="alert__title">{{ 'general.forms.errors' | t }}</span>
{% include 'form_errors' %}
</div>
{% endif %}
<div class="form__control">
<label class="form__label" for="contact__name">{{ [ 'contact.form.name' | t }}</label>
<input type="text" id="contact__name" name="contact[name]">
</div>
<div class="form__control">
<label class="form__label" for="contact__phone">{{ 'contact.form.phone' | t }}</label>
<input type="text" id="contact__phone" name="contact[phone]">
</div>
<input type="submit" class="button button--primary" value="{{ 'contact.form.submit' | t }}">
{% endform %}
</div>
{% endcapture %}

Shopify Custom Email Module

How can I pass the variable data from Shopify form ( I made a template for a page with a form inside that ask customer to choose one product & put name, email, address and more ) to be send in as email? Is it possible to get the data then pass it to some third party apps like Mailchimp and that 3rd party app will send it via email to the customer containing the data?
To make it short, my question is:
How to create custom form then pass data in an email to be sent to the customer?
I have used a customized ajaxchimp jquery plugin to integrate shopify contact form with mailchimp.
{% form 'contact' %} {% comment %} Successful message {% endcomment %} {% if form.posted_successfully? %}
<p class="note form-success">
{{ 'contact.form.post_success' | t }}
</p>
{% endif %} {{ form.errors | default_errors }}
<div class="grid grid--small">
<div class="grid__item large--one-half">
<label for="ContactFormName" class="hidden-label">{{ 'contact.form.name' | t }}</label>
<input type="text" id="ContactFormName" class="input-full" name="contact[name]" placeholder="{{ 'contact.form.name' | t }}" autocapitalize="words" value="{% if form.name %}{{ form.name }}{% elsif customer %}{{ customer.name }}{% endif %}">
</div>
<div class="grid__item large--one-half">
<label for="ContactFormEmail" class="hidden-label">{{ 'contact.form.email' | t }}</label>
<input type="email" id="ContactFormEmail" class="input-full" name="contact[email]" placeholder="{{ 'contact.form.email' | t }}" autocorrect="off" autocapitalize="off" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">
<input type="hidden" id="ContactFormHidden" name="contact[email]" value="{% if form.email %}{{ form.email }}{% elsif customer %}{{ customer.email }}{% endif %}">
</div>
</div>
<label for="ContactFormPhone" class="hidden-label">{{ 'contact.form.phone' | t }}</label>
<input type="tel" id="ContactFormPhone" class="input-full" name="contact[phone]" placeholder="{{ 'contact.form.phone' | t }}" pattern="[0-9\-]*" value="{% if form.phone %}{{ form.phone }}{% elsif customer %}{{ customer.phone }}{% endif %}">
<label for="ContactFormMessage" class="hidden-label">{{ 'contact.form.message' | t }}</label>
<textarea rows="10" id="ContactFormMessage" class="input-full" name="contact[body]" placeholder="{{ 'contact.form.message' | t }}">{% if form.body %}{{ form.body }}{% endif %}</textarea>
<input type="submit" class="btn right" value="{{ 'contact.form.send' | t }}">
<label for="mc-email"></label>
{% endform %}
{{ 'mailchimp.js' | asset_url | script_tag }}
<script>
$('#ContactFormEmail').change(function() {
var email = $(this).val();
$('#ContactFormHidden').val(email);
});
</script>
<script>
$('#contact_form').ajaxChimp({
url: 'https://cyberite.us4.list-manage.com/subscribe/post?u=858232f1e77dc411cb2405b5f&id=502f26188f',
});
</script>

Symfony2: preventing radio widgets from rendering labels

I'm attempting to customise the form layouts using Twig in symfony2. I am aiming to render a radio input that looks something like this...
<label class=" required">Label name</label>
<span class="form-radio">
<input type="radio" name="album_has_subalbums_1" /> Yes
</span>
<span class="form-radio">
<input type="radio" name="album_has_subalbums_0" /> No
</span>
I have overridden the radio_widget block in my custom form theme as follows
{% block radio_widget %}
{% spaceless %}
<span class='form-radio'>
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
</span>
{% endspaceless %}
{% endblock radio_widget %}
However, this renders the following markup:
<label class=" required">Label name</label>
<span class="form-radio">
<input type="radio" id="album_has_subalbums_1" name="album[has_subalbums]" required="required" value="1">
</span>
<label for="album_has_subalbums_1" class=" required">Yes</label>
<span class="form-radio">
<input type="radio" id="album_has_subalbums_0" name="album[has_subalbums]" required="required" value="0">
</span>
<label for="album_has_subalbums_0" class=" required">No</label>
Basically, for each radio input element its creating a label to identify whether the value for it is Yes or No. I'm working with a pre-existing design so I can't easily tweak the html markup.
How can I prevent the radio inputs from generating the selection texts as labels? I know it calls the field_label block internally, but as you can see my radio_widget doesn't make reference to it, so I'm a little lost as to how to prevent this behaviour.
EDIT:
To be clear, I want the same kind of structure as my first example... I have left out the name and value attributes etc, but obviously its just for demonstration purposes.
What you need to override is not the radio_widget block, but the choice_widget one:
{% block choice_widget %}
{% spaceless %}
{% if expanded %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
{{ form_widget(child) }}
{{ child.get('label') | trans }} {# <- this is what you need #}
{# leave the rest untouched #}
And don't forget to clear the cache for this change to take effect.