diff --git a/gruntfile.coffee b/gruntfile.coffee index fbff5e6..af538bd 100644 --- a/gruntfile.coffee +++ b/gruntfile.coffee @@ -44,9 +44,9 @@ module.exports = (grunt) -> dest: "shelfzilla/themes/bootflat/static/js/site.js" css: src: [ + "shelfzilla/themes/bootflat/static/css/app.css", "static_components/css/bootstrap.min.css", "static_components/css/bootflat.min.css", - "shelfzilla/themes/bootflat/static/css/app.css", ] dest: "shelfzilla/themes/bootflat/static/css/style.css" @@ -78,10 +78,10 @@ module.exports = (grunt) -> tasks: [] less: files: ['shelfzilla/themes/bootflat/static/less/*.less'] - tasks: ['less'] + tasks: ['less', 'concat:css'] coffee: files: ['shelfzilla/themes/bootflat/static/coffee/*.coffee'] - tasks: ['coffee', 'concat', 'clean:development'] + tasks: ['coffee', 'concat:js', 'clean:development'] # Modules diff --git a/shelfzilla/apps/users/views.py b/shelfzilla/apps/users/views.py index ce87d3d..67d34dd 100644 --- a/shelfzilla/apps/users/views.py +++ b/shelfzilla/apps/users/views.py @@ -14,6 +14,9 @@ class LoginView(View): template = 'users/login.html' def get(self, request): + if request.user.is_authenticated(): + return HttpResponseRedirect('/') + context = { 'login_form': LoginForm() } @@ -22,6 +25,9 @@ class LoginView(View): return render_to_response(self.template, context_instance=ctx) def post(self, request): + if request.user.is_authenticated(): + return HttpResponseRedirect('/') + login_form = LoginForm(request.POST) if login_form.is_valid(): diff --git a/shelfzilla/themes/bootflat/static/less/app.less b/shelfzilla/themes/bootflat/static/less/app.less index e69de29..fb09eb2 100644 --- a/shelfzilla/themes/bootflat/static/less/app.less +++ b/shelfzilla/themes/bootflat/static/less/app.less @@ -0,0 +1 @@ +@import "layout.less"; diff --git a/shelfzilla/themes/bootflat/static/less/layout.less b/shelfzilla/themes/bootflat/static/less/layout.less new file mode 100644 index 0000000..d4e3800 --- /dev/null +++ b/shelfzilla/themes/bootflat/static/less/layout.less @@ -0,0 +1,14 @@ +/* Login panel */ +.panel-login { + @height: 180px; + @width: 300px; + + left: 50%; + margin: 0 auto; + margin-left: @width/2*-1px; + margin-top: @height/2*-1px; + position: absolute; + text-align: center; + top: 50%; + width: 300px; +} diff --git a/shelfzilla/themes/bootflat/templates/_layout.html b/shelfzilla/themes/bootflat/templates/_layout.html index 44fdb27..3ce0abc 100644 --- a/shelfzilla/themes/bootflat/templates/_layout.html +++ b/shelfzilla/themes/bootflat/templates/_layout.html @@ -1,9 +1,9 @@ - {% block page_title %}{% endblock %} {% block extra_css %}{% endblock %} + {% block page_title %}Shelfzilla{% endblock %} diff --git a/shelfzilla/themes/bootflat/templates/users/login.html b/shelfzilla/themes/bootflat/templates/users/login.html index a34509e..0fd87c5 100644 --- a/shelfzilla/themes/bootflat/templates/users/login.html +++ b/shelfzilla/themes/bootflat/templates/users/login.html @@ -1,9 +1,26 @@ {% extends "_layout.html" %} +{% load i18n %} + +{% block page_title %}{{ block.super }} | Login{% endblock %} {% block main_content %} -
- {% csrf_token %} - {{ login_form.as_p }} - -
+
+
+

{% trans "Access the site" %}

+
+
+
+ {% csrf_token %} + {% for field in login_form %} +
+ +
+ {{ field }} +
+
+ {% endfor %} + +
+
+
{% endblock %}