Commit 01ad0fd18eb09f9310f6de5a118e823e97bbda80
1 parent
ec368658
Exists in
master
and in
29 other branches
Fixed google_cse files names to match plugin routes
Routes changed on commit bfce4eb13212734b675c4fd07f23ecca6946cb3e
Showing
6 changed files
with
54 additions
and
54 deletions
Show diff stats
plugins/google_cse/controllers/google_cse_plugin_controller.rb
0 → 100644
plugins/google_cse/controllers/google_cse_plugin_environment_controller.rb
plugins/google_cse/test/functional/google_cse_plugin_controller_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,20 @@ |
| 1 | +require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
| 2 | +require File.dirname(__FILE__) + '/../../controllers/google_cse_plugin_controller' | |
| 3 | + | |
| 4 | +# Re-raise errors caught by the controller. | |
| 5 | +class GoogleCsePluginController; def rescue_action(e) raise e end; end | |
| 6 | + | |
| 7 | +class GoogleCsePluginControllerTest < ActionController::TestCase | |
| 8 | + | |
| 9 | + def setup | |
| 10 | + @controller = GoogleCsePluginController.new | |
| 11 | + @request = ActionController::TestRequest.new | |
| 12 | + @response = ActionController::TestResponse.new | |
| 13 | + end | |
| 14 | + | |
| 15 | + should 'get results page' do | |
| 16 | + get :results | |
| 17 | + assert_response :success | |
| 18 | + end | |
| 19 | + | |
| 20 | +end | ... | ... |
plugins/google_cse/test/functional/google_cse_plugin_environment_controller_test.rb
| ... | ... | @@ -1,20 +0,0 @@ |
| 1 | -require File.dirname(__FILE__) + '/../../../../test/test_helper' | |
| 2 | -require File.dirname(__FILE__) + '/../../controllers/google_cse_plugin_environment_controller' | |
| 3 | - | |
| 4 | -# Re-raise errors caught by the controller. | |
| 5 | -class GoogleCsePluginEnvironmentController; def rescue_action(e) raise e end; end | |
| 6 | - | |
| 7 | -class GoogleCsePluginEnvironmentControllerTest < ActionController::TestCase | |
| 8 | - | |
| 9 | - def setup | |
| 10 | - @controller = GoogleCsePluginEnvironmentController.new | |
| 11 | - @request = ActionController::TestRequest.new | |
| 12 | - @response = ActionController::TestResponse.new | |
| 13 | - end | |
| 14 | - | |
| 15 | - should 'get results page' do | |
| 16 | - get :results | |
| 17 | - assert_response :success | |
| 18 | - end | |
| 19 | - | |
| 20 | -end |
plugins/google_cse/views/google_cse_plugin/results.rhtml
0 → 100644
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +<% plugin = @plugins[:google_cse] %> | |
| 2 | +<div id="cse" style="width: 100%;"><%= _('Loading') %></div> | |
| 3 | +<script src="//www.google.com/jsapi" type="text/javascript"></script> | |
| 4 | +<script type="text/javascript"> | |
| 5 | + function parseQueryFromUrl () { | |
| 6 | + var queryParamName = "q"; | |
| 7 | + var search = window.location.search.substr(1); | |
| 8 | + var parts = search.split('&'); | |
| 9 | + for (var i = 0; i < parts.length; i++) { | |
| 10 | + var keyvaluepair = parts[i].split('='); | |
| 11 | + if (decodeURIComponent(keyvaluepair[0]) == queryParamName) { | |
| 12 | + return decodeURIComponent(keyvaluepair[1].replace(/\+/g, ' ')); | |
| 13 | + } | |
| 14 | + } | |
| 15 | + return ''; | |
| 16 | + } | |
| 17 | + google.load('search', '1', {style : google.loader.themes.MINIMALIST}); | |
| 18 | + google.setOnLoadCallback(function() { | |
| 19 | + var customSearchControl = new google.search.CustomSearchControl( | |
| 20 | + '<%= plugin && plugin.google_id %>'); | |
| 21 | + customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); | |
| 22 | + var options = new google.search.DrawOptions(); | |
| 23 | + options.enableSearchResultsOnly(); | |
| 24 | + customSearchControl.draw('cse', options); | |
| 25 | + var queryFromUrl = parseQueryFromUrl(); | |
| 26 | + if (queryFromUrl) { | |
| 27 | + customSearchControl.execute(queryFromUrl); | |
| 28 | + } | |
| 29 | + }, true); | |
| 30 | +</script> | ... | ... |
plugins/google_cse/views/google_cse_plugin_environment/results.rhtml
| ... | ... | @@ -1,30 +0,0 @@ |
| 1 | -<% plugin = @plugins[:google_cse] %> | |
| 2 | -<div id="cse" style="width: 100%;"><%= _('Loading') %></div> | |
| 3 | -<script src="//www.google.com/jsapi" type="text/javascript"></script> | |
| 4 | -<script type="text/javascript"> | |
| 5 | - function parseQueryFromUrl () { | |
| 6 | - var queryParamName = "q"; | |
| 7 | - var search = window.location.search.substr(1); | |
| 8 | - var parts = search.split('&'); | |
| 9 | - for (var i = 0; i < parts.length; i++) { | |
| 10 | - var keyvaluepair = parts[i].split('='); | |
| 11 | - if (decodeURIComponent(keyvaluepair[0]) == queryParamName) { | |
| 12 | - return decodeURIComponent(keyvaluepair[1].replace(/\+/g, ' ')); | |
| 13 | - } | |
| 14 | - } | |
| 15 | - return ''; | |
| 16 | - } | |
| 17 | - google.load('search', '1', {style : google.loader.themes.MINIMALIST}); | |
| 18 | - google.setOnLoadCallback(function() { | |
| 19 | - var customSearchControl = new google.search.CustomSearchControl( | |
| 20 | - '<%= plugin && plugin.google_id %>'); | |
| 21 | - customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET); | |
| 22 | - var options = new google.search.DrawOptions(); | |
| 23 | - options.enableSearchResultsOnly(); | |
| 24 | - customSearchControl.draw('cse', options); | |
| 25 | - var queryFromUrl = parseQueryFromUrl(); | |
| 26 | - if (queryFromUrl) { | |
| 27 | - customSearchControl.execute(queryFromUrl); | |
| 28 | - } | |
| 29 | - }, true); | |
| 30 | -</script> |