-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
172 changed files
with
15,108 additions
and
1,311 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
$(document).ready(function() { | ||
$('.batch_public_body_list').hide(); | ||
var showtext = $('.batch_public_body_toggle').attr('data-showtext'); | ||
var hidetext = $('.batch_public_body_toggle').attr('data-hidetext'); | ||
$('.toggle-message').text(showtext); | ||
$('.batch_public_body_toggle').click(function(){ | ||
$('.batch_public_body_list').toggle(); | ||
if ($('.toggle-message').text() == showtext){ | ||
$('.toggle-message').text(hidetext); | ||
}else{ | ||
$('.toggle-message').text(showtext); | ||
} | ||
}) | ||
}) |
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,67 @@ | ||
$(document).ready(function() { | ||
|
||
function add_option(selector, value, text) { | ||
var optionExists = ($(selector + ' option[value=' + value + ']').length > 0); | ||
if(!optionExists){ | ||
$(selector).append("<option value=" + value + ">" + text + "</option>"); | ||
} | ||
} | ||
// Transfer a set of select options defined by 'from_selector' to another select, | ||
// defined by 'to_selector' | ||
function transfer_options(from_selector, to_selector){ | ||
$(from_selector).each(function() | ||
{ | ||
add_option(to_selector, $(this).val(), $(this).text()); | ||
$(this).remove(); | ||
}) | ||
$('#public_body_query').val(''); | ||
return false; | ||
} | ||
|
||
// Submit the search form once the text reaches a certain length | ||
$("#public_body_query").keypress($.debounce( 300, function() { | ||
if ($('#public_body_query').val().length >= 3) { | ||
$('#body_search_form').submit(); | ||
} | ||
})); | ||
|
||
// Populate the candidate list with json search results | ||
$('#body_search_form').on('ajax:success', function(event, data, status, xhr) { | ||
$('#select_body_candidates').empty(); | ||
$.each(data, function(key, value) | ||
{ | ||
add_option('#select_body_candidates', value['id'], value['name']); | ||
}); | ||
}); | ||
|
||
// Add a hidden element to the submit form for every option in the selected list | ||
$('#body_submit_button').click(function(){ | ||
$('#select_body_selections option').each(function() | ||
{ | ||
$('#body_submit_form').append('<input type="hidden" value="' + $(this).val() + '" name="public_body_ids[]">' ); | ||
}) | ||
}) | ||
|
||
// Transfer selected candidates to selected list | ||
$('#body_select_button').click(function(){ | ||
return transfer_options('#select_body_candidates option:selected', '#select_body_selections'); | ||
}) | ||
|
||
// Transfer selected selected options back to candidate list | ||
$('#body_deselect_button').click(function(){ | ||
return transfer_options('#select_body_selections option:selected', '#select_body_candidates'); | ||
}) | ||
|
||
// Transfer all candidates to selected list | ||
$('#body_select_all_button').click(function(){ | ||
return transfer_options('#select_body_candidates option', '#select_body_selections'); | ||
}) | ||
|
||
// Transfer all selected back to candidate list | ||
$('#body_deselect_all_button').click(function(){ | ||
return transfer_options('#select_body_selections option', '#select_body_candidates'); | ||
}) | ||
|
||
// Show the buttons for selecting and deselecting all | ||
$('.select_all_button').show(); | ||
}) |
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
15 changes: 15 additions & 0 deletions
15
app/controllers/admin_public_body_change_requests_controller.rb
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,15 @@ | ||
class AdminPublicBodyChangeRequestsController < AdminController | ||
|
||
def edit | ||
@change_request = PublicBodyChangeRequest.find(params[:id]) | ||
end | ||
|
||
def update | ||
@change_request = PublicBodyChangeRequest.find(params[:id]) | ||
@change_request.close! | ||
@change_request.send_response(params[:subject], params[:response]) | ||
flash[:notice] = 'The change request has been closed and the user has been notified' | ||
redirect_to admin_general_index_path | ||
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
Oops, something went wrong.