Skip to content

Commit f3a1bd1

Browse files
authored
Merge pull request #134 from basemate/refactor_core_components_v2
Refactor core components v2
2 parents a2bb47f + fb4a897 commit f3a1bd1

File tree

30 files changed

+48
-93
lines changed

30 files changed

+48
-93
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def self.views_dir
5353
return ""
5454
end
5555

56-
5756
def initialize(model=nil, options={})
5857
super
5958
@nodes = {}

app/concepts/matestack/ui/core/app/store.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Vue from 'vue/dist/vue.esm'
22
import Vuex from 'vuex'
33
import axios from 'axios'
4-
54
import matestackEventHub from 'js/event-hub'
65

76
Vue.use(Vuex)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import Vue from 'vue/dist/vue.esm'
2-
32
import matestackEventHub from 'js/event-hub'
4-
53
import componentMixin from 'component/component'
64

75
const componentDef = {
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
module Matestack::Ui::Core::Async
2-
class Async < Matestack::Ui::Core::Component::Dynamic
3-
4-
def setup
5-
@rerender = true
6-
end
7-
2+
class Async < Matestack::Ui::Core::Component::Dynamic
83

4+
def setup
5+
@rerender = true
96
end
7+
108
end
9+
end
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module Matestack::Ui::Core::Blockquote
22
class Blockquote < Matestack::Ui::Core::Component::Static
3+
34
def setup
45
@tag_attributes.merge!({
56
"cite": options[:cite]
6-
})
7+
})
78
end
9+
810
end
911
end
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
- if options[:text].nil?
2-
%button{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
- else
6-
%button{@tag_attributes}
1+
%button{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
75
= options[:text]
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
%caption{@tag_attributes}
2-
- if options[:text].nil?
3-
- if block_given?
4-
= yield
2+
- if options[:text].nil? && block_given?
3+
= yield
54
- else
65
= options[:text]

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Vue from 'vue/dist/vue.esm'
2-
32
import matestackEventHub from 'js/event-hub'
43
import queryParamsHelper from 'js/helpers/query-params-helper'
5-
64
import componentMixin from 'component/component'
75
import asyncMixin from 'async/async'
86

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Vue from 'vue/dist/vue.esm'
2-
32
import matestackEventHub from 'js/event-hub'
43
import queryParamsHelper from 'js/helpers/query-params-helper'
5-
64
import componentMixin from 'component/component'
75

86
const componentDef = {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def config
5959

6060
end
6161

62-
6362
module Helper
6463

6564
def get_collection_filter collection_id, key=nil

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import Vue from 'vue/dist/vue.esm'
2-
32
import matestackEventHub from 'js/event-hub'
43
import queryParamsHelper from 'js/helpers/query-params-helper'
5-
64
import componentMixin from 'component/component'
75

86
const componentDef = {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Matestack::Ui::Core::Collection::Order::Toggle
22
class Toggle < Matestack::Ui::Core::Component::Static
33

4-
54
end
65
end

app/concepts/matestack/ui/core/component/component.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Vue from 'vue/dist/vue.esm'
22
import axios from 'axios'
33
import VRuntimeTemplate from "v-runtime-template"
4-
54
import matestackEventHub from 'js/event-hub'
65

76
const componentMixin = {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module Matestack::Ui::Core::Component
22
class Dynamic < Trailblazer::Cell
33

4-
54
include ActionView::Helpers::ActiveModelHelper
65
include ActionView::Helpers::ActiveModelInstanceTag
76
include ActionView::Helpers::AssetTagHelper
@@ -26,8 +25,6 @@ class Dynamic < Trailblazer::Cell
2625
include ActionView::Helpers::TextHelper
2726
include ActionView::Helpers::TranslationHelper
2827
include ActionView::Helpers::UrlHelper
29-
# include ActionView::Helpers::UrlHelper
30-
# include ActionView::Helpers::TranslationHelper
3128
include ::Cell::Haml
3229
include Matestack::Ui::Core::ApplicationHelper
3330
include Matestack::Ui::Core::ToCell
@@ -193,7 +190,6 @@ def modifiers
193190
result.join(" ")
194191
end
195192

196-
197193
private
198194

199195
def generate_children_cells
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module Matestack::Ui::Core::Details
22
class Details < Matestack::Ui::Core::Component::Static
3+
34
end
45
end
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Matestack::Ui::Core::Div
22
class Div < Matestack::Ui::Core::Component::Static
33

4-
54
end
65
end
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
%i{@tag_attributes}
2-
- if options[:text].blank?
3-
- if block_given?
4-
= yield
2+
- if options[:text].nil? && block_given?
3+
= yield
54
- else
65
= options[:text]
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
- if options[:text].blank?
2-
%label{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
- else
6-
%label{@tag_attributes}
1+
%label{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
75
= options[:text]
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
%li{@tag_attributes}
2-
- if options[:text].blank?
3-
- if block_given?
4-
= yield
2+
- if options[:text].nil? && block_given?
3+
= yield
54
- else
65
= options[:text]
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Matestack::Ui::Core::Onclick
22
class Onclick < Matestack::Ui::Core::Component::Dynamic
33

4-
5-
end
64
end
5+
end

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def slot(&block)
6565
Matestack::Ui::Core::PageNode.build(self, nil, context[:params], &block)
6666
end
6767

68-
6968
def show(component_key=nil, only_page=false)
7069
prepare
7170
response
@@ -106,7 +105,6 @@ def show(component_key=nil, only_page=false)
106105
end
107106
end
108107

109-
110108
def page_id
111109
@custom_page_id ||= @page_id
112110
end
@@ -145,7 +143,5 @@ def set_app_class
145143
end
146144
end
147145

148-
149146
end
150-
151147
end
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
- if options[:text].nil?
2-
%p{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
6-
- else
7-
%p{@tag_attributes}
1+
%p{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
85
= options[:text]
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
- if options[:text].nil?
2-
%p{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
6-
- else
7-
%p{@tag_attributes}
1+
%p{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
85
= options[:text]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ def show
66
end
77

88
end
9-
109
end
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
%summary{@tag_attributes}
2-
- if options[:text].blank?
3-
- if block_given?
4-
= yield
2+
- if options[:text].nil? && block_given?
3+
= yield
54
- else
65
= options[:text]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module Matestack::Ui::Core::Summary
22
class Summary < Matestack::Ui::Core::Component::Static
3+
34
end
45
end
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
- if options[:text].nil?
2-
%td{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
6-
- else
7-
%td{@tag_attributes}
1+
%td{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
85
= options[:text]
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
- if options[:text].nil?
2-
%th{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
6-
- else
7-
%th{@tag_attributes}
1+
%th{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
85
= options[:text]
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
- if options[:text].nil?
2-
%a{@tag_attributes}
3-
- if block_given?
4-
= yield
5-
- else
6-
%a{@tag_attributes}
1+
%a{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
75
= options[:text]
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module Matestack::Ui::Core::View::Cell
22
class View < Matestack::Ui::Core::Component::Dynamic
33

4-
5-
end
64
end
7-
5+
end

0 commit comments

Comments
 (0)