Skip to content

Commit

Permalink
Merge pull request #1077 from zestedesavoir/hotfix_issue_1066
Browse files Browse the repository at this point in the history
Hotfix issue 1066
  • Loading branch information
Eskimon committed Jul 7, 2014
2 parents 4212d13 + 3fe1270 commit 32ebdd8
Show file tree
Hide file tree
Showing 9 changed files with 243 additions and 11 deletions.
1 change: 1 addition & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<link rel="stylesheet" href="/static/css/main.css" />
{% else %}
<link rel="stylesheet" href="/static/css/main.min.css" />
{% block source_content %}{% endblock %}
{% endif %}

{# Webfont async loading #}
Expand Down
2 changes: 1 addition & 1 deletion templates/pages/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>À propos</h2>

{% block content %}
<p>
Si vous vous intéressez par tout cela, vous devriez songer à <a href="https://github.com/zestedesavoir/zds-site">contribuer au développement du site</a> !
Si vous vous intéressez à tout cela, vous devriez songer à <a href="https://github.com/zestedesavoir/zds-site">contribuer au développement du site</a> !
</p>

<div>
Expand Down
7 changes: 6 additions & 1 deletion templates/tutorial/base_online.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
&#183; Tutoriels
{% endblock %}

{% block source_content %}
{% if tutorial.source and tutorial.source != "" %}
<link rel="canonical" href="{{tutorial.source}}" />
{% endif %}
{% endblock %}


{% block breadcrumb_base %}
<li><a href="{% url "zds.tutorial.views.index" %}">Tutoriels</a></li>
{% endblock %}
{% endblock %}
6 changes: 3 additions & 3 deletions templates/tutorial/tutorial/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% block headline %}
<h1 {% if tutorial.image %}class="illu"{% endif %}>
{% if tutorial.image %}
<img src="{{ tutorial.image.physical.tutorial_illu.url }}" alt="" />
<img src="{{ tutorial.image.physical.tutorial_illu.url }}" alt="">
{% endif %}
{{ tutorial.title }}
</h1>
Expand Down Expand Up @@ -242,7 +242,7 @@ <h2>
<a href="#ask-validation" class="open-modal ico-after tick green">
Demander la validation
</a>
<div id="ask-validation" class="modal modal-small">
<div id="ask-validation" class="modal modal-medium">
{% crispy formAskValidation %}
</div>
</li>
Expand Down Expand Up @@ -304,7 +304,7 @@ <h3>Validation</h3>
</li>
<li>
<a href="#valid-publish" class="open-modal ico-after tick green">Valider et publier</a>
<div class="modal modal-small" id="valid-publish">
<div class="modal modal-big" id="valid-publish">
{% crispy formValid %}
</div>
</li>
Expand Down
23 changes: 22 additions & 1 deletion zds/tutorial/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ class AskValidationForm(forms.Form):
}
)
)
source = forms.CharField(
label='Source originale',
required=False,
widget=forms.TextInput(
attrs={
'placeholder': 'Url de la version originale'
}
)
)

def __init__(self, *args, **kwargs):
super(AskValidationForm, self).__init__(*args, **kwargs)
Expand All @@ -373,7 +382,9 @@ def __init__(self, *args, **kwargs):
self.helper.form_method = 'post'

self.helper.layout = Layout(
CommonLayoutModalText(), StrictButton(
CommonLayoutModalText(),
Field('source'),
StrictButton(
'Confirmer',
type='submit'),
Hidden(
Expand All @@ -393,6 +404,15 @@ class ValidForm(forms.Form):
)
)
is_major = forms.BooleanField(label='Version majeure ?', required=False)
source = forms.CharField(
label='Source originale',
required=False,
widget=forms.TextInput(
attrs={
'placeholder': 'Url de la version originale'
}
)
)

def __init__(self, *args, **kwargs):
super(ValidForm, self).__init__(*args, **kwargs)
Expand All @@ -402,6 +422,7 @@ def __init__(self, *args, **kwargs):

self.helper.layout = Layout(
CommonLayoutModalText(),
Field('source'),
Field('is_major'),
StrictButton('Publier', type='submit'),
Hidden('tutorial', '{{ tutorial.pk }}'),
Expand Down
194 changes: 194 additions & 0 deletions zds/tutorial/migrations/0004_auto__add_field_tutorial_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

def forwards(self, orm):
# Adding field 'Tutorial.source'
db.add_column(u'tutorial_tutorial', 'source',
self.gf('django.db.models.fields.CharField')(default='', max_length=200),
keep_default=False)


def backwards(self, orm):
# Deleting field 'Tutorial.source'
db.delete_column(u'tutorial_tutorial', 'source')


models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'gallery.gallery': {
'Meta': {'object_name': 'Gallery'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'pubdate': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'subtitle': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'update': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
},
u'gallery.image': {
'Meta': {'object_name': 'Image'},
'gallery': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['gallery.Gallery']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'legend': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'physical': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
'pubdate': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'update': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
},
u'tutorial.chapter': {
'Meta': {'object_name': 'Chapter'},
'conclusion': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['gallery.Image']", 'null': 'True', 'blank': 'True'}),
'introduction': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'part': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Part']", 'null': 'True', 'blank': 'True'}),
'position_in_part': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'position_in_tutorial': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
'tutorial': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Tutorial']", 'null': 'True', 'blank': 'True'})
},
u'tutorial.extract': {
'Meta': {'object_name': 'Extract'},
'chapter': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Chapter']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'position_in_chapter': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'text': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
},
u'tutorial.note': {
'Meta': {'object_name': 'Note', '_ormbases': [u'utils.Comment']},
u'comment_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['utils.Comment']", 'unique': 'True', 'primary_key': 'True'}),
'tutorial': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Tutorial']"})
},
u'tutorial.part': {
'Meta': {'object_name': 'Part'},
'conclusion': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'introduction': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'position_in_tutorial': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'tutorial': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Tutorial']"})
},
u'tutorial.tutorial': {
'Meta': {'object_name': 'Tutorial'},
'authors': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'db_index': 'True', 'symmetrical': 'False'}),
'conclusion': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'create_at': ('django.db.models.fields.DateTimeField', [], {}),
'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'gallery': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['gallery.Gallery']", 'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['gallery.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
'images': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'introduction': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
'is_locked': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_note': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'last_note'", 'null': 'True', 'to': u"orm['tutorial.Note']"}),
'licence': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['utils.Licence']", 'null': 'True', 'blank': 'True'}),
'pubdate': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
'sha_beta': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'sha_draft': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'sha_public': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'sha_validation': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'source': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'subcategory': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': u"orm['utils.SubCategory']", 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'type': ('django.db.models.fields.CharField', [], {'max_length': '10', 'db_index': 'True'}),
'update': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
},
u'tutorial.tutorialread': {
'Meta': {'object_name': 'TutorialRead'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'note': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Note']"}),
'tutorial': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Tutorial']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'tuto_notes_read'", 'to': u"orm['auth.User']"})
},
u'tutorial.validation': {
'Meta': {'object_name': 'Validation'},
'comment_authors': ('django.db.models.fields.TextField', [], {}),
'comment_validator': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'date_proposition': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),
'date_reserve': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'date_validation': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'status': ('django.db.models.fields.CharField', [], {'default': "'PENDING'", 'max_length': '10'}),
'tutorial': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['tutorial.Tutorial']", 'null': 'True', 'blank': 'True'}),
'validator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'author_validations'", 'null': 'True', 'to': u"orm['auth.User']"}),
'version': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'})
},
u'utils.comment': {
'Meta': {'object_name': 'Comment'},
'author': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'comments'", 'to': u"orm['auth.User']"}),
'dislike': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'editor': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'comments-editor'", 'null': 'True', 'to': u"orm['auth.User']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ip_address': ('django.db.models.fields.CharField', [], {'max_length': '39'}),
'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'like': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
'position': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
'pubdate': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
'text': ('django.db.models.fields.TextField', [], {}),
'text_hidden': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '80'}),
'text_html': ('django.db.models.fields.TextField', [], {}),
'update': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
},
u'utils.licence': {
'Meta': {'object_name': 'Licence'},
'code': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
'description': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
},
u'utils.subcategory': {
'Meta': {'object_name': 'SubCategory'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '80'}),
'subtitle': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '80'})
}
}

complete_apps = ['tutorial']
Loading

0 comments on commit 32ebdd8

Please sign in to comment.