Add support for the new_window link tag that open selected links into new browser window/tab.
This commit is contained in:
@@ -399,6 +399,12 @@
|
||||
$('td input:checkbox', table).prop('checked', checked);
|
||||
});
|
||||
|
||||
$('a.new_window').click(function(event) {
|
||||
event.preventDefault();
|
||||
var newWindow = window.open($(this).attr('href'), '_blank');
|
||||
newWindow.focus();
|
||||
});
|
||||
|
||||
$('.alert button.close').click(function() {
|
||||
dismissAlert($(this).parent());
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% if link.disabled %}
|
||||
<a class="{% if link_classes or link.klass %}{{ link_classes }} {{ link.klass }}{% else %}btn {% if link.tags == 'dangerous' %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" disabled='disabled' style="cursor: default;" href="#">{% if link.icon %}<i class="{{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||
<a class="{% if link_classes or link.klass %}{{ link_classes }} {{ link.klass }}{% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if 'new_window' in link.tags %}new_window{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" disabled='disabled' style="cursor: default;" href="#">{% if link.icon %}<i class="{{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||
{% else %}
|
||||
<a class="{% if link_classes or link.klass %}{{ link_classes }} {{ link.klass }}{% else %}btn {% if link.tags == 'dangerous' %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" href="{{ link.url }}">{% if link.icon %}<i class="{{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||
<a class="{% if link_classes or link.klass %}{{ link_classes }} {{ link.klass }}{% else %}btn {% if 'dangerous' in link.tags %}btn-danger{% else %}btn-primary{% endif %} btn-xs{% endif %} {% if link.active %}{{ link_class_active }}{% endif %}" href="{{ link.url }}">{% if link.icon %}<i class="{{ link.icon }}"></i> {% endif %}{{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}</a>{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="{% if div_class %}{{ div_class }}{% else %}col-xs-12 col-sm-6 col-md-4 col-lg-3{% endif %}">
|
||||
<a class="btn btn-default btn-lg btn-block" href="{{ link.url }}">
|
||||
<a class="btn btn-default btn-lg btn-block {% if 'new_window' in link.tags %}new_window{% endif %}" href="{{ link.url }}">
|
||||
<i class="{{ link.icon }} fa-2x"></i><br>
|
||||
{{ link.text }}
|
||||
</a>
|
||||
|
||||
@@ -4,8 +4,11 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from navigation import Link
|
||||
|
||||
link_api = Link(icon='fa fa-plug', text=_('REST API'), view='rest_api:api-root')
|
||||
link_api = Link(
|
||||
icon='fa fa-plug', tags='new_window', text=_('REST API'),
|
||||
view='rest_api:api-root'
|
||||
)
|
||||
link_api_documentation = Link(
|
||||
icon='fa fa-book', text=_('API Documentation'),
|
||||
icon='fa fa-book', tags='new_window', text=_('API Documentation'),
|
||||
view='django.swagger.base.view'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user