Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Commit

Permalink
Change Dashboard Design
Browse files Browse the repository at this point in the history
Add Dashboard icons
Add Dashboard icons to all relevant pages
Add Publishable view and controller

Change of dashboard buttons

Implement publishables index view

Add dashboard images and change publishable controller

Add the dashboard icon image files

Fix formatting issue

Fix feature spec for dashboard changes

Initial implementation of breadcrum

Implemented draft for dashboard breadcrumb

Remove collections from my facets and fixed typo

Change current_tab to a local variable in breadcrumb

Add add files action link for collections list

Add route for collection add file

Add controller and bare view for collections add file

Change dashboard link for Compile

Fix specs to match new dashboard design

Add add-files mechanism for collections

Make add files view more railsy

Add dashboard heading actions on more pages

Add dashboard breadcumb to all pages
  • Loading branch information
tonmoy18 committed Nov 18, 2015
1 parent a516d63 commit abae491
Show file tree
Hide file tree
Showing 25 changed files with 353 additions and 32 deletions.
Binary file added app/assets/images/compile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/describe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/publish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/upload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 30 additions & 9 deletions app/assets/stylesheets/dashboard.scss
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
@import 'global';

div.heading-tile .glyphicon {
background: $hokie-orange;
div.dashboard-breadcrumb {
margin-bottom: 20px;
margin-top: 20px;
border-bottom: solid $hokie-orange;
}

div.heading-tile {
color: white;
display: block;
width: 2em;
height: 2em;
border-radius: 5px 5px 0 0;
line-height: 1.75em;
margin: 0 auto;
border-radius: 50%;
border: 2px solid $hokie-orange;
padding-top: 10px;
overflow: hidden;
transition-property: background-color, color;
transition-duration: .35s;
transition-timing-function: ease-out;
}

div.heading-tile:hover .glyphicon {
div.heading-tile.active {
background-color: orange;
color: white;
transition-property: background-color, color;
transition-duration: .35s;
transition-timing-function: ease-out;
}

div.heading-tile:hover {
background-color: $hokie-orange;
border-color: $hokie-orange;
color: white;
transition-property: background-color, color;
transition-duration: .35s;
transition-timing-function: ease-out;
}

div.heading-tile a:hover {
text-decoration: none;
}


.dashboard {
.panel-default > .panel-heading {
background-color: $hokie-grey;
Expand All @@ -42,4 +57,10 @@ div.heading-tile:hover .glyphicon {
padding: 0 .25em;
}

}
}

.heading-tile {
img {
height: 64px;
}
}
6 changes: 6 additions & 0 deletions app/assets/stylesheets/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
text-align: left;
}

.table-actionable {
.text-left {
text-align: left;
}
}

#login-form {
margin-top: 5%;
margin-bottom: 5%;
Expand Down
7 changes: 6 additions & 1 deletion app/controllers/collections_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class CollectionsController < ApplicationController
include Sufia::CollectionsControllerBehavior
skip_load_and_authorize_resource :only => [:datacite_search, :crossref_search, :import_metadata, :ldap_search]
skip_load_and_authorize_resource :only => [:datacite_search, :crossref_search, :import_metadata, :ldap_search, :add_files]

def presenter_class
MyCollectionPresenter
Expand Down Expand Up @@ -115,4 +115,9 @@ def ldap_search
render :layout => false
end

def add_files
@collection = Collection.find(params[:id])
@files = GenericFile.find(depositor: current_user.user_key)
authorize! :edit, @collection
end
end
13 changes: 13 additions & 0 deletions app/controllers/publishables_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class PublishablesController < ApplicationController
def index
@publishables = []
# there is almost certainly a better way to do this!!!
Collection.find(depositor: current_user.user_key).each do |collection|
unless DoiRequest.find_by_asset_id(collection.id)
unless collection.member_ids.empty?
@publishables << collection
end
end
end
end
end
28 changes: 28 additions & 0 deletions app/views/batch/edit.html.erb
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", locals: {current_tab: :upload} %>

<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 %>
59 changes: 59 additions & 0 deletions app/views/batch_edits/edit.html.erb
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', locals: {current_tab: :describe} %>
<h2 class="non lower">Batch Edit Descriptions &nbsp;&nbsp;&nbsp;<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 -->
28 changes: 28 additions & 0 deletions app/views/collections/add_files.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb', locals: {current_tab: :compile} %>
<h1>Files in <%= @collection.title %></h1>
<%= 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.filename[0] %></td>
<td class="text-center"><%= file.create_date.strftime("%m/%d/%Y") %></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') %>
<% end %>
3 changes: 3 additions & 0 deletions app/views/collections/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<% @page_title = "Edit Dataset #{display_title(@collection)} - #{application_name}" %>
<%= render_breadcrumbs builder: Sufia::BootstrapBreadcrumbsBuilder %>
<%= render partial: 'dashboard/_index_partials/heading_actions.html.erb', locals: {current_tab: :compile} %>

<h1>Edit Dataset: <%= display_title(@collection) %></h1>

<% unless has_collection_search_parameters? %>
Expand Down
4 changes: 4 additions & 0 deletions app/views/collections/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div id="content-header" class="row">
<%= render partial: "dashboard/_index_partials/heading_actions", locals: {current_tab: :compile} %>
</div>

<h1>Create New Dataset</h1>

<%= radio_button_tag :doi_status, "assigned", checked = false %>
Expand Down
31 changes: 31 additions & 0 deletions app/views/dashboard/_index_partials/_heading_actions.html.erb
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_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_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_tab==:compile%>">
<%= link_to sufia.dashboard_collections_path, id: "hydra-collection-add" do %>
<%= image_tag('compile.png') %><br>
<%= t("sufia.dashboard.create_collection") %>
<% end %>
</div>
<% end %>
<div class="col-xs-6 col-sm-3 heading-tile <%="active" if current_tab==:publish%>">
<%= link_to dashboard_publishables_path, id: "hydra-collection-view" do %>
<%= image_tag('publish.png') %><br>
<%= t("sufia.dashboard.publish") %>
<% end %>
</div>
</div>
16 changes: 16 additions & 0 deletions app/views/dashboard/index.html.erb
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" %>

31 changes: 31 additions & 0 deletions app/views/generic_files/edit.html.erb
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', locals: {current_tab: :describe} %>
<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 -->
33 changes: 33 additions & 0 deletions app/views/generic_files/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<h2>Upload</h2>
<%= render partial: 'dashboard/_index_partials/heading_actions', locals: {current_tab: :upload} %>
<%= render partial: 'generic_files/upload/alerts' %>
<%# using partials rather than inlining, so implementers can add or change stuff on this page without much duplication %>
<ul class="nav nav-tabs" role="tablist" title="Data Source Selectors" id="upload_tabs">
<li class="active" id="computer_tab" title="<%= t('sufia.upload.my_computer.sr_tab_label')+' '+ t('sufia.upload.my_computer.tab_label') %>"><a role="tab" href="#local" data-toggle="tab"><i class="glyphicon glyphicon-folder-open" aria-hidden="true"></i> <%= t('sufia.upload.my_computer.tab_label')%></a></li>
<% if Sufia.config.browse_everything %>
<li id="browse_everything_tab" title="<%= t('sufia.upload.browse_everything.sr_tab_label')+' '+ t('sufia.upload.browse_everything.tab_label') %>" aria-activedescendant="browse_everything_link"><a role="tab" href="#browse_everything" data-toggle="tab" id="browse_everything_link" ><i class="glyphicon glyphicon-cloud-download" aria-hidden="true"></i> <%= t('sufia.upload.browse_everything.tab_label')%></a></li>
<% end %>
<% if Sufia.config.enable_local_ingest %>
<li role="tab" id="local_ingest_tab"><a href="#ingest" data-toggle="tab"><i class="glyphicon glyphicon-hdd" aria-hidden="true"></i> <%= t('sufia.upload.local_ingest.tab_label')%></a></li>
<% end %>
</ul>

<div class="tab-content">
<div class="tab-pane active" id="local" aria-labelledby="computer_tab" role="tabpanel">
<span class="sr-only"><%= t("sufia.upload.my_computer.sr_instructions") %></span>
<%= render partial: 'multiple_upload' %>
</div>

<% if Sufia.config.browse_everything %>
<div class="tab-pane" id="browse_everything" aria-labelledby="browse_everything_tab" role="tabpanel">
<%= render partial: 'browse_everything' %>
</div>
<% end %>
<% if Sufia.config.enable_local_ingest %>
<div class="tab-pane" id="ingest" aria-labelledby="local_ingest_tab">
<%= render partial: 'generic_files/local_file_import' %>
</div>
<% end %>

</div>
9 changes: 8 additions & 1 deletion app/views/layouts/sufia-dashboard.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
</div>
<div class="container-fluid">
<div id="content" class="row">
<% dashboard_tab = nil %>
<% if params[:controller] == "my/collections" %>
<% dashboard_tab = :compile %>
<% elsif params[:controller] == "my/files" %>
<% dashboard_tab = :describe %>
<% end %>
<%= render partial: "dashboard/_index_partials/heading_actions", locals: {current_tab: dashboard_tab} %>
<div id="sidebar" class="col-xs-12 col-sm-3"><%= yield :sidebar %></div>
<div class="col-xs-12 col-sm-9"><%= yield %></div>
</div>
Expand All @@ -30,4 +37,4 @@
</div><!-- /#wrapper -->
<%= render 'shared/ajax_modal' %>
</body>
</html>
</html>
2 changes: 2 additions & 0 deletions app/views/my/_collection_action_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
class: 'itemicon itemtrash', title: 'Delete Dataset', method: :delete, data: {
confirm: "Deleting a dataset from #{t('sufia.product_name')} is permanent. Click OK to delete this dataset from #{t('sufia.product_name')}, or Cancel to cancel this operation" } %>
</li>
<li role="menutiem" tabindex="-1">
<%= link_to raw('<i class="glyphicon glyphicon-file" aria-hidden="true"></i> Add Files'), collections_add_files_path(id), class: 'itemicon', title: 'Add Files' %>
<% end %>
</ul>
</div>
Loading

0 comments on commit abae491

Please sign in to comment.