Sha256: ba7c66384b65a20c8379526ba69e15bff929677a17b01d8085f03910d296bf4e

Contents?: true

Size: 909 Bytes

Versions: 4

Compression:

Stored size: 909 Bytes

Contents

require_dependency "publish_my_data/application_controller"

module PublishMyData
  class ThemesController < ApplicationController

    caches_action :show, :index,
      :cache_path => Proc.new { |c| c.params }, :if => Proc.new { |c| is_request_html_format?(c)  }

    respond_to :html, :ttl, :rdf, :nt, :json, :text

    def index
      # don't bother paginating this for now - there probably wont be that many themes
      @themes = Theme.all.where("?uri <#{RDF::RDFS.label}> ?label").order("?label").resources
      respond_with(@themes)
    end

    def show
      @theme = Theme.by_slug(params[:id])

      if @theme
        @pagination_params = ResourcePaginationParams.from_request(request)
        @datasets = Paginator.new(@theme.datasets_criteria, @pagination_params).paginate
        respond_with(@datasets)
      else
        raise Tripod::Errors::ResourceNotFound
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
publish_my_data-0.0.18 app/controllers/publish_my_data/themes_controller.rb
publish_my_data-0.0.17 app/controllers/publish_my_data/themes_controller.rb
publish_my_data-0.0.16 app/controllers/publish_my_data/themes_controller.rb
publish_my_data-0.0.15 app/controllers/publish_my_data/themes_controller.rb