Browse Source

scroll into view the next step

current_wdka_release
crunk 3 years ago
parent
commit
0cb57548fa
  1. 5
      verse/forms/selectorform.py
  2. 12
      verse/start.py
  3. 1
      verse/static/css/style.css
  4. 19
      verse/static/js/script.js
  5. 10
      verse/statuspengguna/helper.py
  6. 3
      verse/templates/distribusi.html
  7. 4
      verse/templates/distribusiworkflow/launch.html
  8. 3
      verse/templates/distribusiworkflow/selector.html
  9. 2
      verse/templates/distribusiworkflow/upload.html

5
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")

12
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

1
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;

19
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")
// }

10
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()

3
verse/templates/distribusi.html

@ -35,4 +35,7 @@
{% endblock launch%}
{%endif%}
</div>
{% if css_selected %}
<p id="cssSelected" hidden>css selected</p>
{% endif %}
{% endblock main %}

4
verse/templates/distribusiworkflow/launch.html

@ -1,6 +1,6 @@
<div id="distribusi" class="workflow">
<div id="launch" class="workflow">
<h3>Step 4: Distribusi</h3>
<p>run distribusi on your files, this will generate your website and make
<p>Run distribusi on your files, this will generate your website and make
your content public.</p>
<form method="POST" enctype="multipart/form-data" action="{{ url_for('distribusi') }}">
{{ distribusiform.csrf_token }}

3
verse/templates/distribusiworkflow/selector.html

@ -13,14 +13,17 @@
</div>
</fieldset>
<fieldset class="button required multiselect">
{{ selectorform.update.label }}
{{ selectorform.update }}
</fieldset>
<fieldset class="button required multiselect warning">
{{ selectorform.delete.label }}
{{ selectorform.delete }}
</fieldset>
<p>Alternatively you can make a new site</p>
<fieldset class="button required multiselect">
{{ selectorform.new.label }}
{{ selectorform.new }}
</fieldset>
</form>

2
verse/templates/distribusiworkflow/upload.html

@ -54,6 +54,6 @@
</fieldset>
</form>
{% if files_uploaded %}
<p>Your files have been uploaded successfully</p>
<p id="uploadsuccessful">Your files have been uploaded successfully</p>
{% endif %}
</div>

Loading…
Cancel
Save