Commit ebabc712811662d5406c184aff229292f9993941

Authored by Francisco Júnior
2 parents 6de7aebf 45d5481f

Merge branch 'virtuoso_integration' of gitlab.com:participa/noosfero into virtuoso_integration

plugins/virtuoso/lib/virtuoso_plugin.rb
... ... @@ -19,6 +19,10 @@ class VirtuosoPlugin < Noosfero::Plugin
19 19 def virtuoso_client
20 20 @virtuoso_client ||= RDF::Virtuoso::Repository.new("#{settings.virtuoso_uri}/sparql", :update_uri => "#{settings.virtuoso_uri}/sparql-auth", :username => settings.virtuoso_username, :password => settings.virtuoso_password, :auth_method => 'digest', :timeout => 30)
21 21 end
  22 +
  23 + def js_files
  24 + ['edit-server-list']
  25 + end
22 26  
23 27 def stylesheet?
24 28 true
... ...
plugins/virtuoso/public/edit-server-list.js 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +function send_ajax(source_url) {
  2 + jQuery(".server-address").autocomplete({
  3 + source : function(request, response){
  4 + jQuery.ajax({
  5 + type: "GET",
  6 + url: source_url,
  7 + data: {query: request.term},
  8 + success: function(result){
  9 + response(result);
  10 + },
  11 + error: function(ajax, stat, errorThrown) {
  12 + console.log('Server not found : ' + errorThrown);
  13 + }
  14 + });
  15 + },
  16 +
  17 + minLength: 3
  18 + });
  19 +}
  20 +
  21 +function new_server_action(){
  22 + send_ajax(jQuery("#page_url").val());
  23 +
  24 + jQuery(".delete-server-list-row").click(function(){
  25 + jQuery(this).parent().parent().remove();
  26 + return false;
  27 + });
  28 +
  29 + jQuery(document).scrollTop(jQuery('#dropable-server-list').scrollTop());
  30 +}
  31 +
  32 +function add_new_server() {
  33 + var new_server = jQuery('#edit-server-list-block #new-template>li').clone();
  34 + new_server.show();
  35 + jQuery('#dropable-server-list').append(new_server);
  36 + new_server_action();
  37 +}
  38 +
  39 +jQuery(document).ready(function(){
  40 + new_server_action();
  41 +
  42 + jQuery("#dropable-server-list").sortable({
  43 + revert: true,
  44 + axis: "y"
  45 + });
  46 +});
... ...
plugins/virtuoso/views/virtuoso_plugin_admin/index.html.erb
  1 +<%= javascript_include_tag '/plugins/virtuoso/edit-server-list' %>
  2 +
1 3 <h1><%= _('Virtuoso settings')%></h1>
2 4  
3 5 <%= form_for(:settings) do |f| %>
... ...