import base html core + bootstrap from warren
| 
		 After Width: | Height: | Size: 457 B  | 
| 
		 After Width: | Height: | Size: 351 B  | 
| 
		 After Width: | Height: | Size: 244 B  | 
| 
		 After Width: | Height: | Size: 301 B  | 
| 
		 After Width: | Height: | Size: 387 B  | 
| 
		 After Width: | Height: | Size: 246 B  | 
| 
		 After Width: | Height: | Size: 5.7 KiB  | 
| 
		 After Width: | Height: | Size: 317 B  | 
| 
		 After Width: | Height: | Size: 367 B  | 
| 
		 After Width: | Height: | Size: 6.8 KiB  | 
| 
		 After Width: | Height: | Size: 4.5 KiB  | 
| 
		 After Width: | Height: | Size: 4.5 KiB  | 
| 
		 After Width: | Height: | Size: 4.5 KiB  | 
| 
		 After Width: | Height: | Size: 6.3 KiB  | 
| 
						 | 
					@ -0,0 +1,40 @@
 | 
				
			||||||
 | 
					body {
 | 
				
			||||||
 | 
					  padding-top: 40px;
 | 
				
			||||||
 | 
					  padding-bottom: 40px;
 | 
				
			||||||
 | 
					  background-color: #eee;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.form-signin {
 | 
				
			||||||
 | 
					  max-width: 330px;
 | 
				
			||||||
 | 
					  padding: 15px;
 | 
				
			||||||
 | 
					  margin: 0 auto;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin .form-signin-heading,
 | 
				
			||||||
 | 
					.form-signin .checkbox {
 | 
				
			||||||
 | 
					  margin-bottom: 10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin .checkbox {
 | 
				
			||||||
 | 
					  font-weight: normal;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin .form-control {
 | 
				
			||||||
 | 
					  position: relative;
 | 
				
			||||||
 | 
					  height: auto;
 | 
				
			||||||
 | 
					  -webkit-box-sizing: border-box;
 | 
				
			||||||
 | 
					     -moz-box-sizing: border-box;
 | 
				
			||||||
 | 
					          box-sizing: border-box;
 | 
				
			||||||
 | 
					  padding: 10px;
 | 
				
			||||||
 | 
					  font-size: 16px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin .form-control:focus {
 | 
				
			||||||
 | 
					  z-index: 2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin input[type="email"] {
 | 
				
			||||||
 | 
					  margin-bottom: -1px;
 | 
				
			||||||
 | 
					  border-bottom-right-radius: 0;
 | 
				
			||||||
 | 
					  border-bottom-left-radius: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.form-signin input[type="password"] {
 | 
				
			||||||
 | 
					  margin-bottom: 10px;
 | 
				
			||||||
 | 
					  border-top-left-radius: 0;
 | 
				
			||||||
 | 
					  border-top-right-radius: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					body {
 | 
				
			||||||
 | 
					  padding-top: 50px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					.starter-template {
 | 
				
			||||||
 | 
					  padding: 40px 15px;
 | 
				
			||||||
 | 
					  text-align: center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.col-form .row .col-xs-2 {
 | 
				
			||||||
 | 
					  text-align: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					$(document).ready( function () {
 | 
				
			||||||
 | 
					  $( "#datepicker" ).datepicker();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					/*!
 | 
				
			||||||
 | 
					 * jquery.confirm
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @version 2.3.1
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author My C-Labs
 | 
				
			||||||
 | 
					 * @author Matthieu Napoli <matthieu@mnapoli.fr>
 | 
				
			||||||
 | 
					 * @author Russel Vela
 | 
				
			||||||
 | 
					 * @author Marcus Schwarz <msspamfang@gmx.de>
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license MIT
 | 
				
			||||||
 | 
					 * @url http://myclabs.github.io/jquery.confirm/
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					(function($){$.fn.confirm=function(options){if(typeof options==="undefined"){options={}}this.click(function(e){e.preventDefault();var newOptions=$.extend({button:$(this)},options);$.confirm(newOptions,e)});return this};$.confirm=function(options,e){if($(".confirmation-modal").length>0)return;var dataOptions={};if(options.button){var dataOptionsMapping={title:"title",text:"text","confirm-button":"confirmButton","cancel-button":"cancelButton","confirm-button-class":"confirmButtonClass"};$.each(dataOptionsMapping,function(attributeName,optionName){var value=options.button.data(attributeName);if(value){dataOptions[optionName]=value}})}var settings=$.extend({},$.confirm.options,{confirm:function(){var url=e&&("string"===typeof e&&e||e.currentTarget&&e.currentTarget.attributes["href"].value);if(url){if(options.post){var form=$('<form method="post" class="hide" action="'+url+'"></form>');$("body").append(form);form.submit()}else{window.location=url}}},cancel:function(o){},button:null},dataOptions,options);var modalHeader="";if(settings.title!==""){modalHeader="<div class=modal-header>"+'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>'+'<h4 class="modal-title">'+settings.title+"</h4>"+"</div>"}var modalHTML='<div class="confirmation-modal modal fade" tabindex="-1" role="dialog">'+'<div class="modal-dialog">'+'<div class="modal-content">'+modalHeader+'<div class="modal-body">'+settings.text+"</div>"+'<div class="modal-footer">'+'<button class="confirm btn '+settings.confirmButtonClass+'" type="button" data-dismiss="modal">'+settings.confirmButton+"</button>"+'<button class="cancel btn btn-default" type="button" data-dismiss="modal">'+settings.cancelButton+"</div>"+"</div>"+"</div>"+"</div>"+"</div>";var modal=$(modalHTML);modal.on("shown.bs.modal",function(){modal.find(".btn-primary:first").focus()});modal.on("hidden.bs.modal",function(){modal.remove()});modal.find(".confirm").click(function(){settings.confirm(settings.button)});modal.find(".cancel").click(function(){settings.cancel(settings.button)});$("body").append(modal);modal.modal("show")};$.confirm.options={text:"Are you sure?",title:"",confirmButton:"Yes",cancelButton:"Cancel",post:false,confirmButtonClass:"btn-primary"}})(jQuery);
 | 
				
			||||||
							
								
								
									
										36
									
								
								main.go
								
								
								
								
							
							
						
						| 
						 | 
					@ -4,6 +4,8 @@ import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"database/sql"
 | 
				
			||||||
 | 
						_ "github.com/lib/pq"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const VERSION = "0.1"
 | 
					const VERSION = "0.1"
 | 
				
			||||||
| 
						 | 
					@ -19,6 +21,7 @@ type Config struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	config Config
 | 
						config Config
 | 
				
			||||||
 | 
						db *sql.DB
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func loadConfig() {
 | 
					func loadConfig() {
 | 
				
			||||||
| 
						 | 
					@ -31,10 +34,41 @@ func loadConfig() {
 | 
				
			||||||
	decoder.Decode(&config)
 | 
						decoder.Decode(&config)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func dbConnect() {
 | 
				
			||||||
 | 
					    var err error
 | 
				
			||||||
 | 
						db, err = sql.Open("postgres", fmt.Sprintf("postgres://%s:%s@%s/%s?sslmode=require", config.Sql.Username, config.Sql.Password, config.Sql.Host, config.Sql.Dbname))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							fmt.Println("DB ERROR: ", err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						err = db.Ping()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							fmt.Println("DB Error on Ping(): ", err)
 | 
				
			||||||
 | 
							os.Exit(-1)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func initTemplates() {
 | 
				
			||||||
 | 
						files, _ := filepath.Glob("templates/pages/*.html")
 | 
				
			||||||
 | 
						re := regexp.MustCompile("templates/pages/(.*).html")
 | 
				
			||||||
 | 
						fmt.Println("Loading Templates:")
 | 
				
			||||||
 | 
						for _, t := range files {
 | 
				
			||||||
 | 
							name := re.FindStringSubmatch(t)
 | 
				
			||||||
 | 
							fmt.Println("  ", name[1])
 | 
				
			||||||
 | 
							var err error
 | 
				
			||||||
 | 
							templates[name[1]], err = template.ParseFiles("templates/layout.html", t)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								fmt.Println("Template load error: ", err)
 | 
				
			||||||
 | 
								os.Exit(-1)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	fmt.Println("transmet ", VERSION)
 | 
						fmt.Println("transmet ", VERSION)
 | 
				
			||||||
	fmt.Println("Loading...")
 | 
						fmt.Println("Loading...")
 | 
				
			||||||
	loadConfig()
 | 
						loadConfig()
 | 
				
			||||||
	 
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						db.Close()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,73 @@
 | 
				
			||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="en">
 | 
				
			||||||
 | 
					  <head>
 | 
				
			||||||
 | 
					    <meta charset="utf-8">
 | 
				
			||||||
 | 
					    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
				
			||||||
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1">
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					    <title>transmet</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- Bootstrap -->
 | 
				
			||||||
 | 
					    <link href="/css/bootstrap.min.css" rel="stylesheet">
 | 
				
			||||||
 | 
					    <link href="/css/jquery-ui.min.css" rel="stylesheet">
 | 
				
			||||||
 | 
					    <link href="/css/template.css" rel="stylesheet">
 | 
				
			||||||
 | 
					    <link href="/css/signin.css" rel="stylesheet">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  </head>
 | 
				
			||||||
 | 
					  <body>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
 | 
				
			||||||
 | 
					      <div class="container">
 | 
				
			||||||
 | 
					        <div class="navbar-header">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-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="/">MasterTracker</a>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					        <div class="collapse navbar-collapse">
 | 
				
			||||||
 | 
					          <ul class="nav navbar-nav">
 | 
				
			||||||
 | 
					            <!--<li class="active"><a href="#">Home</a></li>
 | 
				
			||||||
 | 
					            <li><a href="#about">About</a></li>
 | 
				
			||||||
 | 
					            <li><a href="#contact">Contact</a></li> -->
 | 
				
			||||||
 | 
					          </ul>
 | 
				
			||||||
 | 
					          <ul class="nav navbar-nav navbar-right">
 | 
				
			||||||
 | 
					          {{if .user}}
 | 
				
			||||||
 | 
					            <li><a href="/user/edit">{{.user.Displayname}}</a></li>
 | 
				
			||||||
 | 
					            <li><a href="/logout">Logout</a></li>
 | 
				
			||||||
 | 
					          {{else}}
 | 
				
			||||||
 | 
					            <li><a href="/signup">Sign up</a></li>
 | 
				
			||||||
 | 
					            <li><a href="/login">Log in</a></li>
 | 
				
			||||||
 | 
					          {{end}}
 | 
				
			||||||
 | 
					          </ul>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					    {{template "body" .}}
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
 | 
				
			||||||
 | 
					    <script src="/js/jquery.min.js"></script>
 | 
				
			||||||
 | 
					    <!-- Include all compiled plugins (below), or include individual files as needed -->
 | 
				
			||||||
 | 
					    <script src="/js/bootstrap.min.js"></script>
 | 
				
			||||||
 | 
					    <script src="/js/jquery.confirm.min.js"></script>
 | 
				
			||||||
 | 
					    <script src="/js/jquery-ui.min.js"></script>
 | 
				
			||||||
 | 
					    <script src="/js/funcs.js"></script>
 | 
				
			||||||
 | 
					  </body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{{define "flashes"}}
 | 
				
			||||||
 | 
					<div class="messages">
 | 
				
			||||||
 | 
					   {{range .flashes.info}}
 | 
				
			||||||
 | 
					     <div class="alert alert-success" role="alert">Info: {{.}}</div>
 | 
				
			||||||
 | 
					   {{end}}
 | 
				
			||||||
 | 
					   {{range .flashes.error}}
 | 
				
			||||||
 | 
					     <div class="alert alert-danger" role="alert">Error: {{.}}</div>
 | 
				
			||||||
 | 
					   {{end}}
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					{{end}}
 | 
				
			||||||