From b07520a11332374de645ed22c74959afa8a4b7ed Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 30 Dec 2011 13:19:18 +0100 Subject: [PATCH 1/1] ajaxable dialogs fixes, some layout tweaking --- apps/ajaxable/templates/ajaxable/form.html | 1 + apps/ajaxable/utils.py | 10 ++-- .../templates/infopages/infopage.html | 12 +++-- apps/infopages/views.py | 2 - wolnelektury/settings.py | 18 ++++---- wolnelektury/static/css/base.css | 12 +++-- wolnelektury/static/css/catalogue.css | 46 +++++++++++++++++++ wolnelektury/static/css/dialogs.css | 21 ++++++--- wolnelektury/static/js/base.js | 9 ++++ wolnelektury/static/js/dialogs.js | 12 ++++- wolnelektury/templates/404.html | 36 ++++++--------- wolnelektury/templates/base.html | 4 +- .../templates/catalogue/book_list.html | 12 +++-- .../templates/catalogue/book_text.html | 2 +- .../templates/catalogue/catalogue.html | 2 + .../templates/lesmianator/lesmianator.html | 8 +++- wolnelektury/templates/main_page.html | 3 +- wolnelektury/templates/publish_plan.html | 2 +- wolnelektury/views.py | 4 +- 19 files changed, 150 insertions(+), 66 deletions(-) diff --git a/apps/ajaxable/templates/ajaxable/form.html b/apps/ajaxable/templates/ajaxable/form.html index d8f00361f..ba79e4b69 100755 --- a/apps/ajaxable/templates/ajaxable/form.html +++ b/apps/ajaxable/templates/ajaxable/form.html @@ -3,6 +3,7 @@
    +
    {{ form.as_ul }}
diff --git a/apps/ajaxable/utils.py b/apps/ajaxable/utils.py index 14b5dfc7a..a6faafa05 100755 --- a/apps/ajaxable/utils.py +++ b/apps/ajaxable/utils.py @@ -35,9 +35,8 @@ class AjaxableFormView(object): form_class = None # override to customize form look template = "ajaxable/form.html" - # set to redirect after succesful ajax-less post submit = _('Send') - redirect = None + title = '' success_message = '' formname = "form" @@ -51,10 +50,11 @@ class AjaxableFormView(object): if form.is_valid(): self.success(form, request) redirect = request.GET.get('next') - if not ajax and redirect is not None: + if not ajax and redirect: return HttpResponseRedirect(urlquote_plus( - redirect, safe='/?=')) - response_data = {'success': True, 'message': self.success_message} + redirect, safe='/?=')) + response_data = {'success': True, + 'message': self.success_message, 'redirect': redirect} else: response_data = {'success': False, 'errors': form.errors} if ajax: diff --git a/apps/infopages/templates/infopages/infopage.html b/apps/infopages/templates/infopages/infopage.html index dc9efe1aa..db2d49b29 100755 --- a/apps/infopages/templates/infopages/infopage.html +++ b/apps/infopages/templates/infopages/infopage.html @@ -10,11 +10,15 @@

{{ page.title }}

{% autoescape off %} -
- {{ left_column }} +
+
+ {{ left_column }} +
-
- {{ right_column }} +
+
+ {{ right_column }} +
{% endautoescape %} {% endblock %} diff --git a/apps/infopages/views.py b/apps/infopages/views.py index d457653d1..e1e745148 100644 --- a/apps/infopages/views.py +++ b/apps/infopages/views.py @@ -9,8 +9,6 @@ from infopages.models import InfoPage def infopage(request, slug): - page = InfoPage.objects.get(slug=slug) - page = get_object_or_404(InfoPage, slug=slug) rc = RequestContext(request) left_column = Template(page.left_column).render(rc) diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index 55c845e60..ed48332e6 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -232,16 +232,14 @@ COMPRESS_JS = { ], 'output_filename': 'js/player.min?.js', }, - #~ 'book': { - #~ 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',), - #~ 'source_filenames': [], - #~ 'output_filename': 'js/book?.min.js', - #~ }, - #~ 'book_ie': { - #~ 'source_filenames': ('js/ierange-m2.js',), - #~ 'source_filenames': [], - #~ 'output_filename': 'js/book_ie?.min.js', - #~ } + 'book': { + 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',), + 'output_filename': 'js/book?.min.js', + }, + 'book_ie': { + 'source_filenames': ('js/ierange-m2.js',), + 'output_filename': 'js/book_ie?.min.js', + } } diff --git a/wolnelektury/static/css/base.css b/wolnelektury/static/css/base.css index 7c3b682a6..fde0115a5 100755 --- a/wolnelektury/static/css/base.css +++ b/wolnelektury/static/css/base.css @@ -43,6 +43,10 @@ h1 { float:right; width: 48em; } +.normal-text { + font-size: 1.3em; + line-height: 1.3em; +} h2 { margin: 0; @@ -60,7 +64,7 @@ h2 { clear: both; } -#header-content, div#main-content, div#half-header-content { +#header-content, div#main-content, div#half-header-content, #footer-content { width: 97.5em; margin: auto; } @@ -147,6 +151,8 @@ a.cite { #footer { color: #777; - border-top: 1px solid #ddd; - margin-top: 2.5em; + eborder-top: 1px solid #ddd; + margin-top: 5em; + padding-top:3em; + background: #fff; } diff --git a/wolnelektury/static/css/catalogue.css b/wolnelektury/static/css/catalogue.css index c971ca80b..b75429992 100755 --- a/wolnelektury/static/css/catalogue.css +++ b/wolnelektury/static/css/catalogue.css @@ -9,3 +9,49 @@ margin: 0; padding: 0; } + + +/* listing of all books */ +#book-list { + padding-left: 50px; +} +#book-list-nav { + position: absolute; + right: 50px; + width: 200px; + border-left: 1px #cfcfcf solid; + padding: 10px; + font-size: 1.2em; +} + +#book-list-nav ul { + list-style-type: none; + margin: 5px; + padding: 0; +} + +.book-list-show-index { + display: none; + margin: 0; + padding: 0; +} + + +#book-a-list #book-list ol { + padding-left: 1em; + margin: 0.3em 0 1.2em 0; + list-style: none; +} + +#book-a-list #book-list h2 a { + color: black; +} + +#book-list-up { + position: fixed; + bottom: 50px; + right: 50px; + border-left: 1px #cfcfcf solid; + padding: 10px; + background-color: white; +} \ No newline at end of file diff --git a/wolnelektury/static/css/dialogs.css b/wolnelektury/static/css/dialogs.css index dc76e6cd8..05b74dcc6 100755 --- a/wolnelektury/static/css/dialogs.css +++ b/wolnelektury/static/css/dialogs.css @@ -1,7 +1,11 @@ +.cuteform { + font-size: 1.1em; +} .cuteform ol, .cuteform ul { padding: 0; margin: 0; list-style: none; + font-style: 1.1em; } .cuteform ol li, .cuteform ul li { @@ -22,6 +26,9 @@ color: #BF3024; display: block; } +.cuteform .errorlist { + color: #BF3024; +} .jqmOverlay { background-color: #000; } @@ -36,6 +43,7 @@ } .dialog-window div.header { + font-size: 1.1em; width: 4em; background-color: #FFF; border-right: 0.3em solid #DDD; @@ -60,28 +68,29 @@ font-size: 1.2em; } +.dialog-window textarea, .dialog-window input { + width: 100%; +} #login-window { - width: 24em; + width: 26em; } #register-window { - width: 24em; + width: 26em; } #suggest-window { - width: 24em; + width: 26em; } #suggest-window textarea { - width: 19em; height: 6em; } #suggest-publishing-window { - width: 26em; + width: 29em; } #suggest-publishing-window textarea { - width: 21em; height: 3em; } diff --git a/wolnelektury/static/js/base.js b/wolnelektury/static/js/base.js index 028ab33f4..51107fe8b 100755 --- a/wolnelektury/static/js/base.js +++ b/wolnelektury/static/js/base.js @@ -17,6 +17,15 @@ $('.open-player').click(function(event) { }); + $('.book-list-index').click(function(){ + $('.book-list-show-index').hide('slow'); + if($(this).parent().next('ul:not(:hidden)').length == 0){ + $(this).parent().next('ul').toggle('slow'); + } + return false; + }); + + }); })(jQuery) diff --git a/wolnelektury/static/js/dialogs.js b/wolnelektury/static/js/dialogs.js index 0793a7ffd..bf9d94b54 100755 --- a/wolnelektury/static/js/dialogs.js +++ b/wolnelektury/static/js/dialogs.js @@ -27,14 +27,22 @@ hash.w.show(); }, onLoad: function(hash) { - $('form', hash.w).each(function() {this.action += '?ajax=1';}); + $('form', hash.w).each(function() { + if (this.action.search('[\\?&]ajax=1') != -1) + return; + if (this.action.search('\\?') != -1) + this.action += '&ajax=1'; + else this.action += '?ajax=1'; + }); $('form', hash.w).ajaxForm({ dataType: 'json', target: $('.target', $window), success: function(response) { if (response.success) { $('.target', $window).text(response.message); - setTimeout(function() { $window.jqmHide() }, 1000) + setTimeout(function() { $window.jqmHide() }, 1000); + if (response.redirect) + window.location = response.redirect; } else { $('.error', $window).remove(); diff --git a/wolnelektury/templates/404.html b/wolnelektury/templates/404.html index 50a56ea7e..8083d2865 100644 --- a/wolnelektury/templates/404.html +++ b/wolnelektury/templates/404.html @@ -1,27 +1,19 @@ +{% extends "base.html" %} {% load i18n %} - - - -404 - {% trans "Page does not exist" %} - WolneLektury.pl - - - - - - - - -

{% trans "Page does not exist" %}

+ + +{% block titleextra %}404 - {% trans "Page does not exist" %}{% endblock %} + + +{% block body %} + +

{% trans "Page not found" %}

+ +

{% trans "We are sorry, but this page does not exist. Please check if you entered correct address or go to "%} {% trans "main page" %}.

- - - - \ No newline at end of file + + +{% endblock body %} diff --git a/wolnelektury/templates/base.html b/wolnelektury/templates/base.html index 48f13adb2..04330f232 100644 --- a/wolnelektury/templates/base.html +++ b/wolnelektury/templates/base.html @@ -131,9 +131,11 @@
+
{# end main-content #} -
{# end main-content #} {# template #} diff --git a/wolnelektury/templates/catalogue/book_list.html b/wolnelektury/templates/catalogue/book_list.html index b4336d32b..318f1b446 100644 --- a/wolnelektury/templates/catalogue/book_list.html +++ b/wolnelektury/templates/catalogue/book_list.html @@ -9,9 +9,15 @@ {% block body %}

{% block book_list_header %}{% trans "Listing of all works" %}{% endblock %}

-
{% block book_list_info %}{% endblock %}
+
+ {% block book_list_info %}{% endblock %} +
+ +
+ -
+ +
{% trans "Table of Content" %} {% for index, authors in books_nav.items %}
    @@ -24,7 +30,7 @@
{% endfor %}
-
+
{% block book_list %} {% book_tree orphans books_by_parent %} {% for author, group in books_by_author.items %} diff --git a/wolnelektury/templates/catalogue/book_text.html b/wolnelektury/templates/catalogue/book_text.html index 935cdf392..c1331653c 100644 --- a/wolnelektury/templates/catalogue/book_text.html +++ b/wolnelektury/templates/catalogue/book_text.html @@ -8,7 +8,7 @@ {% block title %}WolneLektury.pl{% endblock %} {% compressed_css "book" %} - {% compressed_js "jquery" %} + {% compressed_js "book" %}