This repository has been archived by the owner on Mar 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add Dashboard icons - Add Publishable view and controller - Implemented draft for dashboard breadcrumb - Remove collections from my facets - Add add files action link for collections list - Fix specs to match new dashboard design - Make dashboard tab groupping centralized in a new helper - Add spec for publishables controller - Add spec for new views - Fix spec for admin users add file
- Loading branch information
Showing
33 changed files
with
495 additions
and
40 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class PublishablesController < ApplicationController | ||
include Hydra::Catalog | ||
include Hydra::BatchEditBehavior | ||
include Hydra::Collections::SelectsCollections | ||
|
||
def index | ||
@publishables = [] | ||
# there is almost certainly a better way to do this!!! | ||
Collection.where(depositor: current_user.user_key).each do |collection| | ||
unless collection.member_ids.empty? | ||
unless collection.identifier.any? {|uri| uri.start_with? "doi:"} | ||
@publishables << collection | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module DashboardBreadcrumbHelper | ||
@@dashboard_groups = { | ||
"generic_files" => :upload, | ||
"batch" => :describe, | ||
"my/files" => :describe, | ||
"my/highlights" => :describe, | ||
"my/shares" => :describe, | ||
"batch_edits" => :describe, | ||
"my/collections" => :organize, | ||
"collections" => :organize, | ||
"publishables" => :publish | ||
} | ||
|
||
def current_dashboard_tab?(sym) | ||
@@dashboard_groups[params[:controller]] == sym | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<%= javascript_tag do %> | ||
<%= render partial: "edit", formats: [:js] %> | ||
<% end %> | ||
<%= render partial: "dashboard/_index_partials/heading_actions" %> | ||
|
||
<h1>Apply Metadata</h1> | ||
<p> | ||
The information you provide for Title will be applied to the corresponding file only; however all other | ||
information you provide will be applied <em>to the entire batch of files</em> you have just | ||
deposited into <%= t('sufia.product_name') %>. You may edit individual files from | ||
<%= link_to "<i class='glyphicon glyphicon-dashboard'></i> #{t('sufia.bread_crumb.file_list')}".html_safe, sufia.dashboard_files_path %> | ||
once this step is finished. <span class="required"><abbr title="required">*</abbr></span> indicates required fields. | ||
</p> | ||
<%= simple_form_for [sufia, @batch, @form], html: { multipart: true }, builder: Sufia::FormBuilder do |f| %> | ||
<%= render 'metadata', f: f %> | ||
<%= render 'generic_files/permission_form', f: f, batch: @batch %> | ||
|
||
<div id="permissions_submit"> | ||
<%= button_tag type: 'submit', class: 'btn btn-primary btn-lg', | ||
onclick: "confirmation_needed = false;", id: "upload_submit", name: "update_permission" do %> | ||
<i class="glyphicon glyphicon-floppy-disk"></i> Save | ||
<% end %> | ||
</div> | ||
|
||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> | ||
<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> | ||
<h2 class="non lower">Batch Edit Descriptions <small>Click on labels below to edit file descriptions.</small> </h2> | ||
<div class="scrollx scrolly fileHeight"> <!-- original values --> | ||
<h3> <b>Changes will be applied to: (<%= @names.size %> files) </b></h3> | ||
<%= @names.join(", ").html_safe %> | ||
</div> <!-- /original values --> | ||
|
||
<div > | ||
<h3> Descriptions:</h3> | ||
|
||
<ul class="nav nav-tabs"> | ||
<li id="edit_descriptions_link" class="active"><a href="#descriptions_display" data-toggle="tab"><i class="glyphicon glyphicon-tags"></i> Descriptions</a></li> | ||
<li id="edit_permissions_link"><a href="#permissions_display" data-toggle="tab"><i class="glyphicon glyphicon-lock"></i> Permissions</a></li> | ||
</ul> | ||
<div class="tab-content"> | ||
<div class="well tab-pane active" id="descriptions_display"> | ||
<% @terms.each do |term| %> | ||
<div class="row"> | ||
<%= simple_form_for @generic_file, url: batch_edits_path, method: :put, remote: true, | ||
builder: Sufia::FormBuilder, html: { id: "form_#{term.to_s}", class: "ajax-form"} do |f| %> | ||
<div class="col-xs-12 col-sm-4"> | ||
<a class="accordion-toggle grey glyphicon-chevron-right-helper collapsed" data-toggle="collapse" href="#collapse_<%= term %>" id="expand_link_<%=term.to_s%>"> | ||
<%= f.input_label term %> <span class="chevron"></span> | ||
</a> | ||
</div> | ||
<div id="collapse_<%= term %>" class="collapse scrolly col-xs-12 col-sm-7"> | ||
<%= hidden_field_tag('update_type', 'update') %> | ||
<%= hidden_field_tag('key', term.to_s) %> | ||
<%# TODO we don't need to show required %> | ||
<%= render_edit_field_partial(term, f: f) %> | ||
<div> | ||
<%= f.submit "Save changes", class: 'btn btn-primary field-save updates-batches' , id: "#{term.to_s}_save" %> | ||
<a class="btn btn-default" data-toggle="collapse" data-parent="#row_<%= term.to_s %>" href="#collapse_<%= term.to_s %>">Cancel </a> | ||
<div class="status fleft"></div> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div><!-- /well --> | ||
|
||
<div id="permissions_display" class="tab-pane"> | ||
<%= form_for @generic_file, url: batch_edits_path, method: :put, remote: true, html: { id: "form_permissions", class: "ajax-form"} do |f| %> | ||
<%= hidden_field_tag('update_type', 'update') %> | ||
<%= hidden_field_tag('key', 'permissions') %> | ||
<%= render "generic_files/permission_form", f: f %> | ||
<div class="row"> | ||
<%= f.submit "Save changes", class: 'btn btn-primary updates-batches', id: 'permissions_save' %> | ||
<div id="status_permissions" class="status fleft"></div> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> <!-- .tab-content --> | ||
|
||
<!-- Ajax call to clear the batch before page uload. --> | ||
<%= button_to "Clear Batch", { controller: :batch_edits, action: :clear }, form_class: 'hidden', remote: true, id: 'clear_batch' %> | ||
|
||
</div><!-- descriptions_display --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> | ||
<h1>Files in <%= @collection.title %></h1> | ||
<% if @files.empty? %> | ||
<span>Please upload some files first</span> | ||
<% else %> | ||
<%= form_for @collection, url: collections.collection_path(@collection) do |f| %> | ||
<%= hidden_field_tag "collection[members][]" %> | ||
<div class="table-responsive"> | ||
<table class="table table-actionable table-striped table-hover"> | ||
<thead> | ||
<tr> | ||
<th class="text-left">Filename</th> | ||
<th>Date Uploaded</th> | ||
<th>In Collection</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% @files.each do |file| %> | ||
<tr> | ||
<td><%= render_thumbnail_tag file, { class: "hidden-xs file_listing_thumbnail pull-left media-left" }, { suppress_link: true } %> | ||
<%= file.title_or_label %></td> | ||
<td class="text-center"><%= file.date_uploaded %></td> | ||
<td class="text-center"><%= check_box_tag 'batch_document_ids[]', file.id, @collection.member_ids.include?(file.id) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<hr /> | ||
</div> | ||
<%= f.button('Add Files to Collection', class: 'btn btn-primary') %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/views/dashboard/_index_partials/_heading_actions.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<% current_tab ||= nil %> | ||
<div class="col-xs-12 heading-row dashboard-breadcrumb"> | ||
<% if can?(:create, GenericFile) %> | ||
<div class="col-xs-6 col-sm-3 heading-tile <%="active" if current_dashboard_tab?(:upload) %>"> | ||
<%= link_to sufia.new_generic_file_path do %> | ||
<%= image_tag('upload.png') %><br> | ||
<%= t("sufia.dashboard.upload") %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<div class="col-xs-6 col-sm-3 heading-tile <%="active" if current_dashboard_tab?(:describe) %>"> | ||
<%= link_to sufia.dashboard_files_path do %> | ||
<%= image_tag('describe.png') %><br> | ||
<%= t("sufia.dashboard.view_files") %> | ||
<% end %> | ||
</div> | ||
<% if can?(:create, Collection) %> | ||
<div class="col-xs-6 col-sm-3 heading-tile <%="active" if current_dashboard_tab?(:organize) %>"> | ||
<%= link_to sufia.dashboard_collections_path, id: "hydra-collection-add" do %> | ||
<%= image_tag('organize.png') %><br> | ||
<%= t("sufia.dashboard.create_collection") %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<div class="col-xs-6 col-sm-3 heading-tile <%="active" if current_dashboard_tab?(:publish) %>"> | ||
<%= link_to dashboard_publishables_path, id: "hydra-collection-view" do %> | ||
<%= image_tag('publish.png') %><br> | ||
<%= t("sufia.dashboard.publish") %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<%= content_for :heading do %> | ||
<%= render partial: "dashboard/_index_partials/heading_greetings" %> | ||
<% end %> | ||
<%= content_for :sidebar do %> | ||
<%= render partial: "dashboard/_index_partials/stats" %> | ||
<%= render partial: "dashboard/_index_partials/user_info" %> | ||
<% end %> | ||
<%= render partial: "dashboard/_index_partials/contents" %> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<%= javascript_tag do %> | ||
<%= render partial: "edit", formats: [:js] %> | ||
<% end %> | ||
<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %> | ||
<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb' %> | ||
<h1 class="lower">Edit <%= @generic_file %></h1> | ||
|
||
<div class="row"> | ||
<div class="col-xs-12 col-sm-4"> | ||
<%= render partial: 'media_display' %> | ||
</div> | ||
<div class="col-xs-12 col-sm-8"> | ||
<ul class="nav nav-tabs"> | ||
<li id="edit_descriptions_link" class="active"> | ||
<a href="#descriptions_display" data-toggle="tab"><i class="glyphicon glyphicon-tags"></i> Descriptions</a> | ||
</li> | ||
<li id="edit_versioning_link"> | ||
<a href="#versioning_display" data-toggle="tab"><i class="glyphicon glyphicon-sitemap"></i> Versions</a> | ||
</li> | ||
<li id="edit_permissions_link"><a href="#permissions_display" data-toggle="tab"> | ||
<i class="glyphicon glyphicon-key"></i> Permissions</a> | ||
</li> | ||
</ul> | ||
<div class="tab-content"> | ||
<%= render "descriptions", form: @form %> | ||
<%= render "permission", generic_file: @generic_file %> | ||
<%= render "versioning", generic_file: @generic_file %> | ||
</div> | ||
</div> <!-- /.col-sm-8 --> | ||
</div><!-- /.row --> |
Oops, something went wrong.