ld4l_virtual_collection 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +34 -0
  3. data/.travis.yml +14 -0
  4. data/CHANGES.md +12 -0
  5. data/Gemfile +5 -0
  6. data/LICENSE.txt +14 -0
  7. data/README.md +128 -0
  8. data/Rakefile +34 -0
  9. data/app/assets/images/ld4l_virtual_collection/loading_spinner.gif +0 -0
  10. data/app/assets/javascripts/ld4l_virtual_collection/application.js +19 -0
  11. data/app/assets/javascripts/ld4l_virtual_collection/collections.js +2 -0
  12. data/app/assets/javascripts/ld4l_virtual_collection/items.js +2 -0
  13. data/app/assets/stylesheets/ld4l_virtual_collection/_bootstrap-custom.scss +50 -0
  14. data/app/assets/stylesheets/ld4l_virtual_collection/application.css.scss +22 -0
  15. data/app/assets/stylesheets/ld4l_virtual_collection/collections.css.scss +4 -0
  16. data/app/assets/stylesheets/ld4l_virtual_collection/items.css.scss +4 -0
  17. data/app/assets/stylesheets/ld4l_virtual_collection/my_virtual_collections.css.scss +4 -0
  18. data/app/assets/stylesheets/scaffold.css +56 -0
  19. data/app/controllers/ld4l_virtual_collection/application_controller.rb +9 -0
  20. data/app/controllers/ld4l_virtual_collection/collections_controller.rb +101 -0
  21. data/app/controllers/ld4l_virtual_collection/items_controller.rb +94 -0
  22. data/app/controllers/ld4l_virtual_collection/my_virtual_collections_controller.rb +189 -0
  23. data/app/controllers/ld4l_virtual_collection/notes_controller.rb +84 -0
  24. data/app/controllers/ld4l_virtual_collection/tags_controller.rb +105 -0
  25. data/app/helpers/ld4l_virtual_collection/application_helper.rb +4 -0
  26. data/app/helpers/ld4l_virtual_collection/collections_helper.rb +4 -0
  27. data/app/helpers/ld4l_virtual_collection/items_helper.rb +4 -0
  28. data/app/models/ld4l_virtual_collection/collection.rb +47 -0
  29. data/app/models/ld4l_virtual_collection/item.rb +50 -0
  30. data/app/models/ld4l_virtual_collection/note.rb +52 -0
  31. data/app/models/ld4l_virtual_collection/tag.rb +94 -0
  32. data/app/views/layouts/ld4l_virtual_collection/application.html.erb +14 -0
  33. data/app/views/ld4l_virtual_collection/collections/_form.html.erb +28 -0
  34. data/app/views/ld4l_virtual_collection/collections/edit.html.erb +13 -0
  35. data/app/views/ld4l_virtual_collection/collections/index.html.erb +30 -0
  36. data/app/views/ld4l_virtual_collection/collections/new.html.erb +12 -0
  37. data/app/views/ld4l_virtual_collection/collections/show.html.erb +43 -0
  38. data/app/views/ld4l_virtual_collection/items/_collection_info.html.erb +14 -0
  39. data/app/views/ld4l_virtual_collection/items/_form.html.erb +25 -0
  40. data/app/views/ld4l_virtual_collection/items/edit.html.erb +14 -0
  41. data/app/views/ld4l_virtual_collection/items/index.html.erb +24 -0
  42. data/app/views/ld4l_virtual_collection/items/new.html.erb +14 -0
  43. data/app/views/ld4l_virtual_collection/items/show.html.erb +23 -0
  44. data/app/views/ld4l_virtual_collection/my_virtual_collections/_collection_lists.html.erb +82 -0
  45. data/app/views/ld4l_virtual_collection/my_virtual_collections/_edit_collection_modal.html.erb +20 -0
  46. data/app/views/ld4l_virtual_collection/my_virtual_collections/_form_collection.html.erb +51 -0
  47. data/app/views/ld4l_virtual_collection/my_virtual_collections/_form_collection_item.html.erb +48 -0
  48. data/app/views/ld4l_virtual_collection/my_virtual_collections/_form_collection_items_query.html.erb +37 -0
  49. data/app/views/ld4l_virtual_collection/my_virtual_collections/_form_item_note.html.erb +31 -0
  50. data/app/views/ld4l_virtual_collection/my_virtual_collections/_form_item_tag.html.erb +30 -0
  51. data/app/views/ld4l_virtual_collection/my_virtual_collections/_modals.html.erb +8 -0
  52. data/app/views/ld4l_virtual_collection/my_virtual_collections/_new_collection_item_modal.html.erb +20 -0
  53. data/app/views/ld4l_virtual_collection/my_virtual_collections/_new_collection_items_by_query_modal.html.erb +20 -0
  54. data/app/views/ld4l_virtual_collection/my_virtual_collections/_new_collection_modal.html.erb +20 -0
  55. data/app/views/ld4l_virtual_collection/my_virtual_collections/_selected_collection_header.html.erb +17 -0
  56. data/app/views/ld4l_virtual_collection/my_virtual_collections/_selected_collection_items.html.erb +121 -0
  57. data/app/views/ld4l_virtual_collection/my_virtual_collections/_selected_collection_range.html.erb +44 -0
  58. data/app/views/ld4l_virtual_collection/my_virtual_collections/edit_collection_modal.js.erb +1 -0
  59. data/app/views/ld4l_virtual_collection/my_virtual_collections/index.html.erb +4 -0
  60. data/app/views/ld4l_virtual_collection/my_virtual_collections/new_collection_item_modal.js.erb +1 -0
  61. data/app/views/ld4l_virtual_collection/my_virtual_collections/new_collection_items_by_query_modal.js.erb +1 -0
  62. data/app/views/ld4l_virtual_collection/my_virtual_collections/new_collection_modal.js.erb +1 -0
  63. data/app/views/ld4l_virtual_collection/my_virtual_collections/show.html.erb +14 -0
  64. data/bin/rails +12 -0
  65. data/config/routes.rb +16 -0
  66. data/ld4l_virtual_collection.gemspec +50 -0
  67. data/lib/ld4l_virtual_collection.rb +34 -0
  68. data/lib/ld4l_virtual_collection/configuration.rb +86 -0
  69. data/lib/ld4l_virtual_collection/engine.rb +23 -0
  70. data/lib/ld4l_virtual_collection/version.rb +3 -0
  71. data/lib/tasks/ld4l_virtual_collection_tasks.rake +4 -0
  72. data/test/controllers/ld4l_virtual_collection/collections_controller_test.rb +51 -0
  73. data/test/controllers/ld4l_virtual_collection/items_controller_test.rb +51 -0
  74. data/test/controllers/ld4l_virtual_collection/my_virtual_collections_controller_test.rb +51 -0
  75. data/test/controllers/ld4l_virtual_collection/virtual_collections_controller_test.rb +51 -0
  76. data/test/dummy/Gemfile +20 -0
  77. data/test/dummy/README.rdoc +28 -0
  78. data/test/dummy/Rakefile +6 -0
  79. data/test/dummy/app/assets/images/.keep +0 -0
  80. data/test/dummy/app/assets/javascripts/application.js +13 -0
  81. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  82. data/test/dummy/app/controllers/application_controller.rb +5 -0
  83. data/test/dummy/app/controllers/concerns/.keep +0 -0
  84. data/test/dummy/app/helpers/application_helper.rb +2 -0
  85. data/test/dummy/app/mailers/.keep +0 -0
  86. data/test/dummy/app/models/.keep +0 -0
  87. data/test/dummy/app/models/concerns/.keep +0 -0
  88. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  89. data/test/dummy/bin/bundle +3 -0
  90. data/test/dummy/bin/rails +4 -0
  91. data/test/dummy/bin/rake +4 -0
  92. data/test/dummy/config.ru +4 -0
  93. data/test/dummy/config/application.rb +23 -0
  94. data/test/dummy/config/boot.rb +5 -0
  95. data/test/dummy/config/database.yml +25 -0
  96. data/test/dummy/config/environment.rb +5 -0
  97. data/test/dummy/config/environments/development.rb +37 -0
  98. data/test/dummy/config/environments/production.rb +78 -0
  99. data/test/dummy/config/environments/test.rb +39 -0
  100. data/test/dummy/config/initializers/assets.rb +8 -0
  101. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  102. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  103. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  104. data/test/dummy/config/initializers/inflections.rb +16 -0
  105. data/test/dummy/config/initializers/mime_types.rb +4 -0
  106. data/test/dummy/config/initializers/rdf_repositories.rb +32 -0
  107. data/test/dummy/config/initializers/session_store.rb +3 -0
  108. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  109. data/test/dummy/config/locales/en.yml +23 -0
  110. data/test/dummy/config/routes.rb +3 -0
  111. data/test/dummy/config/secrets.yml +22 -0
  112. data/test/dummy/lib/assets/.keep +0 -0
  113. data/test/dummy/log/.keep +0 -0
  114. data/test/dummy/public/404.html +67 -0
  115. data/test/dummy/public/422.html +67 -0
  116. data/test/dummy/public/500.html +66 -0
  117. data/test/dummy/public/favicon.ico +0 -0
  118. data/test/fixtures/ld4l_virtual_collection/collections.yml +11 -0
  119. data/test/fixtures/ld4l_virtual_collection/items.yml +11 -0
  120. data/test/fixtures/ld4l_virtual_collection/my_virtual_collections.yml +11 -0
  121. data/test/fixtures/ld4l_virtual_collection/virtual_collections.yml +9 -0
  122. data/test/helpers/ld4l_virtual_collection/collections_helper_test.rb +6 -0
  123. data/test/helpers/ld4l_virtual_collection/items_helper_test.rb +6 -0
  124. data/test/helpers/ld4l_virtual_collection/my_virtual_collections_helper_test.rb +6 -0
  125. data/test/helpers/ld4l_virtual_collection/virtual_collections_helper_test.rb +6 -0
  126. data/test/integration/navigation_test.rb +10 -0
  127. data/test/ld4l_virtual_collection_test.rb +7 -0
  128. data/test/models/ld4l_virtual_collection/collection_test.rb +9 -0
  129. data/test/models/ld4l_virtual_collection/item_test.rb +9 -0
  130. data/test/models/ld4l_virtual_collection/my_virtual_collection_test.rb +9 -0
  131. data/test/models/ld4l_virtual_collection/virtual_collection_test.rb +9 -0
  132. data/test/test_helper.rb +17 -0
  133. metadata +544 -0
@@ -0,0 +1,86 @@
1
+ module Ld4lVirtualCollection
2
+ class Configuration
3
+
4
+ attr_reader :debug_logger
5
+ attr_reader :base_uri
6
+ attr_reader :localname_minter
7
+ attr_reader :metadata_callback
8
+
9
+ def self.default_debug_logger
10
+ @default_debug_logger = Logger.new('log/debug.log')
11
+ end
12
+ private_class_method :default_debug_logger
13
+
14
+ def self.default_base_uri
15
+ @default_base_uri = "http://localhost/".freeze
16
+ end
17
+ private_class_method :default_base_uri
18
+
19
+ def self.default_localname_minter
20
+ # by setting to nil, it will use the default minter in the minter gem
21
+ @default_localname_minter = nil
22
+ end
23
+ private_class_method :default_localname_minter
24
+
25
+ def self.default_metadata_callback
26
+ # by setting to nil, it will use the default minter in the minter gem
27
+ @default_metadata_callback = {}
28
+ end
29
+ private_class_method :default_metadata_callback
30
+
31
+ def initialize
32
+ @debug_logger = self.class.send(:default_debug_logger)
33
+ @base_uri = self.class.send(:default_base_uri)
34
+ @localname_minter = self.class.send(:default_localname_minter)
35
+ @metadata_callback = self.class.send(:default_metadata_callback)
36
+ end
37
+
38
+ def debug_logger=(new_debug_logger)
39
+ @debug_logger = new_debug_logger
40
+ end
41
+
42
+ def reset_debug_logger
43
+ @debug_logger = self.class.send(:default_debug_logger)
44
+ end
45
+
46
+ def base_uri=(new_base_uri)
47
+ @base_uri = new_base_uri
48
+ end
49
+
50
+ def reset_base_uri
51
+ @base_uri = self.class.send(:default_base_uri)
52
+ end
53
+
54
+ def localname_minter=(new_minter)
55
+ @localname_minter = new_minter
56
+ end
57
+
58
+ def reset_localname_minter
59
+ @localname_minter = self.class.send(:default_localname_minter)
60
+ end
61
+
62
+ def metadata_callback=(metadata_callback)
63
+ @metadata_callback = metadata_callback
64
+ end
65
+
66
+ def register_metadata_callback(host,callback)
67
+ @metadata_callback[host] = callback
68
+ end
69
+
70
+ def register_default_metadata_callback(callback)
71
+ @metadata_callback[:DEFAULT] = callback
72
+ end
73
+
74
+ def find_metadata_callback(host)
75
+ @metadata_callback[host]
76
+ end
77
+
78
+ def get_default_metadata_callback
79
+ @metadata_callback[:DEFAULT]
80
+ end
81
+
82
+ def reset_metadata_callback
83
+ @metadata_callback = self.class.send(:default_metadata_callback)
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,23 @@
1
+ module Ld4lVirtualCollection
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Ld4lVirtualCollection
4
+
5
+ # Methods for configuring the GEM
6
+ class << self
7
+ attr_accessor :configuration
8
+ end
9
+
10
+ def self.configuration
11
+ @configuration ||= Ld4lVirtualCollection::Configuration.new
12
+ end
13
+
14
+ def self.reset
15
+ @configuration = Ld4lVirtualCollection::Configuration.new
16
+ end
17
+
18
+ def self.configure
19
+ yield(configuration)
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Ld4lVirtualCollection
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ld4l_virtual_collection do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Ld4lVirtualCollection
4
+ class CollectionsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @collection = collections(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:collections)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create collection" do
21
+ assert_difference('Collection.count') do
22
+ post :create, collection: { }
23
+ end
24
+
25
+ assert_redirected_to collection_path(assigns(:collection))
26
+ end
27
+
28
+ test "should show collection" do
29
+ get :show, id: @collection
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @collection
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update collection" do
39
+ patch :update, id: @collection, collection: { }
40
+ assert_redirected_to collection_path(assigns(:collection))
41
+ end
42
+
43
+ test "should destroy collection" do
44
+ assert_difference('Collection.count', -1) do
45
+ delete :destroy, id: @collection
46
+ end
47
+
48
+ assert_redirected_to collections_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Ld4lVirtualCollection
4
+ class ItemsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @item = items(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:items)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create item" do
21
+ assert_difference('Item.count') do
22
+ post :create, item: { }
23
+ end
24
+
25
+ assert_redirected_to item_path(assigns(:item))
26
+ end
27
+
28
+ test "should show item" do
29
+ get :show, id: @item
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @item
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update item" do
39
+ patch :update, id: @item, item: { }
40
+ assert_redirected_to item_path(assigns(:item))
41
+ end
42
+
43
+ test "should destroy item" do
44
+ assert_difference('Item.count', -1) do
45
+ delete :destroy, id: @item
46
+ end
47
+
48
+ assert_redirected_to items_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Ld4lVirtualCollection
4
+ class MyVirtualCollectionsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @my_virtual_collection = my_virtual_collections(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:my_virtual_collections)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create my_virtual_collection" do
21
+ assert_difference('MyVirtualCollection.count') do
22
+ post :create, my_virtual_collection: { }
23
+ end
24
+
25
+ assert_redirected_to my_virtual_collection_path(assigns(:my_virtual_collection))
26
+ end
27
+
28
+ test "should show my_virtual_collection" do
29
+ get :show, id: @my_virtual_collection
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @my_virtual_collection
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update my_virtual_collection" do
39
+ patch :update, id: @my_virtual_collection, my_virtual_collection: { }
40
+ assert_redirected_to my_virtual_collection_path(assigns(:my_virtual_collection))
41
+ end
42
+
43
+ test "should destroy my_virtual_collection" do
44
+ assert_difference('MyVirtualCollection.count', -1) do
45
+ delete :destroy, id: @my_virtual_collection
46
+ end
47
+
48
+ assert_redirected_to my_virtual_collections_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ require 'test_helper'
2
+
3
+ module Ld4lVirtualCollection
4
+ class VirtualCollectionsControllerTest < ActionController::TestCase
5
+ setup do
6
+ @virtual_collection = virtual_collections(:one)
7
+ end
8
+
9
+ test "should get index" do
10
+ get :index
11
+ assert_response :success
12
+ assert_not_nil assigns(:virtual_collections)
13
+ end
14
+
15
+ test "should get new" do
16
+ get :new
17
+ assert_response :success
18
+ end
19
+
20
+ test "should create virtual_collection" do
21
+ assert_difference('VirtualCollection.count') do
22
+ post :create, virtual_collection: { description: @virtual_collection.description, title: @virtual_collection.title }
23
+ end
24
+
25
+ assert_redirected_to virtual_collection_path(assigns(:virtual_collection))
26
+ end
27
+
28
+ test "should show virtual_collection" do
29
+ get :show, id: @virtual_collection
30
+ assert_response :success
31
+ end
32
+
33
+ test "should get edit" do
34
+ get :edit, id: @virtual_collection
35
+ assert_response :success
36
+ end
37
+
38
+ test "should update virtual_collection" do
39
+ patch :update, id: @virtual_collection, virtual_collection: { description: @virtual_collection.description, title: @virtual_collection.title }
40
+ assert_redirected_to virtual_collection_path(assigns(:virtual_collection))
41
+ end
42
+
43
+ test "should destroy virtual_collection" do
44
+ assert_difference('VirtualCollection.count', -1) do
45
+ delete :destroy, id: @virtual_collection
46
+ end
47
+
48
+ assert_redirected_to virtual_collections_path
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sqlite3'
4
+ gem 'ld4l_virtual_collection', :path => "/Users/elr37/Documents/__DEVELOPMENT__/__RAILS/ld4l_virtual_collection"
5
+
6
+ gem 'rdf', '~> 1.1'
7
+ gem 'active-triples', '~> 0.5'
8
+ gem 'active_triples-local_name', '~> 0.1'
9
+ gem 'ld4l-foaf_rdf', '~> 0.0'
10
+ gem 'doubly_linked_list', '~> 0.0'
11
+ gem 'ld4l-ore_rdf', :git => 'git@github.com:ld4l/ore_rdf.git', :branch => 'rework_with_service_objects'
12
+
13
+ group :development do
14
+ # setup sqlite3 as the persistance triplestore for ActiveTriples
15
+ gem 'sqlite3'
16
+ gem 'rdf-do'
17
+ gem 'do_sqlite3'
18
+ gem 'pry'
19
+ gem 'pry-byebug'
20
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes