diff --git a/verse/forms/selectorform.py b/verse/forms/selectorform.py index 2746840..bcdad85 100644 --- a/verse/forms/selectorform.py +++ b/verse/forms/selectorform.py @@ -1,12 +1,9 @@ from flask_wtf import FlaskForm from wtforms import SubmitField, SelectField -from distribusimodel import Distribusis -from usermodel import User -from flask_login import current_user class SelectorForm(FlaskForm): - distribusis = SelectField(u'Your existing distribusi:') + distribusis = SelectField("Your existing distribusi:") new = SubmitField("new") diff --git a/verse/start.py b/verse/start.py index 92368f8..6c5e62f 100644 --- a/verse/start.py +++ b/verse/start.py @@ -43,6 +43,7 @@ from upload import UploadUpdatedFiles # UserPengguna from statuspengguna.helper import IsZipUploaded +from statuspengguna.helper import IsCssSelected from statuspengguna.helper import CurrentDistribusi from statuspengguna.helper import ResetUserState from statuspengguna.loginuser import LoginUser @@ -86,6 +87,7 @@ def distribusi(): selectorvisible = SelectorVisible() current_distribusi = CurrentDistribusi() files_uploaded = IsZipUploaded(current_distribusi) + css_selected = IsCssSelected(current_distribusi) user = User.query.filter_by(email=current_user.email).first() distribusi = Distribusis.query.filter_by( distribusiname=current_distribusi @@ -122,6 +124,7 @@ def distribusi(): themeform=themeform, selectorform=selectorform, files_uploaded=files_uploaded, + css_selected=css_selected, selectorvisible=selectorvisible, ) return template @@ -143,7 +146,7 @@ def upload(): else: uploadform = UploadUpdatedFiles(APP.config["UPLOAD_FOLDER"]) files_uploaded = IsZipUploaded(uploadform.sitename.data) - + css_selected = IsCssSelected(current_distribusi) template = render_template( "distribusi.html", uploadform=uploadform, @@ -151,6 +154,7 @@ def upload(): themeform=themeform, selectorform=selectorform, files_uploaded=files_uploaded, + css_selected=css_selected, selectorvisible=selectorvisible, ) return template @@ -168,7 +172,7 @@ def theme(): selectorvisible = SelectorVisible() current_distribusi = CurrentDistribusi() files_uploaded = IsZipUploaded(current_distribusi) - + css_selected = IsCssSelected(current_distribusi) if themeform.validate_on_submit(): newuserfolder = os.path.join("stash", current_distribusi) copycssfile = os.path.join( @@ -176,6 +180,7 @@ def theme(): "{}.css".format(themeform.theme.data), ) shutil.copy(copycssfile, newuserfolder) + css_selected = IsCssSelected(current_distribusi) template = render_template( "distribusi.html", @@ -184,6 +189,7 @@ def theme(): themeform=themeform, selectorform=selectorform, files_uploaded=files_uploaded, + css_selected=css_selected, selectorvisible=selectorvisible, ) return template @@ -242,6 +248,7 @@ def selector(): uploadform.tags.data = distribusi.tags files_uploaded = IsZipUploaded(current_distribusi) + css_selected = IsCssSelected(current_distribusi) selectorvisible = SelectorVisible() template = render_template( @@ -251,6 +258,7 @@ def selector(): themeform=themeform, selectorform=selectorform, files_uploaded=files_uploaded, + css_selected=css_selected, selectorvisible=selectorvisible, ) return template diff --git a/verse/static/css/style.css b/verse/static/css/style.css index c2c902c..2cbefec 100644 --- a/verse/static/css/style.css +++ b/verse/static/css/style.css @@ -37,7 +37,6 @@ div#upload form { margin-top: 1em; padding: 0.5em; width: 30em; - border: 3px solid #E0B0FF; background-color:#383C4A; text-decoration: none; scroll-behavior: smooth; diff --git a/verse/static/js/script.js b/verse/static/js/script.js index 534d428..d14dd2d 100644 --- a/verse/static/js/script.js +++ b/verse/static/js/script.js @@ -1,5 +1,24 @@ console.log("everything is still smooth") +function scrollToTheme() { + var uploadsuccessful = document.getElementById("uploadsuccessful"); + if(uploadsuccessful){ + const theme = document.getElementById('theme') + theme.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } +} + +function scrollToLaunch() { + var cssSelected = document.getElementById("cssSelected"); + if(cssSelected){ + const launch = document.getElementById('launch') + launch.scrollIntoView({ behavior: 'smooth', block: 'end' }); + } +} + +document.addEventListener("DOMContentLoaded", scrollToTheme); +document.addEventListener("DOMContentLoaded", scrollToLaunch); + // function(e) { // (e.keyCode === 13 || e.keyCode === 32) && $(this).trigger("click") // } diff --git a/verse/statuspengguna/helper.py b/verse/statuspengguna/helper.py index 43ea19e..75c2bfe 100644 --- a/verse/statuspengguna/helper.py +++ b/verse/statuspengguna/helper.py @@ -17,6 +17,16 @@ def IsZipUploaded(distribusiname): return False +def IsCssSelected(distribusiname): + userfolder = os.path.join("stash", distribusiname) + if os.path.exists(userfolder): + for file in os.listdir(userfolder): + if file.endswith(".css"): + return True + print("distribusi folder has no css file") + return False + + def HasDistribusi(): user = User.query.filter_by(email=current_user.email).first() distribusi = Distribusis.query.filter_by(userid=user.id).first() diff --git a/verse/templates/distribusi.html b/verse/templates/distribusi.html index a36068c..33eef63 100644 --- a/verse/templates/distribusi.html +++ b/verse/templates/distribusi.html @@ -35,4 +35,7 @@ {% endblock launch%} {%endif%} +{% if css_selected %} + +{% endif %} {% endblock main %} diff --git a/verse/templates/distribusiworkflow/launch.html b/verse/templates/distribusiworkflow/launch.html index 640bc06..a8b2449 100644 --- a/verse/templates/distribusiworkflow/launch.html +++ b/verse/templates/distribusiworkflow/launch.html @@ -1,6 +1,6 @@ -
+

Step 4: Distribusi

-

run distribusi on your files, this will generate your website and make +

Run distribusi on your files, this will generate your website and make your content public.

{{ distribusiform.csrf_token }} diff --git a/verse/templates/distribusiworkflow/selector.html b/verse/templates/distribusiworkflow/selector.html index 358a049..969ca8b 100644 --- a/verse/templates/distribusiworkflow/selector.html +++ b/verse/templates/distribusiworkflow/selector.html @@ -13,14 +13,17 @@
+ {{ selectorform.update.label }} {{ selectorform.update }}
+ {{ selectorform.delete.label }} {{ selectorform.delete }}

Alternatively you can make a new site

+ {{ selectorform.new.label }} {{ selectorform.new }}
diff --git a/verse/templates/distribusiworkflow/upload.html b/verse/templates/distribusiworkflow/upload.html index a0c5a83..29aae72 100644 --- a/verse/templates/distribusiworkflow/upload.html +++ b/verse/templates/distribusiworkflow/upload.html @@ -54,6 +54,6 @@ {% if files_uploaded %} -

Your files have been uploaded successfully

+

Your files have been uploaded successfully

{% endif %}