Skip to content

Commit

Permalink
Merge pull request #1340 from scieloorg/beta
Browse files Browse the repository at this point in the history
Incorporação de códigos estáveis para release.
  • Loading branch information
gustavofonseca authored Sep 23, 2016
2 parents 3b6495c + 36d0dc9 commit cb147bb
Show file tree
Hide file tree
Showing 22 changed files with 2,101 additions and 1,401 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ python:
- 2.7
env:
- DJANGO_VERSION=1.4 SCIELOMANAGER_SETTINGS_FILE=`pwd`/scielomanager/scielomanager/settings_local.include
install:
before_install:
- pip install --upgrade pip
- pip install --upgrade setuptools
- pip install -r requirements.txt --use-mirrors
- pip install -r requirements-test.txt --use-mirrors
install:
- pip install -r requirements.txt
- pip install -r requirements-test.txt
before_script:
- cp scielomanager/scielomanager/settings_local.include-TEMPLATE scielomanager/scielomanager/settings_local.include
- psql -c 'create database journalmanager;' -U postgres
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ yuicompressor
jsonfield
django-tastypie==0.9.16
django-htmlmin==0.7.0
packtools==1.1
packtools==1.2
Celery
django-celery
django-kombu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ <h2>
$('#{{ formset.prefix }} tbody tr input').addClass('span12');
//multiple-formsets
$('#{{ formset.prefix }} tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-{{ formset.prefix }}-form',
prefix: '{{ formset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4>{{ journal.title }}</h4>
<strong>{{ journal.collections.all|join:', ' }}</strong>
</li>
<li class="pull-right">
<a href="{% url editorial.export.csv.journal journal.id %}"> Download full board as CSV file <i class="icon-download-alt"></i></a>
<a href="{% url editorial.export.csv.journal journal.id %}"> {% trans 'Download full board as CSV file' %} <i class="icon-download-alt"></i></a>
</li>
</ul>
{% modal 'Journal Details' %}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ <h2>{% trans "Editor" %}:</h2>
<script>

$('#missionformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-missionformset-form',
prefix: '{{ missionformset.prefix }}'
});
Expand Down
10 changes: 6 additions & 4 deletions scielomanager/journalmanager/choices.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# coding: utf-8
import calendar

from django.utils.translation import ugettext_lazy as _

SCIELO_ISSN = [
('print', 'print'),
('electronic', 'electronic'),
Expand Down Expand Up @@ -65,10 +67,10 @@
]

JOURNAL_PUBLICATION_STATUS = [
('current', 'Current'),
('deceased', 'Deceased'),
('suspended', 'Suspended'),
('inprogress', 'In Progress'),
('current', _('Current')),
('deceased', _('Deceased')),
('suspended', _('Suspended')),
('inprogress', _('In Progress')),
]

# the index 0 has an empty value
Expand Down
17 changes: 11 additions & 6 deletions scielomanager/journalmanager/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ class Meta:


class JournalForm(ModelForm):
print_issn = fields.ISSNField(max_length=9, required=False)
eletronic_issn = fields.ISSNField(max_length=9, required=False)
print_issn = fields.ISSNField(label=_('Print ISSN'), max_length=9, required=False)
eletronic_issn = fields.ISSNField(label=_('Electronic ISSN'), max_length=9, required=False)
languages = forms.ModelMultipleChoiceField(models.Language.objects.all(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more languages')}),
required=True)
abstract_keyword_languages = forms.ModelMultipleChoiceField(models.Language.objects.all(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more languages')}),
required=True)
required=True, label=_('Abstract keyword languages'))
sponsor = forms.ModelMultipleChoiceField(models.Sponsor.objects.all(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more sponsors')}),
required=True)
subject_categories = forms.ModelMultipleChoiceField(models.SubjectCategory.objects.all(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more categories')}),
required=False)
required=False, label=_('Study area'))
study_areas = forms.ModelMultipleChoiceField(models.StudyArea.objects.all(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more study area')}),
required=True)
required=True, label=_('Subject categories'))
regex = re.compile(r'^(1|2)\d{3}$')

def save_all(self, creator):
Expand Down Expand Up @@ -347,7 +347,10 @@ class IssueBaseForm(forms.ModelForm):
section = forms.ModelMultipleChoiceField(
models.Section.objects.none(),
widget=forms.SelectMultiple(attrs={'title': _('Select one or more sections')}),
required=False)
required=False, label=_("Sections"))

use_license = forms.ModelChoiceField(models.UseLicense.objects.all(),
label=_("Use License"))

class Meta:
model = models.Issue
Expand Down Expand Up @@ -543,6 +546,7 @@ def __init__(self, *args, **kwargs):
super(SectionForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None)
self.fields['legacy_code'].widget.attrs['readonly'] = True
self.fields['legacy_code'].label = _('Legacy Code')

def clean_code(self):
return self.instance.legacy_code
Expand Down Expand Up @@ -604,6 +608,7 @@ def __init__(self, *args, **kwargs):
"""
self.journal = kwargs.pop('journal', None)
super(RegularPressReleaseForm, self).__init__(*args, **kwargs)
self.fields['issue'].label = _('Issue')

if not self.journal:
raise TypeError('missing journal argument')
Expand Down
8 changes: 4 additions & 4 deletions scielomanager/journalmanager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ class JournalTimeline(models.Model):
status = models.CharField(max_length=16,
choices=choices.JOURNAL_PUBLICATION_STATUS)
since = models.DateTimeField()
reason = models.TextField(default="")
reason = models.TextField(_('Reason'), default="")
created_by = models.ForeignKey(User)


Expand Down Expand Up @@ -855,7 +855,7 @@ class Section(models.Model):

journal = models.ForeignKey(Journal)

code = models.CharField(unique=True, max_length=21, blank=True)
code = models.CharField(_('Legacy code'), unique=True, max_length=21, blank=True)
legacy_code = models.CharField(null=True, blank=True, max_length=16)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
Expand Down Expand Up @@ -941,7 +941,7 @@ class Issue(models.Model):
objects = IssueCustomManager()
userobjects = modelmanagers.IssueManager()

section = models.ManyToManyField(Section, blank=True)
section = models.ManyToManyField(Section, verbose_name=_("Section"), blank=True)
journal = models.ForeignKey(Journal)
volume = models.CharField(_('Volume'), blank=True, max_length=16)
number = models.CharField(_('Number'), blank=True, max_length=16)
Expand All @@ -951,7 +951,7 @@ class Issue(models.Model):
publication_end_month = models.IntegerField(_('End Month'), blank=True, null=True, choices=choices.MONTHS)
publication_year = models.IntegerField(_('Year'))
is_marked_up = models.BooleanField(_('Is Marked Up?'), default=False, null=False, blank=True)
use_license = models.ForeignKey(UseLicense, null=True, help_text=ISSUE_DEFAULT_LICENSE_HELP_TEXT)
use_license = models.ForeignKey(UseLicense, verbose_name=_("Use License"), null=True, help_text=ISSUE_DEFAULT_LICENSE_HELP_TEXT)
total_documents = models.IntegerField(_('Total of Documents'), default=0)
ctrl_vocabulary = models.CharField(_('Controlled Vocabulary'), max_length=64,
choices=sorted(choices.CTRL_VOCABULARY, key=lambda CTRL_VOCABULARY: CTRL_VOCABULARY[1]), null=False, blank=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ <h3>{{ issue_type|capfirst}} {% trans "Issue Information" %}:</h3>
$(".help-text").popover('hide');
//multiple-formsets
$('#titleformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-titleformset-form',
prefix: '{{ titleformset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,14 @@ <h4>{% trans "Logo" %}:</h4>

//multiple-formsets
$('#titleformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-titleformset-form',
prefix: '{{ titleformset.prefix }}'
});
$('#missionformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-missionformset-form',
prefix: '{{ missionformset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,14 @@ <h2><a name="title"></a>{% trans "Content" %}</h2>
<script>
$(document).ready(function() {
$('#translation_formset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-translation_formset-form',
prefix: '{{ translation_formset.prefix }}'
});
$('#article_formset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-article_formset-form',
prefix: '{{ article_formset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ <h2>{% trans "Section Information" %}:</h2>
$(".help-text").popover('hide');

$('#section_title_formset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-section_title_formset-form',
prefix: '{{ section_title_formset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ <h2>{% trans "Sponsor Collections" %}:</h2>
});
//multiple-formsets
$('#sponsorcollectionsformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-sponsorcollectionsformset-form',
prefix: '{{ sponsorcollectionsformset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ <h2>{% trans "User Collections" %}:</h2>
});
//multiple-formsets
$('#usercollectionsformset tbody tr').formset({
addText: "{% trans 'add another' %}",
deleteText: "{% trans 'remove' %}",
formCssClass: 'dynamic-usercollectionsformset-form',
prefix: '{{ usercollectionsformset.prefix }}'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<label
for="{{ field.auto_id }}"
class="control-label {% if field.field.required %} req-field {% endif %}">
{% trans field.label %}

{% trans field.label %}

</label>
<div class="controls">
{{ field }}
Expand All @@ -27,7 +29,6 @@
{% field_help field.label field.help_text term %}
</span>
{% endwith %}
{% field_help field.label field.help_text term-journal-title %}
{% endif %}
{% if field.errors %}
<span class="help-inline danger">{{ field.errors }}</span>
Expand Down
Loading

0 comments on commit cb147bb

Please sign in to comment.