FEATURE: option to update child theme components via theme CLI.

423ce44112
This commit is contained in:
Vinoth Kannan
2020-03-27 03:41:56 +05:30
parent 67b34600d5
commit 257f59f366
3 changed files with 26 additions and 5 deletions

View File

@ -97,9 +97,10 @@ class Admin::ThemesController < Admin::AdminController
# params[:bundle] used by theme CLI. params[:theme] used by admin UI
bundle = params[:bundle] || params[:theme]
theme_id = params[:theme_id]
update_components = params[:components]
match_theme_by_name = !!params[:bundle] && !params.key?(:theme_id) # Old theme CLI behavior, match by name. Remove Jan 2020
begin
@theme = RemoteTheme.update_zipped_theme(bundle.path, bundle.original_filename, match_theme: match_theme_by_name, user: theme_user, theme_id: theme_id)
@theme = RemoteTheme.update_zipped_theme(bundle.path, bundle.original_filename, match_theme: match_theme_by_name, user: theme_user, theme_id: theme_id, update_components: update_components)
log_theme_change(nil, @theme)
render json: @theme, status: :created
rescue RemoteTheme::ImportError => e