Skip to content

Commit

Permalink
Refactor action_builder, so that it takes
Browse files Browse the repository at this point in the history
translation options as an argument
  • Loading branch information
tomdonarski committed Oct 9, 2023
1 parent 649cc05 commit 420086c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions app/models/spree/admin/actions/action_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,14 @@ def build_config
url: @url,
classes: @classes,
availability_check: @availability_check,
text: text,
text: text(@name),
method: @method,
id: @id
}
end

def text
return ::Spree.t(@name) unless @translation_options.present?

::Spree.t(@name, scope: @translation_options[:scope], default: ::Spree.t(@name))
def text(text, options = {})
::Spree.t(text, options)
end

# def available?(current_ability, resource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def resend_config
classes: 'btn-secondary',
method: :post,
translation_options: {
scope: 'admin.order.events'
scope: 'admin.order.events',
default: ::Spree.t(:resend)
}
}
end
Expand Down

0 comments on commit 420086c

Please sign in to comment.