matestack-ui-core 0.7.2

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.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +228 -0
  4. data/Rakefile +34 -0
  5. data/app/concepts/matestack/ui/core/abbr/abbr.haml +5 -0
  6. data/app/concepts/matestack/ui/core/abbr/abbr.rb +12 -0
  7. data/app/concepts/matestack/ui/core/absolute/absolute.haml +3 -0
  8. data/app/concepts/matestack/ui/core/absolute/absolute.rb +17 -0
  9. data/app/concepts/matestack/ui/core/action/action.haml +3 -0
  10. data/app/concepts/matestack/ui/core/action/action.js +49 -0
  11. data/app/concepts/matestack/ui/core/action/action.rb +52 -0
  12. data/app/concepts/matestack/ui/core/address/address.haml +5 -0
  13. data/app/concepts/matestack/ui/core/address/address.rb +5 -0
  14. data/app/concepts/matestack/ui/core/app/app.haml +4 -0
  15. data/app/concepts/matestack/ui/core/app/app.js +27 -0
  16. data/app/concepts/matestack/ui/core/app/app.rb +98 -0
  17. data/app/concepts/matestack/ui/core/app/store.js +70 -0
  18. data/app/concepts/matestack/ui/core/article/article.haml +5 -0
  19. data/app/concepts/matestack/ui/core/article/article.rb +5 -0
  20. data/app/concepts/matestack/ui/core/async/async.haml +2 -0
  21. data/app/concepts/matestack/ui/core/async/async.js +76 -0
  22. data/app/concepts/matestack/ui/core/async/async.rb +12 -0
  23. data/app/concepts/matestack/ui/core/blockquote/blockquote.haml +5 -0
  24. data/app/concepts/matestack/ui/core/blockquote/blockquote.rb +11 -0
  25. data/app/concepts/matestack/ui/core/br/br.haml +5 -0
  26. data/app/concepts/matestack/ui/core/br/br.rb +5 -0
  27. data/app/concepts/matestack/ui/core/button/button.haml +5 -0
  28. data/app/concepts/matestack/ui/core/button/button.rb +11 -0
  29. data/app/concepts/matestack/ui/core/caption/caption.haml +5 -0
  30. data/app/concepts/matestack/ui/core/caption/caption.rb +5 -0
  31. data/app/concepts/matestack/ui/core/collection/content/content.js +98 -0
  32. data/app/concepts/matestack/ui/core/collection/content/content.rb +18 -0
  33. data/app/concepts/matestack/ui/core/collection/content/next/next.haml +3 -0
  34. data/app/concepts/matestack/ui/core/collection/content/next/next.rb +5 -0
  35. data/app/concepts/matestack/ui/core/collection/content/page/link/link.haml +3 -0
  36. data/app/concepts/matestack/ui/core/collection/content/page/link/link.rb +5 -0
  37. data/app/concepts/matestack/ui/core/collection/content/previous/previous.haml +3 -0
  38. data/app/concepts/matestack/ui/core/collection/content/previous/previous.rb +5 -0
  39. data/app/concepts/matestack/ui/core/collection/filter/filter.js +48 -0
  40. data/app/concepts/matestack/ui/core/collection/filter/filter.rb +17 -0
  41. data/app/concepts/matestack/ui/core/collection/filter/input/input.haml +2 -0
  42. data/app/concepts/matestack/ui/core/collection/filter/input/input.rb +25 -0
  43. data/app/concepts/matestack/ui/core/collection/filter/reset/reset.haml +3 -0
  44. data/app/concepts/matestack/ui/core/collection/filter/reset/reset.rb +5 -0
  45. data/app/concepts/matestack/ui/core/collection/filter/submit/submit.haml +3 -0
  46. data/app/concepts/matestack/ui/core/collection/filter/submit/submit.rb +5 -0
  47. data/app/concepts/matestack/ui/core/collection/helper.rb +113 -0
  48. data/app/concepts/matestack/ui/core/collection/order/order.js +56 -0
  49. data/app/concepts/matestack/ui/core/collection/order/order.rb +17 -0
  50. data/app/concepts/matestack/ui/core/collection/order/toggle/indicator/indicator.rb +13 -0
  51. data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.haml +3 -0
  52. data/app/concepts/matestack/ui/core/collection/order/toggle/toggle.rb +5 -0
  53. data/app/concepts/matestack/ui/core/component/anonym-dynamic-component.js +10 -0
  54. data/app/concepts/matestack/ui/core/component/children.haml +2 -0
  55. data/app/concepts/matestack/ui/core/component/component.js +59 -0
  56. data/app/concepts/matestack/ui/core/component/dynamic.haml +6 -0
  57. data/app/concepts/matestack/ui/core/component/dynamic.rb +261 -0
  58. data/app/concepts/matestack/ui/core/component/dynamic_without_rerender.haml +2 -0
  59. data/app/concepts/matestack/ui/core/component/response.haml +2 -0
  60. data/app/concepts/matestack/ui/core/component/response_dynamic.haml +7 -0
  61. data/app/concepts/matestack/ui/core/component/response_dynamic_without_rerender.haml +3 -0
  62. data/app/concepts/matestack/ui/core/component/static.haml +1 -0
  63. data/app/concepts/matestack/ui/core/component/static.rb +16 -0
  64. data/app/concepts/matestack/ui/core/details/details.haml +3 -0
  65. data/app/concepts/matestack/ui/core/details/details.rb +5 -0
  66. data/app/concepts/matestack/ui/core/div/div.haml +3 -0
  67. data/app/concepts/matestack/ui/core/div/div.rb +5 -0
  68. data/app/concepts/matestack/ui/core/footer/footer.haml +3 -0
  69. data/app/concepts/matestack/ui/core/footer/footer.rb +5 -0
  70. data/app/concepts/matestack/ui/core/form/form.haml +2 -0
  71. data/app/concepts/matestack/ui/core/form/form.js +136 -0
  72. data/app/concepts/matestack/ui/core/form/form.rb +71 -0
  73. data/app/concepts/matestack/ui/core/form/inline/inline.haml +6 -0
  74. data/app/concepts/matestack/ui/core/form/inline/inline.rb +9 -0
  75. data/app/concepts/matestack/ui/core/form/input/input.haml +27 -0
  76. data/app/concepts/matestack/ui/core/form/input/input.rb +74 -0
  77. data/app/concepts/matestack/ui/core/form/select/select.haml +76 -0
  78. data/app/concepts/matestack/ui/core/form/select/select.rb +73 -0
  79. data/app/concepts/matestack/ui/core/form/submit/submit.haml +3 -0
  80. data/app/concepts/matestack/ui/core/form/submit/submit.rb +9 -0
  81. data/app/concepts/matestack/ui/core/header/header.haml +3 -0
  82. data/app/concepts/matestack/ui/core/header/header.rb +5 -0
  83. data/app/concepts/matestack/ui/core/heading/heading.haml +50 -0
  84. data/app/concepts/matestack/ui/core/heading/heading.rb +5 -0
  85. data/app/concepts/matestack/ui/core/hr/hr.haml +1 -0
  86. data/app/concepts/matestack/ui/core/hr/hr.rb +5 -0
  87. data/app/concepts/matestack/ui/core/html/html.haml +3 -0
  88. data/app/concepts/matestack/ui/core/html/html.js +10 -0
  89. data/app/concepts/matestack/ui/core/html/html.rb +17 -0
  90. data/app/concepts/matestack/ui/core/icon/icon.haml +5 -0
  91. data/app/concepts/matestack/ui/core/icon/icon.rb +5 -0
  92. data/app/concepts/matestack/ui/core/img/img.haml +1 -0
  93. data/app/concepts/matestack/ui/core/img/img.rb +5 -0
  94. data/app/concepts/matestack/ui/core/input/input.haml +3 -0
  95. data/app/concepts/matestack/ui/core/input/input.rb +5 -0
  96. data/app/concepts/matestack/ui/core/isolate/isolate.haml +2 -0
  97. data/app/concepts/matestack/ui/core/isolate/isolate.rb +11 -0
  98. data/app/concepts/matestack/ui/core/js/core.js +30 -0
  99. data/app/concepts/matestack/ui/core/js/event-hub.js +5 -0
  100. data/app/concepts/matestack/ui/core/js/helpers/query-params-helper.js +56 -0
  101. data/app/concepts/matestack/ui/core/label/label.haml +5 -0
  102. data/app/concepts/matestack/ui/core/label/label.rb +5 -0
  103. data/app/concepts/matestack/ui/core/li/li.haml +5 -0
  104. data/app/concepts/matestack/ui/core/li/li.rb +5 -0
  105. data/app/concepts/matestack/ui/core/link/link.haml +5 -0
  106. data/app/concepts/matestack/ui/core/link/link.rb +26 -0
  107. data/app/concepts/matestack/ui/core/main/main.haml +3 -0
  108. data/app/concepts/matestack/ui/core/main/main.rb +5 -0
  109. data/app/concepts/matestack/ui/core/nav/nav.haml +3 -0
  110. data/app/concepts/matestack/ui/core/nav/nav.rb +5 -0
  111. data/app/concepts/matestack/ui/core/ol/ol.haml +3 -0
  112. data/app/concepts/matestack/ui/core/ol/ol.rb +5 -0
  113. data/app/concepts/matestack/ui/core/onclick/onclick.haml +2 -0
  114. data/app/concepts/matestack/ui/core/onclick/onclick.js +21 -0
  115. data/app/concepts/matestack/ui/core/onclick/onclick.rb +5 -0
  116. data/app/concepts/matestack/ui/core/page/content.haml +7 -0
  117. data/app/concepts/matestack/ui/core/page/content.js +17 -0
  118. data/app/concepts/matestack/ui/core/page/content.rb +5 -0
  119. data/app/concepts/matestack/ui/core/page/page.haml +9 -0
  120. data/app/concepts/matestack/ui/core/page/page.rb +175 -0
  121. data/app/concepts/matestack/ui/core/paragraph/paragraph.haml +5 -0
  122. data/app/concepts/matestack/ui/core/paragraph/paragraph.rb +5 -0
  123. data/app/concepts/matestack/ui/core/partial/partial.haml +2 -0
  124. data/app/concepts/matestack/ui/core/partial/partial.rb +5 -0
  125. data/app/concepts/matestack/ui/core/pg/pg.haml +5 -0
  126. data/app/concepts/matestack/ui/core/pg/pg.rb +5 -0
  127. data/app/concepts/matestack/ui/core/plain/plain.rb +9 -0
  128. data/app/concepts/matestack/ui/core/progress/progress.haml +3 -0
  129. data/app/concepts/matestack/ui/core/progress/progress.rb +14 -0
  130. data/app/concepts/matestack/ui/core/section/section.haml +3 -0
  131. data/app/concepts/matestack/ui/core/section/section.rb +5 -0
  132. data/app/concepts/matestack/ui/core/slot/slot.haml +2 -0
  133. data/app/concepts/matestack/ui/core/slot/slot.rb +5 -0
  134. data/app/concepts/matestack/ui/core/small/small.haml +5 -0
  135. data/app/concepts/matestack/ui/core/small/small.rb +5 -0
  136. data/app/concepts/matestack/ui/core/span/span.haml +5 -0
  137. data/app/concepts/matestack/ui/core/span/span.rb +5 -0
  138. data/app/concepts/matestack/ui/core/strong/strong.haml +5 -0
  139. data/app/concepts/matestack/ui/core/strong/strong.rb +5 -0
  140. data/app/concepts/matestack/ui/core/sub/sub.haml +5 -0
  141. data/app/concepts/matestack/ui/core/sub/sub.rb +5 -0
  142. data/app/concepts/matestack/ui/core/summary/summary.haml +5 -0
  143. data/app/concepts/matestack/ui/core/summary/summary.rb +5 -0
  144. data/app/concepts/matestack/ui/core/table/table.haml +3 -0
  145. data/app/concepts/matestack/ui/core/table/table.rb +5 -0
  146. data/app/concepts/matestack/ui/core/tbody/tbody.haml +3 -0
  147. data/app/concepts/matestack/ui/core/tbody/tbody.rb +5 -0
  148. data/app/concepts/matestack/ui/core/td/td.haml +5 -0
  149. data/app/concepts/matestack/ui/core/td/td.rb +5 -0
  150. data/app/concepts/matestack/ui/core/tfoot/tfoot.haml +3 -0
  151. data/app/concepts/matestack/ui/core/tfoot/tfoot.rb +5 -0
  152. data/app/concepts/matestack/ui/core/th/th.haml +5 -0
  153. data/app/concepts/matestack/ui/core/th/th.rb +5 -0
  154. data/app/concepts/matestack/ui/core/thead/thead.haml +3 -0
  155. data/app/concepts/matestack/ui/core/thead/thead.rb +5 -0
  156. data/app/concepts/matestack/ui/core/time/time.haml +3 -0
  157. data/app/concepts/matestack/ui/core/time/time.rb +11 -0
  158. data/app/concepts/matestack/ui/core/tr/tr.haml +3 -0
  159. data/app/concepts/matestack/ui/core/tr/tr.rb +5 -0
  160. data/app/concepts/matestack/ui/core/transition/transition.haml +5 -0
  161. data/app/concepts/matestack/ui/core/transition/transition.js +26 -0
  162. data/app/concepts/matestack/ui/core/transition/transition.rb +31 -0
  163. data/app/concepts/matestack/ui/core/ul/ul.haml +3 -0
  164. data/app/concepts/matestack/ui/core/ul/ul.rb +5 -0
  165. data/app/concepts/matestack/ui/core/video/video.haml +1 -0
  166. data/app/concepts/matestack/ui/core/video/video.rb +7 -0
  167. data/app/concepts/matestack/ui/core/view/view.haml +2 -0
  168. data/app/concepts/matestack/ui/core/view/view.js +42 -0
  169. data/app/concepts/matestack/ui/core/view/view.rb +5 -0
  170. data/app/concepts/matestack/ui/core/youtube/youtube.haml +1 -0
  171. data/app/concepts/matestack/ui/core/youtube/youtube.rb +26 -0
  172. data/app/helpers/matestack/ui/core/application_helper.rb +35 -0
  173. data/app/lib/matestack/ui/app.rb +1 -0
  174. data/app/lib/matestack/ui/core/app_node.rb +53 -0
  175. data/app/lib/matestack/ui/core/component_node.rb +73 -0
  176. data/app/lib/matestack/ui/core/page_node.rb +96 -0
  177. data/app/lib/matestack/ui/core/to_cell.rb +129 -0
  178. data/app/lib/matestack/ui/dynamic_component.rb +1 -0
  179. data/app/lib/matestack/ui/page.rb +1 -0
  180. data/app/lib/matestack/ui/static_component.rb +1 -0
  181. data/config/routes.rb +3 -0
  182. data/lib/generators/matestack_app/USAGE +21 -0
  183. data/lib/generators/matestack_app/matestack_app_generator.rb +26 -0
  184. data/lib/generators/matestack_app/templates/matestack_app.erb +26 -0
  185. data/lib/generators/matestack_app/templates/matestack_app_controller.erb +7 -0
  186. data/lib/generators/matestack_component/USAGE +20 -0
  187. data/lib/generators/matestack_component/matestack_component_generator.rb +30 -0
  188. data/lib/generators/matestack_component/templates/matestack_component.haml.erb +5 -0
  189. data/lib/generators/matestack_component/templates/matestack_component.js.erb +17 -0
  190. data/lib/generators/matestack_component/templates/matestack_component.rb.erb +13 -0
  191. data/lib/generators/matestack_component/templates/matestack_component.scss.erb +1 -0
  192. data/lib/generators/matestack_page/USAGE +28 -0
  193. data/lib/generators/matestack_page/matestack_page_generator.rb +41 -0
  194. data/lib/generators/matestack_page/templates/matestack_page.erb +15 -0
  195. data/lib/matestack/ui/core.rb +15 -0
  196. data/lib/matestack/ui/core/engine.rb +19 -0
  197. data/lib/matestack/ui/core/version.rb +7 -0
  198. data/lib/tasks/matestack/ui/core_tasks.rake +4 -0
  199. data/vendor/assets/javascripts/manifest.json +4 -0
  200. data/vendor/assets/javascripts/matestack-ui-core.js +15309 -0
  201. data/vendor/assets/javascripts/matestack-ui-core.js.map +1 -0
  202. metadata +350 -0
@@ -0,0 +1,5 @@
1
+ module Matestack::Ui::Core::Address
2
+ class Address < Matestack::Ui::Core::Component::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ %component{"is": "matestack-ui-core-app", "inline-template": true}
2
+ %div{"class": "matestack_app"}
3
+ - @cells.each do |key, cell|
4
+ = cell.call(:show)
@@ -0,0 +1,27 @@
1
+ import Vue from 'vue/dist/vue.esm'
2
+ import axios from 'axios'
3
+ import VRuntimeTemplate from "v-runtime-template"
4
+ import Vuex from 'vuex'
5
+
6
+ const componentDef = {
7
+ props: ['appConfig', 'params'],
8
+ data: function(){
9
+ return {}
10
+ },
11
+ computed: Vuex.mapState({
12
+ asyncTemplate: state => state.pageTemplate,
13
+ }),
14
+ mounted: function(){
15
+ const self = this;
16
+ window.onpopstate = function(event) {
17
+ self.$store.dispatch("navigateTo", {url: document.location.pathname, backwards: true} );
18
+ }
19
+ },
20
+ components: {
21
+ VRuntimeTemplate: VRuntimeTemplate
22
+ }
23
+ }
24
+
25
+ let component = Vue.component('matestack-ui-core-app', componentDef)
26
+
27
+ export default componentDef
@@ -0,0 +1,98 @@
1
+ module Matestack::Ui::Core::App
2
+ class App < Trailblazer::Cell
3
+ include ActionView::Helpers::ActiveModelHelper
4
+ include ActionView::Helpers::ActiveModelInstanceTag
5
+ include ActionView::Helpers::AssetTagHelper
6
+ include ActionView::Helpers::AssetUrlHelper
7
+ include ActionView::Helpers::AtomFeedHelper
8
+ include ActionView::Helpers::CacheHelper
9
+ include ActionView::Helpers::CaptureHelper
10
+ include ActionView::Helpers::CspHelper
11
+ include ActionView::Helpers::CsrfHelper
12
+ include ActionView::Helpers::DateHelper
13
+ include ActionView::Helpers::DebugHelper
14
+ include ActionView::Helpers::FormHelper
15
+ include ActionView::Helpers::FormOptionsHelper
16
+ include ActionView::Helpers::FormTagHelper
17
+ include ActionView::Helpers::JavaScriptHelper
18
+ include ActionView::Helpers::NumberHelper
19
+ include ActionView::Helpers::OutputSafetyHelper
20
+ include ActionView::Helpers::RecordTagHelper
21
+ # include ActionView::Helpers::RenderingHelper
22
+ include ActionView::Helpers::SanitizeHelper
23
+ include ActionView::Helpers::TagHelper
24
+ include ActionView::Helpers::TextHelper
25
+ include ActionView::Helpers::TranslationHelper
26
+ include ActionView::Helpers::UrlHelper
27
+ include ::Cell::Haml
28
+ include Matestack::Ui::Core::ApplicationHelper
29
+ include Matestack::Ui::Core::ToCell
30
+ # include ::Rails.application.routes.url_helpers
31
+
32
+ view_paths << "#{Matestack::Ui::Core::Engine.root}/app/concepts"
33
+
34
+ extend ViewName::Flat
35
+
36
+ def self.prefixes
37
+ _prefixes = super
38
+ modified_prefixes = _prefixes.map do |prefix|
39
+ prefix_parts = prefix.split("/")
40
+
41
+ if prefix_parts.last.include?(self.name.split("::")[-1].downcase)
42
+ prefix_parts[0..-2].join("/")
43
+ else
44
+ prefix
45
+ end
46
+
47
+ end
48
+
49
+ return modified_prefixes
50
+ end
51
+
52
+ def self.views_dir
53
+ return ""
54
+ end
55
+
56
+ def initialize(model=nil, options={})
57
+ super
58
+ @nodes = {}
59
+ @cells = {}
60
+ @page_block = nil
61
+ @page_id = ""
62
+ setup
63
+ end
64
+
65
+ def setup
66
+ true
67
+ end
68
+
69
+ def prepare
70
+ true
71
+ end
72
+
73
+ def show(page_id, page_nodes, &block)
74
+ @page_id = page_id
75
+ @page_nodes = page_nodes
76
+ prepare
77
+ response
78
+ render(view: :app, &block)
79
+ end
80
+
81
+ def page_nodes
82
+ @page_nodes
83
+ end
84
+
85
+ def components(&block)
86
+ @nodes = Matestack::Ui::Core::AppNode.build(self, &block)
87
+
88
+ @nodes.each do |key, node|
89
+ @cells[key] = to_cell(key, node["component_name"], node["config"], node["argument"], node["components"], nil, node["cached_params"])
90
+ end
91
+ end
92
+
93
+ def partial(&block)
94
+ Matestack::Ui::Core::AppNode.build(self, &block)
95
+ end
96
+
97
+ end
98
+ end
@@ -0,0 +1,70 @@
1
+ import Vue from 'vue/dist/vue.esm'
2
+ import Vuex from 'vuex'
3
+ import axios from 'axios'
4
+ import matestackEventHub from 'js/event-hub'
5
+
6
+ Vue.use(Vuex)
7
+
8
+ const store = new Vuex.Store({
9
+ state: {
10
+ pageTemplate: null,
11
+ currentPath: document.location.pathname
12
+ },
13
+ mutations: {
14
+ setPageTemplate (state, serverResponse){
15
+ state.pageTemplate = serverResponse
16
+ },
17
+ setCurrentPath (state, path){
18
+ state.currentPath = path
19
+ }
20
+ },
21
+ actions: {
22
+ navigateTo ({ commit, state }, { url, backwards }) {
23
+ matestackEventHub.$emit("page_loading", url);
24
+ if (typeof matestackUiCoreTransitionStart !== 'undefined') {
25
+ matestackUiCoreTransitionStart(url);
26
+ }
27
+ if (!window.history.pushState) {
28
+ document.location.href = url;
29
+ return;
30
+ }
31
+ return new Promise((resolve, reject) => {
32
+ axios({
33
+ method: "get",
34
+ url: url,
35
+ headers: {
36
+ 'X-CSRF-Token': document.getElementsByName("csrf-token")[0].getAttribute('content')
37
+ },
38
+ params: {"only_page": true}
39
+ })
40
+ .then(function(response){
41
+ if (backwards){
42
+ window.history.replaceState({matestackApp: true, url: url}, null, url);
43
+ } else {
44
+ window.history.pushState({matestackApp: true, url: url}, null, url);
45
+ }
46
+ setTimeout(function () {
47
+ resolve(response["data"])
48
+ commit('setPageTemplate', response["data"])
49
+ commit('setCurrentPath', url)
50
+ matestackEventHub.$emit("page_loaded", url);
51
+ if (typeof matestackUiCoreTransitionSuccess !== 'undefined') {
52
+ matestackUiCoreTransitionSuccess(url);
53
+ }
54
+ }, 5);
55
+ })
56
+ .catch(function(error){
57
+ setTimeout(function () {
58
+ resolve(error)
59
+ matestackEventHub.$emit("page_loading_error", error);
60
+ if (typeof matestackUiCoreTransitionError !== 'undefined') {
61
+ matestackUiCoreTransitionError(url);
62
+ }
63
+ }, 5);
64
+ })
65
+ })
66
+ }
67
+ }
68
+ })
69
+
70
+ export default store
@@ -0,0 +1,5 @@
1
+ %article{@tag_attributes}
2
+ - if options[:text].nil? && block_given?
3
+ = yield
4
+ - else
5
+ = options[:text]
@@ -0,0 +1,5 @@
1
+ module Matestack::Ui::Core::Article
2
+ class Article < Matestack::Ui::Core::Component::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ %div{@tag_attributes}
2
+ = yield
@@ -0,0 +1,76 @@
1
+ import Vue from 'vue/dist/vue.esm'
2
+ import matestackEventHub from 'js/event-hub'
3
+ import componentMixin from 'component/component'
4
+
5
+ const componentDef = {
6
+ mixins: [componentMixin],
7
+ data: function(){
8
+ return {
9
+ showing: true,
10
+ hide_after_timeout: null,
11
+ event: {
12
+ data: {}
13
+ }
14
+ }
15
+ },
16
+ methods: {
17
+ show: function(event_data){
18
+ const self = this
19
+ if (this.showing === true){
20
+ return
21
+ }
22
+ this.showing = true
23
+ this.event.data = event_data
24
+ if(this.componentConfig["defer"] != undefined){
25
+ if(!isNaN(this.componentConfig["defer"])){
26
+ this.startDefer()
27
+ }
28
+ }
29
+ if(this.componentConfig["hide_after"] != undefined){
30
+ self.hide_after_timeout = setTimeout(function () {
31
+ self.hide()
32
+ }, parseInt(this.componentConfig["hide_after"]));
33
+ }
34
+ },
35
+ hide: function(){
36
+ this.showing = false
37
+ this.event.data = {}
38
+ },
39
+ startDefer: function(){
40
+ const self = this
41
+ setTimeout(function () {
42
+ self.rerender()
43
+ }, parseInt(this.componentConfig["defer"]));
44
+ }
45
+ },
46
+ created: function () {
47
+ const self = this
48
+ matestackEventHub.$on(this.componentConfig["rerender_on"], self.rerender)
49
+ matestackEventHub.$on(this.componentConfig["show_on"], self.show)
50
+ matestackEventHub.$on(this.componentConfig["hide_on"], self.hide)
51
+ if(this.componentConfig["show_on"] != undefined){
52
+ this.showing = false
53
+ }
54
+ if(this.componentConfig["defer"] != undefined){
55
+ if(!isNaN(this.componentConfig["defer"])){
56
+ if (this.componentConfig["show_on"] == undefined){
57
+ this.startDefer()
58
+ }
59
+ }
60
+ }
61
+ if(this.componentConfig["init_show"] == true){
62
+ this.showing = true
63
+ }
64
+ },
65
+ beforeDestroy: function() {
66
+ const self = this
67
+ clearTimeout(self.hide_after_timeout)
68
+ matestackEventHub.$off(this.componentConfig["rerender_on"], self.rerender);
69
+ matestackEventHub.$off(this.componentConfig["show_on"], self.show);
70
+ matestackEventHub.$off(this.componentConfig["hide_on"], self.hide);
71
+ },
72
+ }
73
+
74
+ let component = Vue.component('matestack-ui-core-async', componentDef)
75
+
76
+ export default componentDef
@@ -0,0 +1,12 @@
1
+ module Matestack::Ui::Core::Async
2
+ class Async < Matestack::Ui::Core::Component::Dynamic
3
+
4
+ def setup
5
+ @rerender = true
6
+ @tag_attributes.merge!({
7
+ "v-if": "showing"
8
+ })
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ %blockquote{@tag_attributes}
2
+ - if options[:text].nil? && block_given?
3
+ = yield
4
+ - else
5
+ = options[:text]
@@ -0,0 +1,11 @@
1
+ module Matestack::Ui::Core::Blockquote
2
+ class Blockquote < Matestack::Ui::Core::Component::Static
3
+
4
+ def setup
5
+ @tag_attributes.merge!({
6
+ "cite": options[:cite]
7
+ })
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ - unless options[:times].nil?
2
+ - options[:times].times do
3
+ %br{@tag_attributes}
4
+ - else
5
+ %br{@tag_attributes}
@@ -0,0 +1,5 @@
1
+ module Matestack::Ui::Core::Br
2
+ class Br < Matestack::Ui::Core::Component::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ %button{@tag_attributes}
2
+ - if options[:text].nil? && block_given?
3
+ = yield
4
+ - else
5
+ = options[:text]
@@ -0,0 +1,11 @@
1
+ module Matestack::Ui::Core::Button
2
+ class Button < Matestack::Ui::Core::Component::Static
3
+
4
+ def setup
5
+ @tag_attributes.merge!({
6
+ "disabled": options[:disabled] ||= nil
7
+ })
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ %caption{@tag_attributes}
2
+ - if options[:text].nil? && block_given?
3
+ = yield
4
+ - else
5
+ = options[:text]
@@ -0,0 +1,5 @@
1
+ module Matestack::Ui::Core::Caption
2
+ class Caption < Matestack::Ui::Core::Component::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,98 @@
1
+ import Vue from 'vue/dist/vue.esm'
2
+ import matestackEventHub from 'js/event-hub'
3
+ import queryParamsHelper from 'js/helpers/query-params-helper'
4
+ import componentMixin from 'component/component'
5
+ import asyncMixin from 'async/async'
6
+
7
+ const componentDef = {
8
+ mixins: [componentMixin, asyncMixin],
9
+ data: function(){
10
+ return {
11
+ currentLimit: null,
12
+ currentOffset: null,
13
+ currentFilteredCount: null,
14
+ currentBaseCount: null
15
+ }
16
+ },
17
+ methods: {
18
+ next: function(){
19
+ if (this.currentTo() < this.currentCount()){
20
+ this.currentOffset += this.currentLimit
21
+ var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
22
+ window.history.pushState({matestackApp: true, url: url}, null, url);
23
+ matestackEventHub.$emit(this.componentConfig["id"] + "-update")
24
+ }
25
+ },
26
+ previous: function(){
27
+ if ((this.currentOffset - this.currentLimit)*-1 != this.currentLimit){
28
+ if((this.currentOffset - this.currentLimit) < 0){
29
+ this.currentOffset = 0
30
+ } else {
31
+ this.currentOffset -= this.currentLimit
32
+ }
33
+ var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
34
+ window.history.pushState({matestackApp: true, url: url}, null, url);
35
+ matestackEventHub.$emit(this.componentConfig["id"] + "-update")
36
+ }
37
+ },
38
+ currentTo: function(){
39
+ var to = parseInt(this.currentOffset) + parseInt(this.currentLimit)
40
+ if (to > parseInt(this.currentCount())){
41
+ return this.currentCount();
42
+ } else {
43
+ return to;
44
+ }
45
+ },
46
+ currentCount: function(){
47
+ if (this.currentFilteredCount != null || this.currentFilteredCount != undefined){
48
+ return this.currentFilteredCount;
49
+ } else {
50
+ return this.currentBaseCount;
51
+ }
52
+ },
53
+ goToPage: function(page){
54
+ this.currentOffset = parseInt(this.currentLimit) * (parseInt(page)-1)
55
+ var url = queryParamsHelper.updateQueryParams(this.componentConfig["id"] + "-offset", this.currentOffset)
56
+ window.history.pushState({matestackApp: true, url: url}, null, url);
57
+ matestackEventHub.$emit(this.componentConfig["id"] + "-update")
58
+ }
59
+ },
60
+ mounted: function(){
61
+ if(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-offset") != null){
62
+ this.currentOffset = parseInt(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-offset"))
63
+ } else {
64
+ if(this.componentConfig["init_offset"] != undefined){
65
+ this.currentOffset = this.componentConfig["init_offset"]
66
+ } else {
67
+ this.currentOffset = 0
68
+ }
69
+ }
70
+
71
+ if(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-limit") != null){
72
+ this.currentOffset = parseInt(queryParamsHelper.getQueryParam(this.componentConfig["id"] + "-limit"))
73
+ } else {
74
+ if(this.componentConfig["init_limit"] != undefined){
75
+ this.currentLimit = this.componentConfig["init_limit"]
76
+ } else {
77
+ this.currentLimit = 10
78
+ }
79
+ }
80
+
81
+ if(this.componentConfig["filtered_count"] != undefined){
82
+ this.currentFilteredCount = this.componentConfig["filtered_count"]
83
+ if(this.currentOffset >= this.currentFilteredCount){
84
+ this.previous()
85
+ }
86
+ }
87
+ if(this.componentConfig["base_count"] != undefined){
88
+ this.currentBaseCount = this.componentConfig["base_count"]
89
+ if(this.currentOffset >= this.currentBaseCount){
90
+ this.previous()
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ let component = Vue.component('matestack-ui-core-collection-content', componentDef)
97
+
98
+ export default componentDef