images are now inline

This commit is contained in:
Suraj 2016-02-16 22:48:13 +05:30
parent b60b8d9dfa
commit 046b1810c0
3 changed files with 12 additions and 2 deletions

View File

@ -174,6 +174,11 @@ hr{
display: none;
}
.noteContent img {
width: 90%;
padding-left: 10%;
}
.toggle{
cursor: pointer;
margin-top:-30px;

View File

@ -37,12 +37,12 @@
<option value="{{$cat.Name}}" {{if eq $cat.Name $navigation }} selected="true" {{end}}> {{$cat.Name}} </option>
{{end}}
</select>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
<input type="submit" value="Submit" class="btn btn-primary" id="addNoteBtn" />
</div>
</form>
</div>
</div>
</div>

View File

@ -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 := "<br> <a href=/files/" + token + ">" + handler.Filename + "</a>"
if strings.HasSuffix(handler.Filename, ".png") || strings.HasSuffix(handler.Filename, ".jpg") {
filelink = "<br> <img src='/files/" + token + "'/>"
} else {
filelink = "<br> <a href=/files/" + token + ">" + handler.Filename + "</a>"
}
content = content + filelink
fileTruth := db.AddFile(handler.Filename, token)