Commit f140b579 authored by Deion Menor's avatar Deion Menor

Search bar in navbar with dropdown menu

parent 336dc526
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-04 13:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Album',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('album_name', models.CharField(max_length=64)),
('year', models.DecimalField(decimal_places=0, max_digits=4)),
],
),
migrations.CreateModel(
name='Artist',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=64)),
('description', models.TextField()),
],
),
migrations.CreateModel(
name='MusicEntry',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('order_in_playlist', models.PositiveSmallIntegerField()),
('rating', models.DecimalField(choices=[(0, '1'), (1, '2'), (2, '3'), (3, '4'), (4, '5'), (5, '6'), (6, '7'), (7, '8'), (8, '9'), (9, '10')], decimal_places=0, max_digits=1)),
],
),
migrations.CreateModel(
name='MusicPlaylist',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('playlist_name', models.CharField(max_length=32)),
('is_public', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='Song',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('song_name', models.TextField()),
('genre', models.CharField(max_length=128)),
('song_length', models.PositiveIntegerField(default=0, null=True)),
('lyrics', models.TextField(null=True)),
('album', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Album')),
('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Artist')),
],
),
migrations.CreateModel(
name='Tag',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=32)),
('tag', models.ManyToManyField(to='core.MusicEntry')),
],
),
migrations.CreateModel(
name='UserAccount',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('first_name', models.CharField(max_length=64)),
('last_name', models.CharField(max_length=64)),
('email', models.CharField(max_length=64)),
],
),
migrations.AddField(
model_name='musicplaylist',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.UserAccount'),
),
migrations.AddField(
model_name='musicentry',
name='playlist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.MusicPlaylist'),
),
migrations.AddField(
model_name='musicentry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Song'),
),
migrations.AddField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.Artist'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-05 05:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='MusicEntry',
new_name='music_entry',
),
migrations.RenameModel(
old_name='MusicPlaylist',
new_name='music_playlist',
),
migrations.RenameModel(
old_name='UserAccount',
new_name='user_account',
),
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
migrations.AlterField(
model_name='music_entry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.song'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-05 05:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20171105_1339'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
migrations.AlterField(
model_name='music_entry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.song'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-05 05:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20171105_1339'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
migrations.AlterField(
model_name='music_entry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.song'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-05 05:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20171105_1350'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
migrations.AlterField(
model_name='music_entry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.song'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-05 06:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20171105_1352'),
]
operations = [
migrations.AlterField(
model_name='album',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
migrations.AlterField(
model_name='music_entry',
name='song',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.song'),
),
migrations.AlterField(
model_name='song',
name='album',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.album'),
),
migrations.AlterField(
model_name='song',
name='artist',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.artist'),
),
]
......@@ -27,6 +27,78 @@ body {
text-align: center;
}
/*for dropdown thing */
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: blue;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
/*searchbar*/
/*form {
width:500px;
margin:50px auto;
}*/
.search_nav{
padding: 15px;
}
.searchbar {
padding:8px 15px;
background:rgba(50, 50, 50, 0.2);
border:0px solid #dbdbdb;
color: white;
}
.button {
position:relative;
padding:6px 15px;
left:-8px;
border:2px solid #207cca;
background-color:#207cca;
color:#fafafa;
}
.button:hover {
background-color:#fafafa;
color:#207cca;
}
/* Generic style for clickable shit*/
.buttoned{
......@@ -38,7 +110,7 @@ body {
/* Generic style for wrapping stuff in a box*/
.boxified{
background-color: rgba(0,0,0,0.6);
background-color: rgba(20,100,100,0.3);
border-radius: 10px;
padding: 3vw;
}
......@@ -48,7 +120,7 @@ body {
position:fixed;
width : 100vw;
list-style-type: none;
background-color: #282525;
background-color: #000;
overflow: hidden;
margin : -15px;
margin-top: -70px;
......@@ -76,7 +148,7 @@ body {
.nav_bar_tab{
float: left;
display: block;
display:inline-block;
color: white;
font-size: 20px;
font-family: PalanquinDark;
......@@ -128,5 +200,3 @@ a, .link{
font-family: 'PalanquinDark';
src: url('/files/fonts/palanquindark/PalanquinDark-Regular.ttf');
}
files/images/background.jpg

288 KB | W: | H:

files/images/background.jpg

30.1 KB | W: | H:

files/images/background.jpg
files/images/background.jpg
files/images/background.jpg
files/images/background.jpg
  • 2-up
  • Swipe
  • Onion skin
......@@ -4,7 +4,7 @@
<meta charset="utf-8">
<title>{% block title %}MyMusicList{% endblock %}</title>
<link rel="stylesheet" href="/files/css/mymusiclist.css">
<link rel="stylesheet" href="/files/css/font-awesome.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<header>
......@@ -19,9 +19,38 @@
<li><a class="nav_bar_home" href="/">MyMusicList</a></li>
<li><a class="nav_bar_tab" href="{% url 'login' %}">LOGIN</a></li>
<li><a class="nav_bar_tab" href="{% url 'signup' %}">SIGN UP</a></li>
<li>
<div class="search_nav">
<form action="{% url 'search' %}" method="get">
<div class="wrap">
<div class="search">
<input class="searchbar" type="text" name="search" placeholder="Search..">
<input id="searchbytype" type="hidden" name="searchtype" value="album">
<button class="button"> <i class="fa fa-search" aria-hidden="true"></i></button>
</div>
</div>
</form>
</div>
</li>
<li class="dropdown nav_bar_tab">
<a id=search_type href=# class="dropbtn">SEARCH <i class="fa fa-caret-down"></i></a>
<div class="dropdown-content">
<a href="#" onclick="mainA()" >Album</a>
<a href="#" onclick="mainB()">Artist</a>
<a href="#" onclick="mainC()">Song</a>
</div>
</li>
<li style="float:right"><button class="nav_bar_tab"type="button" onclick="toggleWallpaper()"></button></li>
</ul>
{% endif %}
<div class="boxified sidebar">
{% block sidebar %}
<h2>Featured Songs</h2>
......@@ -34,54 +63,40 @@
{% endblock %}
</div>
</header>
<script>
function mainA(){
document.getElementById("demo").innerHTML = "Album Search";
document.getElementById("search_type").innerHTML = "Album Search";
document.getElementById("searchbytype").value = "album";
}
function mainB(){
document.getElementById("demo").innerHTML = "Artist Search";
document.getElementById("search_type").innerHTML = "Artist Search";
document.getElementById("searchbytype").value = "artist";
}
function mainC(){
document.getElementById("demo").innerHTML = "Song Search";
document.getElementById("search_type").innerHTML = "Song Search";
document.getElementById("searchbytype").value = "song";
}
</script>
<form action="{% url 'search' %}" method="get">
<div class="wrap">
<div class="search">
<input type="text" name="search" placeholder="Search..">
<input id="searchbytype" type="hidden" name="searchtype" value="album">
<p id="demo">Album Search</p></input>
<button>Search</button>
</div>
</div>
</form>
<div>
<a><button onclick="mainA()">By Album</button></a>
<a><button onclick="mainB()">By Artist</button></a>
<a><button onclick="mainC()">By Song</button></a>
</div>
{% block content %}
{% endblock %}
<script>
......
......@@ -11,16 +11,16 @@
{% endblock %}
{% block content %}
{% for i in results %}
<div class = "boxified main">
<div class = "boxified main">
{% if type == "album" %}
<h3><a href="/album/{{i.id}}">{{i.album_name}}</a></h3>
<p>Artist: <a href="/artist/{{i.artist.id}}">{{i.artist.name}}</a><br>
Year: {{i.year}} </p>
{% endif %}
{% if type == "artist" %}
<h3><a href="/artist/{{i.id}}">{{i.name}}</a></h3>
{% for j in albums %}
......@@ -30,17 +30,17 @@
{% endif %} </p>
{% endfor %}
{% endif %}
{% if type == "song" %}
<h3>{{i.song_name}}</h3>
<h3><a href="/album/{{i.album.id}}">{{i.album.album_name}}</a></h3>
<p>Artist: <a href="/artist/{{i.artist.id}}">{{i.artist.name}}</a><br>
Year: {{i.album.year}} </p>
{% endif %}
</div>
{% endfor %}
{% endblock %}
\ No newline at end of file
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment