ld4l_virtual_collection 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,12 @@
1
+ <h1>New collection</h1>
2
+
3
+ <%=
4
+ render :partial =>'form',
5
+ :locals => {
6
+ :form_action => 'create',
7
+ :form_class => 'new_collection',
8
+ :form_id => 'new_collection',
9
+ :form_method => 'post' }
10
+ %>
11
+
12
+ <%= link_to 'Back', collections_path %>
@@ -0,0 +1,43 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h2>Collection</h2>
4
+
5
+ <p>
6
+ <strong>Title:</strong>
7
+ <%= @collection.title %>
8
+ </p>
9
+
10
+ <p>
11
+ <strong>Description:</strong>
12
+ <%= @collection.description %>
13
+ </p>
14
+
15
+ <%= link_to 'Edit', edit_collection_path(@collection.id.to_s) %> |
16
+ <%= link_to 'Back', collections_path %>
17
+
18
+ <hr />
19
+
20
+ <h3>Listing items</h3>
21
+
22
+ <table>
23
+ <thead>
24
+ <tr>
25
+ <th>URI</th>
26
+ <th colspan="3"></th>
27
+ </tr>
28
+ </thead>
29
+
30
+ <tbody>
31
+ <% @collection.proxy_resources.each do |item| %>
32
+ <tr>
33
+ <td><%= item.proxy_for.first.rdf_subject.to_s %></td>
34
+ <td><%= link_to 'Remove', collection_item_path(@collection.id,item.rdf_subject.to_s), method: :delete, data: { confirm: 'Are you sure?' } %></td>
35
+ </tr>
36
+ <% end %>
37
+ </tbody>
38
+ </table>
39
+
40
+ <br>
41
+
42
+ <%= link_to 'New Item', new_collection_item_path(@collection.id) %>
43
+
@@ -0,0 +1,14 @@
1
+ <h2>Collection</h2>
2
+
3
+ <p>
4
+ <strong>Title:</strong>
5
+ <%= @collection.title %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Description:</strong>
10
+ <%= @collection.description %>
11
+ </p>
12
+
13
+ <hr />
14
+
@@ -0,0 +1,25 @@
1
+ <%= form_tag( {action: form_action}, method: form_method, id: form_id, class: form_class ) do %>
2
+ <% if @item.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@item.errors.count, "error") %> prohibited this item from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @item.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <%= hidden_field( "collection", "id" ) %>
15
+ <%= hidden_field( "item", "id" ) %>
16
+
17
+ <div class="field">
18
+ <%= label_tag("item_proxy_for", "Item URI") %>
19
+ <%= text_field "item", "proxy_for", "size" => 80, "value" => @proxy_for %>
20
+ </div>
21
+
22
+ <div class="actions">
23
+ <%= submit_tag("Save") %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= render 'collection_info' %>
2
+
3
+ <h1>Edit item</h1>
4
+
5
+ <%=
6
+ render :partial =>'form',
7
+ :locals => {
8
+ :form_action => 'update',
9
+ :form_class => 'edit_item',
10
+ :form_id => "edit_item_#{@item.id}",
11
+ :form_method => 'patch' }
12
+ %>
13
+
14
+ <%= link_to 'Back', collection_path(@collection.id) %>
@@ -0,0 +1,24 @@
1
+ <h1>Listing items</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th colspan="3"></th>
7
+ </tr>
8
+ </thead>
9
+
10
+ <tbody>
11
+ <% @collection.proxy_resources.each do |item| %>
12
+ <tr>
13
+ <td><%= item.proxy_for.first.to_s %></td>
14
+ <td><%= link_to 'Show', collection_item_path(item.rdf_subject.to_s) %></td>
15
+ <td><%= link_to 'Edit', edit_collection_path(item.rdf_subject.to_s) %></td>
16
+ <td><%= link_to 'Destroy', collection_path(item.rdf_subject.to_s), method: :delete, data: { confirm: 'Are you sure?' } %></td>
17
+ </tr>
18
+ <% end %>
19
+ </tbody>
20
+ </table>
21
+
22
+ <br>
23
+
24
+ <%= link_to 'New Item', new_collection_item_path(@collection.id) %>
@@ -0,0 +1,14 @@
1
+ <%= render 'collection_info' %>
2
+
3
+ <h1>New item</h1>
4
+
5
+ <%=
6
+ render :partial =>'form',
7
+ :locals => {
8
+ :form_action => 'create',
9
+ :form_class => 'new_item',
10
+ :form_id => 'new_item',
11
+ :form_method => 'post' }
12
+ %>
13
+
14
+ <%= link_to 'Back', collection_path(@collection.id) %>
@@ -0,0 +1,23 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h2>Collection</h2>
4
+ <p>
5
+ <strong>Title:</strong>
6
+ <%= @collection.title %>
7
+ </p>
8
+
9
+ <p>
10
+ <strong>Description:</strong>
11
+ <%= @collection.description %>
12
+ </p>
13
+
14
+ <%= link_to 'Edit', edit_collection_path(@collection.id.to_s) %> |
15
+ <%= link_to 'Back', collections_path %>
16
+
17
+ <hr />
18
+
19
+ <h3>Items</h3>
20
+
21
+
22
+ <%= link_to 'Edit', edit_item_path(@item) %> |
23
+ <%= link_to 'Back', items_path %>
@@ -0,0 +1,82 @@
1
+ <div class="col-sm-3">
2
+ <div id="collections">
3
+ <div class="my_collections">
4
+ <h4 class="twiddle" style="width: 250px;">My Virtual Collections
5
+ <%= link_to content_tag(:i, '', :class => "fa fa-plus-circle"), new_collection_modal_path,
6
+ {:remote => true, 'data-toggle' => "modal", 'data-target' => '#new-collection-modal'} %>
7
+ </h4>
8
+
9
+ <div id="cl_loading_spinner" class="loading">
10
+ <div class="loading-overlay">
11
+ <p class="loading-spinner">
12
+ </p>
13
+ </div>
14
+ </div>
15
+
16
+
17
+ <%- if !@collections || @collections.size <= 0 %>
18
+ <p class="add-message">No collections. Click <i class="fa fa-plus-circle"></i> to create a new collection.</p>
19
+ <%- else %>
20
+ <div class="side-menu">
21
+ <ul class="collections-list">
22
+ <%- @collections.each do |col| %>
23
+ <li<%- if @select_id == col[:id] %> class="selected-collection"
24
+ <%- end %>>
25
+ <div class="title">
26
+ <%= link_to col[:title], my_virtual_collection_path(col[:id]),
27
+ :title => col[:description], :class => "title",
28
+ :onclick => "document.getElementById('cl_loading_spinner').style.visibility = 'visible';"
29
+ %>
30
+ </div>
31
+ <div class="icons">
32
+ <%= link_to content_tag(:i, '', :class => "fa fa-edit"), edit_collection_modal_path(col[:id]),
33
+ {:remote => true, 'data-toggle' => "modal", 'data-target' => '#edit-collection-modal' } %>
34
+ <%= link_to content_tag(:i, '', :class => "fa fa-minus-circle"), collection_path(col[:id]),
35
+ method: :delete, data: { confirm: 'Are you sure?' } %>
36
+ </div>
37
+ </li>
38
+ <%- end %>
39
+ </ul>
40
+ </div><!--/.collections-list -->
41
+ <%- end %>
42
+ </div>
43
+ <div class="watched_collections">
44
+ <h4 class="twiddle">Watched Collections <i class="fa fa-plus-circle"></i></h4>
45
+ <%- if !@watched %>
46
+ <p class="add-message">No watched collections. Click <i class="fa fa-plus-circle"></i> to find collections to watch.</p>
47
+ <%- else %>
48
+ <div class="side-menu">
49
+ <ul class="collections-list">
50
+ <%- @watched.each do |id,collection| %>
51
+ <li<%- if @select_id == id.to_s %> class="selected-collection"
52
+ <%- end %>>
53
+ <div class="title">
54
+ <%= link_to collection[:title].to_s, my_virtual_collection_path(id.to_s),
55
+ :title => collection[:description], :class => "title"%>
56
+ </div>
57
+ <div class="icons">
58
+ <i class="fa fa-info-sign" />
59
+ <i class="fa fa-minus-circle" />
60
+ </div>
61
+ </li>
62
+ <%- end %>
63
+ </ul>
64
+ </div><!--/.collections-list -->
65
+
66
+
67
+
68
+ <table>
69
+ <tbody>
70
+ <%- @watched.each do |id,collection| %>
71
+ <tr
72
+ <%- if (@select_id == id.to_s) %>
73
+ class="selected"
74
+ <%- end %>
75
+ ><td><%= link_to collection[:title].to_s, my_virtual_collection_path(id.to_s) %></td></tr>
76
+ <%- end %>
77
+ </tbody>
78
+ </table>
79
+ <%- end %>
80
+ </div>
81
+ </div>
82
+ </div>
@@ -0,0 +1,20 @@
1
+ <div class="modal-dialog">
2
+ <div class="modal-content">
3
+ <div class="modal-header">
4
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
5
+ <h3 id="edit-collection-label">Edit Collection</h3>
6
+ </div>
7
+ <div class="modal-body">
8
+ <%=
9
+ render :partial => 'form_collection',
10
+ :locals => {
11
+ :form_controller => 'collections',
12
+ :form_action => 'update',
13
+ :form_class => 'edit_collection',
14
+ :form_id => 'edit_collection#{@collection.id}',
15
+ :form_method => 'patch',
16
+ :modal_id => 'edit-collection-modal' }
17
+ %>
18
+ </div>
19
+ </div>
20
+ </div>
@@ -0,0 +1,51 @@
1
+ <%= form_tag( {controller: form_controller, action: form_action}, method: form_method, id: form_id, class: form_class ) do %>
2
+ <% if @collection.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@collection.errors.count, "error") %> prohibited this collection from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @collection.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div id="fc_loading_spinner" class="loading">
15
+ <div class="loading-overlay">
16
+ <p class="loading-spinner">
17
+ </p>
18
+ </div>
19
+ </div>
20
+
21
+ <%= hidden_field( :collection, :id ) %>
22
+
23
+ <div class="field">
24
+ <%= label_tag("collection_title", "Title") %>
25
+ <%= text_field "collection", "title", "size" => 80, "value" => @collection.title %>
26
+ </div>
27
+ <div class="field">
28
+ <%= label_tag("collection_description", "Description") %>
29
+ <%= text_area "collection", "description", "cols" => 280, "rows" => 5, "value" => @collection.description %>
30
+ </div>
31
+
32
+ <div class="modal-footer">
33
+ <button id="close-btn" class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
34
+ <button id="submit-btn" class="btn btn-primary" type="submit">Save changes</button>
35
+ </div>
36
+ <% end %>
37
+
38
+ <script>
39
+ $('#close-btn').on('click', function() {
40
+ document.getElementById("fc_loading_spinner").style.visibility = "visible";
41
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
42
+ $("#close-btn").prop("disabled",true);
43
+ $("#submit-btn").prop('disabled',true);
44
+ });
45
+ $('#submit-btn').on('click', function() {
46
+ document.getElementById("fc_loading_spinner").style.visibility = "visible";
47
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
48
+ $("#close-btn").prop("disabled",true);
49
+ $("#submit-btn").prop('disabled',true);
50
+ });
51
+ </script>
@@ -0,0 +1,48 @@
1
+ <%= form_tag( {controller: form_controller, action: form_action, collection_id: @collection.id}, method: form_method, id: form_id, class: form_class ) do %>
2
+ <% if @item.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@item.errors.count, "error") %> prohibited this item from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @item.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div id="fci_loading_spinner" class="loading">
15
+ <div class="loading-overlay">
16
+ <p class="loading-spinner">
17
+ </p>
18
+ </div>
19
+ </div>
20
+
21
+ <%= hidden_field( :collection, :id ) %>
22
+ <%= hidden_field( :item, :id ) %>
23
+
24
+ <div class="field">
25
+ <%= label_tag("item_proxy_for", "Item URI") %>
26
+ <%= text_field "item", "proxy_for", "size" => 80, "value" => @proxy_for %>
27
+ </div>
28
+
29
+ <div class="modal-footer">
30
+ <button id="close-btn" class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
31
+ <button id="submit-btn" class="btn btn-primary" type="submit">Save changes</button>
32
+ </div>
33
+ <% end %>
34
+
35
+ <script>
36
+ $('#close-btn').on('click', function() {
37
+ document.getElementById("fci_loading_spinner").style.visibility = "visible";
38
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
39
+ $("#close-btn").prop("disabled",true);
40
+ $("#submit-btn").prop('disabled',true);
41
+ });
42
+ $('#submit-btn').on('click', function() {
43
+ document.getElementById("fci_loading_spinner").style.visibility = "visible";
44
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
45
+ $("#close-btn").prop("disabled",true);
46
+ $("#submit-btn").prop('disabled',true);
47
+ });
48
+ </script>
@@ -0,0 +1,37 @@
1
+ <%= form_tag( {controller: form_controller, action: form_action, collection_id: @collection.id}, method: form_method, id: form_id, class: form_class ) do %>
2
+
3
+ <div id="fci_loading_spinner" class="loading">
4
+ <div class="loading-overlay">
5
+ <p class="loading-spinner">
6
+ </p>
7
+ </div>
8
+ </div>
9
+
10
+ <%= hidden_field( :collection, :id ) %>
11
+ <%= hidden_field( :item, :id ) %>
12
+
13
+ <div class="field">
14
+ <%= label_tag("items_query", "Cornell Solr Query") %>
15
+ <%= text_field "items", "query", "size" => 80, "value" => @solr_query %>
16
+ </div>
17
+
18
+ <div class="modal-footer">
19
+ <button id="close-btn" class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
20
+ <button id="submit-btn" class="btn btn-primary" type="submit">Save changes</button>
21
+ </div>
22
+ <% end %>
23
+
24
+ <script>
25
+ $('#close-btn').on('click', function() {
26
+ document.getElementById("fci_loading_spinner").style.visibility = "visible";
27
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
28
+ $("#close-btn").prop("disabled",true);
29
+ $("#submit-btn").prop('disabled',true);
30
+ });
31
+ $('#submit-btn').on('click', function() {
32
+ document.getElementById("fci_loading_spinner").style.visibility = "visible";
33
+ $("#<%= modal_id %>").addClass("vc-disable-modal");
34
+ $("#close-btn").prop("disabled",true);
35
+ $("#submit-btn").prop('disabled',true);
36
+ });
37
+ </script>
@@ -0,0 +1,31 @@
1
+ <%- old_value = @note.getComment %>
2
+ <%= form_tag( note_path(@note.id), method: form_method, id: form_id, class: form_class ) do %>
3
+
4
+ <% if @note.errors.any? %>
5
+ <div id="error_explanation">
6
+ <h2><%= pluralize(note.errors.count, "error") %> prohibited this note from being saved:</h2>
7
+
8
+ <ul>
9
+ <% @note.errors.full_messages.each do |message| %>
10
+ <li><%= message %></li>
11
+ <% end %>
12
+ </ul>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= hidden_field( :note, :old_value, :value => old_value ) %>
17
+ <%= hidden_field( :note, :collection_id, :value => collection_id ) %>
18
+ <%= hidden_field( :note, :item_id, :value => item_id ) %>
19
+
20
+ <div class="field">
21
+ <%= label_tag("note_text_#{count}", "Note:") %>
22
+ <%= text_area "note", "new_value", "rows" => 5, :id => "note_text_#{count}", :value => old_value %>
23
+ </div>
24
+
25
+ <div class="form-footer">
26
+ <button id="close-note-btn_<%=count%>" class="link_style_button" type="button"
27
+ onclick="$('textarea#note_text_<%=count%>').val('<%=old_value%>');">Reset</button>
28
+ <button id="set-note-btn_<%=count%>" class="link_style_button" type="submit"
29
+ onclick="document.getElementById('cl_loading_spinner').style.visibility = 'visible';">Set Note</button>
30
+ </div>
31
+ <% end %>