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
38 39 40 41 42 43 44 45 |
# File 'app/controllers/lit/sources_controller.rb', line 38 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
56 57 58 59 60 |
# File 'app/controllers/lit/sources_controller.rb', line 56 def destroy @source = Source.find(params[:id]) @source.destroy redirect_to sources_url end |
#edit ⇒ Object
17 18 19 |
# File 'app/controllers/lit/sources_controller.rb', line 17 def edit @source = Source.find(params[:id]) end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/lit/sources_controller.rb', line 5 def index @sources = Source.all end |
#new ⇒ Object
13 14 15 |
# File 'app/controllers/lit/sources_controller.rb', line 13 def new @source = Source.new end |
#show ⇒ Object
9 10 11 |
# File 'app/controllers/lit/sources_controller.rb', line 9 def show @source = Source.find(params[:id]) end |
#sync_complete ⇒ Object
62 63 64 65 |
# File 'app/controllers/lit/sources_controller.rb', line 62 def sync_complete @source = Source.find(params[:id]) render json: { sync_complete: @source.sync_complete } end |
#synchronize ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/lit/sources_controller.rb', line 21 def synchronize @source = Source.find(params[:id]) @source.update_column(:sync_complete, false) if defined?(ActiveJob) SynchronizeSourceJob.perform_later(@source) else @source.synchronize end redirect_to lit.source_incomming_localizations_path(@source) end |
#touch ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/lit/sources_controller.rb', line 32 def touch @source = Source.find(params[:id]) @source.touch_last_updated_at! redirect_to request.env['HTTP_REFERER'].present? ? :back : @source end |
#update ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/controllers/lit/sources_controller.rb', line 47 def update @source = Source.find(params[:id]) if @source.update_attributes(clear_params) redirect_to @source, notice: 'Source was successfully updated.' else render action: 'edit' end end |