Commit b1852662 authored by alexandre's avatar alexandre

Started to improve score meta data with extra field.

For some reason, I don't manage to save the form for several fields, for
instance "auteur de la perfomance"
parent f9ad1307
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2017-12-10 21:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('playground', '0007_auto_20171101_1446'),
]
operations = [
migrations.AddField(
model_name='score',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='score',
name='duration',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='effectif',
field=models.CharField(blank=True, max_length=255),
),
migrations.AddField(
model_name='score',
name='genre',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='performance_author',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='presentation',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='score_author',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='score_type',
field=models.PositiveSmallIntegerField(choices=[(1, 'transcription'), (2, 'prescription')], default=1),
),
migrations.AddField(
model_name='score',
name='tags',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='score',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
migrations.AlterField(
model_name='score',
name='title',
field=models.CharField(max_length=255),
),
]
......@@ -5,10 +5,26 @@ from django.contrib.postgres.fields import JSONField
class Score(models.Model):
"""docstring"""
title = models.TextField(blank=True)
SCORE_TYPE_CHOICES = (
(1, "transcription"),
(2, "prescription"),
)
title = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
score_type = models.PositiveSmallIntegerField(default=1, choices=SCORE_TYPE_CHOICES)
score_author = models.TextField(blank=True)
performance_author = models.TextField(blank=True)
presentation = models.TextField(blank=True)
effectif = models.CharField(blank=True, max_length=255)
stage_set = models.TextField(blank=True)
duration = models.TextField(blank=True)
genre = models.TextField(blank=True)
tags = models.TextField(blank=True)
mainline = JSONField(blank=True)
def __str__(self):
return self.title
......
......@@ -8,4 +8,5 @@ class ScoreSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Score
fields = ('id', 'title', 'stage_set', 'mainline')
#fields = ('id', 'title', 'stage_set', 'mainline')
fields = '__all__'
......@@ -12,12 +12,14 @@ window.W = window.W || {};
mainline: {},
stage_set: "Here comes the initial set",
setting: '',
author: '',
performers: '',
duration: '',
creation: Date.now(),
genre: '',
tags: '',
score_type: 1,
score_author: "",
performance_author: "",
presentation: "",
effectif: "",
},
urlRoot: '/api/scores/',
......
......@@ -452,7 +452,7 @@ window.W = window.W || {};
},
/**
* Only show indications marker if the line has
* Only show indications marker if the line has
* indications, commandement, destination of code
*/
hasIndications: function () {
......@@ -758,7 +758,7 @@ window.W = window.W || {};
} else if (value) {
return value.trim();
} else {
return null;
return "";
}
}
}
......@@ -770,13 +770,18 @@ window.W = window.W || {};
e.stopImmediatePropagation();
e.preventDefault();
console.log(this.fieldVal("performance_author"));
// Todo: merge boucle and alternative into one value / datatype:
// null | [number, number]
const data = {
title: this.fieldVal('title'),
score_type: this.fieldVal('score_type'),
score_author: this.fieldVal('score_author'),
performance_autor: this.fieldVal('performance_author'),
description: this.fieldVal('description'),
effectif: this.fieldVal('effectif'),
stage_set: this.fieldVal('stage_set'),
author: this.fieldVal('author'),
performers: this.fieldVal('performers'),
duration: this.fieldVal('duration'),
genre: this.fieldVal('genre'),
};
......@@ -786,6 +791,7 @@ window.W = window.W || {};
});
W.ScoreView = Backbone.Marionette.View.extend({
// Conditionnal rendering according we are in edit mode or not
template: '#score-template-vue',
......
<!-- stage_set = models.TextField(blank=True)
duration = models.TextField(blank=True)
genre = models.TextField(blank=True)
tags = models.TextField(blank=True)
mainline = JSONField(blank=True) -->
<!-- Title -->
<label>
<span class="label-text">Titre:</span>
<input type="text" name="title" value="<%= title %>">
</label>
<!-- description
<!-- score_type = models.PositiveSmallIntegerField(default=1, choices=SCORE_TYPE_CHOICES) -->
<label>
<span class="label-text">Type:</span>
<select class="" name="score_type">
<option value="1">Transcription</option>
<option value="2">Prescription</option>
</select>
<!-- <input type="text" name="score_type" value="<%= score_type %>"> -->
</label>
<!-- Score author -->
<label>
<span class="label-text">Auteur de la partition:</span>
<input type="text" name="score_author" value="<%= score_author %>">
</label>
<!-- Performance author -->
<label>
<span class="label-text">Auteur de la perfomance:</span>
<input type="text" name="performance_author" value="<%= performance_author %>">
</label>
<!-- description -->
<label>
<span class="label-text">Présentation: </span>
<textarea name="description">< %= description %></textarea>
</label> -->
<textarea name="description"><%= presentation %></textarea>
</label>
<!-- effectif = models.CharField(blank=True, max_length=255) -->
<label>
<span class="label-text">Effectif:</span>
<input type="text" name="effectif" value="<%= effectif %>">
</label>
<!-- Setting -->
<label>
......@@ -16,23 +51,17 @@
<textarea name="stage_set"><%= stage_set %></textarea>
</label>
<!-- Author
<!-- Duration -->
<label>
<span class="label-text">Auteur</span>
<input type="text" name="author" value="< %= author %>">
</label> -->
<!-- Duration --
<label>
<span class="label-text">Durée</span>
<input type="text" name="duration" value="< %= duration %>">
</label> -->
<span class="label-text">Durée:</span>
<input type="text" name="duration" value="<%= duration %>">
</label>
<!-- Genre --
<!-- Genre -->
<label>
<span class="label-text">Genre: </span>
<input type="text" name="genre" value="< %= genre %>">
</label> -->
<input type="text" name="genre" value="<%= genre %>">
</label>
<button data-name="close">Annuler</button>
<button data-name="submit">OK</button>
\ No newline at end of file
<button data-name="submit">OK</button>
......@@ -5,7 +5,7 @@
<div id="stage_set">
<%= stage_set %>
</div>
<div class="author"><%= author %></div>
<div class="author"><%= score_author %></div>
<div class="score-actions">
<div id="expand-level-slider"></div>
<button class="unfold">Tout déplier</button>
......
......@@ -5,7 +5,7 @@
<%= stage_set %>
</div>
<div class="author">
<%= author %>
<%= score_author %>
</div>
<button class="save">Enregistrer</button>
<button class="delete">Supprimer</button>
......
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