Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grappelli compatibility #39

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Prerequisites:
* Python 2.5.4+ <http://www.python.org/>
* Django 1.3+ <http://www.djangoproject.com/>
* django-mptt e734079+ <https://github.com/django-mptt/django-mptt/>
* (optional) django-grappelli 2.0+ <http://code.google.com/p/django-grappelli/>
* (optional) django-grappelli 2.4+ <https://github.com/sehmaschine/django-grappelli/>
* (optional) south 0.7.2+ <http://south.aeracode.org/>
* (philo.contrib.penfield) django-taggit 0.9.3+ <https://github.com/alex/django-taggit/>
* (philo.contrib.waldo, optional) recaptcha-django r6+ <http://code.google.com/p/recaptcha-django/>
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Prerequisites:
* [Python 2.5.4+](http://www.python.org/)
* [Django 1.3+](http://www.djangoproject.com/)
* [django-mptt e734079+](https://github.com/django-mptt/django-mptt/)
* (optional) [django-grappelli 2.0+](http://code.google.com/p/django-grappelli/)
* (optional) [django-grappelli 2.4+](https://github.com/sehmaschine/django-grappelli/)
* (optional) [south 0.7.2+](http://south.aeracode.org/)
* (philo.contrib.penfield) [django-taggit 0.9.3+](https://github.com/alex/django-taggit/)
* (philo.contrib.waldo, optional) [recaptcha-django r6+](http://code.google.com/p/recaptcha-django/)
Expand Down
26 changes: 3 additions & 23 deletions philo/static/philo/css/EmbedWidget.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,7 @@
background-color:#EEE;
}
.embed-widget textarea{
margin-top:0;
}
.embed-widget button, .embed-widget select{
vertical-align:middle;
margin-right:3px;
}
.embed-toolbar button{
background:#FFF;
border:1px solid #CCC;
border-radius:3px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
color:#666;
}
.embed-toolbar button:hover{
color:#444;
}
.embed-toolbar button:active{
color:#FFF;
background:#666;
border-color:#666;
margin-top: 0;
}

.grappelli .embed-widget{
Expand All @@ -44,8 +24,8 @@
margin:0 -3px;
}
.grappelli .embed-toolbar{
padding:0;
padding:0 5px;
padding-bottom:3px;
background:none;
border:none;
}
}
7 changes: 4 additions & 3 deletions philo/static/philo/js/EmbedWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
EmbedWidgets = widget.EmbedWidgets,
EmbedBars = widget.EmbedBars,
EmbedButtons = widget.EmbedButtons,
EmbedSelects = widget.EmbedSelects;
EmbedSelects = widget.EmbedSelects,
LoupeImageUrl = 'grappelli' in window ? "/grapelli/img/admin/selector-search.gif" : __admin_media_prefix__ + "img/selector-search.gif";

EmbedFields.wrap($('<div class="embed-widget" />'));
EmbedWidgets = $('.embed-widget');
EmbedWidgets.prepend($('<div class="embed-toolbar" />'));
EmbedBars = $('.embed-toolbar');
EmbedBars.append('<select class="embed-select"></select><button class="embed-button">Embed</button>');
EmbedBars.append('<strong>Embed Media:</strong> <select class="embed-select"></select> <a href="#" class="related-lookup embed-button"><img src="' + LoupeImageUrl + '" width="16" height="16" alt="Lookup"></a>');
EmbedButtons = $('.embed-button');
EmbedSelects = $('.embed-select');

Expand Down Expand Up @@ -85,7 +86,7 @@
optgroup_el, group;

// append a title
$this.append('<option value="">Media Types</option>');
$this.append('<option value="">Select a Media Type</option>');

// for each group
for (name in optgroups){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{% load i18n adminmedia grp_tags %}

<!-- group -->
<div class="group tabular{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}"
<div class="grp-group grp-tabular{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}-group" >
<h2 class="collapse-handler">{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
<ul class="tools">
<h2 class="grp-collapse-handler">{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
<ul class="grp-tools">
<li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Another' %}"> </a></li>
</ul>
{{ inline_admin_formset.formset.management_form }}
{{ inline_admin_formset.formset.non_form_errors }}
<!-- container -->
<div class="module table">
<div class="module thead">
<div class="tr">
<div class="grp-module grp-table">
<div class="grp-module grp-thead">
<div class="grp-tr">
{% for field in inline_admin_formset.fields %}
{% if not field.widget.is_hidden %}
<div class="th {{ field.label|lower }}{% if field.required %} required{% endif %}">{{ field.label|capfirst }}</div>
<div class="grp-th {{ field.label|lower }}{% if field.required %} required{% endif %}">{{ field.label|capfirst }}</div>
{% endif %}
{% endfor %}
<div class="th content_type">Content type</div>
<div class="th value">Value</div>
<div class="grp-th content_type">Content type</div>
<div class="grp-th value">Value</div>
{% if inline_admin_formset.formset.can_delete %}<div class="th">&nbsp;</div>{% endif %}
</div>
</div>
{% for inline_admin_form in inline_admin_formset %}
<!-- element -->
<div class="module tbody{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form{% endif %}"
<div class="grp-module grp-tbody{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form{% endif %}"
id="{{ inline_admin_formset.formset.prefix }}{% if not forloop.last %}{{ forloop.counter0 }}{% else %}-empty{% endif %}">
{% if inline_admin_form.form.non_field_errors %}
<ul class="errorlist"><li>{{ inline_admin_form.form.non_field_errors }}</li></ul>
Expand All @@ -40,11 +40,11 @@ <h3 style="display: none;"><b>{{ inline_admin_formset.opts.verbose_name|title }}
{% endfor %}
{% endfor %}
{% endspaceless %}
<div class="tr">
<div class="grp-tr">
{% for fieldset in inline_admin_form %}
{% for line in fieldset %}
{% for field in line %}
<div class="td {{ field.field.name }} {% if field.field.errors %} error{% endif %}">
<div class="grp-td {{ field.field.name }} {% if field.field.errors %} error{% endif %}">
{% if field.is_readonly %}
<p>{{ field.contents }}</p>
{% else %}
Expand All @@ -55,16 +55,16 @@ <h3 style="display: none;"><b>{{ inline_admin_formset.opts.verbose_name|title }}
{% endfor %}
{% endfor %}
{% endfor %}
{% with inline_admin_form.form.content_type as field %}<div class="td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
{% with inline_admin_form.form.value as field %}<div class="td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
<div class="td tools">
{% with inline_admin_form.form.content_type as field %}<div class="grp-td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
{% with inline_admin_form.form.value as field %}<div class="grp-td {{ field.name }}{% if field.errors %} error{% endif %}">{{ field }}{{ field.errors.as_ul }}</div>{% endwith %}
<div class="grp-td grp-tools-container">
{% spaceless %}
<ul class="tools">
{% if inline_admin_form.show_url %}<li class="viewsite-link-container"><a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/" class="icon viewsite-link" title="{% trans 'View on Site' %}"> </a></li>{% endif %}
<ul class="grp-tools">
{% if inline_admin_form.show_url %}<li class="grp-viewsite-link-container"><a href="../../../r/{{ inline_admin_form.original_content_type_id }}/{{ inline_admin_form.original.id }}/" class="grp-icon grp-viewsite-link" title="{% trans 'View on Site' %}"> </a></li>{% endif %}
{% if inline_admin_formset.opts.sortable_field_name %}
<li class="drag-handler-container"><a href="javascript://" class="icon drag-handler" title="{% trans 'Move Item' %}"></a></li>
<li><a href="javascript://" class="grp-icon grp-drag-handler" title="{% trans 'Move Item' %}"></a></li>
{% endif %}
{% if inline_admin_formset.formset.can_delete %}<li class="delete-handler-container">{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="icon {% if inline_admin_form.original %}delete-handler{% else %}remove-handler{% endif %}" title="{% trans 'Remove' %}"> </a>{% endif %}
{% if inline_admin_formset.formset.can_delete %}<li class="grp-delete-handler-container">{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="grp-icon {% if inline_admin_form.original %}grp-delete-handler{% else %}grp-remove-handler{% endif %}" title="{% trans 'Remove' %}"> </a>{% endif %}
</ul>
{% endspaceless %}
</div>
Expand All @@ -74,11 +74,13 @@ <h3 style="display: none;"><b>{{ inline_admin_formset.opts.verbose_name|title }}
</div>
{% endfor %}
</div>
<div class="module add-item">
<a href="javascript://" class="add-handler">{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}</a>
<ul class="tools">
<li class="add-handler-container"><a href="javascript://" class="icon add-handler" title="{% trans 'Add Item' %}"> </a></li>
</ul><br clear="all" />
<div class="grp-module grp-transparent grp-dynamic-form">
<div class="grp-row">
<a href="javascript://" class="grp-icon grp-add-handler"><strong>{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}</strong></a>
<ul class="grp-tools">
<li class="add-handler-container"><a href="javascript://" class="grp-icon grp-add-handler" title="{% trans 'Add Item' %}"> </a></li>
</ul>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
{{ inline_admin_formset.formset.management_form }}
{% comment %}Don't render the formset at all if there aren't any forms.{% endcomment %}
{% if inline_admin_formset.formset.forms %}
<fieldset class="module{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}">
<h2{% if "collapse" in inline_admin_formset.opts.classes %} class="collapse-handler"{% endif %}>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
<fieldset class="grp-module{% if inline_admin_formset.opts.classes %} {{ inline_admin_formset.opts.classes|join:" " }}{% endif %}">
<h2{% if "collapse" in inline_admin_formset.opts.classes %} class="grp-collapse-handler"{% endif %}>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
{{ inline_admin_formset.formset.non_form_errors }}
{% for inline_admin_form in inline_admin_formset %}
{% if inline_admin_form.has_auto_field %}{{ inline_admin_form.pk_field.field }}{% endif %}
Expand All @@ -20,14 +20,14 @@
{% endfor %}{% endspaceless %}
{% endfor %}
{% for form in inline_admin_formset.formset.forms %}
<div class="row cells-{{ form.fields|length }} cells{% if form.errors %} errors{% endif %}{% for field in form %} {{ field.field.name }}{% endfor %}">
<div class="grp-row grp-cells-{{ form.fields|length }}{% if form.errors %} errors{% endif %}{% for field in form %} {{ field.field.name }}{% endfor %}">
{{ form.non_field_errors }}
<div>
<div class="l-2c-fluid l-d-4">
{% for field in form %}
{% if not field.is_hidden %}
{% comment %}This will be true for one field: the content/content reference{% endcomment %}
<div class="column span-4"><label class='required' for="{{ form.content.auto_id }}{{ form.content_id.auto_id }}">{{ form.verbose_name|capfirst }}:</label></div>
<div class="column span-flexible">
<div class="grp-column c-1"><label for="{{ form.content.auto_id }}{{ form.content_id.auto_id }}">{{ form.verbose_name|capfirst }}:</label></div>
<div class="grp-column c-2">
{{ field }}
{{ field.errors }}
{% if field.field.help_text %}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
],
extras_require = {
'docs': ["sphinx>=1.0"],
'grappelli': ['django-grappelli>=2.3'],
'grappelli': ['django-grappelli>=2.4'],
'migrations': ['south>=0.7.2'],
'waldo-recaptcha': ['recaptcha-django'],
'sobol-eventlet': ['eventlet'],
Expand Down