Class: WorkflowInstancesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- WorkflowInstancesController
- Defined in:
- lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
- #collection_edit ⇒ Object
- #collection_update ⇒ Object
- #index ⇒ Object
- #reset ⇒ Object
-
#selection ⇒ Object
POST /records/selection input=EAP/123; …ETC.…
- #show ⇒ Object
-
#with_bas_correction ⇒ Object
This is a custom reporting action where an extra filter is applied to the full index scope.
-
#with_incomplete_bas_records ⇒ Object
reports.
- #workflow_instance_class ⇒ Object
Class Method Details
.record_batch_class ⇒ Object
164 165 166 167 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 164 def record_batch_class return @record_batch_class if @record_batch_class @record_batch_class = record_class.try(:batch_class) end |
.record_class ⇒ Object
157 158 159 160 161 162 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 157 def record_class return @record_class if @record_class parts = controller_path.split('/').map(&:classify) parts.pop until klass = parts.join('::').safe_constantize @record_class = klass end |
Instance Method Details
#collection_edit ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 26 def collection_edit :update, record_class redirect_to record_class and return unless @collection.any? if params[:reveal].present? render layout: false # popup end end |
#collection_update ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 61 def collection_update :update, record_class if @collection.update params[:collection] redirect_to polymorphic_path([:selection, record_class], ids: @collection.ids) else render "collection_edit" end end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 9 def index :read, record_class set_records_for_index respond_to do |format| format.html do @records = @records.page(params[:page]).per(params[:per_page]).decorate end format.csv { respond_with @records, record_class: record_class, include_notes: params[:include_notes] } end end |
#reset ⇒ Object
70 71 72 73 74 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 70 def reset :reset, @record @record.reset! redirect_to @record end |
#selection ⇒ Object
POST /records/selection input=EAP/123; …ETC.…
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 77 def selection :read, record_class unless record_class == WorkflowInstance respond_to do |format| format.html do @records = find_records_by_ids_or_input decorate: true end format.csv do @records = find_records_by_ids_or_input respond_with @records, record_class: record_class, include_notes: params[:include_notes] end end end |
#show ⇒ Object
20 21 22 23 24 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 20 def show :read, @record @record = @record.decorate respond_with(@record) end |
#with_bas_correction ⇒ Object
This is a custom reporting action where an extra filter is applied to the full index scope. reports
37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 37 def with_bas_correction :read, record_class set_records_for_index @records = @records.where(data_corrected_by_bas_data: true).decorate respond_to do |format| format.html { render action: :selection } format.csv { respond_with @records, record_class: record_class, include_notes: params[:include_notes] } end end |
#with_incomplete_bas_records ⇒ Object
reports
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 48 def with_incomplete_bas_records :read, record_class set_records_for_index @records = @records.with_incomplete_bas_records.decorate respond_to do |format| format.html do redirect_to :back, notice: "There are no incompletely enriched DSLAMs" and return unless @records.any? render action: :selection end format.csv { respond_with @records, record_class: record_class, include_notes: params[:include_notes] } end end |
#workflow_instance_class ⇒ Object
5 |
# File 'lib/generators/dunlop/install/workflow/templates/controllers/workflow_instances_controller.rb', line 5 alias_method :workflow_instance_class, :record_class |