Sha256: 467c03bcc61c0c8e2dd1b22bd409adef41c1e9842421e0aeb4abf50adb32a61c
Contents?: true
Size: 867 Bytes
Versions: 1
Compression:
Stored size: 867 Bytes
Contents
module Solder class UiStateController < ApplicationController include ActionView::Helpers::SanitizeHelper before_action :set_ui_state, only: :show around_action Solder.config[:around_action] def show render json: @ui_state.to_json end def update Rails.cache.write "solder/#{ui_state_params[:key]}", parsed_attributes records_to_touch.map(&:touch) head :ok end private def ui_state_params params.permit(:attributes, :key) end def set_ui_state @ui_state = Rails.cache.read "solder/#{ui_state_params[:key]}" end def records_to_touch GlobalID::Locator.locate_many_signed parsed_attributes["data-solder-touch"]&.split(":") || [] end def parsed_attributes JSON.parse(ui_state_params[:attributes]).deep_transform_values { sanitize(_1) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
solder-0.3.0 | app/controllers/solder/ui_state_controller.rb |