Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
[SE-3732] fix: removes django-angular lib. and its usage from login f…
Browse files Browse the repository at this point in the history
…orm (#883)
  • Loading branch information
DubeySandeep authored Mar 16, 2022
1 parent fc9bf7d commit a0fbf14
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 40 deletions.
1 change: 0 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ module.exports = function(config) {
'static/external/js/restangular.min.js',
'static/external/js/angular-mocks.js',
'static/external/js/jshint.js',
'static/external/js/django-angular.min.js',
'static/external/js/icheck.min.js',
'instance/static/js/src/**/*.js',
'registration/static/js/src/**/*.js',
Expand Down
4 changes: 2 additions & 2 deletions marketing/templates/marketing/conversion.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ <h1 class="page-title__text">Conversion data</h1>
{% csrf_token %}
{% if form.non_field_errors %}
<div class="page-content__inner__wrapper">
<ul class="djng-form-errors">
<ul class="ocim-form-errors">
{% for error in form.non_field_errors %}
<li class="invalid">{{ error|last }}</li>
<li class="invalid">{{ error }}</li>
{% endfor %}
</ul>
</div>
Expand Down
1 change: 0 additions & 1 deletion opencraft/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@
'django_extensions',
'foundation',
'compressor',
'djng',
'rest_framework',
'django_rest_passwordreset',
'huey.contrib.djhuey',
Expand Down
4 changes: 2 additions & 2 deletions registration/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from django import forms
from django.contrib.auth.forms import AuthenticationForm
from djng.forms import NgDeclarativeFieldsMetaclass, NgFormValidationMixin


# Logging #####################################################################
Expand Down Expand Up @@ -86,14 +85,15 @@ class Textarea(InputStyleMixin, forms.widgets.Textarea):

# Forms #######################################################################

class LoginForm(NgFormValidationMixin, AuthenticationForm, metaclass=NgDeclarativeFieldsMetaclass):
class LoginForm(AuthenticationForm):
"""
Allows users to login with username/email and password.
"""
username = forms.CharField(
label='Your email or username',
help_text='You can enter either your username or your email to login.',
widget=TextInput,
max_length=150
)
password = forms.CharField(
help_text=('If you have forgotten your login details or need to reset '
Expand Down
2 changes: 1 addition & 1 deletion registration/static/js/src/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@

// App configuration //////////////////////////////////////////////////////////

var app = angular.module('LoginApp', ['djng.forms']);
var app = angular.module('LoginApp', []);

})();
12 changes: 10 additions & 2 deletions registration/templates/registration/form_field.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{% load staticfiles %}
<div class="page-content__inner__wrapper">
<div class="page-content__inner__left">
<div class="field field--host">
<div class="field field--host login-form-field">
<label class="field-label {% if field.field.required %}field-label--required{% endif %}" for="{{ field.id_for_label }}">
{{ field.label }}
</label>
<div class="input--host__wrapper input--host__wrapper--{{ field.name }}">
{{ field }}
</div>
{{ field.errors }}
<div class="ocim-field-errors__inner__wrapper">
<ul class="ocim-field-errors">
{% if field.errors %}
{% for error in field.errors %}
<li class="invalid">{{ error }}</li>
{% endfor %}
{% endif %}
</ul>
</div>
</div>
</div>
<div class="page-content__inner__right">
Expand Down
1 change: 0 additions & 1 deletion registration/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ <h1 class="page-title__text">Login</h1>
{% endblock content %}

{% block body_js %}
<script src="{% static "djng/js/django-angular.min.js" %}"></script>
<script src="{% static "js/src/login.js" %}"></script>
{% endblock body_js %}
4 changes: 2 additions & 2 deletions registration/templates/registration/login_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

{% if form.non_field_errors %}
<div class="page-content__inner__wrapper">
<ul class="djng-form-errors">
<ul class="ocim-form-errors">
{% for error in form.non_field_errors %}
<li class="invalid">{{ error|last }}</li>
<li class="invalid">{{ error }}</li>
{% endfor %}
</ul>
</div>
Expand Down
1 change: 0 additions & 1 deletion registration/tests/js/spec/javascripts/support/jasmine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ src_files:
- static/external/js/jquery.min.js
- static/external/js/underscore-min.js
- static/external/js/angular.min.js
- static/external/js/django-angular.min.js
- static/external/js/icheck.min.js
- static/external/js/angular-mocks.js
- registration/static/js/src/*.js
Expand Down
2 changes: 0 additions & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ cookies<2.3
cryptography==3.2.1
dictdiffer<0.9
Django<2.3,>=2.2
# using the latest django-angular (2.2 or later) requires a heavy rewrite of the registration form, so we use the old 1.0.0 version patched to work under Django 2
-e git+https://github.com/open-craft/django-angular.git@v1-with-django2-support#egg=django_angular
django-compressor==2.4
django-cors-headers<3.3
django-environ==0.4.5
Expand Down
2 changes: 0 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#
# pip-compile --output-file=requirements/base.txt requirements/base.in
#
-e git+https://github.com/open-craft/django-angular.git@v1-with-django2-support#egg=django_angular
# via -r requirements/base.in
aioredis==1.3.1
# via channels-redis
appdirs==1.4.4
Expand Down
2 changes: 0 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#
# pip-compile --output-file=requirements/dev.txt requirements/dev.in
#
-e git+https://github.com/open-craft/django-angular.git@v1-with-django2-support#egg=django_angular
# via -r requirements/base.in
aioredis==1.3.1
# via channels-redis
appdirs==1.4.4
Expand Down
2 changes: 0 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#
# pip-compile --output-file=requirements/test.txt requirements/test.in
#
-e git+https://github.com/open-craft/django-angular.git@v1-with-django2-support#egg=django_angular
# via -r requirements/base.in
aioredis==1.3.1
# via channels-redis
appdirs==1.4.4
Expand Down
1 change: 0 additions & 1 deletion spec/support/jasmine.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"static/external/js/restangular.min.js",
"static/external/js/angular-mocks.js",
"static/external/js/jshint.js",
"static/external/js/django-angular.min.js",
"static/external/js/icheck.min.js",
"static/external/js/angular-sanitize.min.js",
"static/external/js/marked.min.js",
Expand Down
7 changes: 1 addition & 6 deletions static/external/js/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CDNJS = https://cdnjs.cloudflare.com/ajax/libs
# Files #######################################################################

all: angular.min.js angular.min.js.map angular-mocks.js angular-route.min.js angular-route.min.js.map \
angucomplete-alt.min.js angular-ui-router.min.js angular-sanitize.min.js django-angular.min.js \
angucomplete-alt.min.js angular-ui-router.min.js angular-sanitize.min.js \
icheck.min.js jquery.min.js jshint.js marked.min.js restangular.min.js underscore-min.js \
underscore-min.map zxcvbn.js

Expand Down Expand Up @@ -52,11 +52,6 @@ angular-route.min.js.map:
angular-ui-router.min.js:
$(GET) $@ $(CDNJS)/angular-ui-router/0.2.15/angular-ui-router.min.js

# This is included in the django-angular package, but we include it here so
# we can use it in javascript tests.
django-angular.min.js:
$(GET) $@ https://github.com/open-craft/django-angular/raw/5f3e54f909b925eecb59dc4dd73b6e9fe27e9558/djng/static/djng/js/django-angular.min.js

icheck.min.js:
$(GET) $@ https://github.com/fronteed/icheck/raw/6fd2ef473c16d74773bebb134d57621d877b140e/icheck.min.js

Expand Down
5 changes: 1 addition & 4 deletions static/scss/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/

// http://sass-guidelin.es/#the-7-1-pattern
//


// EXTERNAL DEPENDENCIES
Expand Down Expand Up @@ -46,6 +45,4 @@

// PAGES
@import 'pages/page';

// DJANGO-ANGULAR
@import 'djng';
@import 'pages/login';
12 changes: 4 additions & 8 deletions static/scss/_djng.scss → static/scss/pages/_login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,30 @@ form .ng-invalid.ng-dirty {
border-color: #e9322d;
}

ul.djng-form-errors, ul.djng-field-errors {
ul.ocim-form-errors, ul.ocim-field-errors {
display: inline-block;
list-style-type: none;
margin: 5px 0 0 0;
padding: 0;
}

ul.djng-form-errors li, ul.djng-field-errors li {
ul.ocim-form-errors li, ul.ocim-field-errors li {
color: #e9322d;
}

ul.djng-field-errors {
ul.ocim-field-errors {
li::before {
position: absolute;
top: 2.8rem;
left: -2.5rem;
line-height: 2rem;
}

li.valid::before {
content: url('/static/img/svg/forms/opencraft_valid.svg');
}

li.invalid::before {
content: url('/static/img/svg/forms/opencraft_error.svg');
}
}

.checkbox__wrapper__text ul.djng-field-errors li::before {
.checkbox__wrapper__text ul.ocim-field-errors li::before {
top: 0.35rem;
}

0 comments on commit a0fbf14

Please sign in to comment.