Skip to content

Commit 30774f7

Browse files
Move :sync_complete outside of the public API
1 parent 15e9895 commit 30774f7

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

app/assets/javascripts/lit/sources.js.coffee

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
$ ->
22
sourceId = $('#source_id').attr('value')
3-
apiKey = $('#api_key').attr('value')
43

54
updateFunc = ->
6-
$.ajax "/lit/api/v1/sources/" + sourceId + "/sync_complete",
5+
$.ajax "/lit/sources/" + sourceId + "/sync_complete",
76
type: 'GET'
8-
headers:
9-
'Authorization': "Token token=\"#{apiKey}\""
7+
format: 'json'
108
success: (xml, textStatus, xhr) ->
119
if xhr.responseJSON.sync_complete
1210
$('.loading').addClass('loaded').removeClass('loading')

app/controllers/lit/api/v1/sources_controller.rb

-10
This file was deleted.

app/controllers/lit/sources_controller.rb

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def destroy
5959
redirect_to sources_url
6060
end
6161

62+
def sync_complete
63+
@source = Source.find(params[:id])
64+
render json: { sync_complete: @source.sync_complete }
65+
end
66+
6267
private
6368

6469
def clear_params

app/views/lit/incomming_localizations/index.html.erb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<h1>Incomming localizations</h1>
22
<input type="hidden" id="source_id" value="<%= @source.id %>">
3-
<input type="hidden" id="api_key" value="<%= @source.api_key %>">
43
<div class="container">
54
<div class="row inline-headers">
65
<h4 class="<%= source_loading_class(@source) %>">Synchronization in progress, please wait. The page will refresh automatically when done.</h2>

config/routes.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
resources :localizations, :only=>[:index] do
1111
get 'last_change', :on=>:collection
1212
end
13-
resources :sources, only: [] do
14-
get 'sync_complete', :on=>:member
15-
end
1613
end
1714
end
1815
end
@@ -35,6 +32,7 @@
3532
resources :sources do
3633
member do
3734
get :synchronize
35+
get :sync_complete
3836
put :touch
3937
end
4038
resources :incomming_localizations, :only=>[:index, :destroy] do

0 commit comments

Comments
 (0)