Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard modals, rspec versions and screen reader #487

Merged
merged 2 commits into from
Jun 3, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions app/controllers/concerns/sufia/my_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,8 @@ def index
end
end

def search_action_url opts={}
sufia.url_for(opts)
end

protected

# show only files with edit permissions in lib/hydra/access_controls_enforcement.rb apply_gated_discovery
def discovery_permissions
["edit"]
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/my/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@ def index
super
@selected_tab = :collections
end

protected
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious why this method is protected now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an override from Blacklight::Catalog, in which it is also protected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, OK!


def search_action_url *args
sufia.dashboard_collections_url *args
end

end
end
7 changes: 7 additions & 0 deletions app/controllers/my/files_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,12 @@ def index
super
@selected_tab = :files
end

protected

def search_action_url *args
sufia.dashboard_files_url *args
end

end
end

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="col-xs-4 heading-tile">
<span class="glyphicon glyphicon-folder-open"></span>
<%= link_to t("sufia.dashboard.create_collection"), collections.new_collection_path %>
<%= link_to t("sufia.dashboard.create_collection"), collections.new_collection_path, id: "hydra-collection-add" %>
</div>
<div class="col-xs-4 heading-tile">
<span class="glyphicon glyphicon-eye-open"></span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/homepage.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
</div><!-- /#page-positioner -->
</div><!-- /.container -->
</div><!-- /#wrapper -->
<div id="ajax-modal" class="modal hide" tabindex="-1"></div>
<%= render 'shared/ajax_modal' %>
</body>
</html>
12 changes: 6 additions & 6 deletions app/views/layouts/sufia-dashboard.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html>
<head><%= render partial: "layouts/head_tag_content" %></head>
<head><%= render partial: 'layouts/head_tag_content' %></head>
<body>
<div id="wrapper">
<div class="container-fluid">
<div id="page-positioner">

<%= render partial: "/masthead" %>
<%= render partial: "/controls" %>
<%= render partial: "/flash_msg" %>
<%= render partial: '/masthead' %>
<%= render partial: '/controls' %>
<%= render partial: '/flash_msg' %>

<div id="content-wrapper">
<div class="container-fluid">
Expand All @@ -22,11 +22,11 @@
</div>
</div>

<%= render partial: "/footer" %>
<%= render partial: '/footer' %>

</div><!-- /#page-positioner -->
</div><!-- /.container -->
</div><!-- /#wrapper -->
<div id="ajax-modal" class="modal hide" tabindex="-1"></div>
<%= render 'shared/ajax_modal' %>
</body>
</html>
4 changes: 2 additions & 2 deletions app/views/layouts/sufia-one-column.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<%= render partial: "layouts/head_tag_content"%>
<%= render partial: 'layouts/head_tag_content' %>
</head>

<body>
Expand All @@ -22,6 +22,6 @@
</div><!-- /#page-positioner -->
</div><!-- /.container -->
</div><!-- /#wrapper -->
<div id="ajax-modal" class="modal hide" tabindex="-1"></div>
<%= render 'shared/ajax_modal' %>
</body>
</html>
4 changes: 2 additions & 2 deletions app/views/layouts/sufia-two-column.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<%= render partial: "layouts/head_tag_content"%>
<%= render partial: 'layouts/head_tag_content' %>
</head>

<body>
Expand All @@ -25,6 +25,6 @@
</div><!-- /#page-positioner -->
</div><!-- /.container -->
</div><!-- /#wrapper -->
<div id="ajax-modal" class="modal hide" tabindex="-1"></div>
<%= render 'shared/ajax_modal' %>
</body>
</html>
9 changes: 2 additions & 7 deletions app/views/my/_did_you_mean.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<% if @response.response[:numFound] <= spell_check_max and @response.spelling.words.size > 0 %>
<% if should_show_spellcheck_suggestions? @response %>
<div id="spell">
<h4 class="suggest"><i>Did you mean to type
<% @response.spelling.words.each_with_index do |word,index| -%>
<% if index > 0 -%>, or <% end -%>
<%= link_to_query(word) -%>
<% end -%>
?</i></h4>
<h4 class="suggest"><em><%= t('blacklight.did_you_mean', options: safe_join(@response.spelling.words.map { |word| link_to_query(word) }, " #{t('blacklight.or')} ")).html_safe %></em></h4>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/my/_document_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% # container for all documents in index view -%>
<div id="documents" class="clear">
<div id="documents">
<%= render partial: 'my/_index_partials/default_group', locals: {docs: @response.docs.map { |x| SolrDocument.new(x) }, facet_value: nil} %>
</div>
19 changes: 10 additions & 9 deletions app/views/my/_facet_layout.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<li class="expandable_new grey">
<% id = facet_field.label.gsub(" ","_")+"_db" %>

<a class="accordion-toggle grey" data-toggle="collapse" data-parent="#facet_group" data-target="#collapse_<%= id%>">
<%= facet_field.label %> <i class="glyphicon glyphicon-chevron-right grey"></i>
</a>

<div id="collapse_<%= id%>" class="accordion-body collapse">
<div class="panel panel-default facet_limit blacklight-<%= facet_field.field.parameterize %> <%= 'facet_limit-active' if facet_field_in_params?(facet_field.field) %>">
<div class="<%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle panel-heading" data-toggle="collapse" data-target="#<%= facet_field_id(facet_field) %>">
<h5 class="panel-title">
<%= link_to facet_field_label(facet_field.field), "#", :"data-no-turbolink" => true %>
</h5>
</div>
<div id="<%= facet_field_id(facet_field) %>" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'in' %>">
<div class="panel-body">
<%= yield %>
</div>
</div>
</li>
</div>
18 changes: 9 additions & 9 deletions app/views/my/_facet_limit.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<% paginator = Blacklight::Solr::FacetPaginator.new(display_facet.items,
limit: facet_limit_for(solr_field)) %>
<ul class="slide-list">
<ul class="facet-values list-unstyled">
<% paginator = facet_paginator(facet_field, display_facet) %>
<% paginator.items.each do |item| -%>
<li>
<% if facet_in_params?( solr_field, item.value ) %>
<%= render_selected_facet_value(solr_field, item) %>
<% else %>
<%= render_facet_value(solr_field, item) %>
<li>
<% if facet_in_params?(solr_field, item.value) %>
<%= render_selected_facet_value(solr_field, item) %>
<% else %>
<%= render_facet_value(solr_field, item) %>
<% end -%>
</li>
<% end %>

<% if(paginator.has_next?) %>
<li class="more_facets_link"><%= link_to 'more ' + facet_field.label.pluralize + '»', sufia.url_for(params.merge(id: solr_field, action: "facet", path_only: true)), class: "more_facets_link" %></li>
<% end %>
</ul> <!-- /slide-list -->

</ul>
31 changes: 14 additions & 17 deletions app/views/my/_facet_pagination.html.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
<!-- This was copied from https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/_facet_pagination.html.erb
It implements the facets in the same manner as blacklight does for the main catalog for the individual's dashbord
-->
<div class="prev_next_links btn-group pull-left">
<%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn' do %>
<span class="disabled btn"><%= raw(t('views.pagination.previous')) %></span>
<%= link_to_previous_page @pagination, raw(t('views.pagination.previous')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn btn-link', data: {ajax_modal: "preserve"} do %>
<span class="disabled btn btn-disabled"><%= raw(t('views.pagination.previous')) %></span>
<% end %>
<%= link_to_next_page @pagination, raw(t('views.pagination.next')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn' do %>

<span class="disabled btn"><%= raw(t('views.pagination.next')) %></span>
<%= link_to_next_page @pagination, raw(t('views.pagination.next')), route_set: sufia, params: params, param_name: Blacklight::Solr::FacetPaginator.request_keys[:page], class: 'btn btn-link', data: {ajax_modal: "preserve"} do %>
<span class="disabled btn btn-disabled"><%= raw(t('views.pagination.next')) %></span>
<% end %>

</div>

<div class="sort_options btn-group pull-right">
<% if @pagination.sort == 'index' -%>
<span class="active az btn"><%= t('blacklight.search.facets.sort.index') %></span><%= link_to_unless(@pagination.sort == 'count', t('blacklight.search.facets.sort.count'),
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('count', params).symbolize_keys.merge(only_path: true)),
class: "sort_change numeric btn") %>
<span class="active az btn btn-default"><%= t('blacklight.search.facets.sort.index') %></span><%= link_to_unless(@pagination.sort == 'count', t('blacklight.search.facets.sort.count'),
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('count', params).symbolize_keys.merge(only_path: true)),
class: "sort_change numeric btn btn-default",
data: {ajax_modal: "preserve"}) %>
<% elsif @pagination.sort == 'count' -%>
<%= link_to(t('blacklight.search.facets.sort.index'),
Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('index', params).symbolize_keys.merge(only_path: true)),
class: "sort_change az btn") %><span class="active numeric btn"><%= t('blacklight.search.facets.sort.count') %></span>
<% end -%>
<%= link_to(t('blacklight.search.facets.sort.index'), Sufia::Engine.routes.url_for(@pagination.params_for_resort_url('index', params).symbolize_keys.merge(only_path: true)),
class: "sort_change az btn btn-default", data: {ajax_modal: "preserve"}) %><span class="active numeric btn btn-default"><%= t('blacklight.search.facets.sort.count') %></span>
<% end -%>
</div>
2 changes: 1 addition & 1 deletion app/views/my/_facet_selected.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% v.each do |selected_facet| %>
<% link_options = remove_facet_params(k, selected_facet, params).merge(action: :index) %>
<div class="alert alert-warning">
<%= link_to 'X', sufia.url_for(link_options), {class: 'close', :'data-dismiss' => "alert" } %>
<%= link_to "X", sufia.url_for(link_options), { class: "close", data: { dismiss: "alert" } } %>
<i class="glyphicon glyphicon-ok"></i> <strong><%= selected_facet %></strong>
</div>
<% end %>
Expand Down
27 changes: 20 additions & 7 deletions app/views/my/_facets.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
<% # main container for facets/limits menu -%>
<div>
<%= render partial: 'collections/button_for_creating_empty_collection', locals: {label: 'Create Collection'} %>
<div class="row">&nbsp;</div>
<h2>Browse By</h2>
<ul class="nav nav-list" id="facets">
<%= render_facet_partials %>
</ul>
<% if has_facet_values? %>
<div id="facets" class="facets sidenav">
<div class="top-panel-heading panel-heading">
<button type="button" class="facets-toggle" data-toggle="collapse" data-target="#facet-panel-collapse">
<span class="sr-only">Toggle facets</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h4>
<%= t('blacklight.search.facets.title') %>
</h4>
</div>
<div id="facet-panel-collapse" class="collapse panel-group">
<%= render_facet_partials %>
</div>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/my/_index_partials/_default_group.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<table class="table table-zebra-striped table-bordered">
<caption class="sr-only">Listing of files you have deposited in <%= t('sufia.product_name') %></caption>
<caption class="sr-only">Listing of items you have deposited in <%= t('sufia.product_name') %></caption>
<% unless params[:display_type] == 'list' %>
<thead>
<tr>
Expand Down
11 changes: 7 additions & 4 deletions app/views/my/_results_pagination.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<% if @response.total_pages > 1 %>
<div class="pager">
<%= paginate @response, outer_window: 2, theme: 'blacklight', route_set: sufia %>
<div class="clearfix"></div>
</div><!-- /pager -->
<div class="row record-padding">
<div class="col-md-9">
<div class="pagination">
<%= paginate @response, outer_window: 2, theme: 'blacklight', route_set: sufia %>
</div>
</div>
</div>
<% end %>
7 changes: 2 additions & 5 deletions app/views/my/facet.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<!-- This was copied from https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/facet.html.erb
It implements the facets in the same manner as blacklight does for the main catalog for the individual's dashbord
-->
<div class="facet_pagination top">
<%= render partial: 'facet_pagination' %>
</div>
Expand All @@ -11,10 +8,10 @@
</div>
<div class="modal-body">
<div class="facet_extended_list">
<%= render_facet_limit(@display_facet, layout: false) %>
<%= render_facet_limit(@display_facet, layout: false) %>
</div>
</div>

<div class="modal-footer">

<div class="facet_pagination bottom">
Expand Down
8 changes: 4 additions & 4 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@
scope :dashboard do
get '/files', controller: 'my/files', action: :index, as: 'dashboard_files'
get '/files/page/:page', controller: 'my/files', action: :index
get '/files/facet/:id', controller: 'my/files', action: :facet, as: 'dashboard_facet_dashboard_files'
get '/files/facet/:id', controller: 'my/files', action: :facet, as: 'dashboard_files_facet'

get '/collections', controller: 'my/collections', action: :index, as: 'dashboard_collections'
get '/collections/page/:page', controller: 'my/collections', action: :index
get '/collections/facet/:id', controller: 'my/collections', action: :facet, as: 'dashboard_facet_dashboard_collections'
get '/collections/facet/:id', controller: 'my/collections', action: :facet, as: 'dashboard_collections_facet'

get '/highlights', controller: 'my/highlights', action: :index, as: 'dashboard_highlights'
get '/highlights/page/:page', controller: 'my/highlights', action: :index
get '/highlights/facet/:id', controller: 'my/highlights', action: :facet, as: 'dashboard_facet_dashboard_highlights'
get '/highlights/facet/:id', controller: 'my/highlights', action: :facet, as: 'dashboard_highlights_facet'

get '/shares', controller: 'my/shares', action: :index, as: 'dashboard_shares'
get '/shares/page/:page', controller: 'my/shares', action: :index
get '/shares/facet/:id', controller: 'my/shares', action: :facet, as: 'dashboard_facet_dashboard_shares'
get '/shares/facet/:id', controller: 'my/shares', action: :facet, as: 'dashboard_shares_facet'
end

# advanced routes for advanced search
Expand Down
2 changes: 0 additions & 2 deletions spec/features/browse_dashboard_files_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
end

it "should allow you to browse facets" do
pending "Issue #428 is causing this"
click_link "more Subjects"
click_link "consectetur"
save_and_open_page
within("#document_#{@fixtures[1].noid}") do
click_link "Test Document MP3.mp3"
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

describe 'collection' do
def create_collection(title, description)
visit '/dashboard'
first('#hydra-collection-add').click
expect(page).to have_content 'Create New Collection'
fill_in('Title', with: title)
Expand Down Expand Up @@ -50,7 +51,6 @@ def create_collection(title, description)
end
it "should create collection from the dashboard and include files", js: true do
create_collection(title2, description2)

visit '/dashboard/files'
first('input#check_all').click
click_button "Add to Collection" # opens the modal
Expand Down
Loading