being able to select your distribusi and to either update, new or delete
This commit is contained in:
parent
8857f17f7f
commit
aa89547ee1
@ -11,12 +11,7 @@ This particular work in progress project is an attempt to make distribusi into a
|
||||
This project is made for Autonomous Practices at the WDKA in Rotterdam.
|
||||
## Work in progress
|
||||
|
||||
1. ~~Nothing is working yet but I need to do this project in smaller steps then everything in one go.~~
|
||||
2. So far, in this project you can make a user, upload a zip, make a website name and have distribusi
|
||||
run it for you.
|
||||
3. There is a css editor and a theme selector, but very buggy.
|
||||
I am still developing a lot of features and I want to finish them first before
|
||||
I do a first pass, fixing issues and refactoring code.
|
||||
Amazingly helpful testers, currently I am writing some database upgrades and new functionalities, and they don't work, so have some patience with testing the in development material.
|
||||
|
||||
## Start your engines!
|
||||
|
||||
|
4
notes.md
4
notes.md
@ -7,8 +7,12 @@ this way we should be able to run distribusi from code on a folder, or multiple
|
||||
# Shit! We need entire CRUD functionality.
|
||||
|
||||
## Create:
|
||||
There is a listing of the users distribusis. Purp
|
||||
There is a yellow button, giving you the new option.
|
||||
|
||||
### Uploading
|
||||
User can select the distribusi and upload/update.
|
||||
|
||||
User can upload based on $distribusiname field in db.
|
||||
the zip file is changed to $distribusiname.
|
||||
and a folder is made in the stash called $distribusiname
|
||||
|
15
verse/forms/selectorform.py
Normal file
15
verse/forms/selectorform.py
Normal file
@ -0,0 +1,15 @@
|
||||
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:')
|
||||
|
||||
new = SubmitField("new")
|
||||
|
||||
update = SubmitField("update")
|
||||
|
||||
delete = SubmitField("delete")
|
@ -34,8 +34,10 @@ from forms.uploadform import UploadForm
|
||||
from forms.distribusiform import DistribusiForm
|
||||
from forms.themeform import ThemeForm
|
||||
from forms.editorform import EditorForm
|
||||
from forms.selectorform import SelectorForm
|
||||
|
||||
from statuspengguna.helper import AreFilesUploaded
|
||||
from statuspengguna.helper import HasDistribusi
|
||||
from statuspengguna.loginuser import LoginUser
|
||||
from statuspengguna.registeruser import RegisterUser
|
||||
|
||||
@ -70,7 +72,12 @@ def distribusi():
|
||||
uploadform = UploadForm()
|
||||
distribusiform = DistribusiForm()
|
||||
themeform = ThemeForm()
|
||||
selectorform = SelectorForm()
|
||||
selectorform.distribusis.choices = distribusisfields()
|
||||
|
||||
files_uploaded = AreFilesUploaded()
|
||||
has_distribusi = HasDistribusi()
|
||||
|
||||
user = User.query.filter_by(email=current_user.email).first()
|
||||
distribusi = Distribusis.query.filter_by(userid=user.id).first()
|
||||
if distribusiform.validate_on_submit():
|
||||
@ -99,7 +106,9 @@ def distribusi():
|
||||
uploadform=uploadform,
|
||||
distribusiform=distribusiform,
|
||||
themeform=themeform,
|
||||
selectorform=selectorform,
|
||||
files_uploaded=files_uploaded,
|
||||
has_distribusi=has_distribusi,
|
||||
)
|
||||
return template
|
||||
|
||||
@ -245,6 +254,14 @@ def load_user(user_id):
|
||||
return User.query.get(int(user_id))
|
||||
|
||||
|
||||
def distribusisfields():
|
||||
distribusinames = []
|
||||
user = User.query.filter_by(email=current_user.email).first()
|
||||
for distribusi in Distribusis.query.filter_by(userid=user.id).all():
|
||||
distribusinames.append(distribusi.distribusiname)
|
||||
return distribusinames
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
APP.debug = True
|
||||
APP.run(port=5000)
|
||||
|
43
verse/static/css/selector.css
Normal file
43
verse/static/css/selector.css
Normal file
@ -0,0 +1,43 @@
|
||||
.selector-style {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 1px solid #ccc;
|
||||
width: 120px;
|
||||
border-radius: 3px;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
background: #fff;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.selector-style select {
|
||||
padding: 5px 8px;
|
||||
width: 130%;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.selector-style:after {
|
||||
top: 50%;
|
||||
left: 85%;
|
||||
border: solid transparent;
|
||||
content: " ";
|
||||
height: 0;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
border-color: rgba(0, 0, 0, 0);
|
||||
border-top-color: #000000;
|
||||
border-width: 5px;
|
||||
margin-top: -2px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.selector-style select:focus {
|
||||
outline: none;
|
||||
}
|
@ -34,13 +34,18 @@ div#upload form {
|
||||
.workflow{
|
||||
margin-top: 1em;
|
||||
padding: 0.5em;
|
||||
width: 25em;
|
||||
width: 30em;
|
||||
border: 3px solid #E0B0FF;
|
||||
background-color:#383C4A;
|
||||
text-decoration: none;
|
||||
scroll-behavior: smooth;
|
||||
border-style: outset;
|
||||
}
|
||||
|
||||
.workflow input{
|
||||
max-width: 20em;
|
||||
}
|
||||
|
||||
#mainworkflow
|
||||
{
|
||||
width: 30em;
|
||||
@ -79,6 +84,9 @@ input {
|
||||
border: none;
|
||||
background: #E0B0FF;
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,15 @@ def AreFilesUploaded():
|
||||
return True
|
||||
|
||||
|
||||
def HasDistribusi():
|
||||
user = User.query.filter_by(email=current_user.email).first()
|
||||
distribusi = Distribusis.query.filter_by(userid=user.id).first()
|
||||
if distribusi is None:
|
||||
print("distribusi is empty")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
# def IsThemeSelected
|
||||
# def IsCustomThemePresent
|
||||
# def IsDistribusiLive
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Autonomous Practices X Distribusi-Verse</title>
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css')}}">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/selector.css')}}">
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='icons/apple-touch-icon.png')}}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', filename='icons/favicon-32x32.png')}}">
|
||||
|
@ -13,6 +13,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainworkflow">
|
||||
{% if has_distribusi %}
|
||||
{% block selector %}
|
||||
{% include "distribusiworkflow/selector.html" %}
|
||||
{% endblock selector%}
|
||||
{%endif%}
|
||||
{% block upload %}
|
||||
{% include "distribusiworkflow/upload.html" %}
|
||||
{% endblock upload%}
|
||||
|
21
verse/templates/distribusiworkflow/selector.html
Normal file
21
verse/templates/distribusiworkflow/selector.html
Normal file
@ -0,0 +1,21 @@
|
||||
<div id="distribusi" class="workflow">
|
||||
<h3>Welcome back to your Distribusi</h3>
|
||||
<p>You have already uploaded a distribusi website, do you want to make a new one, update or delete?</p>
|
||||
<form method="POST" enctype="multipart/form-data" action="{{ url_for('distribusi') }}">
|
||||
{{ selectorform.csrf_token }}
|
||||
<select class="selector-style">
|
||||
{% for subfield in selectorform.distribusis %}
|
||||
{{ subfield }}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<fieldset class="button required multiselect">
|
||||
{{ selectorform.new }}
|
||||
</fieldset>
|
||||
<fieldset class="button required multiselect">
|
||||
{{ selectorform.update }}
|
||||
</fieldset>
|
||||
<fieldset class="button required multiselect warning">
|
||||
{{ selectorform.delete }}
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user