Skip to content

Commit 5465438

Browse files
author
Nils Henning
committed
[FEATURE] move vuejs_component_name into class method
1 parent 4847036 commit 5465438

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+133
-161
lines changed

.byebug_history

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
continue
2+
n
3+
save_screenshot
4+
sleep 1
5+
save_screenshot
6+
n
7+
save_screenshot
8+
page.html
9+
continue
210
save_screenshot
311
continue
412
save_screenshot
@@ -246,11 +254,3 @@ continue
246254
args
247255
params
248256
respond_to? :params
249-
self
250-
self.params
251-
self
252-
params
253-
@params
254-
self
255-
params
256-
continue

CHANGELOG.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,7 @@ This behavior changed in `0.8.0`:
232232

233233
```ruby
234234
class Matestack::Ui::Core::Collection::Filter::Filter < Matestack::Ui::DynamicComponent
235-
236-
def vuejs_component_name
237-
"matestack-ui-core-collection-filter"
238-
end
235+
vue_js_component_name "matestack-ui-core-collection-filter"
239236

240237
#...
241238

@@ -259,10 +256,7 @@ This behavior changed in `0.8.0`:
259256

260257
```ruby
261258
class Components::Some::Component < Matestack::Ui::DynamicComponent
262-
263-
def vuejs_component_name
264-
"some-component"
265-
end
259+
vue_js_component_name "some-component"
266260

267261
#...
268262

app/concepts/matestack/ui/core/action/action.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
module Matestack::Ui::Core::Action
22
class Action < Matestack::Ui::Core::Component::Dynamic
3+
vue_js_component_name 'matestack-ui-core-action'
4+
35
optional :path, :success, :failure, :notify, :confirm,
46
method: { as: :action_method }, params: { as: :action_params }
57

6-
def vuejs_component_name
7-
'matestack-ui-core-action'
8-
end
9-
108
def setup
119
@component_config[:action_path] = action_path
1210
@component_config[:method] = action_method

app/concepts/matestack/ui/core/async/async.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
module Matestack::Ui::Core::Async
22
class Async < Matestack::Ui::Core::Component::Rerender
3+
vue_js_component_name "matestack-ui-core-async"
4+
35
optional :id # will be required in 1.0.0
46

5-
def vuejs_component_name
6-
"matestack-ui-core-async"
7-
end
8-
97
def initialize(*args)
108
super
119
ActiveSupport::Deprecation.warn(

app/concepts/matestack/ui/core/collection/content/content.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
module Matestack::Ui::Core::Collection::Content
22
class Content < Matestack::Ui::Core::Component::Rerender
3-
4-
def vuejs_component_name
5-
'matestack-ui-core-collection-content'
6-
end
3+
vue_js_component_name 'matestack-ui-core-collection-content'
74

85
def setup
96
@component_config = @component_config.except(:data, :paginated_data)

app/concepts/matestack/ui/core/collection/filter/filter.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
module Matestack::Ui::Core::Collection::Filter
22
class Filter < Matestack::Ui::Core::Component::Dynamic
3-
4-
def vuejs_component_name
5-
'matestack-ui-core-collection-filter'
6-
end
3+
vue_js_component_name 'matestack-ui-core-collection-filter'
74

85
def setup
96
@component_config = @component_config.except(:data, :paginated_data)

app/concepts/matestack/ui/core/collection/order/order.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
module Matestack::Ui::Core::Collection::Order
22
class Order < Matestack::Ui::Core::Component::Dynamic
3-
4-
def vuejs_component_name
5-
'matestack-ui-core-collection-order'
6-
end
3+
vue_js_component_name 'matestack-ui-core-collection-order'
74

85
def setup
96
@component_config = @component_config.except(:data, :paginated_data)

app/concepts/matestack/ui/core/component/dynamic.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def show
1313

1414
def dynamic_tag_attributes
1515
attrs = {
16-
"is": vuejs_component_name,
16+
"is": self.class.vue_js_name,
1717
"ref": component_id,
1818
":params": @url_params.to_json,
1919
":component-config": @component_config.to_json,
@@ -23,8 +23,14 @@ def dynamic_tag_attributes
2323
attrs
2424
end
2525

26-
def vuejs_component_name
27-
self.class.name.split(/(?=[A-Z])/).join("-").downcase.gsub("::", "")
26+
class << self
27+
def vue_js_component_name(name)
28+
@vue_js_name = name.to_s
29+
end
30+
31+
def vue_js_name
32+
@vue_js_name ||= self.name.split(/(?=[A-Z])/).join("-").downcase.gsub("::", "")
33+
end
2834
end
2935

3036
end

app/concepts/matestack/ui/core/form/form.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
module Matestack::Ui::Core::Form
22
class Form < Matestack::Ui::Core::Component::Dynamic
3+
vue_js_component_name "matestack-ui-core-form"
34

45
requires :for, :path, method: { as: :form_method }
56

6-
def vuejs_component_name
7-
"matestack-ui-core-form"
8-
end
9-
107
def setup
118
begin
129
@component_config[:for] = form_wrapper
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
module Matestack::Ui::Core::Onclick
22
class Onclick < Matestack::Ui::Core::Component::Dynamic
3-
4-
def vuejs_component_name
5-
"matestack-ui-core-onclick"
6-
end
3+
vue_js_component_name "matestack-ui-core-onclick"
74

85
end
96
end

0 commit comments

Comments
 (0)