From 046b1810c0642b491c191bc82eb73a99034ac5ca Mon Sep 17 00:00:00 2001 From: Suraj Date: Tue, 16 Feb 2016 22:48:13 +0530 Subject: [PATCH] images are now inline --- public/static/css/styles.css | 5 +++++ templates/home.html | 2 +- views/addViews.go | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/public/static/css/styles.css b/public/static/css/styles.css index 8969d88..43756b2 100644 --- a/public/static/css/styles.css +++ b/public/static/css/styles.css @@ -174,6 +174,11 @@ hr{ display: none; } +.noteContent img { + width: 90%; + padding-left: 10%; +} + .toggle{ cursor: pointer; margin-top:-30px; diff --git a/templates/home.html b/templates/home.html index 61af4e5..a235bf4 100644 --- a/templates/home.html +++ b/templates/home.html @@ -37,12 +37,12 @@ {{end}} - + diff --git a/views/addViews.go b/views/addViews.go index 9b73fae..065c638 100644 --- a/views/addViews.go +++ b/views/addViews.go @@ -35,6 +35,7 @@ func UploadedFileHandler(w http.ResponseWriter, r *http.Request) { //AddTaskFunc is used to handle the addition of new task, "/add" URL func AddTaskFunc(w http.ResponseWriter, r *http.Request) { if r.Method == "POST" { // Will work only for POST requests, will redirect to home + var filelink string // will store the html when we have files to be uploaded, appened to the note content r.ParseForm() file, handler, err := r.FormFile("uploadfile") if err != nil && handler != nil { @@ -87,7 +88,11 @@ func AddTaskFunc(w http.ResponseWriter, r *http.Request) { defer f.Close() io.Copy(f, file) - filelink := "
" + handler.Filename + "" + if strings.HasSuffix(handler.Filename, ".png") || strings.HasSuffix(handler.Filename, ".jpg") { + filelink = "
" + } else { + filelink = "
" + handler.Filename + "" + } content = content + filelink fileTruth := db.AddFile(handler.Filename, token)