Skip to content

Commit

Permalink
Update wf_owner when non-marc authority records are updated
Browse files Browse the repository at this point in the history
Make this field visible in the display page, and update it using current
user field.  After uptading, redirect to the display page, because if
redirects to the list, the modified record is lost and not easily
accessible, except via the browser history.

Closes rism-digital#1584
  • Loading branch information
fjorba committed May 28, 2024
1 parent 8df96d2 commit 85c2132
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/admin/liturgical_feast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def index
# redirect update failure for preserving sidebars
def update
update! do |success,failure|
success.html { redirect_to collection_path }
success.html { redirect_to resource_path(params[:id]) }
failure.html { redirect_back fallback_location: root_path, flash: { :error => "#{I18n.t(:error_saving)}" } }
end
# Run the eventual triggers
Expand Down Expand Up @@ -140,6 +140,7 @@ def create
row (I18n.t :filter_name) { |r| r.name }
row (I18n.t :filter_alternate_terms) { |r| r.alternate_terms }
row (I18n.t :filter_notes) { |r| r.notes }
row (I18n.t :filter_owner) { |r| User.find_by(id: r.wf_owner).name rescue r.wf_owner }
end
active_admin_embedded_source_list( self, liturgical_feast, !is_selection_mode? )

Expand Down Expand Up @@ -180,6 +181,7 @@ def create
f.input :alternate_terms, :label => (I18n.t :filter_alternate_terms)
f.input :notes, :label => (I18n.t :filter_notes)
f.input :wf_stage, :label => (I18n.t :filter_wf_stage)
f.input :wf_owner, :input_html => { :value => current_user.id }, :as => :hidden
f.input :lock_version, :as => :hidden
end
end
Expand Down
5 changes: 4 additions & 1 deletion app/admin/place.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def index
# redirect update failure for preserving sidebars
def update
update! do |success,failure|
success.html { redirect_to collection_path }
success.html { redirect_to resource_path(params[:id]) }
failure.html { redirect_back fallback_location: root_path, flash: { :error => "#{I18n.t(:error_saving)}" } }
end
# Run the eventual triggers
Expand Down Expand Up @@ -159,6 +159,7 @@ def create
row (I18n.t :filter_country) { |r| r.country }
row (I18n.t :filter_district) { |r| r.district }
row (I18n.t :filter_notes) { |r| r.notes }
row (I18n.t :filter_owner) { |r| User.find_by(id: r.wf_owner).name rescue r.wf_owner }
end

active_admin_embedded_source_list( self, place, !is_selection_mode? )
Expand Down Expand Up @@ -264,6 +265,8 @@ def create
f.input :country, :label => (I18n.t :filter_country), :as => :string # otherwise country-select assumed
f.input :district, :label => (I18n.t :filter_district)
f.input :notes, :label => (I18n.t :filter_notes)
f.input :wf_stage, :label => (I18n.t :filter_wf_stage)
f.input :wf_owner, :input_html => { :value => current_user.id }, :as => :hidden
f.input :lock_version, :as => :hidden
end
end
Expand Down
4 changes: 3 additions & 1 deletion app/admin/standard_term.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def index
# redirect update failure for preserving sidebars
def update
update! do |success,failure|
success.html { redirect_to collection_path }
success.html { redirect_to resource_path(params[:id]) }
failure.html { redirect_back fallback_location: root_path, flash: { :error => "#{I18n.t(:error_saving)}" } }
end

Expand Down Expand Up @@ -154,6 +154,7 @@ def create
row (I18n.t :filter_term) { |r| r.term }
row (I18n.t :filter_alternate_terms) { |r| r.alternate_terms }
row (I18n.t :filter_notes) { |r| r.notes }
row (I18n.t :filter_owner) { |r| User.find_by(id: r.wf_owner).name rescue r.wf_owner }
end
active_admin_embedded_source_list( self, standard_term, !is_selection_mode? )

Expand Down Expand Up @@ -209,6 +210,7 @@ def create
f.input :alternate_terms, :label => (I18n.t :filter_alternate_terms), :input_html => { :rows => 8 }
f.input :notes, :label => (I18n.t :filter_notes)
f.input :wf_stage, :label => (I18n.t :filter_wf_stage)
f.input :wf_owner, :input_html => { :value => current_user.id }, :as => :hidden
f.input :lock_version, :as => :hidden
end
end
Expand Down
4 changes: 3 additions & 1 deletion app/admin/standard_title.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def index
# redirect update failure for preserving sidebars
def update
update! do |success,failure|
success.html { redirect_to collection_path }
success.html { redirect_to resource_path(params[:id]) }
failure.html { redirect_back fallback_location: root_path, flash: { :error => "#{I18n.t(:error_saving)}" } }
end

Expand Down Expand Up @@ -174,6 +174,7 @@ def create
row (I18n.t :filter_record_type) { |r| r.typus }
row (I18n.t :menu_latin) { |r| r.latin }
row (I18n.t :filter_notes) { |r| r.notes }
row (I18n.t :filter_owner) { |r| User.find_by(id: r.wf_owner).name rescue r.wf_owner }
end
active_admin_embedded_source_list( self, standard_title, !is_selection_mode? )

Expand Down Expand Up @@ -221,6 +222,7 @@ def create
#f.input :typus, :label => (I18n.t :filter_record_type)
f.input :notes, :label => (I18n.t :filter_notes)
f.input :wf_stage, :label => (I18n.t :filter_wf_stage)
f.input :wf_owner, :input_html => { :value => current_user.id }, :as => :hidden
f.input :lock_version, :as => :hidden
end
end
Expand Down

0 comments on commit 85c2132

Please sign in to comment.