{% extends "base.html" %} {%- block view %}
{%- if 'activity' in context['type'] -%} {%- else -%} {%- endif -%}
  {{context['title']}}

{{_('Summary')}}

{{context['summary']}}

{{_('Author(s)')}}

{%- for author in context['author'] -%}
{% if (session['connected'] or False) %} {{author['name']}} {% else %} {{sugar_nick}} {% endif %}
{%- endfor -%}

{{_('License')}}

{{_('Work in progress.')}}
{% include inner_template or '_context-resource-list.html' %}
{%- endblock view %} {%- block script %} {{ super() }} function delete_artifact (guid) { $(this).parent().parent().fadeOut(); $.ajax({ url: '/_artifacts/'+guid, type: 'DELETE', success: function(result) { location.reload(); } }); } function initComments () { var guid = $(this).data('guid'); $('#throbber_'+guid).slideDown(); $('#comments-button-'+guid).slideUp( function () { }); $.get('/_comments/'+guid, { document: $(this).data('document'), resource_type:'{{resource_type}}' }, function ( data ) { $('#comments-'+guid).empty().append( data ); $('#throbber_'+guid).slideUp( function() { $('#comments-'+guid).slideDown(); }); $('#comment_form_'+guid).submit(onSubmit_Comment); initCollapse (guid); }); } function initCollapse (guid) { $('span.collapse-button').click( function() { $('#comments-'+guid).slideUp(); $('#comments-button-'+guid).slideDown(); }); $('span.delete-comment-button').click( function () { $(this).parent().parent().fadeOut(); $.ajax({ url: '/_comments/'+$(this).data('guid'), type: 'DELETE', success: function(result) { } }); }); } // This is what happens when we (re)load the comments section. function onSubmit_Comment (e) { e.preventDefault(); var guid = $(this).data('guid'); var document = $(this).data('document'); $('#comment_form_'+guid).slideUp(); $('#comment_button_'+guid).slideUp(); $('#comment_throbber_'+guid).slideDown(); $.post( '/submit_comment', $(this).serialize() + '&document=' + $(this).data('document'), function(response) { $.get('/_comments/'+guid, { document: document, resource_type:'{{resource_type}}' }, function ( data ) { $('#comment_throbber_'+guid).slideUp(); $('#comments-'+guid).empty().append( data ); $('#comment_form_'+guid).submit(onSubmit_Comment); initCollapse (guid); }); }); }; $(function() { /* var source = new EventSource('/_events/solution'); source.onmessage = function(data) { alert(data); };*/ init_styles('#D7EBF2'); $("#accordion").accordion(); /*$("#accordion").tabs( #jquery-tools broke luckily we have jqueryui "#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});*/ $('#solution-form').submit( function() { $('#contribute-button').slideUp(); $('#textarea-solution').slideUp(); /* $('#contribute-button').attr("disabled", "disabled");*/ }); $('span.comments-button').click( initComments ); $('.solution-link').click( function() { $.get($(this).data('href') + '?_pjax', {}, function ( data ) { $('#resource-section').empty().append( data ); $('span.comments-button').click( initComments ); }); $('#bottom-palette').slideUp(); $( '#info' ).empty(); $( '#meta' ).empty(); History.pushState(null,null, $(this).data('href')); return false; //prevents form from being submitted. }); // When viewing solutions if ($(".resource-header-column").length) { $('#bottom-palette').slideUp(); }; // When viewing articles if ($("article").length) { $('#bottom-palette').slideUp(); }; // When displaying notice if ($(".notice").length) { $("#mejorar-sistema").css( "left", "49%"); $("#mejorar-sistema").css( "top", "40%"); $('#bottom-palette').slideUp(); }; // When viewing resources if ($(".resource-scrollable").length) { // initialize scrollable $(".resource-scrollable").scrollable( {vertical:true} ); var api = $("#resource-scrollable").data("scrollable"); var last_page = {{page or 0}}; function load_adyacent_pages(page) { if (page-1 > 0) { $.get( '?page='+(page-1)+'&_pjax', { }, function( data ) { $( '#resource-page-'+(page-1)).empty().append( data ); }); } if (page+1 <= {{total_pages or 0}}) { $.get( '?page='+(page+1)+'&_pjax', { }, function( data ) { $( '#resource-page-'+(page+1) ).empty().append( data ); }); } } api.seekTo({{ (page or 0) -1}},0); load_adyacent_pages({{page}}); // initialize scroll range input $("#vrange").rangeinput({vertical: true}); $("#vrange").change(function(event, value) { api.seekTo(value-1); }); range_api = $("#vrange").data("rangeinput"); range_api.setValue({{page}}); api.onSeek( function() { new_page = api.getIndex()+1; $('div.generic_tooltip').hide(); History.pushState(null,null,'?page=' + new_page); range_api.setValue(new_page); if (new_page != last_page+1 && new_page != last_page-1) { $.get( '?page='+new_page+'&_pjax', { }, function( data ) { $( '#resource-page-'+new_page ).empty().append( data ); } ); $( '#resource-page-'+last_page ).empty().append('
'); } last_page=new_page; load_adyacent_pages(new_page); $( '#info' ).empty().append('{% trans %}page '+new_page+' of{% endtrans %} {{total_pages}}'); }); }; }); {%- endblock script %}