<commit_before>---
Description: Displays a product's reviews.
---
{# takes product as an argument #}
{# takes reviews as an argument #}
{# can only be used once on a page, because it has id attributes #}

<button class="button secondary" data-open="review-view">view reviews</button>
<button class="button secondary" data-open="review-add">leave a review</button>

<!-- review modals -->

<section class="reveal review-view" id="review-view" data-reveal>
  <header>
    <h1>{{ product.name }}</h1>
  </header>
  <main>
    <section "total">
      {{ partial('ratings', {rating: product.rating()}) }}
    </section>
    <nav>
      <button class="button" data-open="review-add">leave a review</button>
    </nav>
    {% for review in product.reviews() %}
      <section class="review">
        {{ partial('stars', {count: review.item_rating}) }}
        <p class="date">{{ review.created_at|date('M jS, Y') }}</p>
        <h2>{{ review.title }}</h2>
        <p>{{ review.comment }}</p>
        <p class="name">By {{ review.from_name }}</p>
      </section>
    {% endfor %}
  </main>
</section>

<section class="reveal review-add" id="review-add" data-reveal>
  <header>
    <h1 class="modal-title">{{ product.name }}</h1>
  </header>
  <main>
    {{ flash() }}
    <form method="post" data-ajax-handler="system:onSendMessage">
      <label>
        Name
        <input type="text" name="fields[name]" required>
        <span class="error"></span>
      </label>
      <label>
        Email
        <input type="email" name="fields[email]" required>
        <span class="error"></span>
      </label>

      <label>
        Title
        <input type="text" name="fields[subject]" required/>
        <span class="error"></span>
      </label>
      <label>
        Review
        <textarea name="fields[message]" rows="10" required></textarea>
        <span class="error"></span>
      </label>

      <label>
        Rating
        <select name="fields[item_rating]">
          <option value="1">&starf;&star;&star;&star;&star;</option>
          <option value="2">&starf;&starf;&star;&star;&star;</option>
          <option value="3">&starf;&starf;&starf;&star;&star;</option>
          <option value="4">&starf;&starf;&starf;&starf;&star;</option>
          <option value="5" selected>&starf;&starf;&starf;&starf;&starf;</option>
        </select>
      </label>

      <button type="submit" class="button">submit</button>
      <input type="hidden" name="hp" value="">
      <input type="hidden" name="fields[shop_customer_id]" value="{{customer.id}}">
      <input type="hidden" name="fields[shop_product_id]" value="{{product.id}}">
      <input type="hidden" name="fields[message_type]" value="review">
    </form>
  </main>
</section>

<!-- end review modals --><commit_msg>Removed unneeded hidden form element.<commit_after>---
Description: Displays a product's reviews.
---
{# takes product as an argument #}
{# takes reviews as an argument #}
{# can only be used once on a page, because it has id attributes #}

<button class="button secondary" data-open="review-view">view reviews</button>
<button class="button secondary" data-open="review-add">leave a review</button>

<!-- review modals -->

<section class="reveal review-view" id="review-view" data-reveal>
  <header>
    <h1>{{ product.name }}</h1>
  </header>
  <main>
    <section "total">
      {{ partial('ratings', {rating: product.rating()}) }}
    </section>
    <nav>
      <button class="button" data-open="review-add">leave a review</button>
    </nav>
    {% for review in product.reviews() %}
      <section class="review">
        {{ partial('stars', {count: review.item_rating}) }}
        <p class="date">{{ review.created_at|date('M jS, Y') }}</p>
        <h2>{{ review.title }}</h2>
        <p>{{ review.comment }}</p>
        <p class="name">By {{ review.from_name }}</p>
      </section>
    {% endfor %}
  </main>
</section>

<section class="reveal review-add" id="review-add" data-reveal>
  <header>
    <h1 class="modal-title">{{ product.name }}</h1>
  </header>
  <main>
    {{ flash() }}
    <form method="post" data-ajax-handler="system:onSendMessage">
      <label>
        Name
        <input type="text" name="fields[name]" required>
        <span class="error"></span>
      </label>
      <label>
        Email
        <input type="email" name="fields[email]" required>
        <span class="error"></span>
      </label>

      <label>
        Title
        <input type="text" name="fields[subject]" required/>
        <span class="error"></span>
      </label>
      <label>
        Review
        <textarea name="fields[message]" rows="10" required></textarea>
        <span class="error"></span>
      </label>

      <label>
        Rating
        <select name="fields[item_rating]">
          <option value="1">&starf;&star;&star;&star;&star;</option>
          <option value="2">&starf;&starf;&star;&star;&star;</option>
          <option value="3">&starf;&starf;&starf;&star;&star;</option>
          <option value="4">&starf;&starf;&starf;&starf;&star;</option>
          <option value="5" selected>&starf;&starf;&starf;&starf;&starf;</option>
        </select>
      </label>

      <button type="submit" class="button">submit</button>

      <input type="hidden" name="fields[shop_customer_id]" value="{{customer.id}}">
      <input type="hidden" name="fields[shop_product_id]" value="{{product.id}}">
      <input type="hidden" name="fields[message_type]" value="review">
    </form>
  </main>
</section>

<!-- end review modals -->
{'fraction_non_alphanumeric': 0.19790538100397256, 'fraction_numerical': 0.004694835680751174, 'mean_word_length': 3.081798084008843, 'pattern_counts': {'":': 0, '<': 164, '<?xml version=': 0, '>': 164, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3058363', 'n_tokens_mistral': 1780, 'n_tokens_neox': 1722, 'n_words': 378}