{% extends "base.html" %}

{% block title %}File rename or rotate form{% endblock %}

{% block content %}

<h2>Renaming or Rotating "{{filename}}"</h2>
<a href="/expofiles/{{filepath|urlencode}}">
    <figure class=onleft>
    <img src="/expofiles/{{filepath|urlencode}}" width=150px>
    <figcaption>filesize: {{filesize}} bytes
    </figcaption>
    </figure></a>
    {% if rename_bad %}
    <p style="font-family: monospace; font-weight: bold; color: red; font-size: 130%; text-align: center">

    Cannot rename to '{{rename_bad}}' as a file (or a subfolder) of that name already exists here.
    </p>
    {% endif %}
<div style = "max-width:95%; margin-left:8%; text-align: left; " >
    
    <form method ='post' >
        {% csrf_token %}              
       <br>                  
       <input class="fancybutton2" style="padding: 0.5em 25px; margin-left: 110px "
       
       title="Type in the new name for this file here"
       label = "Rename to" name = "renametoname" id="renameto"  
       pattern="[A-Za-z][A-Za-z0-9_-\.]*"/> 
       <label 
       style="padding: 0.5em 25px; margin-left: 110px"
       for="renametoname">type in the new name for this file<br></label>
       <br><br><br>
       
       <button  class="fancybutton2"  style="padding: 0.5em 25px; margin-left: 110px"  name="rename" type = "submit"  title="Renames the file but disallows certain characters and replaces them, e.g. #, &, ?" value = "Rename" >
          Rename it
       </button>
    </form>
    <br />
    {% if rotatable %}
    <form method ='post' >
        {% csrf_token %}              
       <button  class="fancybutton2"  style="padding: 0.5em 25px; margin-left: 110px"  name="rotate" type = "submit"  title="Rotates 90 degrees clockwise. JPG and PNG files only." value = "Rotate" >
          Rotate it
       </button>
    </form>
    {% else %}
    <p style="padding: 0.5em 25px; margin-left: 110px">Not a rotatable image.
    {% endif %}
    <br /><br /><br />
    Full urlencoded path for this file in expofiles is <a href="/expofiles/{{filepath|urlencode}}"><em>{{filepath|urlencode}}</em></a>
    <br /><br />
    Return to wallet <a href="/walletedit/{{wallet|urlencode}}">{{wallet}}</a>
 
</div>

<br />
<hr />
{% for np in notpics %}
  <a href="/expofilerename/{{walletpath|urlencode}}/{{np|urlencode}}">{{np}}</a>  <br />               
{% endfor %}
<br />
{% for filename in files %}
<a href="/expofilerename/{{walletpath|urlencode}}/{{filename|urlencode}}">
    <figure class=onleft>
    <img src="/expofiles/{{walletpath|urlencode}}/{{filename|urlencode}}" width=75px>
    <figcaption style="font-variant-caps: normal;">{{filename}}
    </figcaption>
    </figure></a>
    
{% empty %}
No files found.<br />
{% endfor %}



{% endblock %}