Skip to content

Commit

Permalink
inline styling with post functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiffany-Zhu5303 committed Jan 12, 2024
1 parent 9eabcb6 commit 9d55713
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 19 deletions.
38 changes: 38 additions & 0 deletions projectApp/static/projectApp/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
body {
background-color: #F8F9FA;
}

.container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 50px;
text-align: center;
}

h1 {
color: #333;
}

.btn-custom {
background-color: #4CAF50;
color: #fff;
border: 2px solid #4CAF50;
}

.btn-custom:hover {
background-color: #45A049;
color: #fff;
}

.btn-secondary-custom {
background-color: #3498DB;
color: #fff;
border: 2px solid #3498DB;
}

.btn-secondary-custom:hover {
background-color: #2980B9;
color: #fff;
}
Empty file removed projectApp/static/style.css
Empty file.
8 changes: 4 additions & 4 deletions projectApp/templates/projectApp/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ <h2 class="text-center">How many structures do you want to compare?</h2>
<div class="row justify-content-center mt-3">
<div class="col-md-6 text-center">

<a href="{% url 'inputOneMolecule' %}" class="btn btn-custom btn-lg btn-block" value="1">
One Struture
<a href="{% url 'oneMolecule' %}" class="btn btn-custom btn-lg btn-block" value="1">
One structure
</a>
</div>
<div class="col-md-6 text-center">
<a href="{% url 'inputTwoMolecules' %}" class="btn btn-custom btn-lg btn-block" value="2">
Two Strutures
<a href="{% url 'twoMolecules' %}" class="btn btn-custom btn-lg btn-block" value="2">
Two structures
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion projectApp/templates/projectApp/oneMolecule.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block content %}
<div class="container mt-5">
<h1 class="text-center mb-4">Compare Subgraphs of a Complex Structure</h1>
<form action="{% url 'inputMolecules' %}" method="post">
<form action="{% url 'collectInputOne' %}" method="post">
{% csrf_token %}

<div class="form-group">
Expand Down
2 changes: 1 addition & 1 deletion projectApp/templates/projectApp/twoMolecules.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block content %}
<div class="container mt-5">
<h1 class="text-center mb-4">Compare Subgraphs of Two Complex Structures</h1>
<form action="{% url 'inputMolecules' %}" method="post">
<form action="{% url 'collectInputTwo' %}" method="post">
{% csrf_token %}

<div class="form-group">
Expand Down
12 changes: 8 additions & 4 deletions projectApp/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views

urlpatterns = [
path("home/", views.home, name="home"),
path("inputMolecules/", views.inputMolecules, name="inputMolecules"),
path("inputOneMolecule/", views.inputOneMolecule, name="inputOneMolecule"),
path("inputTwoMolecules/", views.inputTwoMolecules, name="inputTwoMolecules")
]
path("oneMolecule/", views.oneMolecule, name="oneMolecule"),
path("views.twoMolecules/", views.twoMolecules, name="twoMolecules"),
path("collectDataOne/", views.collectInputOne, name="collectInputOne"),
path("collectDataTwo/", views.collectInputTwo, name="collectInputTwo"),
path("processData/", views.processData, name="processData")
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
24 changes: 15 additions & 9 deletions projectApp/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
from django.shortcuts import render
from django.http import HttpResponse
#from .forms import oneMolecule
from subunitIdent import subunitIdent

def home(request):
return render(request, "projectApp/home.html")

def inputMolecules(request):
molecule = request.POST.get("molecule")
print(molecule)
return HttpResponse("Recieved molecule!")

def inputOneMolecule(request):
def oneMolecule(request):
return render(request, "projectApp/oneMolecule.html")

def inputTwoMolecules(request):
return render(request, "projectApp/twoMolecules.html")
def twoMolecules(request):
return render(request, "projectApp/TwoMolecules.html")

def collectInputOne(request):
return render(request, 'projectApp/oneMolecule.html')

def collectInputTwo(request):
return render(request, 'projectApp/twoMolecules.html')

def processData(request):
input = request.POST.get("user-input")
output = subunitIdent(input)
return render(request, "projectApp/oneMolecules.html", {"molecular_data": output.molecular_data})

0 comments on commit 9d55713

Please sign in to comment.