<div class="header-Outro with-site-image">
  <% if flash.keys.length > 0 %>
    <div class="row content">
      <div class="alert txt-Center">
        <p style="padding:5px">
          <% flash.keys.each do |key| %>
            <%= flash[key] %>
          <% end %>
        </p>
      </div>
    </div>
  <% end %>
  <div class="row content">
    <div class="col col-50 signup-Area large">
      <div class="signup-Form">
  	  <fieldset class="content">
        <a href="/surf/<%= site.username %>" class="screenshot" style="background-image:url(<%= site.screenshot_url('index.html', '540x405') %>);"></a>
	    </fieldset>
      </div>
    </div>
    <div class="col col-50">
      <h2 class="eps title-with-badge"><span><%= site.title %></span> <% if site.supporter? && !site.ended_supporter? %><a href="/plan" class="supporter-badge" title="Neocities Supporter"></a> <% end %></h2>
      <p class="site-url"><a href="/surf/<%= site.username %>"><%= site.host %></a></p>
      <div class="stats">
        <div class="stat"><strong><%= site.views_english %></strong> <span>views</span></div>
        <div class="stat"><strong><%= site.hits_english %></strong> <span>hits</span></div>
        <div class="stat"><strong><%= site.follows_dataset.count %></strong> <span>followers</span></div>
        <!-- <div class="stat tips"><strong><%= site.tips_dataset.count %></strong> <span>tips</span></div> -->
      </div>
      <div class="actions">
        <% if current_site == site %>
          <a href="/dashboard" class="btn-Action edit"><span><i class="fa fa-pencil"></i> Edit Site</span></a>
        <% end %>

        <% if current_site && current_site != site %>
          <% is_following = current_site.is_following?(site) %>
  
          <a id="followLink" href="#" onclick="Site.toggleFollow(<%= site.id %>, '<%= csrf_token %>'); return false" class="btn-Action <%= is_following ? 'is-following' : '' %>">
              <span class="unfollow"><i class="fa fa-times"></i>Unfollow</span>
              <span class="following"><i class="fa fa-check"></i>Following</span>
              <span class="follow"><i class="fa fa-plus"></i>Follow</span>
          </a>
            
          <!-- <a href="#" class="btn-Action tip"><span>Tip</span></a> -->
        <% end %>

        <a href="#" id="shareButton" class="btn-Action" data-container="body" data-toggle="popover" data-placement="bottom" data-content='<%== erb :'_share', layout: false, locals: {site: site} %>'>
         <i class="fa fa-share-alt"></i> <span>Share</span></a>
      </div>
    </div>
  </div>
</div>

<div class="container">
<div class="content misc-page columns right-col"><div class="col-left">
  <div class="col col-66">
    <% if current_site && site.profile_comments_enabled %>

        <div class="post-comment">
          <form method="POST" action="/site/<%= site.username %>/comment">
            <input name="csrf_token" type="hidden" value="<%= csrf_token %>">
            <input name="message" 
                   type="text" 
                   placeholder="Post a message..."
                   autocomplete="off"
                   maxlength="<%= Site::MAX_COMMENT_SIZE %>"
                   <% unless current_site.commenting_allowed? %>disabled<% end %>
            >
            <button class="btn-Action"
                    <% unless current_site.commenting_allowed? %>disabled<% end %>
            >Post</button>
          </form>
          
          <% unless current_site.commenting_allowed? %>
              <p class="comment-policy">
                  To prevent spam, you cannot comment until you have updated your site <strong><%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> times</strong> (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days), and your account is one week old. While waiting, now is a great time to <a href="/dashboard">start building your awesome site!</a>
              </p>
          <% end %>
        </div>
    <% end %>

    <% if @latest_events.empty? %>
      <div>
        <p>No recent activity.</p>
        <% if current_site && site.owned_by?(parent_site) %>
          <p>
            You should <a href="/dashboard">update your site</a>!
          </p>
        <% end %>
      </div>
      <%== erb :'_news', layout: false, locals: {site: @site, events: @latest_events} %>
    <% else %>
      <div><%== erb :'_news', layout: false, locals: {site: @site, events: @latest_events} %></div>
    <% end %>

  </div>

  <div class="col col-33">
    <h3>Website Stats</h3>
    <div class="stats">
      <div class="stat">
        <span>Last updated</span>
        <strong>
          <% if site.updated_at.nil? %>
            <%= site.created_at.ago.downcase %>
          <% else %>
            <%= site.updated_at.ago.downcase %>
          <% end %>
        </strong>
      </div>
      <div class="stat"><span>Number of updates</span><strong><%= site.changed_count %></strong></div>
      <div class="stat"><span>Created</span><strong><%= site.created_at.strftime('%B %-d, %Y') %></strong></div>
    </div>

    <%== erb :'_follows', layout: false, locals: {site: site, is_current_site: site == current_site} %>

    <%== erb :'_tags', layout: false, locals: {site: site, is_current_site: site == current_site} %>

    <% if site != current_site %>
      <div class="report">
        <a href="#report" data-toggle="modal">Report</a> | 
        <% if current_site && current_site.is_blocking?(site) %>
          <a href="#">Unblock</a>
        <% else %>
          <a href="#block" data-toggle="modal">Block</a>
        <% end %>
      </div>
    <% end %>
  </div>
</div></div>
</div>

<div class="modal hide fade" id="report" tabindex="-1" role="dialog" aria-labelledby="reportLabel" aria-hidden="true">
  <form method="POST" action="/site/<%= site.username %>/report">
    <input type="hidden" value="<%= csrf_token %>" name="csrf_token">
    <div class="modal-header">
      <button class="close" type="button" data-dismiss="modal" aria-hidden="true">x</button>
      <h3 id="reportLabel">Report Site</h3>
    </div>
    <div class="modal-body">
      <p>
        What is the reason you are reporting this site?
        <select name="type" class="input-Area">
          <option value="spam">Site is spamming</option>
          <option value="phishing">Site is being used for a phishing attack</option>
          <option value="abusive">Site is abusive or threatening</option>
          <option value="harassment">Site is harassing other sites</option>
          <option value="content">Site contains inappropriate/illegal content</option>
          <option value="other">Other</option>
        </select>
      </p>
      <p>Comments:</p>
      <textarea name="comments" type="text" style="width: 400px"></textarea>
    </div>
    <div class="modal-footer">
      <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
      <button type="submit" class="btn btn-Action">Report</button>
    </div>
  </form>
</div>

<div class="modal hide fade" id="block" tabindex="-1" role="dialog" aria-labelledby="blockLabel" aria-hidden="true">
  <form method="POST" action="/site/<%= site.username %>/block">
    <input type="hidden" value="<%= csrf_token %>" name="csrf_token">
    <div class="modal-header">
      <button class="close" type="button" data-dismiss="modal" aria-hidden="true">x</button>
      <h3 id="blockLabel">Block Site</h3>
    </div>
    <div class="modal-body">
      <p>You are going to block this site. This will do the following:</p>

      <ul>
        <li>You will no longer see this site in searches.</li>
        <li>Site will no longer see your site in searches.</li>
        <li>Site will not be able to comment on your site profile.</li>
        <li>Any comments this site has posted to your profile will not be displayed.</li>
      </ul>

      <p>Are you sure you want to do this?</p>
    </div>
    <div class="modal-footer">
      <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
      <button type="submit" class="btn btn-Action">Block Site</button>
    </div>
  </form>
</div>