dash_kit 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ec76c48c05ce86854dd0b5e5311ab5471ec2760545dcc4f66becd44ca7db2b9
4
- data.tar.gz: 37023a5c9040d15f02706a50f169ef3a265b7bb9c96209b934380d085da3f543
3
+ metadata.gz: '0085b35d17fc2418812df58123590ceb3a41b35050b6f20cba93dcd14e92f2c2'
4
+ data.tar.gz: a1f92e0da84207158dac5f49a0ed9f1d5296f1a258b1585d726e47c69c998cf3
5
5
  SHA512:
6
- metadata.gz: 5eb37c702f9f31e693f3817aa65c707bf25ad905fde6bccb161849efebd0f324cdaf12b07f5b2c48a2a6cc0f896e4e6fbe07a29fa54ce5aec2c30eef4768a5d1
7
- data.tar.gz: e81a29aae7a41bcb15af136a5bb2f9cfba1c6c6fd56c9f701784c2c9a13a9fd3d9dd556b4288b921936af6103f9bd61845eadc25ce93f4a9828e3997c707342d
6
+ metadata.gz: 6d0041d39227bb187f9b62edcb71249ea45be292e45915a2b9bcebf3e705b3ea5664c68150b6fe072f8482cc0518d95f12a64d9cff02c7c23cac59093cc17519
7
+ data.tar.gz: 77d4aa5ee0c3cbbfcb6353ab01e4413e1912f4a141f7d9bc987bcf271c14830a6bd495f51aa17ee955f576632cc60956bbbf631973d809994d3c3ec83438b7e1
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "ks_blocks/layout_endpoints"
4
+
3
5
  module DashKit
4
6
  class DashboardsController < DashKit.parent_controller.constantize
7
+ include KsBlocks::LayoutEndpoints
8
+
5
9
  before_action :require_editable!, only: %i[toggle_widget move_widget reorder save_filters create_definition update_definition destroy_definition]
6
10
 
7
11
  def index
@@ -51,13 +55,6 @@ module DashKit
51
55
  end
52
56
  end
53
57
 
54
- def place_blocks
55
- widget_dashboard.place_blocks(params.require(:layout).map { |position| position.permit(:id, :x, :y, :w, :h).to_h }, version: params[:version])
56
- head :no_content
57
- rescue KsBlocks::InvalidLayout => refusal
58
- render json: { error: refusal.message }, status: :unprocessable_entity
59
- end
60
-
61
58
  def save_filters
62
59
  widget_dashboard.update_filter(params[:filter_key], params[:filter_value])
63
60
  respond_to do |format|
@@ -109,6 +106,10 @@ module DashKit
109
106
  )
110
107
  end
111
108
 
109
+ def block_layout_record
110
+ widget_dashboard
111
+ end
112
+
112
113
  def dashboard_params
113
114
  params.require(:dashboard).permit(:name, :dashboard_type)
114
115
  end
data/config/routes.rb CHANGED
@@ -7,7 +7,10 @@ DashKit::Engine.routes.draw do
7
7
  post :select
8
8
  post :duplicate
9
9
  post :save_filters
10
- patch "blocks", to: "dashboards#place_blocks", as: :blocks
10
+ get "layout", to: "dashboards#layout", as: :layout
11
+ post "blocks", to: "dashboards#add_block", as: :blocks
12
+ patch "blocks", to: "dashboards#place_blocks"
13
+ delete "blocks/:block_id", to: "dashboards#remove_block", as: :block
11
14
  post :create_definition
12
15
  post :update_definition
13
16
  post :destroy_definition
@@ -1,3 +1,3 @@
1
1
  module DashKit
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dash_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider