Remove code for CodeHighlighting UI

We load it always, no need for a user config UI
pull/31/head
Marcel van der Boom 6 years ago
parent a659acdc14
commit 7181fd9d9e
  1. 5
      collections.go
  2. 15
      database.go
  3. 5
      templates/user/collection.tmpl

@ -70,7 +70,6 @@ type (
Privacy int `schema:"privacy" json:"privacy"` Privacy int `schema:"privacy" json:"privacy"`
Pass string `schema:"password" json:"password"` Pass string `schema:"password" json:"password"`
MathJax bool `schema:"mathjax" json:"mathjax"` MathJax bool `schema:"mathjax" json:"mathjax"`
Highlight bool `schema:"highlight" json:"highlight"`
Handle string `schema:"handle" json:"handle"` Handle string `schema:"handle" json:"handle"`
// Actual collection values updated in the DB // Actual collection values updated in the DB
@ -307,10 +306,6 @@ func (c *Collection) RenderMathJax() bool {
return c.db.CollectionHasAttribute(c.ID, "render_mathjax") return c.db.CollectionHasAttribute(c.ID, "render_mathjax")
} }
func (c *Collection) CodeHighlight() bool {
return c.db.CollectionHasAttribute(c.ID, "code_highlight")
}
func newCollection(app *app, w http.ResponseWriter, r *http.Request) error { func newCollection(app *app, w http.ResponseWriter, r *http.Request) error {
reqJSON := IsJSON(r.Header.Get("Content-Type")) reqJSON := IsJSON(r.Header.Get("Content-Type"))
alias := r.FormValue("alias") alias := r.FormValue("alias")

@ -800,21 +800,6 @@ func (db *datastore) UpdateCollection(c *SubmittedCollection, alias string) erro
} }
} }
// Update CodeHighlight value
if c.Highlight {
_, err = db.Exec("INSERT INTO collectionattributes (collection_id, attribute, value) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value = ?", collID, "code_highlight", "1", "1")
if err != nil {
log.Error("Unable to insert code_highlight value: %v", err)
return err
}
} else {
_, err = db.Exec("DELETE FROM collectionattributes WHERE collection_id = ? AND attribute = ?", collID, "code_highlight")
if err != nil {
log.Error("Unable to delete code_highlight value: %v", err)
return err
}
}
// Update rest of the collection data // Update rest of the collection data
res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...) res, err = db.Exec("UPDATE collections SET "+q.Updates+" WHERE "+q.Conditions, q.Params...)
if err != nil { if err != nil {

@ -105,11 +105,6 @@
MathJax MathJax
</label> </label>
</li> </li>
<li>
<label><input type="checkbox" name="highlight" {{if .CodeHighlight}}checked="checked"{{end}} />
Syntax highlight source-code
</label>
</li>
</ul> </ul>
</div> </div>
</div> </div>

Loading…
Cancel
Save