Skip to content

Commit

Permalink
Hidden input on admin model editor, to allow django-cms placeholder p…
Browse files Browse the repository at this point in the history
…lugin js editor to get current language
  • Loading branch information
bercab committed Apr 24, 2012
1 parent 4cb7c35 commit cf4be06
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nani/templates/admin/nani/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
<div class="nani-language-tabs">
{% for url,name,code,status in language_tabs %}
{% if status == 'current' %}
<!-- input for django-cms plugin js editor to get current language -->
<div style="display: none;"><input type="hidden" name="language" value="{{code}}" id="id_language"/></div>
<span class="current">{{ name }}{% if current_is_translated and allow_deletion %}<a class="deletelink" href="./delete-translation/{{ code }}/" title="{% trans 'Delete Translation' %}">&nbsp;</a>{% endif %}</span>
{% else %}
<span class="{{ status }}"><a href="{{ url }}">{{ name }}</a> {% if status == 'available' and allow_deletion %}<a class="deletelink" href="./delete-translation/{{ code }}/" title="{% trans 'Delete Translation' %}">&nbsp;</a>{% endif %}</span>
{% endif %}
{% endfor %}
</div>
{% endblock %}
{% endblock %}

2 comments on commit cf4be06

@KristianOellegaard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this be added as title on the span element, so we dont need a new element here?

@bercab
Copy link
Owner Author

@bercab bercab commented on cf4be06 Apr 25, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it could, and would be a much better solution.

The motivation to have done it this way is to not have to modify django-cms code (plugin_editor.js).
As this js currently does:

language = $('input[name=language]').attr("value");

But you are right, I will do things well, and make a pull request on both projects.

Thank you

Please sign in to comment.