Merge branch 'develop' into 'master'

Develop

See merge request vtmk/web2.0!100
This commit is contained in:
Jan Tuomi
2017-11-25 23:37:45 +02:00
16 changed files with 2036 additions and 13 deletions
+45
View File
@@ -0,0 +1,45 @@
# Ilmotunkki
## Terms
- Signup, Form with collection of questions
- Response, One answer to some signup
- Quota, Amount of people allowed to respond with some option selected.
- In generic case there is no option and quota is just max number of people.
## Requirements
- Officials may generate signups forms
- Officials may see results from signups
- Officials may see some stats from their signups
- for example distributions of multiple choice answers
- Officials should be able to edit signups wherever possible
- Propably not possible to edit after first response
- Officials should be able to delete responses
- Officials should be able to embed payment information to the signup?
- TODO: is there need for unique reference numbers for every response?
- Officials should be able to save a signup to a reusable template.
- Signup may be attached to an event
- multiple signups to a single event?
- Signup should support custom quotas
- Atleast quotas from multiple choices and checkboxes
- Text quotas are risky (typos everywhere!!)
- Signup should have start and end times
- signup should support atleast following questiontypes
- Text
- multiple choice (select one)
- checkbox (boolean yes/no)
- Signup should support reserve slots.
TODO: quota based reserves or generic? or both?
- Responding should send confirm email
- Response should be editable by responder and only by the responder until the closing of the signup
- TODO: is there need to custom edit period or disable?
- Responders should see amount of quotas left.
- Responders should see some information about other responses
- TODO: names? should this be editable by officials?
- NOTE: Quota related info is exposed if any info is printed
View File
+3
View File
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
+5
View File
@@ -0,0 +1,5 @@
from django.apps import AppConfig
class IlmotunkkiConfig(AppConfig):
name = 'ilmotunkki'
View File
+16
View File
@@ -0,0 +1,16 @@
from django.db import models
from django.utils import timezone
class Signup(models.Model):
start = models.DateTimeField()
end = models.DateTimeField()
class Question(models.Model):
pass
class Answer(models.Model):
signup = models.ForeignKey(Signup, on_delete=models.CASCADE)
question = models.ForeignKey(Question, on_delete=models.PROTECT)
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+3
View File
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
+1919
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -19,6 +19,8 @@
"remark-preset-lint-recommended": "^3.0.1"
},
"remarkConfig": {
"plugins": ["remark-preset-lint-recommended"]
"plugins": [
"remark-preset-lint-recommended"
]
}
}
+1 -6
View File
@@ -76,12 +76,7 @@ pip install -r requirements.production.txt
## Development workflow
When pulling changes from the server, use `rebase` instead of `merge` for a nice and clean linear history.
Example of pulling with rebase:
```
git pull --rebase
```
Do not use `rebase` when pulling or merging changes. Rebasing transforms the commit history and makes it appear more linear. This is a plus e.g. when working with a few people, but in this project traditional merging is recommended for clarity.
When you start working on a feature, create a feature branch for your changes. These feature branches should be prefixed with `feature`.
+13
View File
@@ -0,0 +1,13 @@
set -e
PURPLE='\033[0;35m'
NC='\033[0m' # No Color
. "VIRTUALENV_ACTIVATE"
printf "${PURPLE}Running pre-commit tests.${NC}\n"
npm test
pycodestyle .
python manage.py test --noinput
set +e
printf "${PURPLE}Tests passed.${NC}\n"
+11 -2
View File
@@ -3,7 +3,7 @@
echo "SIK WEB 2.0"
echo "This script will set up the environment for this project."
echo "========================================================="
echo "Dependencies: postgresql>9.5, python>3.5"
echo "Dependencies: python>3.5"
INTERACTIVE="true"
USE_NPM="true"
@@ -27,7 +27,7 @@ then
exit 0
fi
$INTERACTIVE && read -p "Create user 'sik' in postgres (needs sudo) [y/n]?" -n 1 -r || REPLY="n"
$INTERACTIVE && read -p "Create user 'sik' in database (needs sudo) [y/n]?" -n 1 -r || REPLY="n"
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
@@ -52,6 +52,15 @@ then
cp "$PWD/sikweb/settings-sample.py" "$PWD/sikweb/settings.py"
fi
$INTERACTIVE && read -p "Copy pre-commit hook to .git/hooks? [y/n]" -n 1 -r || REPLY="y"
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
cp "$PWD/scripts/git/pre-commit" "$PWD/.git/hooks/pre-commit"
sed -i "s|VIRTUALENV_ACTIVATE|$(which activate)|g" "$PWD/.git/hooks/pre-commit"
fi
$INTERACTIVE && read -p "Start setup? [y/n]" -n 1 -r || REPLY="y"
echo ""
+9
View File
@@ -24,3 +24,12 @@ div.tooltip-inner {
width: auto;
margin-bottom: 1rem;
}
.kaehmy-content {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
p {
overflow-wrap: break-word;
}
+4 -3
View File
@@ -38,9 +38,10 @@
{% include "kaehmy_navigation.html" %}
{% endblock %}
{% block content %}
{% endblock %}
<div class="kaehmy-content">
{% block content %}
{% endblock %}
</div>
<div class="footer">
{% block footer %}
{% include "kaehmy_footer.html" %}
+1 -1
View File
@@ -3,7 +3,7 @@
<div class="card" style="margin-top: 0.5rem; margin-bottom: 0">
<div class="card-block">
<h4>{{ message.name }}</h4>
<p>{{ message.message|linebreaks }}</p>
<p>{{ message.message|linebreaks|urlize }}</p>
<h6 class="card-subtitle mb-2 text-muted">{{ message.timestamp }}</h6>
<div>