Page MenuHomec4science

websearch_admin_helpers.html
No OneTemporary

File Metadata

Created
Mon, Jan 6, 07:43

websearch_admin_helpers.html

{#
## This file is part of Invenio.
## Copyright (C) 2012 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## Invenio is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#}
{% from "_formhelpers.html" import render_field with context %}
{% macro collection_tree(collection, children ) %}
<ul class="nav nav-list">
<li class="nav-header">{{ collection.name }}</li>
<li>
<ul {{ kwargs|xmlattr }} data-id="{{ collection.id }}">
{% for c in collection|attr(children)|sort(attribute='score') recursive %}
<li data-id-son="{{ c.id_son }}"
data-id-dad="{{ c.id_dad }}"
data-type="{{ c.type }}">
{% if c.type == 'v' %}
<i>
<a href="{{ url_for(".manage_collection", name=c.son.name) }}" >
{{ c.son.name }}
</a>
</i>
{% else %}
<a href="{{ url_for(".manage_collection", name=c.son.name) }}" >
{{ c.son.name }}
</a>
{% endif %}
<ul {{ kwargs|xmlattr }} data-id="{{ c.son.id }}">
{% if c.son.sons %}
{{ loop(c.son.sons|sort(attribute='score')) }}
{% endif %}
</ul>
</li>
{% endfor %}
</ul>
</li>
</ul>
{% endmacro %}
{% macro collection_translations(collection) %}
<div {{ kwargs|xmlattr }}>
<h2>{{ _('Modify translations') }}</h2>
{% if config.CFG_LANGUAGE_LIST_LONG %}
<form class="form-horizontal" method="POST" action="{{ url_for('.update_translations', id=collection.id) }}">
{% for field in translation_form%}
{{ render_field(field)}}
{% endfor %}
<div class="form-actions">
<p><input type="submit" name="send_button" value="{{ _("Send") }}" class="btn
btn-primary"/></p>
</div>
</form>
{% endif %}
</div>
{% endmacro %}
{% macro portalboxes_admin(collection) %}
<a href="#" >{{ _('Create a new portalbox') }}</a>
<ul id="sortable" class="nav nav-list" data-id="{{ collection.id }}">
{% for k,l in collection.portalboxes_ln|groupby('position') -%}
{% for portalbox in l %}
<li data-id="{{portalbox.id_portalbox}}">
<a href="#" data-id="{{ portalbox.id }}" class="modalloader" >{{ portalbox.portalbox.title }}</a>
</li>
{% endfor %}
{% endfor %}
</ul>
{# FIXME #}
<script>
$(function() {
$( "#sortable" ).sortable(
{
cursor: "'move",
stop: function(event, ui) {
$.ajax( '{{url_for('.manage_portalboxes_order')}}', {
type: 'GET',
data: 'id='+ $(ui.item).attr("data-id") +
"&id_collection="+$(ui.item).parent().attr("data-id") + "&score=" +
ui.item.index()
}
).done(function(data) {});
}
});
/*$("a.modalloader").each(
$(this).click(function(){
$.ajax( '{{url_for('.edit_portalbox')}}', {
type: 'GET',
data: 'id='+ $(ui.item).attr("data-id")
}
).done(function(data) {});
});
);*/
});
</script>
{% endmacro %}

Event Timeline