Browse Source

working version alpha

pull/11/head
crunk 7 months ago
parent
commit
963b33f170
  1. 4
      verse/models/distribusimodel.py
  2. 2
      verse/start.py
  3. 5
      verse/static/js/dropdown.js
  4. 10
      verse/upload.py

4
verse/models/distribusimodel.py

@ -9,14 +9,10 @@ class Distribusis(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
distribusiname = db.Column(db.String(300), nullable=False, unique=True) distribusiname = db.Column(db.String(300), nullable=False, unique=True)
userid = db.Column(db.Integer, db.ForeignKey("users.id")) userid = db.Column(db.Integer, db.ForeignKey("users.id"))
term = db.Column(db.String(5), nullable=False, unique=False)
category = db.Column(db.String(500), nullable=True, unique=False) category = db.Column(db.String(500), nullable=True, unique=False)
# Academic year eg:2020-2021, so no need for a Datetime object
year = db.Column(db.String(9), nullable=True, unique=False) year = db.Column(db.String(9), nullable=True, unique=False)
tags = db.Column(db.String(500), nullable=True, unique=False) tags = db.Column(db.String(500), nullable=True, unique=False)
publictheme = db.Column(db.String(300), unique=True, nullable=True) publictheme = db.Column(db.String(300), unique=True, nullable=True)
visible = db.Column(db.Boolean, default=False) visible = db.Column(db.Boolean, default=False)
def __repr__(self): def __repr__(self):

2
verse/start.py

@ -59,7 +59,6 @@ def index():
distribusisindex[distribusi.distribusiname] = singledistribusi distribusisindex[distribusi.distribusiname] = singledistribusi
years = uploadform.year.choices years = uploadform.year.choices
categories = uploadform.category.choices categories = uploadform.category.choices
adminuser = isadminuser() adminuser = isadminuser()
template = render_template( template = render_template(
"index.html", "index.html",
@ -100,7 +99,6 @@ def publicthemes(path):
distribusi = Distribusis.query.filter_by(distribusiname=path).first() distribusi = Distribusis.query.filter_by(distribusiname=path).first()
publicthemefolder = f"publicthemes/{distribusi.distribusiname}/" publicthemefolder = f"publicthemes/{distribusi.distribusiname}/"
cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css" cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css"
print(cssfile)
return send_from_directory("themes", cssfile, as_attachment=True) return send_from_directory("themes", cssfile, as_attachment=True)

5
verse/static/js/dropdown.js

@ -24,9 +24,8 @@ function filterSelection(c, name, id) {
} }
function resetDropDownButtons(){ function resetDropDownButtons(){
document.getElementById("Academicyear").innerText = "Academic year"; document.getElementById("Year").innerText = "Year";
document.getElementById("Term").innerText = "Term"; document.getElementById("Category").innerText = "Category";
document.getElementById("Course").innerText = "Course";
allactivebuttons = document.getElementsByClassName("activebtn"); allactivebuttons = document.getElementsByClassName("activebtn");
for(var i = 0;allactivebuttons.length; i++) { for(var i = 0;allactivebuttons.length; i++) {
removeClass(allactivebuttons[i], "activebtn"); removeClass(allactivebuttons[i], "activebtn");

10
verse/upload.py

@ -22,9 +22,8 @@ def UploadNewDistribusi(uploadfolder):
newdistribusi = Distribusis( newdistribusi = Distribusis(
distribusiname=uploadform.sitename.data, distribusiname=uploadform.sitename.data,
userid=user.id, userid=user.id,
term=uploadform.term.data, category=uploadform.category.data,
course=uploadform.course.data, year=uploadform.year.data,
year=uploadform.academicyear.data,
tags=uploadform.tags.data, tags=uploadform.tags.data,
) )
user.currentdistribusi = uploadform.sitename.data user.currentdistribusi = uploadform.sitename.data
@ -66,9 +65,8 @@ def UploadUpdatedFiles(uploadfolder):
distribusi = Distribusis.query.filter_by( distribusi = Distribusis.query.filter_by(
distribusiname=current_distribusi distribusiname=current_distribusi
).first() ).first()
distribusi.term = uploadform.term.data distribusi.category = uploadform.category.data
distribusi.course = uploadform.course.data distribusi.year = uploadform.year.data
distribusi.year = uploadform.academicyear.data
distribusi.tags = uploadform.tags.data distribusi.tags = uploadform.tags.data
distribusi.visible = False distribusi.visible = False
db.session.commit() db.session.commit()

Loading…
Cancel
Save