<commit_before>{% extends "layouts/" + render_mode + ".html" %}

{% macro render_profile(profile) -%}  
  <div class="boxy">
    <div class="boxy-inner">
      <h3>{{profile.email}}</h3>
      
      <form>
        <label>{{_("Display name:")}}</label> {{ profile.name }}<br/>
        <label>{{_("E-mail address:")}}</label> {{ profile.email }}<br/>
        <label>{{_("Delivery route:")}}</label> {{ config.routes[profile.messageroute].name }}<br/>
      </form>

      <a class="profile-card-message-link" href="/profile/list/{{profile.slug}}/"><span class="icon-settings"></span> {{_("Settings")}}</a>
    </div>
  </div>
{%- endmacro %}
{% block content %}

<div id="settings" class="content-normal">
  {% if "profiles" in result %}
  <div id="profiles">
    <div style="float:right;"><button onclick="$('#newprofile').show();">Add new profile</button></div>
    <h3>{{_("Your Profiles")}}</h3>


    {% for p in result.profiles %}
      {{ render_profile(p) }}
    {% endfor %}
  
  </div>
  {% endif %}

  {% if "route" in result %}
          <label>{{_("Login")}}</label>
          <input type="text" name="username" value="" placeholder="{{_("<EMAIL>")}}" id="profile-add-username">

          <label>{{_("Password")}}</label>
          <input type="password" name="password" value="" placeholder="<PASSWORD>" id="profile-add-password">

          <label>{{_("Server")}}</label>
          <input type="text" name="server" value="" placeholder="{{_("smtp.mailserver.org")}}" id="profile-add-server">

          <label>{{_("Port")}}</label>
          <select name="smtp-port" id="profile-add-port">
            <option value="25">25</option>
            <option value="587">587</option>
            <option value="465">465 (TLS)</option>
          </select>
  {% endif %}

  {% if "prefs" in result %}
  <div id="prefs">
    <h3>{{_("Preferences")}}</h3>
    <ul>
      {% for p in result.prefs %}
      <li>{{p}}</li>
      {% endfor %}
    </ul><commit_msg>More work on profiles and routes dialogs<commit_after>{% extends "layouts/" + render_mode + ".html" %}

{% macro render_profile(profile) -%}  
  <div class="boxy">
    <div class="boxy-inner">
      <h3>{{profile.email}}</h3>
      
      <form>
        <label>{{_("Display name:")}}</label> {{ profile.name }}<br/>
        <label>{{_("E-mail address:")}}</label> {{ profile.email }}<br/>
        <label>{{_("Delivery route:")}}</label> {{ config.routes[profile.messageroute].name }}<br/>
      </form>

      <div style="position: absolute; bottom: 10px;">
        <button><span class="icon-settings"></span> {{_("Settings")}}</button>
      </div>
    </div>
  </div>
{%- endmacro %}

{% block content %}

<div id="settings" class="content-normal">
  {% if "profiles" in result %}
  <div id="profiles">
    <div style="float:right;"><button onclick="$('#newprofile').show();">Add new profile</button></div>
    <h3>{{_("Your Profiles")}}</h3>


    {% for p in result.profiles %}
      {{ render_profile(p) }}
    {% endfor %}
  
  </div>
  {% endif %}

  {% if "routes" in result %}
  <div id="routes">
    <div style="float: left; background: #fff; border: 1px solid #ccc;">
      <ul>
      {% for id in result.routes %}
      {% set r = result.routes[id] %}
        <li><a href="#" style="display: block; margin: 20px;" onclick="$('.route').hide();$('#route_{{id}}').show();">{{r.name}}</a></li>
      {% endfor %}
      </ul>
    </div>

    {% for id in result.routes %}
    {% set r = result.routes[id] %}
    <div id="route_{{id}}" class="route" style="margin-left: 40px; display: none; float: left;">
      <h4>Route: {{r.name}}</h4>
      <form action="" class="standard">
        <input type="hidden" name="route_id" value="{{id}}"/>

        <label>{{_("Route name")}}</label>
        <input type="text" name="name" value="{{r.name}}" placeholder="{{_("my delivery route")}}" id="route-add-name"/>

        <label>{{_("Login")}}</label>
        <input type="text" name="username" value="{{r.username}}" placeholder="{{_("<EMAIL>")}}" id="route-add-username"/>

        <label>{{_("Password")}}</label>
        <input type="password" name="password" value="{{r.password}}" placeholder="<PASSWORD>" id="route-add-password"/>

        <label>{{_("Server")}}</label>
        <input type="text" name="host" value="{{r.host}}" placeholder="{{_("smtp.mailserver.org")}}" id="route-add-server"/>

        <label>{{_("Port")}}</label>
        <select name="port" id="route-add-port">
          <option {% if r.port == 25 %}selected {% endif %}value="25">25</option>
          <option {% if r.port == 587 %}selected {% endif %}value="587">587</option>
          <option {% if r.port == 465 %}selected {% endif %}value="465">465 (TLS)</option>
        </select>

        <label></label>
        <input type="submit" value="Save"/>
        <input type="button" value="Cancel"/>
      </form>
    </div>
    {% endfor %}
  </div>
  {% endif %}

  {% if "prefs" in result %}
  <div id="prefs">
    <h3>{{_("Preferences")}}</h3>
    <ul>
      {% for p in result.prefs %}
      <li>{{p}}</li>
      {% endfor %}
    </ul>
{'fraction_non_alphanumeric': 0.24818092428711896, 'fraction_numerical': 0.011996066863323501, 'mean_word_length': 3.0720576461168934, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 145, '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': '3298941', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1642, 'n_words': 325}