fcrepo_admin 0.2.0 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/fcrepo_admin/datastreams_controller.rb +4 -6
- data/app/views/fcrepo_admin/datastreams/edit.html.erb +4 -4
- data/app/views/fcrepo_admin/objects/_permissions.html.erb +18 -0
- data/app/views/fcrepo_admin/objects/show.html.erb +8 -4
- data/config/locales/fcrepo_admin.en.yml +5 -0
- data/lib/fcrepo_admin/version.rb +1 -1
- data/spec/features/objects/show.html.erb_spec.rb +1 -0
- metadata +3 -3
- data/script/rails +0 -6
@@ -4,12 +4,12 @@ module FcrepoAdmin
|
|
4
4
|
class DatastreamsController < ApplicationController
|
5
5
|
|
6
6
|
include FcrepoAdmin::ControllerBehavior
|
7
|
-
# include CanCan::ControllerAdditions
|
8
7
|
|
9
8
|
TEXT_MIME_TYPES = ['application/xml', 'application/rdf+xml', 'application/json']
|
10
9
|
|
11
10
|
before_filter :load_and_authz_object, :only => :index
|
12
|
-
before_filter :load_and_authz_datastream, :except => :index
|
11
|
+
before_filter :load_and_authz_datastream, :except => [:index, :download]
|
12
|
+
before_filter :load_datastream, :only => :download
|
13
13
|
before_filter :inline_filter, :only => [:show, :edit]
|
14
14
|
|
15
15
|
def index
|
@@ -19,6 +19,7 @@ module FcrepoAdmin
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def download
|
22
|
+
authorize! :read, @datastream
|
22
23
|
mimetypes = MIME::Types[@datastream.mimeType]
|
23
24
|
send_data @datastream.content, :disposition => 'attachment', :type => @datastream.mimeType, :filename => "#{@datastream.pid.sub(/:/, '_')}_#{@datastream.dsid}.#{mimetypes.first.extensions.first}"
|
24
25
|
end
|
@@ -28,10 +29,7 @@ module FcrepoAdmin
|
|
28
29
|
|
29
30
|
def update
|
30
31
|
if params[:file]
|
31
|
-
|
32
|
-
# FIXME read in chunks
|
33
|
-
@datastream.content = f.read
|
34
|
-
end
|
32
|
+
@datastream.content = params[:file].read
|
35
33
|
else
|
36
34
|
@datastream.content = params[:content]
|
37
35
|
end
|
@@ -3,16 +3,16 @@
|
|
3
3
|
<h3><%= t("fcrepo_admin.datastream.title") %>: <%= @datastream.dsid %></h3>
|
4
4
|
|
5
5
|
<%= form_tag fcrepo_admin.object_datastream_path(@datastream.pid, @datastream.dsid), :method => :put, :multipart => true do %>
|
6
|
+
<div>
|
7
|
+
<%= label_tag "file", t("fcrepo_admin.datastream.edit.file") %>
|
8
|
+
<%= file_field_tag "file" %>
|
9
|
+
</div>
|
6
10
|
<% if @inline %>
|
7
11
|
<div>
|
8
12
|
<%= label_tag "content", t("fcrepo_admin.datastream.edit.content") %>
|
9
13
|
<%= text_area_tag "content", @datastream.content, :size => "50x20", :class => "field span9" %>
|
10
14
|
</div>
|
11
15
|
<% end %>
|
12
|
-
<div>
|
13
|
-
<%= label_tag "file", t("fcrepo_admin.datastream.edit.file") %>
|
14
|
-
<%= file_field_tag "file" %>
|
15
|
-
</div>
|
16
16
|
<p>
|
17
17
|
<%= submit_tag t("fcrepo_admin.datastream.edit.submit"), :confirm => t("fcrepo_admin.datastream.edit.confirm"), :class => "btn btn-primary" %>
|
18
18
|
</p>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<table class="table table-bordered table-condensed">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th scope="col"><%= t("fcrepo_admin.object.permissions.type") %></th>
|
5
|
+
<th scope="col"><%= t("fcrepo_admin.object.permissions.name") %></th>
|
6
|
+
<th scope="col"><%= t("fcrepo_admin.object.permissions.access") %></th>
|
7
|
+
</tr>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<% object.permissions.each do |p| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= p[:type] %></td>
|
13
|
+
<td><%= p[:name] %></td>
|
14
|
+
<td><%= p[:access] %></td>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
@@ -2,16 +2,20 @@
|
|
2
2
|
|
3
3
|
<div class="tabbable">
|
4
4
|
<ul class="nav nav-tabs">
|
5
|
-
<li class="active"><a href="#
|
6
|
-
<li><a href="#
|
5
|
+
<li class="active"><a href="#tab-datastreams" data-toggle="tab"><%= t("fcrepo_admin.object.tabs.datastreams") %></a></li>
|
6
|
+
<li><a href="#tab-properties" data-toggle="tab"><%= t("fcrepo_admin.object.tabs.properties") %></a></li>
|
7
|
+
<li><a href="#tab-permissions" data-toggle="tab"><%= t("fcrepo_admin.object.tabs.permissions") %></a></li>
|
7
8
|
</ul>
|
8
9
|
<div class="tab-content">
|
9
|
-
<div class="tab-pane active" id="
|
10
|
+
<div class="tab-pane active" id="tab-datastreams">
|
10
11
|
<%= render :partial => 'fcrepo_admin/datastreams/datastreams', :locals => {:datastreams => @object.datastreams} %>
|
11
12
|
</div>
|
12
|
-
<div class="tab-pane" id="
|
13
|
+
<div class="tab-pane" id="tab-properties">
|
13
14
|
<%= render :partial => 'properties', :locals => {:properties => @properties} %>
|
14
15
|
</div>
|
16
|
+
<div class="tab-pane" id="tab-permissions">
|
17
|
+
<%= render :partial => 'permissions', :locals => {:object => @object} %>
|
18
|
+
</div>
|
15
19
|
</div>
|
16
20
|
</div>
|
17
21
|
|
@@ -5,6 +5,7 @@ en:
|
|
5
5
|
tabs:
|
6
6
|
datastreams: 'Datastreams'
|
7
7
|
properties: 'Properties'
|
8
|
+
permissions: 'Permissions'
|
8
9
|
properties:
|
9
10
|
title: 'Properties'
|
10
11
|
keys:
|
@@ -13,6 +14,10 @@ en:
|
|
13
14
|
create_date: 'Create Date'
|
14
15
|
modified_date: 'Modified Date'
|
15
16
|
label: 'Label'
|
17
|
+
permissions:
|
18
|
+
type: 'Type'
|
19
|
+
name: 'Name'
|
20
|
+
access: 'Access'
|
16
21
|
audit_trail:
|
17
22
|
title: 'Audit Trail'
|
18
23
|
download: 'Download'
|
data/lib/fcrepo_admin/version.rb
CHANGED
@@ -22,6 +22,7 @@ describe "objects/show.html.erb" do
|
|
22
22
|
visit fcrepo_admin.object_path(object)
|
23
23
|
page.should have_link(I18n.t("fcrepo_admin.audit_trail.title"), :href => fcrepo_admin.object_audit_trail_index_path(object))
|
24
24
|
end
|
25
|
+
it "should display the object's permissions"
|
25
26
|
context "object governed by an admin policy" do
|
26
27
|
it "should link to the APO"
|
27
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fcrepo_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -272,6 +272,7 @@ files:
|
|
272
272
|
- app/views/fcrepo_admin/datastreams/index.html.erb
|
273
273
|
- app/views/fcrepo_admin/datastreams/show.html.erb
|
274
274
|
- app/views/fcrepo_admin/objects/_more_info.html.erb
|
275
|
+
- app/views/fcrepo_admin/objects/_permissions.html.erb
|
275
276
|
- app/views/fcrepo_admin/objects/_properties.html.erb
|
276
277
|
- app/views/fcrepo_admin/objects/show.html.erb
|
277
278
|
- config/locales/fcrepo_admin.en.yml
|
@@ -288,7 +289,6 @@ files:
|
|
288
289
|
- lib/fcrepo_admin/version.rb
|
289
290
|
- lib/tasks/.gitkeep
|
290
291
|
- lib/tasks/fcrepo_admin.rake
|
291
|
-
- script/rails
|
292
292
|
- spec/controllers/audit_trail_controller_spec.rb
|
293
293
|
- spec/controllers/datastreams_controller_spec.rb
|
294
294
|
- spec/factories/fcrepo_admin_factories.rb
|
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
369
369
|
version: '0'
|
370
370
|
segments:
|
371
371
|
- 0
|
372
|
-
hash:
|
372
|
+
hash: 3240411754357515048
|
373
373
|
requirements: []
|
374
374
|
rubyforge_project:
|
375
375
|
rubygems_version: 1.8.25
|
data/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|