Class: AhoyCaptain::Tables::PropertiesTableComponent

Inherits:
DynamicTable
  • Object
show all
Defined in:
app/components/ahoy_captain/tables/properties_table_component.rb

Class Method Summary collapse

Methods inherited from DynamicTable

register, table

Class Method Details

.url(item) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/ahoy_captain/tables/properties_table_component.rb', line 13

def self.url(item)
  name = Base64.decode64(item.request.params[:id])
  params = item.search_params.dup
  if params["q"] && params["q"].key?("properties_json_cont")
    json = JSON.parse(params["q"]["properties_json_cont"])
    json[name] = item.item.label
    params["q"]["properties_json_cont"] = json.to_json
  else
    params[:q] = { "properties_json_cont" => { name => item.item.label }.to_json }
  end
  params
end