Class: Lit::SourcesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Lit::SourcesController
- Defined in:
- app/controllers/lit/sources_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #sync_complete ⇒ Object
- #synchronize ⇒ Object
- #touch ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'app/controllers/lit/sources_controller.rb', line 33 def create @source = Source.new(clear_params) if @source.save redirect_to @source, notice: 'Source was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
50 51 52 53 |
# File 'app/controllers/lit/sources_controller.rb', line 50 def destroy @source.destroy redirect_to sources_url end |
#edit ⇒ Object
16 |
# File 'app/controllers/lit/sources_controller.rb', line 16 def edit; end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/lit/sources_controller.rb', line 6 def index @sources = Source.all end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/lit/sources_controller.rb', line 12 def new @source = Source.new end |
#show ⇒ Object
10 |
# File 'app/controllers/lit/sources_controller.rb', line 10 def show; end |
#sync_complete ⇒ Object
55 56 57 |
# File 'app/controllers/lit/sources_controller.rb', line 55 def sync_complete render json: { sync_complete: @source.sync_complete } end |
#synchronize ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/lit/sources_controller.rb', line 18 def synchronize @source.update_column(:sync_complete, false) if defined?(ActiveJob) SynchronizeSourceJob.perform_later(@source) else SynchronizeSourceService.new(@source).execute end redirect_to lit.source_incomming_localizations_path(@source) end |
#touch ⇒ Object
28 29 30 31 |
# File 'app/controllers/lit/sources_controller.rb', line 28 def touch @source.touch_last_updated_at! redirect_to_back_or_default fallback_location: source_path(@source) end |
#update ⇒ Object
42 43 44 45 46 47 48 |
# File 'app/controllers/lit/sources_controller.rb', line 42 def update if @source.update(clear_params) redirect_to @source, notice: 'Source was successfully updated.' else render action: 'edit' end end |