<commit_before>{% extends "base.html" %}
{% load i18n %}
{% load markdown_deux_tags %}
{% block title %}{{ profile_user.username }}'{% trans 's Profile'%}{% endblock %}
{% block js %}<script src="/static/bower/Autolinker.js/dist/Autolinker.min.js"></script><script src="/static/js/profile.js"></script>{% endblock %}

{% block content %}
{% load imageurl %}
{% load padzeros %}
<div class="container">
  <br><br>
  <div class="jumbotron {{ preferences.color }}" id="profile">
    <div class="topprofile {{ preferences.color }}">
      <div class="row">
	<div class="col-md-8">
	  <div class="row">
	    <div class="col-sm-4">
	      <img src="{{ avatar }}" class="avatar">
	    </div>
	    <div class="col-sm-8">
	      <div class="info">
		<h1 id="username">{{ profile_user.username }}</h1>
		{% if is_me %}<div><a href="/edit/"><i class="flaticon-edit"></i> {% trans 'Edit your settings' %}</a></div>{% endif %}
		<br>
		<div class="description">{{ preferences.description|markdown }}</div>
	      </div>
	    </div>
	  </div>
	</div>
	<div class="col-md-4 text-right">
	  {% if not preferences.private and not is_me %}
	  <br><br>
	  <form method="POST" class="noform" id="follow" action="/ajax/follow/{{ profile_user.username }}/">
	    {% csrf_token %}
	    <input type="hidden" name="{% if following %}unfollow{% else %}follow{% endif %}">
	    <input type="submit" class="btn btn-lg btn-{{ preferences.color }}" value="{% if following %}{% trans 'Unfollow' %}{% else %}{% trans 'Follow' %}{% endif %}" data-reverse="{% if following %}{% trans 'Follow' %}{% else %}{% trans 'Unfollow' %}{% endif %}">
	  </form>
	  {% endif %}
	  <br><br>
	  <table class="table table-bordered">
	    {% if total_followers %}
	    <tr>
	      <th>{% trans 'Followers' %}</th>
	      <td><a href="#followers">{{ total_followers }}</a></td>
	    </tr>
	    {% endif %}
	    {% if total_following %}
	    <tr>
	      <th>{% trans 'Following' %}</th>
	      <td><a href="#following">{{ total_following }}</a></td>
	    </tr>
	    {% endif %}
	    {% if preferences.best_girl %}
	    <tr>
	      <th>{% trans 'Best Girl' %}</th>
	      <td><a href="/cards/?name={{ preferences.best_girl }}" target="_blank">{{ preferences.best_girl }}</a></td>
	    </tr>
	    {% endif %}
	    {% if preferences.location %}
	    <tr>
	      <th>{% trans 'Location' %}</th>
	      <td><a href="http://maps.google.com/?q={{ preferences.location }}" target="_blank">{{ preferences.location }}</a></td>
	    </tr>
	    {% endif %}
	    <tr>
	      <th>{% trans 'Accept Friend Requests' %}</th>
	      <td>{% if preferences.accept_friend_requests %}{% trans 'Yes' %}{% else %}{% trans 'No' %}{% endif %}</td>
	    </tr>
	  </table>
	  {% if preferences.twitter %}
	  <br>
	  <a href="https://twitter.com/{{ preferences.twitter }}" class="twitter-follow-button" data-show-count="false" data-size="large" data-dnt="true">Follow @{{ preferences.twitter }}</a>
	  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
	  {% endif %}
	</div>
      </div>
    </div>
  </div>
    {% with user_accounts|length as length %}
    {% if length == 0 %}
    <h2>{% trans 'No account.' %}</h2>
    {% else %}
    <h2>{% trans 'Accounts:' %}</h2>
    {% for account in user_accounts %}
    {% with account.center.card.attribute|default:'All' as attribute %}
    <div class="panel panel-{{ attribute }} profile-account" id="{{ account.pk }}">
      <div class="panel-heading">
	<h3>
	  {% if is_me %}
	  <div class="pull-right" style="letter-spacing: 10px;">
	    <a href="/editaccount/{{ account.pk }}/">
	      <i class="flaticon-edit"></i>
	    </a>
	  </div>
	  {% endif %}
	  <a href="#{{ account.pk }}">{{ account }}</a></h3>
      </div>
      <div class="panel-body">
	<div class="padding20 padding-novertical">
	  <div class="pull-right" style="padding: 20px;">
	    {% if account.center %}
	    <a href="{% if is_me %}/editaccount/{{ account.pk }}{% else %}/cards/{{ account.center.card.id }}{% endif %}" class="center">
	      <div class="circled_card_200 {{ account.center.card.attribute }} {{ account.center.card.rarity }} hover"
		   style="background-image: url('{% if not account.center.idolized and account.center.card.card_image %}{{ account.center.card|imageurl:'card_image' }}{% else %}{{ account.center.card|imageurl:'card_idolized_image' }}{% endif %}')"></div>
	    </a>
	    {% else %}
	    {% if is_me %}<a href="/editaccount/{{ account.pk }}/">{% endif %}
	    <div style="width: 200px; padding: 50px; text-align: center;">
	      <strong>{% trans 'No Center Specified' %}</strong>
	    </div>
	    {% if is_me %}</a>{% endif %}
	    {% endif %}
	  </div>
	  <div class="table-responsive">
	    <table class="table">
	      <tr>
		<th><br>{% trans 'Nickname' %}</th>
		<td><br>{{ account.nickname }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Friend ID' %}</th>
		<td>{{ account.friend_id|padzeros:9 }}</td>
	      </tr>
	      {% if is_me and account.transfer_code %}
	      <tr>
		<th>{% trans 'Transfer Code' %} <small>{% trans 'Only you can see it' %}</small></th>
		<td>{{ account.transfer_code }}</td>
	      </tr>
	      {% endif %}
	      <tr>
		<th>{% trans 'Game Version' %}</th>
		<td>
		  <div class="pull-right">
		    <i class="flaticon-{{ account.language }} fontx2"></i>
		  </div>
		  {{ account.language }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Device Operating System' %}</th>
		<td>{{ account.os }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Significant Cards' %}</th>
		<td><strong>{{ account.deck_total_sr }} SR</strong> {% trans 'and' %} <strong>{{ account.deck_total_ur }} UR</strong></td>
	      </tr>
	      <tr>
		<th>{% trans 'Rank' %}</th>
		<td><h3>{{ account.rank }}</h3></td>
	      </tr>
	    </table>
	  </div>

	  {% if not preferences.private or is_me %}
	  <div role="tabpanel" class="tabpanel">
	    <div class="btn-group btn-group-justified" data-toggle="buttons">
	      <label for="optDeck" class="cardstype btn btn-{{ attribute }} active">
		<input id="optDeck" name="cardstype" checked type="radio" data-target="#cardtabDeck{{ account.pk }}" >
		<i class="flaticon flaticon-deck"></i>
		{% trans 'Deck' %}
	      </label>
	      <label for="optAlbum" class="cardstype btn btn-{{ attribute }}">
		<input id="optAlbum" name="cardstype" type="radio" data-target="#cardtabAlbum{{ account.pk }}" >
		<i class="flaticon flaticon-album"></i>
		{% trans 'Album' %}
	      </label>
	      {% if is_me %}
	      <label for="optBox" class="cardstype btn btn-{{ attribute }}">
		<input id="optBox" name="cardstype" type="radio" data-target="#cardtabBox{{ account.pk }}" >
		<i class=".flaticon flaticon-present"></i>
		{% trans 'Present Box' %}
	      </label>
	      {% endif %}
	      <label for="optWishlist" class="cardstype btn btn-{{ attribute }}">
		<input id="optWishlist" name="cardstype" type="radio" data-target="#cardtabWishlist{{ account.pk }}" >
		<i class="flaticon flaticon-star"></i>
		{% trans 'Wish List' %}
	      </label>
	    </div>
	  </div>
	  <div class="tab-content">
	    {% if is_me %}
	    <br>
	    <div class="alert alert-info">{% blocktrans %}To search through your cards, order them, edit them or add some new, go to <a href="/cards/?search=">the cards page and use the filters {% endblocktrans %}<i class="flaticon-filter"></i></a></div>
	    {% endif %}
	    <div id="cardtabDeck{{ account.pk }}" class="tab-pane fade in active cardtab-pane text-center">
	      {% include 'ownedcards.html' with cards=account.deck %}
	    </div>
	    <div id="cardtabAlbum{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Album"></div>
	    {% if is_me %}
	    <div id="cardtabBox{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Box"></div>
	    {% endif %}
	    <div id="cardtabWishlist{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Favorite"></div>
	    <br>
	  </div>
	  {% endif %}
	</div>
      </div>
    </div>
    <br><br>
    {% endwith %}
    {% endfor %}
    {% endif %}
    {% endwith %}

    <div id="disqus_thread"></div>
    <script type="text/javascript">
      var disqus_shortname = 'schoolidol';
      (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
      })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>

{% endblock %}
<commit_msg>web: Fix follow button when not connected<commit_after>{% extends "base.html" %}
{% load i18n %}
{% load markdown_deux_tags %}
{% block title %}{{ profile_user.username }}'{% trans 's Profile'%}{% endblock %}
{% block js %}<script src="/static/bower/Autolinker.js/dist/Autolinker.min.js"></script><script src="/static/js/profile.js"></script>{% endblock %}

{% block content %}
{% load imageurl %}
{% load padzeros %}
<div class="container">
  <br><br>
  <div class="jumbotron {{ preferences.color }}" id="profile">
    <div class="topprofile {{ preferences.color }}">
      <div class="row">
	<div class="col-md-8">
	  <div class="row">
	    <div class="col-sm-4">
	      <img src="{{ avatar }}" class="avatar">
	    </div>
	    <div class="col-sm-8">
	      <div class="info">
		<h1 id="username">{{ profile_user.username }}</h1>
		{% if is_me %}<div><a href="/edit/"><i class="flaticon-edit"></i> {% trans 'Edit your settings' %}</a></div>{% endif %}
		<br>
		<div class="description">{{ preferences.description|markdown }}</div>
	      </div>
	    </div>
	  </div>
	</div>
	<div class="col-md-4 text-right">
	  {% if user.is_authenticated and not preferences.private and not is_me %}
	  <br><br>
	  <form method="POST" class="noform" id="follow" action="/ajax/follow/{{ profile_user.username }}/">
	    {% csrf_token %}
	    <input type="hidden" name="{% if following %}unfollow{% else %}follow{% endif %}">
	    <input type="submit" class="btn btn-lg btn-{% if preferences.color %}{{ preferences.color }}{% else %}default{% endif %}" value="{% if following %}{% trans 'Unfollow' %}{% else %}{% trans 'Follow' %}{% endif %}" data-reverse="{% if following %}{% trans 'Follow' %}{% else %}{% trans 'Unfollow' %}{% endif %}">
	  </form>
	  {% elif not user.is_authenticated %}
	  <a href="/create/" class="btn btn-lg btn-{% if preferences.color %}{{ preferences.color }}{% else %}default{% endif %}">Follow</a>
	  {% endif %}
	  <br><br>
	  <table class="table table-bordered">
	    {% if total_followers %}
	    <tr>
	      <th>{% trans 'Followers' %}</th>
	      <td><a href="#followers">{{ total_followers }}</a></td>
	    </tr>
	    {% endif %}
	    {% if total_following %}
	    <tr>
	      <th>{% trans 'Following' %}</th>
	      <td><a href="#following">{{ total_following }}</a></td>
	    </tr>
	    {% endif %}
	    {% if preferences.best_girl %}
	    <tr>
	      <th>{% trans 'Best Girl' %}</th>
	      <td><a href="/cards/?name={{ preferences.best_girl }}" target="_blank">{{ preferences.best_girl }}</a></td>
	    </tr>
	    {% endif %}
	    {% if preferences.location %}
	    <tr>
	      <th>{% trans 'Location' %}</th>
	      <td><a href="http://maps.google.com/?q={{ preferences.location }}" target="_blank">{{ preferences.location }}</a></td>
	    </tr>
	    {% endif %}
	    <tr>
	      <th>{% trans 'Accept Friend Requests' %}</th>
	      <td>{% if preferences.accept_friend_requests %}{% trans 'Yes' %}{% else %}{% trans 'No' %}{% endif %}</td>
	    </tr>
	  </table>
	  {% if preferences.twitter %}
	  <br>
	  <a href="https://twitter.com/{{ preferences.twitter }}" class="twitter-follow-button" data-show-count="false" data-size="large" data-dnt="true">Follow @{{ preferences.twitter }}</a>
	  <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
	  {% endif %}
	</div>
      </div>
    </div>
  </div>
    {% with user_accounts|length as length %}
    {% if length == 0 %}
    <h2>{% trans 'No account.' %}</h2>
    {% else %}
    <h2>{% trans 'Accounts:' %}</h2>
    {% for account in user_accounts %}
    {% with account.center.card.attribute|default:'All' as attribute %}
    <div class="panel panel-{{ attribute }} profile-account" id="{{ account.pk }}">
      <div class="panel-heading">
	<h3>
	  {% if is_me %}
	  <div class="pull-right" style="letter-spacing: 10px;">
	    <a href="/editaccount/{{ account.pk }}/">
	      <i class="flaticon-edit"></i>
	    </a>
	  </div>
	  {% endif %}
	  <a href="#{{ account.pk }}">{{ account }}</a></h3>
      </div>
      <div class="panel-body">
	<div class="padding20 padding-novertical">
	  <div class="pull-right" style="padding: 20px;">
	    {% if account.center %}
	    <a href="{% if is_me %}/editaccount/{{ account.pk }}{% else %}/cards/{{ account.center.card.id }}{% endif %}" class="center">
	      <div class="circled_card_200 {{ account.center.card.attribute }} {{ account.center.card.rarity }} hover"
		   style="background-image: url('{% if not account.center.idolized and account.center.card.card_image %}{{ account.center.card|imageurl:'card_image' }}{% else %}{{ account.center.card|imageurl:'card_idolized_image' }}{% endif %}')"></div>
	    </a>
	    {% else %}
	    {% if is_me %}<a href="/editaccount/{{ account.pk }}/">{% endif %}
	    <div style="width: 200px; padding: 50px; text-align: center;">
	      <strong>{% trans 'No Center Specified' %}</strong>
	    </div>
	    {% if is_me %}</a>{% endif %}
	    {% endif %}
	  </div>
	  <div class="table-responsive">
	    <table class="table">
	      <tr>
		<th><br>{% trans 'Nickname' %}</th>
		<td><br>{{ account.nickname }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Friend ID' %}</th>
		<td>{{ account.friend_id|padzeros:9 }}</td>
	      </tr>
	      {% if is_me and account.transfer_code %}
	      <tr>
		<th>{% trans 'Transfer Code' %} <small>{% trans 'Only you can see it' %}</small></th>
		<td>{{ account.transfer_code }}</td>
	      </tr>
	      {% endif %}
	      <tr>
		<th>{% trans 'Game Version' %}</th>
		<td>
		  <div class="pull-right">
		    <i class="flaticon-{{ account.language }} fontx2"></i>
		  </div>
		  {{ account.language }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Device Operating System' %}</th>
		<td>{{ account.os }}</td>
	      </tr>
	      <tr>
		<th>{% trans 'Significant Cards' %}</th>
		<td><strong>{{ account.deck_total_sr }} SR</strong> {% trans 'and' %} <strong>{{ account.deck_total_ur }} UR</strong></td>
	      </tr>
	      <tr>
		<th>{% trans 'Rank' %}</th>
		<td><h3>{{ account.rank }}</h3></td>
	      </tr>
	    </table>
	  </div>

	  {% if not preferences.private or is_me %}
	  <div role="tabpanel" class="tabpanel">
	    <div class="btn-group btn-group-justified" data-toggle="buttons">
	      <label for="optDeck" class="cardstype btn btn-{{ attribute }} active">
		<input id="optDeck" name="cardstype" checked type="radio" data-target="#cardtabDeck{{ account.pk }}" >
		<i class="flaticon flaticon-deck"></i>
		{% trans 'Deck' %}
	      </label>
	      <label for="optAlbum" class="cardstype btn btn-{{ attribute }}">
		<input id="optAlbum" name="cardstype" type="radio" data-target="#cardtabAlbum{{ account.pk }}" >
		<i class="flaticon flaticon-album"></i>
		{% trans 'Album' %}
	      </label>
	      {% if is_me %}
	      <label for="optBox" class="cardstype btn btn-{{ attribute }}">
		<input id="optBox" name="cardstype" type="radio" data-target="#cardtabBox{{ account.pk }}" >
		<i class=".flaticon flaticon-present"></i>
		{% trans 'Present Box' %}
	      </label>
	      {% endif %}
	      <label for="optWishlist" class="cardstype btn btn-{{ attribute }}">
		<input id="optWishlist" name="cardstype" type="radio" data-target="#cardtabWishlist{{ account.pk }}" >
		<i class="flaticon flaticon-star"></i>
		{% trans 'Wish List' %}
	      </label>
	    </div>
	  </div>
	  <div class="tab-content">
	    {% if is_me %}
	    <br>
	    <div class="alert alert-info">{% blocktrans %}To search through your cards, order them, edit them or add some new, go to <a href="/cards/?search=">the cards page and use the filters {% endblocktrans %}<i class="flaticon-filter"></i></a></div>
	    {% endif %}
	    <div id="cardtabDeck{{ account.pk }}" class="tab-pane fade in active cardtab-pane text-center">
	      {% include 'ownedcards.html' with cards=account.deck %}
	    </div>
	    <div id="cardtabAlbum{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Album"></div>
	    {% if is_me %}
	    <div id="cardtabBox{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Box"></div>
	    {% endif %}
	    <div id="cardtabWishlist{{ account.pk }}" class="tab-pane fade cardtab-pane text-center" data-stored="Favorite"></div>
	    <br>
	  </div>
	  {% endif %}
	</div>
      </div>
    </div>
    <br><br>
    {% endwith %}
    {% endfor %}
    {% endif %}
    {% endwith %}

    <div id="disqus_thread"></div>
    <script type="text/javascript">
      var disqus_shortname = 'schoolidol';
      (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
      })();
    </script>
    <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>

{% endblock %}

{'fraction_non_alphanumeric': 0.22268441486411536, 'fraction_numerical': 0.003993344425956739, 'mean_word_length': 3.279848089247567, 'pattern_counts': {'":': 0, '<': 479, '<?xml version=': 0, '>': 479, 'https://': 4, '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': '4302979', 'n_tokens_mistral': 6944, 'n_tokens_neox': 6184, 'n_words': 1360}