Skip to content

Commit 5e9fa14

Browse files
committed
Merge branch 'develop' into implementing_issue_59
2 parents 3bbed50 + ea297e3 commit 5e9fa14

Some content is hidden

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

41 files changed

+1412
-228
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ const componentDef = {
1818
methods: {
1919
show: function(event_data){
2020
const self = this
21+
if (this.showing === true){
22+
return
23+
}
2124
this.showing = true
2225
this.event.data = event_data
26+
if(this.componentConfig["defer"] != undefined){
27+
if(!isNaN(this.componentConfig["defer"])){
28+
this.startDefer()
29+
}
30+
}
2331
if(this.componentConfig["hide_after"] != undefined){
2432
self.hide_after_timeout = setTimeout(function () {
2533
self.hide()
@@ -29,6 +37,12 @@ const componentDef = {
2937
hide: function(){
3038
this.showing = false
3139
this.event.data = {}
40+
},
41+
startDefer: function(){
42+
const self = this
43+
setTimeout(function () {
44+
self.rerender()
45+
}, parseInt(this.componentConfig["defer"]));
3246
}
3347
},
3448
created: function () {
@@ -39,8 +53,12 @@ const componentDef = {
3953
if(this.componentConfig["show_on"] != undefined){
4054
this.showing = false
4155
}
42-
if(this.componentConfig["hide_on"] != undefined){
43-
this.showing = true
56+
if(this.componentConfig["defer"] != undefined){
57+
if(!isNaN(this.componentConfig["defer"])){
58+
if (this.componentConfig["show_on"] == undefined){
59+
this.startDefer()
60+
}
61+
}
4462
}
4563
},
4664
beforeDestroy: function() {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
%blockquote{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Matestack::Ui::Core::Blockquote
2+
class Blockquote < Matestack::Ui::Core::Component::Static
3+
def setup
4+
@tag_attributes.merge!({
5+
"cite": options[:cite]
6+
})
7+
end
8+
end
9+
end
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%caption{@tag_attributes}
2+
- if options[:text].nil?
3+
- if block_given?
4+
= yield
5+
- else
6+
= options[:text]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Matestack::Ui::Core::Caption
2+
class Caption < Matestack::Ui::Core::Component::Static
3+
4+
end
5+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
%details{@tag_attributes}
2+
- if block_given?
3+
= yield
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Matestack::Ui::Core::Details
2+
class Details < Matestack::Ui::Core::Component::Static
3+
end
4+
end
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
- if options[:text].nil?
2-
= link_to link_path, @tag_attributes do
3-
- if block_given?
4-
= yield
5-
- else
6-
= link_to options[:text], link_path, @tag_attributes
1+
%a{@tag_attributes}
2+
- if options[:text].nil? && block_given?
3+
= yield
4+
- else
5+
= options[:text]

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ class Link < Matestack::Ui::Core::Component::Static
44
REQUIRED_KEYS = [:path]
55

66
def setup
7-
@tag_attributes.merge!({ "class": options[:class],
7+
@tag_attributes.merge!({
8+
"class": options[:class],
89
"id": component_id,
910
"method": options[:method],
10-
"target": options[:target] ||= nil
11+
"target": options[:target] ||= nil,
12+
"href": link_path
1113
})
1214
end
1315

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

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def prepare
4848
end
4949

5050
def components(&block)
51-
@nodes = Matestack::Ui::Core::PageNode.build(self, nil, &block)
51+
@nodes = Matestack::Ui::Core::PageNode.build(self, nil, context[:params], &block)
5252
end
5353

5454
def nodes_to_cell
@@ -59,12 +59,10 @@ def nodes_to_cell
5959

6060
def partial(&block)
6161
return block
62-
# Matestack::Ui::Core::PageNode.build(self, included, &block)
6362
end
6463

6564
def slot(&block)
66-
# return block
67-
Matestack::Ui::Core::PageNode.build(self, nil, &block)
65+
Matestack::Ui::Core::PageNode.build(self, nil, context[:params], &block)
6866
end
6967

7068

@@ -82,25 +80,28 @@ def show(component_key=nil, only_page=false)
8280

8381
when :only_page
8482
nodes_to_cell
85-
# keys_array = ["div_2","components", "partial_1", "components", "form_1"]
86-
# puts @nodes.dig(*keys_array)
8783
render :page
8884
when :render_page_with_app
8985
concept(@app_class).call(:show, @page_id, @nodes)
9086
when :render_component
91-
if component_key.include?("__")
92-
keys_array = component_key.gsub("__", "__components__").split("__").map {|k| k.to_s}
93-
page_content_keys = keys_array.select{|key| key.match(/^page_content_/)}
94-
if page_content_keys.any?
95-
keys_array = keys_array.drop(keys_array.find_index(page_content_keys[0])+2)
87+
begin
88+
if component_key.include?("__")
89+
keys_array = component_key.gsub("__", "__components__").split("__").map {|k| k.to_s}
90+
page_content_keys = keys_array.select{|key| key.match(/^page_content_/)}
91+
if page_content_keys.any?
92+
keys_array = keys_array.drop(keys_array.find_index(page_content_keys[0])+2)
93+
end
94+
node = @nodes.dig(*keys_array)
95+
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
96+
return cell.render_content
97+
else
98+
node = @nodes[component_key]
99+
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
100+
return cell.render_content
96101
end
97-
node = @nodes.dig(*keys_array)
98-
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
99-
return cell.render_content
100-
else
101-
node = @nodes[component_key]
102-
cell = to_cell(component_key, node["component_name"], node["config"], node["argument"], node["components"], node["included_config"])
103-
return cell.render_content
102+
rescue
103+
raise "Component '#{component_key}' could not be resolved. Notice: Rerendering currently works only on page-level. \
104+
You are therefore currently not able to use 'async' within a component for example!"
104105
end
105106
end
106107
end

0 commit comments

Comments
 (0)