-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
load selection criteria for shelf selection
- Loading branch information
Showing
20 changed files
with
223 additions
and
71 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,17 +1,71 @@ | ||
$(document).on('change', '#shelf_selection_report_lib', function() { | ||
$("#shelf_selection_report_loc_array option").remove(); | ||
lib = $('#shelf_selection_report_lib').find(':selected').text(); | ||
$.ajax({ | ||
url: '/shelf_selection_reports/home_locations', | ||
cache: false, | ||
data: { lib: lib }, | ||
success: function(html){ | ||
$('#shelf_selection_report_loc_array').append(html); | ||
} | ||
$(document).on('ready page:load', function() { | ||
$('#shelf_selection_report_lib').change(function() { | ||
$("#shelf_selection_report_loc_array option").remove(); | ||
lib = $('#shelf_selection_report_lib').find(':selected').text(); | ||
$.ajax({ | ||
url: '/shelf_selection_reports/home_locations', | ||
cache: false, | ||
data: { lib: lib }, | ||
success: function(html){ | ||
$('#shelf_selection_report_loc_array').append(html); | ||
} | ||
}) | ||
}) | ||
$('input[type="radio"]').click(function (){ | ||
$('#lc-show-hide').css('display', ($(this).val() == 'lc') ? 'block' : 'none'); | ||
$('#classic-show-hide').css('display', ($(this).val() == 'classic') ? 'block' : 'none'); | ||
$('#other-show-hide').css('display', ($(this).val() == 'other') ? 'block' : 'none'); | ||
}) | ||
$('#shelf_selection_report_search_name').change(function(){ | ||
search_name = $('#shelf_selection_report_search_name').find(':selected').text(); | ||
$.ajax({ | ||
url: '/shelf_selection_reports/load_saved_options', | ||
cache: false, | ||
data: { search_name: search_name }, | ||
success: function(html_opts) { | ||
$('#shelf_selection_report_lib').val($(html_opts).find('lib').text()); | ||
$("#shelf_selection_report_loc_array option").remove(); | ||
$.ajax({ | ||
url: '/shelf_selection_reports/home_locations', | ||
cache: false, | ||
data: { lib: $(html_opts).find('lib').text() }, | ||
success: function(html){ | ||
$('#shelf_selection_report_loc_array').append(html); | ||
$('#shelf_selection_report_loc_array').val($(html_opts).find('locs').text()); | ||
} | ||
}) | ||
$('#shelf_selection_report_fmt_array option').remove(); | ||
$('#shelf_selection_report_fmt_array').append($(html_opts).find('fmts option')); | ||
$.each($(html_opts).find('fmtsstring').text().split(','), function(i,e){ | ||
$("#shelf_selection_report_fmt_array option[value='" + e + "']").prop('selected', true); | ||
}); | ||
$('#shelf_selection_report_itype_array option').remove(); | ||
$('#shelf_selection_report_itype_array').append($(html_opts).find('itypes option')); | ||
$.each($(html_opts).find('itypesstring').text().split(','), function(i,e){ | ||
$("#shelf_selection_report_itype_array option[value='" + e + "']").prop('selected', true); | ||
}); | ||
$('#shelf_selection_report_icat1_array option').remove(); | ||
$('#shelf_selection_report_itcat1_array').append($(html_opts).find('icats option')); | ||
$.each($(html_opts).find('icat1sstring').text().split(','), function(i,e){ | ||
$("#shelf_selection_report_itcat1_array option[value='" + e + "']").prop('selected', true); | ||
}); | ||
$('#shelf_selection_report_lang').val($(html_opts).find('lang').text()); | ||
$('#shelf_selection_report_min_yr').val($(html_opts).find('minyr').text()); | ||
$('#shelf_selection_report_max_yr').val($(html_opts).find('maxyr').text()); | ||
$('#shelf_selection_report_min_circ').val($(html_opts).find('mincirc').text()); | ||
$('#shelf_selection_report_max_circ').val($(html_opts).find('maxcirc').text()); | ||
$('#shelf_selection_report_shadowed').val($(html_opts).find('shadowed').text()); | ||
$('#shelf_selection_report_digisent').val($(html_opts).find('digisent').text()); | ||
$('#shelf_selection_report_url').val($(html_opts).find('url').text()); | ||
$('#shelf_selection_report_mhlds').val($(html_opts).find('mhlds').text()); | ||
$('#shelf_selection_report_has_dups').val($(html_opts).find('hasdups').text()); | ||
$('#shelf_selection_report_multvol').val($(html_opts).find('multvol').text()); | ||
$('#shelf_selection_report_multcop').val($(html_opts).find('multcop').text()); | ||
$('#noboundw').val($(html_opts).find('noboundw').text()); | ||
$('#shelf_selection_report_lc_call_lo').val($(html_opts).find('calllo').text()); | ||
$('#shelf_selection_report_lc_call_hi').val($(html_opts).find('callhi').text()); | ||
$('#shelf_selection_report_subj_name').val($(html_opts).find('subjname').text()); | ||
} | ||
}) | ||
}) | ||
}); |
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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
# app/model/shelf_sel_search.rb | ||
class ShelfSelSearch < ActiveRecord::Base | ||
self.table_name = 'shelf_sel_searches' | ||
# TODO: make saved_cursors return more than just my own | ||
|
||
def self.saved_cursors(sunet_id) | ||
own_saved_cursor(sunet_id) | ||
own_saved_cursor(sunet_id) + others_saved_cursor(sunet_id) | ||
end | ||
|
||
def self.own_saved_cursor(sunet_id) | ||
where(user_name: sunet_id).order(:search_name).pluck(:search_name, :user_name).map { |a| a.join(', ') } | ||
end | ||
|
||
def self.others_saved_cursor(sunet_id) | ||
where.not(user_name: sunet_id).order(:search_name).pluck(:search_name, :user_name).map { |a| a.join(', ') } | ||
end | ||
|
||
def self.from_search_name(search_name) | ||
# example search_name param: 'Green Stacks A-Z, azanella' | ||
search_name_array = search_name.split(',').map(&:strip) | ||
search_name = search_name_array[0] | ||
user_name = search_name_array[1] | ||
find_by(search_name: search_name, user_name: user_name) | ||
end | ||
|
||
def call_lo | ||
call_range.split('-')[0] | ||
end | ||
|
||
def call_hi | ||
call_range.split('-')[1] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<div class='form-group row pad'> | ||
<%= f.label :lib, 'Select Library:', class: 'col-sm-5 form-control-label' %> | ||
<div class='col-sm-10'> | ||
<%= f.select :lib, UniLibsLocs.libraries, { include_blank: true }, { class: 'form-control' } %> | ||
<%= f.select :lib, UniLibsLocs.libraries, { include_blank: true, selected: 'GREEN' }, { class: 'form-control' } %> | ||
</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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<% @home_locations.each do |home_location| %> | ||
<option><%= home_location %></option> | ||
<option value='<%= home_location %>'><%= home_location %></option> | ||
<% end %> |
43 changes: 43 additions & 0 deletions
43
app/views/shelf_selection_reports/load_saved_options.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,43 @@ | ||
<search> | ||
<username><%= @shelf_sel_search.user_name %></username> | ||
<searchname><%= @shelf_sel_search.search_name %></searchname> | ||
<callrange><%= @shelf_sel_search.call_range %></callrange> | ||
<lib><%= @shelf_sel_search.lib %></lib> | ||
<locs><%= @shelf_sel_search.locs %></locs> | ||
<fmtsstring><%= @shelf_sel_search.fmts %></fmtsstring> | ||
<fmts> | ||
<% @shelf_sel_search.fmts.split(',').each do |fmt| %> | ||
<option value='<%= fmt %>'><%= fmt %></option> | ||
<% end %> | ||
</fmts> | ||
<itypesstring><%= @shelf_sel_search.itypes %></itypesstring> | ||
<itypes> | ||
<% @shelf_sel_search.itypes.split(',').each do |itype| %> | ||
<option value='<%= itype %>'><%= itype %></option> | ||
<% end %> | ||
</itypes> | ||
<% unless @shelf_sel_search.blank? %> | ||
<itcat1sstring><%= @shelf_sel_search.icat1s %></icat1sstring> | ||
<icat1s> | ||
<% @shelf_sel_search.icat1s.split(',').each do |icat1| %> | ||
<option value='<%= icat1 %>'><%= icat1 %></option> | ||
<% end %> | ||
</icat1s> | ||
<% end %> | ||
<lang><%= @shelf_sel_search.lang %></lang> | ||
<minyr><%= @shelf_sel_search.min_yr %></minyr> | ||
<maxyr><%= @shelf_sel_search.max_yr %></maxyr> | ||
<mincirc><%= @shelf_sel_search.min_circ %></mincirc> | ||
<maxcirc><%= @shelf_sel_search.max_circ %></maxcirc> | ||
<shadowed><%= @shelf_sel_search.na_i_e_shadow %></shadowed> | ||
<digisent><%= @shelf_sel_search.na_i_e_digisent %></digisent> | ||
<url><%= @shelf_sel_search.na_i_e_url %></url> | ||
<mhlds><%= @shelf_sel_search.na_i_e_mhlds %></mhlds> | ||
<hasdups><%= @shelf_sel_search.na_i_e_dups %></hasdups> | ||
<multvol><%= @shelf_sel_search.na_i_e_multvol %></multvol> | ||
<multcop><%= @shelf_sel_search.na_i_e_multcop %></multcop> | ||
<noboundw><%= @shelf_sel_search.na_i_e_boundw %></noboundw> | ||
<calllo><%= @shelf_sel_search.call_lo %></calllo> | ||
<callhi><%= @shelf_sel_search.call_hi %></callhi> | ||
<subjname><%= @shelf_sel_search.search_name %></subjname> | ||
</search> |
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
Oops, something went wrong.