Skip to content

Commit

Permalink
[oer] Revisão nos formulários
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciusandrade committed May 30, 2017
1 parent 3037ea5 commit 6a48aba
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 77 deletions.
4 changes: 2 additions & 2 deletions bireme/static/css/screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,11 @@ div.onlineresource div.check {
}
.preview #tab-descriptors { padding-bottom: 10px; }

#field_LILACS_indexed{
#field_LILACS_indexed, #field_CVSP_resource{
margin-bottom: 10px;
font-weight: bold;
}
#field_LILACS_indexed input[type="checkbox"]{
#field_LILACS_indexed input[type="checkbox"], #field_CVSP_resource input[type="checkbox"]{
width: 18px;
height: 18px;
margin-left: 5px;
Expand Down
20 changes: 16 additions & 4 deletions bireme/templates/oer/fieldset_relationship.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
<thead>
<th>{% trans "Relation type" %}</th>
<th>{% trans "Resource" %}</th>
<th>{% trans "Delete?" %}</th>
{% if user_can_edit %}
<th>{% trans "Delete?" %}</th>
{% endif %}
</thead>

<tbody>
Expand Down Expand Up @@ -81,11 +83,21 @@
{% endfor %}
{% else %}
{% for form in formset_relation %}
{% for field in form %}
<tr>
{% if field.name == 'oer_referred' %}
<td>
{{ field }}
{{ form.instance.oer_referred }}
</td>
{% endfor %}
{% elif field.name == 'relation_type' %}
<td>
{{ form.instance.relation_type.get_label_present }}
</td>
{% else %}
<td>
{{ field.value }}
</td>
{% endif %}
</tr>
{% endfor %}
{% endif %}
</tbody>
Expand Down
159 changes: 89 additions & 70 deletions bireme/templates/oer/oer_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ <h2><i class='icon-file'></i>{% if not object %}{% trans "New Resource" %}{% els
{% if field.value %}
<blockquote>
<p><strong>{{ field.label }}</strong><p>
<p>{% display_field field %}<p>
{% if field.name == 'status' %}
<p>{{ field.value|display_status_label }}</p>
{% else %}
<p>{% display_field field %}<p>
{% endif %}
</blockquote>
{% endif %}
{% else %}
<span {{ field.row_attrs }} {% if not field.is_hidden %}id="field_{{ field.name }}"{% endif %}>
<li {{ field.row_attrs }} {% if not field.is_hidden %}id="field_{{ field.name }}"{% endif %}>
{% if field.name == 'status' and not user_can_change_status %}
<p>
{{ field.label }} : {{ field.value|display_status_label }}
Expand Down Expand Up @@ -101,7 +105,7 @@ <h2><i class='icon-file'></i>{% if not object %}{% trans "New Resource" %}{% els

{% endif %}
{% endif %}
</span>
</li>
{% endfor %}

{% comment %}Display administrative information{% endcomment %}
Expand All @@ -128,52 +132,59 @@ <h2><i class='icon-file'></i>{% if not object %}{% trans "New Resource" %}{% els
<th></th>
</thead>
<tbody>

{% if descriptor_list %}
{% for descriptor in descriptor_list %}
{% if user_can_edit %}
{{ formset_descriptor.management_form }}

{% for form in formset_descriptor %}
<tr id="descriptor-{{ forloop.counter0 }}" class="descriptor-row{% if form.errors %} error{% endif %} formset-row">
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% for field in form.visible_fields %}
{% if field.name == 'status' %}
<input type="hidden" id="{{ field.auto_id }}" name="{{ field.html_name }}" value="1" class="keep-field-value" />
{% elif field.name == 'code' %}
{{ field.as_hidden }}
{% elif field.name == 'text' %}
<td class="span9">
{{ field.as_hidden }}
<div class="input-xxlarge uneditable-input {% if field.value == None %}placeholder-style{% endif %}" id="label_{{ field.html_name }}" onclick="javascript:decs_search(this)">
{% spaceless %}
{% if field.value == None or field.value == '' %}
{% trans "Select by search" %}
{% else %}
{{ field.value}}
{% endif %}
{% endspaceless %}
</div>
</td>
{% elif field.name != 'DELETE' %}
<td class="span6">
{{ field }}
{{ field.errors }}
</td>
{% endif %}
{% endfor %}
<td class="span6">
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
{% for form in formset_descriptor %}
<tr>
<td>{{ descriptor.text }}</td>
{% if form.instance.id %}
{% for field in form %}
{% if field.name == 'text' or field.name == 'primary' %}
<td>
{{field.value}}
</td>
{% endif %}
{% endfor %}
{% endif %}
</tr>
{% endfor %}
{% endif %}

{{ formset_descriptor.management_form }}

{% for form in formset_descriptor %}
<tr id="descriptor-{{ forloop.counter0 }}" class="descriptor-row{% if form.errors %} error{% endif %} formset-row">
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
{% for field in form.visible_fields %}
{% if field.name == 'status' %}
<input type="hidden" id="{{ field.auto_id }}" name="{{ field.html_name }}" value="1" class="keep-field-value" />
{% elif field.name == 'code' %}
{{ field.as_hidden }}
{% elif field.name == 'text' %}
<td class="span9">
{{ field.as_hidden }}
<div class="input-xxlarge uneditable-input {% if field.value == None %}placeholder-style{% endif %}" id="label_{{ field.html_name }}" onclick="javascript:decs_search(this)">
{% spaceless %}
{% if field.value == None or field.value == '' %}
{% trans "Select by search" %}
{% else %}
{{ field.value}}
{% endif %}
{% endspaceless %}
</div>
</td>
{% elif field.name != 'DELETE' %}
<td class="span6">
{{ field }}
{{ field.errors }}
</td>
{% endif %}
{% endfor %}
<td class="span6">
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</fieldset>
Expand Down Expand Up @@ -208,39 +219,47 @@ <h2><i class='icon-file'></i>{% if not object %}{% trans "New Resource" %}{% els
<table class="table table-condensed table-striped span8">
<thead>
<th>{% trans "Thematic area" %}</th>
<th>{% trans "Delete?" %}</th>
{% if user_can_edit %}
<th>{% trans "Delete?" %}</th>
{% endif %}
</thead>
<tbody>
{% if thematic_list %}
{% for thematic in thematic_list %}
<tr>
<td colspan="3">{{ thematic }}</td>
</tr>
{% endfor %}
{% endif %}

{{ formset_thematic.management_form }}
{% if user_can_edit %}
{{ formset_thematic.management_form }}

{% for form in formset_thematic %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% for form in formset_thematic %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<tr id="thematic-{{ forloop.counter0 }}" class="thematic-row{% if form.errors %} error{% endif %} formset-row">
{% for field in form.visible_fields %}
{% if role == 'doc' and field.name == 'status' %}
<input type="hidden" id="{{ field.auto_id }}" name="{{ field.html_name }}" value="0" class="keep-field-value" />
{% elif field.name != 'DELETE' %}
<td>
{{ field }}
{{ field.errors }}
</td>
{% endif %}
{% endfor %}
<td>
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
</td>
</tr>
{% endfor %}
<tr id="thematic-{{ forloop.counter0 }}" class="thematic-row{% if form.errors %} error{% endif %} formset-row">
{% for field in form.visible_fields %}
{% if role == 'doc' and field.name == 'status' %}
<input type="hidden" id="{{ field.auto_id }}" name="{{ field.html_name }}" value="0" class="keep-field-value" />
{% elif field.name != 'DELETE' %}
{% else %}
{% for form in formset_thematic %}
<tr>
{% for field in form %}
{% if field.name == 'thematic_area' %}
<td>
{{ field }}
{{ field.errors }}
{{ form.instance.thematic_area }}
</td>
{% endif %}
{% endfor %}
<td>
{% if form.instance.pk %}{{ form.DELETE }}{% endif %}
</td>
</tr>
{% endfor %}
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</fieldset>
Expand Down
2 changes: 1 addition & 1 deletion bireme/templates/oer/oer_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ <h2><i class='icon-file'></i> {% trans "Educational resources" %}</h2>
<td>{{ oer.status|display_status_label }}</td>
<td>
<a href="{% url 'edit_oer' oer.id %}" class='btn btn-mini'><i class='icon-pencil'></i></a>
{% if oer.created_by_id = user.id %}
{% if oer.created_by_id = user.id and oer.status < 1 %}
<a href="{% url 'delete_oer' oer.id %}" class='btn btn-mini' title="{% trans 'Remove' %}"><i class='icon-remove'></i></a>
{% endif %}
</td>
Expand Down

0 comments on commit 6a48aba

Please sign in to comment.