Skip to content

Commit

Permalink
Admins have a list of admin sets. Fixes #2564
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Aug 30, 2016
1 parent 58ea685 commit 0b3c220
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 25 deletions.
5 changes: 5 additions & 0 deletions app/assets/javascripts/sufia/app.js
Expand Up @@ -11,6 +11,11 @@ Sufia = {
this.transfers();
this.relationships_table();
this.file_manager_init();
this.datatable();
},

datatable: function () {
$('.datatable').DataTable();
},

autocomplete: function () {
Expand Down
10 changes: 10 additions & 0 deletions app/controllers/sufia/admin/admin_sets_controller.rb
Expand Up @@ -8,6 +8,7 @@ def index
add_breadcrumb 'Home', root_path
add_breadcrumb 'Repository Dashboard', sufia.admin_path
add_breadcrumb 'Administrative Sets', sufia.admin_admin_sets_path
@admin_sets = CurationConcerns::AdminSetService.new(self).send(:search_results, :read)
end

def new
Expand All @@ -23,6 +24,11 @@ def create
end
end

# for the AdminSetService
def repository
repository_class.new(blacklight_config)
end

private

def setup_create_form
Expand All @@ -40,5 +46,9 @@ def admin_set_params
def form_class
Forms::AdminSetForm
end

def repository_class
blacklight_config.repository_class
end
end
end
32 changes: 7 additions & 25 deletions app/views/sufia/admin/admin_sets/index.html.erb
Expand Up @@ -19,34 +19,16 @@
<th>Title</th>
<th>Date created</th>
<th>Creator</th>
<th>Visibility</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="admin-set-show.html">Steven Chu Papers</a></td>
<td>2013-06-12</td>
<td>repo-manager@stanford.edu</td>
<td>Public</td>
</tr>
<tr>
<td><a href="admin-set-show.html">Stanford Memorial Church Research Materials</a></td>
<td>2014-10-19</td>
<td>miller@example.com</td>
<td>Embargo</td>
</tr>
<tr>
<td><a href="admin-set-show.html">George Forsythe Papers</a></td>
<td>2016-03-11</td>
<td>thomas@example.com</td>
<td>Your institution</td>
</tr>
<tr>
<td><a href="admin-set-show.html">Stanford University, Graduate School of Business, slides</a></td>
<td>2015-12-22</td>
<td>repo-manager@stanford.edu</td>
<td>No default</td>
</tr>
<% @admin_sets.each do |admin_set| %>
<tr>
<td><%= link_to admin_set.title.first, [sufia, :admin, admin_set] %></td>
<td><%= admin_set.create_date %></td>
<td><a href="https://github.com/projecthydra/curation_concerns/pull/948">https://github.com/projecthydra/curation_concerns/pull/948</a></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
Expand Down
5 changes: 5 additions & 0 deletions lib/generators/sufia/install_generator.rb
Expand Up @@ -20,6 +20,7 @@ class Install < Rails::Generators::Base
8. Installs hydra:batch_edit
9. Updates simple_form to use browser validations
10. Installs Blacklight gallery (and removes it's scss)
11. Runs the jquery-datatables generator
"""

def banner
Expand Down Expand Up @@ -146,5 +147,9 @@ def install_blacklight_gallery
# includes to sufia.scss
remove_file 'app/assets/stylesheets/blacklight_gallery.css.scss'
end

def datatables
generate 'jquery:datatables:install bootstrap3'
end
end
end
1 change: 1 addition & 0 deletions lib/sufia/engine.rb
Expand Up @@ -8,6 +8,7 @@ class Engine < ::Rails::Engine
require 'flot-rails'
require 'almond-rails'
require 'flip'
require 'jquery-datatables-rails'

config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
Expand Down
1 change: 1 addition & 0 deletions spec/controllers/sufia/admin/admin_sets_controller_spec.rb
Expand Up @@ -30,6 +30,7 @@
it 'allows an authorized user to view the page' do
get :index
expect(response).to be_success
expect(assigns[:admin_sets]).to be_kind_of Array
end
end

Expand Down
1 change: 1 addition & 0 deletions sufia.gemspec
Expand Up @@ -47,6 +47,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'almond-rails', '~> 0.0.1'
spec.add_dependency 'qa', '~> 0.8' # questioning_authority
spec.add_dependency 'flip', '~> 1.1'
spec.add_dependency 'jquery-datatables-rails', '~> 3.3.0'

spec.add_development_dependency 'engine_cart', '~> 1.0'
spec.add_development_dependency 'mida', '~> 0.3'
Expand Down

0 comments on commit 0b3c220

Please sign in to comment.