Skip to content

Commit

Permalink
Refactorización de Registro
Browse files Browse the repository at this point in the history
  • Loading branch information
Dionakra committed Jun 25, 2017
1 parent f391ab4 commit 7f22613
Show file tree
Hide file tree
Showing 9 changed files with 363 additions and 498 deletions.
22 changes: 21 additions & 1 deletion Metronus-Project/metronus/static/css/custom.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Metronus-Project/metronus/static/css/green.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* iCheck plugin Flat skin, green
----------------------------------- */
.icheckbox_flat-green,
.iradio_flat-green {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
width: 20px;
height: 20px;
background: url(green.png) no-repeat;
border: none;
cursor: pointer;
}

.icheckbox_flat-green {
background-position: 0 0;
}
.icheckbox_flat-green.checked {
background-position: -22px 0;
}
.icheckbox_flat-green.disabled {
background-position: -44px 0;
cursor: default;
}
.icheckbox_flat-green.checked.disabled {
background-position: -66px 0;
}

.iradio_flat-green {
background-position: -88px 0;
}
.iradio_flat-green.checked {
background-position: -110px 0;
}
.iradio_flat-green.disabled {
background-position: -132px 0;
cursor: default;
}
.iradio_flat-green.checked.disabled {
background-position: -154px 0;
}

/* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_flat-green,
.iradio_flat-green {
background-image: url(green@2x.png);
-webkit-background-size: 176px 22px;
background-size: 176px 22px;
}
}
Binary file added Metronus-Project/metronus/static/css/green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Metronus-Project/metronus/static/css/green@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Metronus-Project/metronus/templates/anon_master.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<link href="/static/css/custom.min.css" rel="stylesheet">
<link href="/static/css/bootstrapvalidator.min.css" rel="stylesheet"/>
<link href="/static/css/fileinput.min.css" rel="stylesheet"/>
<link href="/static/css/green.css" rel="stylesheet"/>
{% endcompress %}

<!-- Favicon content -->
Expand Down
738 changes: 267 additions & 471 deletions Metronus-Project/metronus/templates/company/company_register.html

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions Metronus-Project/metronus/templates/tags/field.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
{% load i18n %}
{% load l10n %}

<div class="form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="id_{{ field.name }}">{% trans field.name %}
{% if required != "" %}
<span class="required">*</span>

<div class="form-group required form-class" id="div_{{field.name}}">
<label class="control-label col-md-4 col-sm-4 col-xs-12" for="id_{{ field.name }}">{% trans field.name %} {{required}}</label>
<div class="col-md-4 col-sm-5 col-xs-12">
{% if type == "file" %}
<input id="id_{{ field.name }}" name="{{ field.name }}" multiple type="file" class="file file-loading"
value="{{field.value|default_if_none:""}}" data-show-preview="false" multiple data-show-upload="false"
data-allowed-file-extensions='["jpeg", "jpg", "png"]'>
{% else %}
<input type="{{type}}" class="form-control" name="{{ field.name }}" id="id_{{ field.name }}" value="{{field.value|default_if_none:""}}" placeholder={{placeholder}}>
{% endif %}
<div class="help-block with-errors" id="id_unique_message">{{ field.errors }}</div>
{% if custom_error_str %}
<div class="help-block with-errors ajax-error" id="{{id_custom_error}}">{% trans custom_error_str %}</div>
{% endif %}
</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="{{ type }}" name="{{ field.name }}" id="id_{{ field.label }}" {{ required }} class="form-control col-md-7 col-xs-12">
</div>

{% if field.errors %}
<div class="col-xs-5 messageContainer">
{{ field.errors }}
</div>
{% endif %}
</div>
13 changes: 3 additions & 10 deletions Metronus-Project/metronus_app/controllers/companyController.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def edit(request):
form = CompanyForm(request.POST, request.FILES)
if form.is_valid():
errors = []

# Check that the image is OK
if not check_image(form, 'logo'):
errors.append('company_imageNotValid')
Expand Down Expand Up @@ -311,13 +311,6 @@ def validate_email(request):
"""
checks whether the email is unique
"""

email = request.GET.get("email", None)

if not email:
return HttpResponseBadRequest()

if is_company_email_unique(email) and is_email_unique(email):
return JsonResponse({'res': True})
else:
return JsonResponse({'res': False})
is_taken = not (is_company_email_unique(email) and is_email_unique(email))
return JsonResponse({'is_taken': is_taken})
7 changes: 4 additions & 3 deletions Metronus-Project/metronus_app/templatetags/custom_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def get_form_type(form_type):
def show_form(form):
return {'form': form}


@register.inclusion_tag('tags/field.html')
def show_field(field, required=True):
return {'field': field, 'required': "required" if required else "", 'type': get_form_type(get_type(field))}
def show_field(field, placeholder="", error_code=None):
return {'field': field, 'required': "*" if field.field.required else "",
'type': get_form_type(get_type(field)), 'placeholder':placeholder,
'custom_error_str':error_code}

@register.inclusion_tag('tags/team_item.html')
def team_item(name, img_name, role):
Expand Down

0 comments on commit 7f22613

Please sign in to comment.