Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VEN-248 Change Order Channel by selecting #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/spree/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def scope

def order_params
params[:created_by_id] = try_spree_current_user.try(:id)
params.permit(:created_by_id, :user_id, :store_id, :channel)
params.permit(:created_by_id, :user_id, :store_id, :channel_id)
end

def load_order
Expand Down
24 changes: 11 additions & 13 deletions app/views/spree/admin/orders/_channel_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<div data-hook="channel-form-container">
<%= form_for [:admin, order], method: :put, url: set_channel_admin_order_url do |f| %>
<%= form_tag set_channel_admin_order_url, method: :put do %>
<fieldset>
<div data-hook="admin_order_channel_field">
<%= f.field_container :channel do %>
<%= f.label :channel, Spree.t(:channel) %>
<%= f.text_field :channel, name: 'channel', class: 'form-control' %>
<%= f.error_message_on :channel %>
<% end %>
</div>
<div class="form-actions" data-hook="buttons">
<%= button Spree.t('actions.update'), 'recycle.svg', 'submit', { class: 'btn-success', data: { disable_with: "#{ Spree.t(:saving) }..." }} %>
<span class="or"><%= Spree.t(:or) %></span>
<%= button_link_to Spree.t('actions.cancel'), edit_admin_order_url(order), icon: 'cancel.svg' %>
</div>
<div data-hook="admin_order_channel_field">
<%= label_tag :channel_id, Spree.t(:channel) %>
<%= select_tag :channel_id, options_for_select(order.store.store_channels.pluck(:name, :id), order.channel_id), include_blank: true, class: 'select2-clear' %>
</div>
<br/>
<div class="form-actions" data-hook="buttons">
<%= button Spree.t('actions.update'), 'recycle.svg', 'submit', { class: 'btn-success', data: { disable_with: "#{ Spree.t(:saving) }..." }} %>
<span class="or"><%= Spree.t(:or) %></span>
<%= button_link_to Spree.t('actions.cancel'), edit_admin_order_url(order), icon: 'cancel.svg' %>
</div>
<fieldset>
<% end %>
</div>