Commit b6e871084862689e92ae4e63e14def9f2fd5a47f
Exists in
staging
and in
4 other branches
Merge branch 'virtuoso_integration' of gitlab.com:participa/noosfero into virtuoso_integration
Conflicts: plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
Showing
5 changed files
with
24 additions
and
7 deletions
Show diff stats
plugins/virtuoso/lib/virtuoso_plugin/dspace_harvest.rb
@@ -56,11 +56,11 @@ class VirtuosoPlugin::DspaceHarvest | @@ -56,11 +56,11 @@ class VirtuosoPlugin::DspaceHarvest | ||
56 | def self.harvest_all(environment, from_start) | 56 | def self.harvest_all(environment, from_start) |
57 | settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin) | 57 | settings = Noosfero::Plugin::Settings.new(environment, VirtuosoPlugin) |
58 | if settings.dspace_servers.present? | 58 | if settings.dspace_servers.present? |
59 | - settings.dspace_servers.each do |k, v| | 59 | + settings.dspace_servers.each do |k, v| |
60 | harvest = VirtuosoPlugin::DspaceHarvest.new(environment, k[:dspace_uri]) | 60 | harvest = VirtuosoPlugin::DspaceHarvest.new(environment, k[:dspace_uri]) |
61 | harvest.start(from_start) | 61 | harvest.start(from_start) |
62 | end | 62 | end |
63 | - end | 63 | + end |
64 | end | 64 | end |
65 | 65 | ||
66 | def start(from_start = false) | 66 | def start(from_start = false) |
plugins/virtuoso/lib/virtuoso_plugin/triples_template.rb
@@ -28,7 +28,7 @@ class VirtuosoPlugin::TriplesTemplate < Article | @@ -28,7 +28,7 @@ class VirtuosoPlugin::TriplesTemplate < Article | ||
28 | def to_html(options = {}) | 28 | def to_html(options = {}) |
29 | article = self | 29 | article = self |
30 | proc do | 30 | proc do |
31 | - render :file => 'content_viewer/triples_template', :locals => {:article => article} | 31 | + render :file => 'content_viewer/triples_template', :locals => {:article => article, :page => params[:npage]} |
32 | end | 32 | end |
33 | end | 33 | end |
34 | 34 | ||
@@ -36,11 +36,18 @@ class VirtuosoPlugin::TriplesTemplate < Article | @@ -36,11 +36,18 @@ class VirtuosoPlugin::TriplesTemplate < Article | ||
36 | @plugin ||= VirtuosoPlugin.new(self) | 36 | @plugin ||= VirtuosoPlugin.new(self) |
37 | end | 37 | end |
38 | 38 | ||
39 | + attr_reader :results | ||
40 | + | ||
39 | def template_content(page=1) | 41 | def template_content(page=1) |
40 | begin | 42 | begin |
41 | - results = plugin.virtuoso_readonly_client.query(query).paginate({:per_page => per_page, :page => page}) | 43 | + @results ||= plugin.virtuoso_readonly_client.query(query).paginate({:per_page => per_page, :page => page}) |
42 | liquid_template = Liquid::Template.parse(template) | 44 | liquid_template = Liquid::Template.parse(template) |
43 | - rendered_template = liquid_template.render('results' => results) | 45 | + rendered_template = liquid_template.render('results' => results, |
46 | + 'total_pages' => results.total_pages, | ||
47 | + 'current_page' => results.current_page, | ||
48 | + 'per_page' => results.per_page, | ||
49 | + 'total_entries' => results.total_entries, | ||
50 | + 'page_offset' => (results.current_page-1)*results.per_page) | ||
44 | transform_html(rendered_template) | 51 | transform_html(rendered_template) |
45 | rescue => ex | 52 | rescue => ex |
46 | logger.info ex.to_s | 53 | logger.info ex.to_s |
plugins/virtuoso/public/virtuoso_plugin_admin.css
plugins/virtuoso/views/content_viewer/triples_template.html.erb
plugins/virtuoso/views/virtuoso_plugin_custom_queries/_form.html.erb
1 | +<link rel="stylesheet" type="text/css" href="/plugins/virtuoso/virtuoso_plugin_admin.css"> | ||
2 | + | ||
3 | +<div class="virtuoso-manage-custom-queries"> | ||
1 | <%= form_for(:custom_query, :url => {:action => @custom_query.persisted? ? :update : :create, :id => @custom_query.id}) do |f| %> | 4 | <%= form_for(:custom_query, :url => {:action => @custom_query.persisted? ? :update : :create, :id => @custom_query.id}) do |f| %> |
2 | <% if @custom_query.errors.any? %> | 5 | <% if @custom_query.errors.any? %> |
3 | <div id="error_explanation"> | 6 | <div id="error_explanation"> |
@@ -35,3 +38,4 @@ | @@ -35,3 +38,4 @@ | ||
35 | <%= f.submit %> | 38 | <%= f.submit %> |
36 | </div> | 39 | </div> |
37 | <% end %> | 40 | <% end %> |
41 | +</div> |