Skip to content

Commit

Permalink
votes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shweta4321 committed Mar 24, 2018
1 parent 9ee3be5 commit 6fe8788
Show file tree
Hide file tree
Showing 16 changed files with 384 additions and 241 deletions.
Empty file modified Procfile
100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion cosmos
Submodule cosmos deleted from 2006c2
4 changes: 2 additions & 2 deletions cosmos_search/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
# Application definition

INSTALLED_APPS = [
'update.apps.UpdateConfig',
'search.apps.SearchConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'update.apps.UpdateConfig',
'search.apps.SearchConfig',
]

MIDDLEWARE = [
Expand Down
Empty file modified manage.py
100755 → 100644
Empty file.
Empty file modified runtime.txt
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions search/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib import admin # noqa
from django.contrib import admin

# Register your models here.
from search.models import Votes
admin.site.register(Votes)
29 changes: 29 additions & 0 deletions search/form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from django import forms
from .models import Votes


VOTES_CHOICES = [
('1', ''),
('2', ''),
['3', ''],
('4', ''),
('5', ''),
]


class VotesForm(forms.Form):
project_name = forms.CharField(max_length=500, required=False)
ip_address = forms.CharField(max_length=50, required=False)
vote_value = forms.ChoiceField(VOTES_CHOICES, required=True,
widget=forms.RadioSelect(attrs={"onclick": "this.form.submit();",
"class": "votes",
"data-fa-icon": "&#xf005"}))

def save(self):
u = Votes.objects.create(
project_name=self.cleaned_data['project_name'],
vote_value=self.cleaned_data['vote_value'],
ip_address=self.cleaned_data['ip_address'],
)
u.save()
return u
19 changes: 17 additions & 2 deletions search/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
from django.db import models # noqa
from django.db import models

# Create your models here.
VOTES_CHOICES = [
('1', '1'),
('2', '2'),
('3', '3'),
('4', '4'),
('5', '5'),
]


class Votes(models.Model):
project_name = models.CharField(max_length=500, null=True, blank=True)
vote_value = models.CharField(choices=VOTES_CHOICES, default='1', max_length=20, null=True)
ip_address = models.CharField(max_length=50, null=True, blank=True)

def __str__(self):
return self.vote_value
203 changes: 74 additions & 129 deletions search/static/css/calculator.css
Original file line number Diff line number Diff line change
@@ -1,168 +1,113 @@
#calculator {
width: 475px;
width: 40% !important;
min-width: 320px;
height: auto;

margin: 100px auto;
padding: 20px 20px 9px;
margin: 0 auto;
padding: 1em;

background: #949494;
/*background: linear-gradient(#9dd2ea, #8bceec);*/
border-radius: 3px;
}
.cal-top{
position: relative;
top: -70px;
}
/* Top portion */
.top span.clear {
float: left;
box-shadow: .15em .15em .15em rgba(0, 0, 0, .2);
border-radius: .2em;
}

/* Inset shadow on the screen to create indent */
.top .screen {
height: 65px;
width: 426px;
float: left;
padding: 10px 10px;
background: rgb(255, 255, 255);
border-radius: 3px;
/*box-shadow: inset 0px 4px rgba(0, 0, 0, 0.2);*/
font-size: 17px;
line-height: 40px;
color: white !important;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
text-align: right;
letter-spacing: 1px;
margin-bottom: 2%;
#calculator * {
border-radius: .2em;
border: none;
outline: none;
cursor: pointer;
}

/* Clear floats */
.keys, .top {
overflow: hidden;
#calculator input {
background: white;
text-shadow: .1em .1em .1em rgba(0, 0, 0, .1);
}

/* Applying same to the keys */
.keys span, .top span.clear {
float: left;
position: relative;
top: 0;

cursor: pointer;

width: 65px;
height: 36px;

/* Inset shadow on the screen to create indent */
.screen {
width: 100%;
padding: .5em;
margin: .5em 0;
font-size: 1em;
line-height: 1.25em;
color: white;
background: white;
border-radius: 3px;
box-shadow: 0px 2px rgba(0, 0, 0, 0.2);

margin: 0 7px 11px 0;

line-height: 36px;
text-align: center;

/* prevent selection of text inside keys */
user-select: none;

/* Smoothing out hover and active states using css3 transitions */
transition: all 0.2s ease;
box-shadow: .15em .15em .15em rgba(0, 0, 0, .2);
}

/* Remove right margins from operator keys */
/* style different type of keys (operators/evaluate/clear) differently */
.keys span.operator {
background: #FFF0F5;
margin-right: 0;
#resultText {
width: 100%;
height: 70%;
text-align: right;
font-size: 1.2em;
outline: none;
}

.keys span.eval {
background: #a6e3e4;
/*box-shadow: 0px 4px #9da853;*/

#seq {
width: 100%;
height: 30%;
text-align: right;
font-size: .75em;
}

.top span.clear {
background: #ff9fa8;
box-shadow: 0px 4px #ff7c87;
color: white;
.keys-row {
width: 100%;
display: flex;
flex-wrap: wrap;
}

/* Some hover effects */
.keys span:hover {
background: #d9d5ec;
color: white;
.keys-col-4 {
width: calc(100% / 12 * 4);
}

.keys span.eval:hover {
background: #96cfd0;
/*box-shadow: 0px 4px #717a33;*/
color: #ffffff;
}
input#seq:focus {
outline: none;
background: transparent;
}
.top span.clear:hover {
background: #f68991;
box-shadow: 0px 4px #d3545d;
color: white;
.keys-col-8 {
width: calc(100% / 12 * 8);
}

.keys span:active {
top: 4px;
.adv-keys span {
width: calc(100% / 2 - .2em);
margin: .1em;
}

.keys span.eval:active {
box-shadow: 0px 0px #717a33;
top: 4px;
.base-keys span{
width: calc(100% / 4 - .2em);
margin: .1em;
}

.top span.clear:active {
top: 4px;
box-shadow: 0px 0px #d3545d;
/* Applying same to the keys */
.keys * {
float: left;
width: 100%;
box-shadow: .1em .1em .1em rgba(0, 0, 0, .2);
text-align: center;

/* prevent selection of text inside keys */
user-select: none;

/* Smoothing out hover and active states using css3 transitions */
transition: all .2s ease;
}

.sp {
margin-right: 7px !important;
/* Remove right margins from operator keys */
/* style different type of keys (operators/evaluate/clear) differently */
.keys .operator input {
background: #FFF0F5 !important;
}

input {
border: none;
background: none;
.keys .eval input {
background: #a6e3e4 !important;
}

.clear {
.keys .clear input {
background: #dcbd5e !important;
color: #fff;
}

input.num {
width: 100% !important;
}
input.num:focus {
outline: none;
}
input#resultText {
outline: none;
padding-bottom: 4px;
width: 100%;
float: right;
text-align: right;
height: 15px;
position: relative;
top: -10px;
/* Some hover effects */
.keys span:hover {
opacity: .75;
top: .1em;
}
input[type="text"], textarea {
background-color: rgb(255, 255, 255);
background-image: none;
color: rgb(0, 0, 0);

.keys *:active {
top: .1em;
}
input#seq {
width: 100%;
text-align: right;
padding: 0px !important;
margin: 0px !important;
position: relative;
top: -15px;
font-size: 10px;
}

0 comments on commit 6fe8788

Please sign in to comment.