<div class="row">
  <div class="col-xs-12 col-sm-6">

    <h4 class="breadcrumb"><%= t(:channels_my) %></h4>

    <div class="col-pad">

      <% if @channels.length > 0 %>

        <table class="table table-striped table-bordered tablesorter">
          <thead>
            <tr>
              <th><%= t(:channel_name) %> <i class="fa fa-unsorted"></i></th>
              <th><%= t(:created) %> <i class="fa fa-unsorted"></i></td>
            </tr>
          </thead>
          <tbody>
            <% @channels.where(:social => false).each do |channel| %>
              <tr>
                <td>

                  <a href="/channels/<%= channel.id %>">
                    <i class="fa fa-<%= 'un' if channel.public_flag == true %>lock fa-fw"></i>
                    <%= channel.name %>
                  </a>
                  <br>
                  <%= link_to t(:private_link), channel_path(channel.id, :anchor => 'privateview') %>  |
                  <%= link_to t(:public_link), channel_path(channel.id, :anchor => 'publicview') %> |
                  <%= link_to t(:settings_link), channel_path(channel.id, :anchor => 'channelsettings') %>  |
                  <%= link_to t(:api_key_link), channel_path(channel.id, :anchor => 'apikeys') %>  |
                  <%= link_to t(:data_import_link), channel_path(channel.id, :anchor => 'dataimport') %>

                </td>
                <td><%= channel.created_at.strftime("%Y-%m-%d") %></td>
              </tr>
            <% end %>
          </tbody>
        </table>
      <% end %>

      <%= button_to t(:channel_create), channels_path, :method => :post, :class => 'btn btn-primary' %>

      <% if current_admin_user.present? %>
        <br><br><br>
        <% @channels.each do |c| %>
          <% if c.social %>
            <%= t(:social_channel) %>: <%= link_to c.name, (Rails.env == 'production') ? "http://www.socialsensornetwork.com/#{c.slug}" : "/s/#{c.slug}" %>
            <br>
          <% end %>
        <% end %>
        <br>
        <%= link_to t(:social_channel_create), :controller => 'channels', :action => 'social_new' %>
      <% end %>

    </div>
  </div>

  <div id="sidebar" class="col-xs-12 col-sm-6">
    <h4 class="breadcrumb"><%= t(:help) %></h4>

    <div class="col-pad">

      <%= t(:help_channel) %>
      (<a href="/docs/channels"><%= t(:help_options) %></a>)
      <ul>
        <li><a href="http://community.thingspeak.com/tutorials/arduino/using-an-arduino-ethernet-shield-to-update-a-thingspeak-channel/">Arduino Tutorial</a></li>
        <li><a href="http://community.thingspeak.com/tutorials/netduino/create-your-own-web-of-things-using-the-netduino-plus-and-thingspeak/">Netduino Plus Tutorial</a></li>
      </ul>

    </div>
  </div>

</div>

<script>
  $(document).ready(function() {
    $('.tablesorter').tablesorter();
  });
</script>

