<!DOCTYPE html>
<html>
  <head>
    {% block head %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="pyAggr3g470r is a web-based news aggregator." />
    <meta name="author" content="" />
    <title>pyAggr3g470r{% if head_titles %} - {{ ' - '.join(head_titles) }}{% endif %}</title>
    <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}" />
    <!-- Bootstrap core CSS -->
    <link href="{{ url_for('static', filename='css/bootstrap.css') }}" rel="stylesheet" media="screen" />
    <!-- Add custom CSS here -->
    <link href="{{ url_for('static', filename='css/customized-bootstrap.css') }}" rel="stylesheet" media="screen" />
    <link href="{{ url_for('static', filename='css/side-nav.css') }}" rel="stylesheet" media="screen" />
  {% endblock %}
  </head>
  <body>
    <nav class="navbar navbar-inverse navbar-fixed-top navbar-custom" role="navigation">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="{{ url_for("home") }}">pyAggr3g470r</a>
          {% if head_titles %}
            {% for head_title in head_titles %}
              <span class="navbar-brand"> - </span>
              <span class="navbar-brand">{{ head_title }}</span>
            {% endfor %}
          {% endif %}
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">
          <ul class="nav navbar-nav navbar-right">
            {% if g.user.is_authenticated() %}
                <!-- <li><a href="{{ url_for("feed.form") }}"><span class="glyphicon glyphicon-plus-sign"></span> {{ _('Add a feed') }}</a></li> -->
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <div><span class="glyphicon glyphicon-plus-sign"></span>&nbsp;{{ _('Add a feed') }}</div>
                    </a>
                    <ul class="dropdown-menu">
                        <li>
                            <form action="{{ url_for('feed.bookmarklet') }}" class="navbar-form" method="GET" name="save">
                                <input class="form-control" name="url" type="text" placeholder="{{_("site or feed url")}}" /> <input type="submit" value="+" class="btn btn-default" />
                            </form>
                        </li>
                    </ul>
                </li>
                {% if page_to_render == "favorites" %}
                <li><a href="{{ url_for("home") }}"><span class="glyphicon glyphicon-home"></span> {{ _('Home') }}</a></li>
                {% else %}
                <li><a href="{{ url_for("favorites") }}"><span class="glyphicon glyphicon-star"></span> {{ _('Favorites') }}</a></li>
                {% endif %}
                {% if conf.CRAWLING_METHOD == "classic" and (not conf.ON_HEROKU or g.user.is_admin()) %}
                <li><a href="/fetch"><span class="glyphicon glyphicon-import"></span> {{ _('Fetch') }}</a></li>
                {% endif %}
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ _('Feed') }} <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="{{ url_for("feeds.update", action="read") }}">{{ _('Mark all as read') }}</a></li>
                        <li role="presentation" class="divider"></li>
                        <li><a href="{{ url_for("inactives") }}">{{ _('Inactive') }}</a></li>
                        <li><a href="{{ url_for("history") }}">{{ _('History') }}</a></li>
                        <li><a href="{{ url_for("feeds.feeds") }}">{{ _('All') }}</a></li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <div><span class="glyphicon glyphicon-user"></span>&nbsp;<b class="caret"></b></div>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="{{ url_for("profile") }}"><span class="glyphicon glyphicon-user"></span> {{ _('Profile') }}</a></li>
                        <li><a href="{{ url_for("management") }}"><span class="glyphicon glyphicon-cog"></span> {{ _('Your data') }}</a></li>
                        <li><a href="{{ url_for("about") }}"><span class="glyphicon glyphicon-question-sign"></span> {{ _('About') }}</a></li>
                        {% if g.user.is_admin() %}
                        <li role="presentation" class="divider"></li>
                        <li><a href="{{ url_for("dashboard") }}"><span class="glyphicon glyphicon-dashboard"></span> {{ _('Dashboard') }}</a></li>
                        <li role="presentation" class="divider"></li>
                        {% endif %}
                        <li><a href="{{ url_for("logout") }}"><span class="glyphicon glyphicon-log-out"></span> {{ _('Logout') }}</a></li>
                    </ul>
                </li>

                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <div><span class="glyphicon glyphicon-search"></span>&nbsp;<b class="caret"></b></div>
                    </a>
                    <ul class="dropdown-menu">
                        <li>
                            <form class="navbar-form" method=get action="{{ url_for("search") }}" role="search">
                                <div class="input-group">
                                    {% if filter_ %}<input type="hidden" name="filter_" value="{{ filter_ }}" />{% endif %}
                                    {% if limit %}<input type="hidden" name="limit" value="{{ limit }}" />{% endif %}
                                    {% if feed_id %}<input type="hidden" name="feed_id" value="{{ feed_id }}" />{% endif %}
                                    <label for="search_title">{{ _("Title") }}</label>
                                    <input type="checkbox" name="search_title" {% if search_title == 'on' or not (search_title == 'on' or search_content == 'on') %}checked{%endif%}/>
                                    <br />
                                    <label for="search_content">{{ _("Content") }}</label>
                                    <input type="checkbox" name="search_content" {% if search_content == 'on' %}checked{%endif%}/>
                                    <input type="text" class="form-control" name="query" placeholder="{{ _("Search") }}" {% if search_query %} value="{{ search_query }}"{% endif %} />
                                </div>
                            </form>
                        </li>
                    </ul>
                </li>
            {% else %}
                <li><a href="{{ url_for("about") }}"><span class="glyphicon glyphicon-question-sign"></span>&nbsp;{{ _('About') }}</a></li>
            {% endif %}
          </ul>
        </div><!-- /.navbar-collapse -->
      </div><!-- /.container -->
    </nav>
    <br />

    <div class="container-fluid not-at-home">
        {% block messages %}
            {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                    {% for category, message in messages %}
                        <div class="alert alert-{{category}}">
                            <button type="button" class="close" data-dismiss="alert">&times;</button>
                            {{ message }}
                        </div>
                    {% endfor %}
                {% endif %}
            {% endwith %}
        {% endblock %}
    </div>

    {% block content %}{% endblock %}

    <!-- Bootstrap core JavaScript -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/javascript" src="{{ url_for('static', filename = 'js/jquery.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename = 'js/bootstrap.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename = 'js/articles.js') }}"></script>
    <script type="text/javascript" src="{{ url_for('static', filename = 'js/feed.js') }}"></script>
    <script type="text/javascript" class="source">
        var filter_ = {% if filter_ %}"{{ filter_ }}"{% else %}undefined{% endif %};
        if (filter_ == undefined) {
            if (window.location.href.indexOf("filter_=all") > -1){
                filter_ = 'all';
            }
            else if (window.location.href.indexOf("filter_=unread") > -1) {
                filter_ = 'unread';
            }
            else if (window.location.href.indexOf("filter_=read") > -1) {
                filter_ = 'read';
            }
        }
        $("#tab-" + filter_).attr('class', "active");
    </script>
  </body>
</html>