<% the_current_user = current_user %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>BuildWise<%=  settings.company_name && !settings.company_name.blank? ? " - " +  settings.company_name : '' %></title>
  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700' rel='stylesheet' type='text/css'>                    <link href="//fonts.googleapis.com/css?family=Cousine" rel="stylesheet" type="text/css"/>
             
  <link rel="stylesheet" href="/stylesheets/bootstrap-4.6.0.min.css"  type="text/css" media="all" /> 
  <link rel="stylesheet" href="/stylesheets/bootstrap-theme.min.css" type="text/css" media="all"/>

  <link rel="stylesheet" href="/plugins/font-awesome-4.7.0/css/font-awesome.min.css" type="text/css" media="all"/>

  <%= stylesheet_link_tag 'buildwise', :media => 'all' %>
  <%= stylesheet_link_tag 'coderay', :media => 'all' %>
  <%= stylesheet_link_tag 'print', :media => 'print' %>

  <%= stylesheet_link_tag 'select2.min', :media =>'all' %>
  <%= stylesheet_link_tag 'bootstrap-editable', :media => 'all' %>
  <%= stylesheet_link_tag 'bootstrap-toggle.min', :media => 'all' %>

	<link rel="stylesheet" type="text/css" href="/plugins/codemirror-5.27.4/lib/codemirror.css" />
	<link rel="stylesheet" type="text/css" href="/plugins/codemirror-5.27.4/addon/fold/foldgutter.css" />	
	<link rel="stylesheet" type="text/css" href="/plugins/codemirror-5.27.4/theme/monokai.css" />
	<link rel="stylesheet" type="text/css" href="/plugins/codemirror-5.27.4/theme/elegant.css" />
	<link rel="stylesheet" type="text/css" href="/plugins/highlight/default.css" />

  <%= stylesheet_link_tag 'bootstrap-datepicker', :media => 'all' %>
  <%= stylesheet_link_tag 'daterangepicker.min', :media => 'all' %>
		
  <script src="/javascripts/jquery-3.6.0.min.js" type="text/javascript"></script>
  <script src="/javascripts/popper-1.14.7.min.js" type="text/javascript"></script> <!-- 1.12.3 works-->
	<script src="/javascripts/bootstrap-4.6.0.min.js"></script>
	<script src="/javascripts/bootbox-5.4.0.min.js"></script>
  
  <script src="/javascripts/clipboard.min.js" type="text/javascript"></script>
  <script src="/javascripts/bootstrap-editable.min.js" type="text/javascript"></script>
  <script src="/javascripts/bootstrap-toggle.min.js" type="text/javascript"></script>
<!--	
  <script src="/javascripts/back-to-top.js" type="text/javascript"></script>
-->
  <script src="/javascripts/highcharts.js" type="text/javascript"></script>
  <script src="/javascripts/jquery.localtime-0.7.1.js" type="text/javascript"></script>

  <script src="/javascripts/select2.full.min.js" type="text/javascript"></script>
  <script src="/javascripts/fuse.min.js" type="text/javascript"></script>

 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/lib/codemirror.js"></script> 
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/foldcode.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/foldgutter.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/brace-fold.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/xml-fold.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/markdown-fold.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/addon/fold/comment-fold.js"></script> 	
	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/mode/javascript/javascript.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/mode/xml/xml.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/mode/htmlmixed/htmlmixed.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/mode/htmlembedded/htmlembedded.js"></script> 	
 	<script type="text/javascript" src="/plugins/codemirror-5.27.4/mode/css/css.js"></script> 	
	
 	<script type="text/javascript" src="/plugins/highlight/highlight.min.js"></script> 	
  
 	<script type="text/javascript" src="/javascripts/moment.min.js"></script> 	
 	<script type="text/javascript" src="/javascripts/bootstrap-datepicker.js"></script> 	
 	<script type="text/javascript" src="/javascripts/daterangepicker.min.js"></script> 	
  
  <script src="/javascripts/jquery.sortable.js" type="text/javascript"></script>

  <script src="/javascripts/application.js" type="text/javascript"></script>


<link rel="stylesheet"
      href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/styles/default.min.css">
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/highlight.min.js"></script
  
	<script type="text/javascript">

	</script>

  <% if @autorefresh %>
      <meta http-equiv="refresh" content="<%= @refresh_interval || 300 %>">
      <meta http-equiv="cache-control" content="no-cache">
  <% end %>

  <% if @rss_feeds %>
      <% @rss_feeds.sort.each do |title, url| %>
      <% end %>
  <% end %>

	<%= csrf_meta_tags %>

</head>

<body>


<div class="header">
	
	<div class="dropdown" style="position: absolute; left: 180px; ">				
		<% if @projects %>
			<div class="dropdown">								
		    <button class="btn btn-light btn-sm btn-borderless dropdown-toggle" type="button" data-toggle="dropdown" style="margin-top: -2px;" ><span data-toggle="tooltip" data-placement="right" title="<%= I18n.t(:sort_projects_tooltip) %>"><i class="fa fa-sort" aria-hidden="true"></i></span>
					<!--
					 <span class="caret"></span>
					-->
				 </button>
				
		    <ul class="dropdown-menu dropdown-menu-right">

						
						<a class="dropdown-item" href="/?sort=last_build_time&sort_direction=DESC" >
							<label style="width: 16px;">
							<% if @sort_column == "last_build_time" && @sort_direction == "DESC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>							
							</label>							
							<%= I18n.t(:recent_build) %></a>
							
						<a class="dropdown-item" href="/?sort=last_build_time&sort_direction=ASC" >
							<label style="width: 16px;">
							<% if @sort_column == "last_build_time" && @sort_direction == "ASC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>
							</label>
							<%= I18n.t(:distant_build) %> </a>

						<a class="dropdown-item" href="/?sort=name&sort_direction=ASC" >
							<label style="width: 16px;">
							<% if @sort_column == "name" && @sort_direction == "ASC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>							
							</label>							
							<%= I18n.t(:project_name) %> <i class="fa fa-sort-alpha-asc" aria-hidden="true"></i> </a>
												
						<a class="dropdown-item" href="/?sort=name&sort_direction=DESC" >
							<label style="width: 16px;">
							<% if @sort_column == "name" && @sort_direction == "DESC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>
							</label>
							<%= I18n.t(:project_name) %> <i class="fa fa-sort-alpha-desc" aria-hidden="true"></i> </a>

						<a class="dropdown-item" href="/?sort=id&sort_direction=ASC">
							<label style="width: 16px;">
							<% if @sort_column == "id" && @sort_direction == "ASC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>
							</label>
							<%= I18n.t(:created_first) %> </a>

						<a class="dropdown-item" href="/?sort=id&sort_direction=DESC" >
							<label style="width: 16px;">
							<% if @sort_column == "id" && @sort_direction == "DESC" %>
								<i class="fa fa-check" aria-hidden="true"></i>							
							<% end %>
							</label>
							<%= I18n.t(:created_last) %>  </a>

			</div>
			<div></div>
		<% end %>
	</div>

  <div class="main_menu">
	

			<% if the_current_user %>			
				<!-- current logged in -->
				
			<div class="dropdown">				
		    <button class="btn btn-sm btn-light dropdown-toggle" type="button" data-toggle="dropdown" style="margin-top: -4px;" id="profile_dropdown"  aria-expanded="false">
					<%= the_current_user.username %>
				</button>				 				
		    <div class="dropdown-menu dropdown-menu-right" aria-lablelledby="profile_dropdown">

		     <a class="dropdown-item" href="/users/<%= the_current_user.id %>/edit" ><label class="dropdown-menu-icon"><i class="fa fa-user" ></i></label> <%= I18n.t(:change_password) %></a>

				<% if the_current_user.is_admin?  %>
		    	 <a  class="dropdown-item"  href="/admin/settings" ><label class="dropdown-menu-icon"><i class="fa fa-gear" ></i></label> <%= I18n.t(:preferences) %></a>
		      <a  class="dropdown-item"  href="/projects/new" > 
						<label class="dropdown-menu-icon"><i class="fa fa-plus" ></i></label> <%= I18n.t(:new_project) %> </a>
		      <a  class="dropdown-item"  href="/admin/permissions" ><label class="dropdown-menu-icon"><i class="fa fa-users" aria-hidden="true"></i></label> <%= I18n.t(:permissions) %></a>
				<% end %>		
				  <li><hr class="dropdown-divider"></li>
					<a  class="dropdown-item"  href="/logout" ><label class="dropdown-menu-icon"><i class="fa fa-sign-out"  aria-hidden="true"></i></label> <%= I18n.t(:logout) %></a>
			  </div>	
		  </div>
					
			<% else %>	
				
				<!-- anonymous -->
			    <div style="margin-top: 5px;" class="hidden-print">
				     <a href="/login" ><label class="dropdown-menu-icon"><i class="fa fa-sign-in" aria-hidden="true"></i></label>
 <%= I18n.t(:login) %></a>
			    </div>
				
				
			<% end %>
  </div>


  <div class="cc_logo">
    <a href="/"><%= image_tag("/images/buildwise/buildwise_logo.png") %></a>
    <span id="rack_env" style="display:none;"><%= ENV['RACK_ENV'] %></span>
  </div>

</div>



<div id="content">
	
	<% if flash[:alert] || flash[:error] || flash[:info] %>
  <div id='flash' class="container">
		<% if flash[:info]%>
    <div class='alert alert-success'><%= flash[:info]%></div>
		<% end %>
		<% if flash[:alert]%>
    <div class='alert alert-warning'><%= flash[:alert]%></div>
		<% end %>
		
		<% if flash[:error]%>
    <div class='alert alert-danger'><%= flash[:error] %></div>		
		<% end %>
  </div>
	<% end %>
	
  <!--
     unless @flash[:error].blank?
        <div class="flash_error"> h flash[:error] </div>
     end
  -->
  <%= yield %>
</div>

<div class="footer row" style="margin-top: 0px; margin-bottom: 15px; border-top: 1px solid #ddd; padding-top: 5px;">
  <div class="col-sm-12 col-md-6 slogan">
      <%= raw I18n.t(:buildwise_slogan) %>
  </div>
  <div class="col-sm-12 col-md-6" style="text-align: right;">
     <span id="version" style="margin-right: 5px;">v<%= BuildWise::VERSION %></span>    
	 <!-- <%= SERVER_DIGEST %> -->  
     <%= I18n.t(:copyright) %>
		 &copy; 2017-2026 <a href="https://agileway.com.au"><%= I18n.t(:agileway_ltd) %></a></div>
  </div>
</div>

</body>

    <script>
        $(document).ready(function() {
    
					<% if RACK_ENV == "showcase" %>	  
				  $( "a.not-for-showcase" ).click(function( event ) {
			      event.preventDefault();
						bootbox.alert("This feature is disabled in ShowCase mode");
				  });	
				  $( "input.not-for-showcase" ).click(function( event ) {
			      event.preventDefault();
						bootbox.alert("This feature is disabled in ShowCase mode");
				  });	
			    <% end %>

					$('[data-toggle="tooltip"]').tooltip();		


          hljs.configure({useBR: true});
          
          document.addEventListener('DOMContentLoaded', (event) => {
            document.querySelectorAll('pre code').forEach((block) => {
              hljs.highlightBlock(block);
            });
          });
          
          
        });
    </script>
				
</html>
