Skip to content

Commit

Permalink
Merge pull request django-cms#1 from Flight/feature/cms-643-improve-b…
Browse files Browse the repository at this point in the history
…asic-code-styling

Feature/cms 643 improve basic code styling
  • Loading branch information
Flight committed Nov 10, 2015
2 parents 434e92b + 7128713 commit 1b594a8
Show file tree
Hide file tree
Showing 24 changed files with 638 additions and 545 deletions.
8 changes: 4 additions & 4 deletions filer/static/filer/js/popup_handling.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(function($) {
dismissPopupAndReload = function(win) {
(function ($) {
dismissPopupAndReload = function (win) {
document.location.reload();
win.close();
};
dismissRelatedImageLookupPopup = function(win, chosenId, chosenThumbnailUrl, chosenDescriptionTxt) {
dismissRelatedImageLookupPopup = function (win, chosenId, chosenThumbnailUrl, chosenDescriptionTxt) {
var name = windowname_to_id(win.name);
var img_name = name + '_thumbnail_img';
var txt_name = name + '_description_txt';
Expand All @@ -19,7 +19,7 @@
}
win.close();
};
dismissRelatedFolderLookupPopup = function(win, chosenId, chosenName) {
dismissRelatedFolderLookupPopup = function (win, chosenId, chosenName) {
var id = windowname_to_id(win.name);
var id_name = id + '_description_txt';
document.getElementById(id).value = chosenId;
Expand Down
25 changes: 14 additions & 11 deletions filer/static/filer/js/widget.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
(function($) {
var filer_clear = function(e){
(function ($) {
var documentObject = $(document);
var filer_clear = function (e) {
var clearer = $(this),
hidden_input = clearer.closest('.filerFile').find('input.vForeignKeyRawIdAdminField'),
base_id = '#'+hidden_input.attr('id'),
thumbnail = $(base_id+'_thumbnail_img'),
description = $(base_id+'_description_txt'),
base_id = '#' + hidden_input.attr('id'),
thumbnail = $(base_id + '_thumbnail_img'),
description = $(base_id + '_description_txt'),
static_prefix = clearer.attr('src').replace('admin/img/icon_deletelink.gif', 'filer/');
clearer.hide();
hidden_input.removeAttr("value");
thumbnail.attr("src", static_prefix+"icons/nofile_48x48.png");
description.html("");
}
hidden_input.removeAttr('value');
thumbnail.attr('src', static_prefix + 'icons/nofile_48x48.png');
description.empty();
};

$(document).ready(function(){
documentObject.ready(function () {
$('.filerFile .vForeignKeyRawIdAdminField').attr('type', 'hidden');
//if this file is included multiple time, we ensure that filer_clear is attached only once.
$(document).off('click.filer', '.filerFile .filerClearer', filer_clear).on('click.filer', '.filerFile .filerClearer', filer_clear);
documentObject
.off('click.filer', '.filerFile .filerClearer', filer_clear)
.on('click.filer', '.filerFile .filerClearer', filer_clear);
});
})(django.jQuery);
16 changes: 9 additions & 7 deletions filer/templates/admin/filer/actions.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{% load i18n %}
<div class="actions">
{% for field in action_form %}{% if field.label %}<label>{{ field.label }} {% endif %}{{ field }}{% if field.label %}</label>{% endif %}{% endfor %}
<button type="submit" class="button" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
<button type="submit" class="button" title="{% trans 'Run the selected action' %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
{% if actions_selection_counter %}
<script type="text/javascript">var _actions_icnt="{{ paginated_items.object_list|length|default:"0" }}";</script>
<script type="text/javascript">
var _actions_icnt="{{ paginated_items.object_list|length|default:'0' }}";
</script>
<span class="action-counter">{{ selection_note }}</span>
{% if paginator.count != paginated_items.object_list|length %}
<span class="all">{{ selection_note_all }}</span>
<span class="question">
<a href="javascript:;" title="{% trans "Click here to select the objects across all pages" %}">{% blocktrans with paginator.count as total_count %}Select all {{ total_count }} files and/or folders{% endblocktrans %}</a>
</span>
<span class="clear"><a href="javascript:;">{% trans "Clear selection" %}</a></span>
<span class="all">{{ selection_note_all }}</span>
<span class="question">
<a href="javascript:;" title="{% trans 'Click here to select the objects across all pages' %}">{% blocktrans with paginator.count as total_count %}Select all {{ total_count }} files and/or folders{% endblocktrans %}</a>
</span>
<span class="clear"><a href="javascript:;">{% trans "Clear selection" %}</a></span>
{% endif %}
{% endif %}
</div>
5 changes: 3 additions & 2 deletions filer/templates/admin/filer/base_site.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "admin/base_site.html" %}
{% load i18n staticfiles %}

{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "filer/css/admin_style.css" %}" />
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'filer/css/admin_style.css' %}" />
{% endblock %}
17 changes: 10 additions & 7 deletions filer/templates/admin/filer/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{% load i18n %}

<div class="breadcrumbs">
<a href="{% url 'admin:index' %}" title="{% trans "Go back to admin homepage" %}">{% trans "Home" %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label='filer' %}" title="{% trans "Go back to Filer app" %}"> {% trans "Filer" %}</a>
{% if instance.is_root and not instance.is_smart_folder %}{%else %}&rsaquo; <a href="{% url 'admin:filer-directory_listing-root' %}" title="{% trans "Go back to root folder" %}">{% trans "root" %}</a>{% endif %}
<a href="{% url 'admin:index' %}" title="{% trans 'Go back to admin homepage' %}">{% trans "Home" %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label='filer' %}" title="{% trans 'Go back to Filer app' %}"> {% trans "Filer" %}</a>
{% if not instance.is_root and instance.is_smart_folder %}
&rsaquo; <a href="{% url 'admin:filer-directory_listing-root' %}" title="{% trans 'Go back to root folder' %}">{% trans "root" %}</a>
{% endif %}
{% for ancestor_folder in instance.logical_path %}
&rsaquo; <a href="{{ ancestor_folder.get_admin_directory_listing_url_path }}" title="{% blocktrans with ancestor_folder.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{% if ancestor_folder.label %}{{ ancestor_folder.label }}{% else %}{{ ancestor_folder.name }}{% endif %}</a>
&rsaquo; <a href="{{ ancestor_folder.get_admin_directory_listing_url_path }}" title="{% blocktrans with ancestor_folder.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{% if ancestor_folder.label %}{{ ancestor_folder.label }}{% else %}{{ ancestor_folder.name }}{% endif %}</a>
{% endfor %}
{% if breadcrumbs_action %}
&rsaquo; <a href="{{ instance.get_admin_directory_listing_url_path }}" title="{% blocktrans with instance.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{% if instance.label %}{{ instance.label }}{% else %}{{ instance.name }}{% endif %}</a>
&rsaquo; {{ breadcrumbs_action }}
&rsaquo; <a href="{{ instance.get_admin_directory_listing_url_path }}" title="{% blocktrans with instance.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{% if instance.label %}{{ instance.label }}{% else %}{{ instance.name }}{% endif %}</a>
&rsaquo; {{ breadcrumbs_action }}
{% else %}
&rsaquo; {% if instance.label %}{{ instance.label }}{% else %}{{ instance.name }}{% endif %}
&rsaquo; {% if instance.label %}{{ instance.label }}{% else %}{{ instance.name }}{% endif %}
{% endif %}
</div>
15 changes: 10 additions & 5 deletions filer/templates/admin/filer/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,29 @@
{% endwith %}
{% endblock %}

{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "filer/css/admin_style.css" %}" />
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'filer/css/admin_style.css' %}">
{% endblock %}

{% block coltype %}colMS{% endblock %}

{% block after_field_sets %}
{% if is_popup and select_folder %}<input type="hidden" name="select_folder" value="1" />{% endif %}
{% if is_popup and select_folder %}
<input type="hidden" name="select_folder" value="1">
{% endif %}
{% endblock %}

{% block sidebar %}
<div id="content-related">
{% block file_sidebar %}
{% with original.duplicates as duplicates %}
{% if duplicates %}
<h3>{% trans 'duplicates' %}</h3>
<h3>{% trans "duplicates" %}</h3>
<ul>
{% for duplicate in duplicates %}<li><a href="{{ duplicate.get_admin_url_path }}">{{ duplicate }}</a></li>{% endfor %}
{% for duplicate in duplicates %}
<li><a href="{{ duplicate.get_admin_url_path }}">{{ duplicate }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endwith %}
Expand Down
2 changes: 1 addition & 1 deletion filer/templates/admin/filer/delete_confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n staticfiles %}

{% block extrastyle %}{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "filer/css/admin_style.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static 'filer/css/admin_style.css' %}"/>
{% endblock %}

{% block breadcrumbs %}
Expand Down
77 changes: 39 additions & 38 deletions filer/templates/admin/filer/delete_selected_files_confirmation.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,45 @@
{% endblock %}

{% block content %}
{% if perms_lacking or protected %}
{% if perms_lacking %}
<p>{% blocktrans %}Deleting the selected files and/or folders would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
<ul>
{% for obj in perms_lacking %}
<li>{{ obj }}</li>
{% if perms_lacking or protected %}
{% if perms_lacking %}
<p>{% blocktrans %}Deleting the selected files and/or folders would result in deleting related objects, but your account doesn't have permission to delete the following types of objects:{% endblocktrans %}</p>
<ul>
{% for obj in perms_lacking %}
<li>{{ obj }}</li>
{% endfor %}
</ul>
{% endif %}
{% if protected %}
<p>{% blocktrans %}Deleting the selected files and/or folders would require deleting the following protected related objects:{% endblocktrans %}</p>
<ul>
{% for obj in protected %}
<li>{{ obj }}</li>
{% endfor %}
</ul>
{% endif %}
{% else %}
<p>{% blocktrans %}Are you sure you want to delete the selected files and/or folders? All of the following objects and their related items will be deleted:{% endblocktrans %}</p>
{% for deletable_object in deletable_objects %}
<ul>{{ deletable_object|unordered_list }}</ul>
{% endfor %}
</ul>
<form action="" method="post">
{% csrf_token %}
<div>
{% for f in files_queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="file-{{ f.pk }}">
{% endfor %}
{% for f in folders_queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="folder-{{ f.pk }}">
{% endfor %}
{% if is_popup %}
<input type="hidden" name="_popup" value="1">
{% if select_folder %}<input type="hidden" name="select_folder" value="1">{% endif %}
{% endif %}
<input type="hidden" name="action" value="delete_files_or_folders">
<input type="hidden" name="post" value="yes">
<input type="submit" value="{% trans 'Yes, I&#39;m sure' %}">&quot;
</div>
</form>
{% endif %}
{% if protected %}
<p>{% blocktrans %}Deleting the selected files and/or folders would require deleting the following protected related objects:{% endblocktrans %}</p>
<ul>
{% for obj in protected %}
<li>{{ obj }}</li>
{% endfor %}
</ul>
{% endif %}
{% else %}
<p>{% blocktrans %}Are you sure you want to delete the selected files and/or folders? All of the following objects and their related items will be deleted:{% endblocktrans %}</p>
{% for deletable_object in deletable_objects %}
<ul>{{ deletable_object|unordered_list }}</ul>
{% endfor %}
<form action="" method="post">{% csrf_token %}
<div>
{% for f in files_queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="file-{{ f.pk }}" />
{% endfor %}
{% for f in folders_queryset %}
<input type="hidden" name="{{ action_checkbox_name }}" value="folder-{{ f.pk }}" />
{% endfor %}
{% if is_popup %}
<input type="hidden" name="_popup" value="1" />
{% if select_folder %}<input type="hidden" name="select_folder" value="1" />{% endif %}
{% endif %}
<input type="hidden" name="action" value="delete_files_or_folders" />
<input type="hidden" name="post" value="yes" />
<input type="submit" value="{% trans "Yes, I'm sure" %}" />
</div>
</form>
{% endif %}
{% endblock %}
8 changes: 4 additions & 4 deletions filer/templates/admin/filer/dismiss_popup.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% extends "admin/filer/base_site.html" %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript">
opener.dismissPopupAndReload(window);
</script>
{{ block.super }}
<script type="text/javascript">
opener.dismissPopupAndReload(window);
</script>
{% endblock %}
52 changes: 28 additions & 24 deletions filer/templates/admin/filer/folder/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,40 @@
{% load i18n admin_modify staticfiles %}

{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}" title="{% trans "Go back to" %} {% trans "admin homepage" %}">{% trans "Home" %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label='filer' %}" title="{% trans "Go back to" %} {% trans "Filer" %}"> {% trans "Filer" %}</a>
&rsaquo; <a href="{% url 'admin:filer-directory_listing-root' %}" title="{% trans "Go back to" %} '{% trans "root"|title %}' {% trans "folder" %}">{% trans "root"|title %}</a>
{% for ancestor_folder in original.get_ancestors %}
&rsaquo; <a href="{% url 'admin:filer-directory_listing' ancestor_folder.id %}" title="{% blocktrans with ancestor_folder.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{{ ancestor_folder.name }}</a>
{% endfor %}
&rsaquo; {{ original.name }}
</div>
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}" title="{% trans 'Go back to' %} {% trans 'admin homepage' %}">{% trans "Home" %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label='filer' %}" title="{% trans 'Go back to' %} {% trans 'Filer' %}"> {% trans "Filer" %}</a>
&rsaquo; <a href="{% url 'admin:filer-directory_listing-root' %}" title="{% trans 'Go back to' %} '{% trans 'root'|title %}' {% trans 'folder' %}">{% trans "root"|title %}</a>
{% for ancestor_folder in original.get_ancestors %}
&rsaquo; <a href="{% url 'admin:filer-directory_listing' ancestor_folder.id %}" title="{% blocktrans with ancestor_folder.name as folder_name %}Go back to '{{ folder_name }}' folder{% endblocktrans %}">{{ ancestor_folder.name }}</a>
{% endfor %}
&rsaquo; {{ original.name }}
</div>
{% endblock %}


{% block coltype %}{% if is_popup %}colM{% else %}colMS{% endif %}{% endblock %}

{% block object-tools %}
{% if change %}{% if not is_popup %}
<ul class="object-tools">
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
</ul>
{% endif %}{% endif %}
{% if change and not is_popup %}
<ul class="object-tools">
<li><a href="history/" class="historylink">{% trans "History" %}</a></li>
{% if has_absolute_url %}
<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>
{% endif%}
</ul>
{% endif %}
{% endblock %}

{% block after_field_sets %}
{% if is_popup and select_folder %}<input type="hidden" name="select_folder" value="1" />{% endif %}
{% if is_popup and select_folder %}<input type="hidden" name="select_folder" value="1">{% endif %}
{% endblock %}

{% block sidebar %}{% if not is_popup %}
<div id="content-related">
<div id="navcontainer">
<img src="{% static "icons/plainfolder_128x128.png" %}" alt="{% trans "Folder Icon" %}" />
</div>
</div>
{% endif %}{% endblock %}
{% block sidebar %}
{% if not is_popup %}
<div id="content-related">
<div id="navcontainer">
<img src="{% static 'icons/plainfolder_128x128.png' %}" alt="{% trans 'Folder Icon' %}" />
</div>
</div>
{% endif %}
{% endblock %}
Loading

0 comments on commit 1b594a8

Please sign in to comment.