Sha256: 0a786d7d00b318350ca32b3e94e4d10bf37050a94a902da43a199fb122edded4
Contents?: true
Size: 1.13 KB
Versions: 12
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module Lcms module Engine module Admin class SketchCompilersController < AdminController include Lcms::Engine::GoogleCredentials before_action :validate_params, only: [:compile] def compile response = SketchCompiler .new(current_user.id, request.remote_ip, params[:version]) .compile(params[:url], params[:foundational_url]) if response.success? url = DocumentExporter::Gdoc::Base.url_for JSON.parse(response.body)['id'] redirect_back fallback_location: new_admin_sketch_compiler_path, notice: t('.success', url: url) else redirect_back fallback_location: new_admin_sketch_compiler_path, alert: t('.compile_error') end end def new head :bad_request unless google_credentials.present? @version = params[:version].presence || 'v1' end private def validate_params redirect_to new_admin_sketch_compiler_path, alert: t('.error') unless params[:url].present? end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems