basemate-ui-core 0.2.0

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 (62) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +495 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/config/basemate_ui_core_manifest.js +2 -0
  6. data/app/assets/javascripts/basemate/ui/core/application.js +15 -0
  7. data/app/assets/stylesheets/basemate/ui/core/application.css +15 -0
  8. data/app/concepts/app/cell/app.rb +75 -0
  9. data/app/concepts/app/js/app.js +27 -0
  10. data/app/concepts/app/js/store.js +66 -0
  11. data/app/concepts/app/utils/app_node.rb +53 -0
  12. data/app/concepts/app/view/app.haml +4 -0
  13. data/app/concepts/component/cell/dynamic.rb +110 -0
  14. data/app/concepts/component/cell/static.rb +14 -0
  15. data/app/concepts/component/js/component.js +38 -0
  16. data/app/concepts/component/view/children.haml +2 -0
  17. data/app/concepts/component/view/dynamic.haml +6 -0
  18. data/app/concepts/component/view/static.haml +1 -0
  19. data/app/concepts/core/js/core.js +20 -0
  20. data/app/concepts/div/cell/div.rb +5 -0
  21. data/app/concepts/div/view/div.haml +3 -0
  22. data/app/concepts/header/cell/header.rb +5 -0
  23. data/app/concepts/header/view/header.haml +3 -0
  24. data/app/concepts/heading/cell/heading.rb +5 -0
  25. data/app/concepts/heading/view/heading.haml +50 -0
  26. data/app/concepts/html/cell/html.rb +17 -0
  27. data/app/concepts/html/js/html.js +10 -0
  28. data/app/concepts/html/view/html.haml +3 -0
  29. data/app/concepts/img/cell/img.rb +5 -0
  30. data/app/concepts/img/view/img.haml +1 -0
  31. data/app/concepts/link/cell/link.rb +14 -0
  32. data/app/concepts/link/view/link.haml +6 -0
  33. data/app/concepts/main/cell/main.rb +5 -0
  34. data/app/concepts/main/view/main.haml +3 -0
  35. data/app/concepts/nav/cell/nav.rb +5 -0
  36. data/app/concepts/nav/view/nav.haml +3 -0
  37. data/app/concepts/navigation/cell/button.rb +5 -0
  38. data/app/concepts/navigation/view/button.haml +3 -0
  39. data/app/concepts/page/cell/content.rb +5 -0
  40. data/app/concepts/page/cell/page.rb +110 -0
  41. data/app/concepts/page/utils/page_node.rb +51 -0
  42. data/app/concepts/page/view/content.haml +7 -0
  43. data/app/concepts/page/view/page.haml +3 -0
  44. data/app/concepts/partial/cell/partial.rb +5 -0
  45. data/app/concepts/partial/view/partial.haml +3 -0
  46. data/app/concepts/plain/cell/plain.rb +10 -0
  47. data/app/concepts/section/cell/section.rb +5 -0
  48. data/app/concepts/section/view/section.haml +3 -0
  49. data/app/concepts/shared/utils/to_cell.rb +27 -0
  50. data/app/concepts/span/cell/span.rb +5 -0
  51. data/app/concepts/span/view/span.haml +3 -0
  52. data/app/concepts/transition/cell/transition.rb +18 -0
  53. data/app/concepts/transition/js/transition.js +26 -0
  54. data/app/concepts/transition/view/transition.haml +6 -0
  55. data/app/controllers/basemate/ui/core/application_controller.rb +9 -0
  56. data/app/helpers/basemate/ui/core/application_helper.rb +35 -0
  57. data/config/routes.rb +2 -0
  58. data/lib/basemate/ui/core.rb +14 -0
  59. data/lib/basemate/ui/core/engine.rb +19 -0
  60. data/lib/basemate/ui/core/version.rb +7 -0
  61. data/lib/tasks/basemate/ui/core_tasks.rake +4 -0
  62. metadata +190 -0
@@ -0,0 +1,3 @@
1
+ %section{"class": options[:class], "id": component_id}
2
+ - if block_given?
3
+ = yield
@@ -0,0 +1,27 @@
1
+ module Shared::Utils::ToCell
2
+
3
+ def to_cell(key, component_name, config, argument, children)
4
+ request_uri = context[:request].env["REQUEST_URI"]
5
+ query_string = context[:request].env["QUERY_STRING"]
6
+
7
+ config.merge!(component_key: key)
8
+ config.merge!(children: children)
9
+ config.merge!(origin_url: request_uri.gsub("?" + query_string, ""))
10
+ config.merge!(url_params: context[:params])
11
+
12
+ name = component_name.gsub("_", "/")
13
+ if name.include?("/")
14
+ name = "#{name.split("/")[0]}/cell/#{name.split("/")[1]}"
15
+ else
16
+ name = "#{name}/cell/#{name}"
17
+ end
18
+
19
+ begin
20
+ concept(name, argument, config)
21
+ rescue
22
+ name = "components/" + name
23
+ concept(name, argument, config)
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,5 @@
1
+ module Span::Cell
2
+ class Span < Component::Cell::Static
3
+
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ %span{"class": options[:class], "id": component_id}
2
+ - if block_given?
3
+ = yield
@@ -0,0 +1,18 @@
1
+ module Transition::Cell
2
+ class Transition < Component::Cell::Dynamic
3
+
4
+ def setup
5
+ @component_config[:link_path] = link_path
6
+ end
7
+
8
+ def link_path
9
+ if options[:path].is_a?(Symbol)
10
+ return ::Rails.application.routes.url_helpers.send(options[:path], options[:params])
11
+ end
12
+ if options[:path].is_a?(String)
13
+ return options[:path]
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ import Vue from 'vue/dist/vue.esm'
2
+ import Vuex from 'vuex'
3
+ import componentMixin from 'component/js/component'
4
+
5
+ const componentDef = {
6
+ mixins: [componentMixin],
7
+ data: function(){
8
+ return {}
9
+ },
10
+ computed: Vuex.mapState({
11
+ isActive (state) {
12
+ return this.componentConfig["link_path"] === state.currentPath
13
+ }
14
+ }),
15
+ methods: {
16
+ navigateTo: function(url){
17
+ this.$store.dispatch('navigateTo', {url: url, backwards: false}).then((response) => {
18
+ // self.asyncTemplate = response;
19
+ })
20
+ }
21
+ }
22
+ }
23
+
24
+ let component = Vue.component('transition-cell', componentDef)
25
+
26
+ export default componentDef
@@ -0,0 +1,6 @@
1
+ - if options[:text].nil?
2
+ = link_to link_path, {"class": options[:class], "id": component_id, "@click.prevent": navigate_to(link_path), "v-bind:class": "{ active: isActive }"} do
3
+ - if block_given?
4
+ = yield
5
+ - else
6
+ = link_to options[:text], link_path, {"class": options[:class], "id": component_id, "@click.prevent": navigate_to(link_path), "v-bind:class": "{ active: isActive }"}
@@ -0,0 +1,9 @@
1
+ module Basemate
2
+ module Ui
3
+ module Core
4
+ class ApplicationController < ActionController::Base
5
+ protect_from_forgery with: :exception
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,35 @@
1
+ module Basemate
2
+ module Ui
3
+ module Core
4
+ module ApplicationHelper
5
+
6
+ def render_page(page_class, only_page=false)
7
+ page_class.new(nil, context: {
8
+ params: params,
9
+ request: request
10
+ }, controller_instance: self).call(:show, nil, only_page)
11
+ end
12
+
13
+ def render_component(page_class, component_key)
14
+ page_class.new(nil, context: {
15
+ params: params,
16
+ request: request
17
+ }, controller_instance: self).call(:show, component_key)
18
+ end
19
+
20
+ def responder_for(page_class, options = {})
21
+ unless params[:component_key].blank?
22
+ render plain: render_component(page_class, params[:component_key])
23
+ return
24
+ end
25
+ if params[:only_page]
26
+ render html: render_page(page_class, true)
27
+ else
28
+ render html: render_page(page_class), layout: true
29
+ end
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Basemate::Ui::Core::Engine.routes.draw do
2
+ end
@@ -0,0 +1,14 @@
1
+ require 'trailblazer'
2
+ require 'trailblazer/rails'
3
+ require 'trailblazer/cell'
4
+ require 'cell/haml'
5
+
6
+ require "basemate/ui/core/engine"
7
+
8
+ module Basemate
9
+ module Ui
10
+ module Core
11
+ # Your code goes here...
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Basemate
2
+ module Ui
3
+ module Core
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Basemate::Ui::Core
6
+
7
+ def self.activate
8
+ # Dir.glob(File.join(Rails.root, 'app/basemate/**/*.rb')) do |c|
9
+ # Rails.configuration.cache_classes ? require(c) : load(c)
10
+ # end
11
+ # Rails.configuration.autoload_paths << Dir.glob(File.join(Rails.root, 'config/basemate/**/*.rb'))
12
+ # require_dependency "#{Rails.root}/config/basemate-ui-core"
13
+ end
14
+
15
+ config.to_prepare &method(:activate).to_proc
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ module Basemate
2
+ module Ui
3
+ module Core
4
+ VERSION = '0.2.0'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :basemate_ui_core do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: basemate-ui-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonas Jabari
8
+ - Pascal Wengerter
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-10-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 5.0.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 5.0.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: trailblazer
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: trailblazer-rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: trailblazer-cells
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: cells-rails
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: cells-haml
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: Description of Basemate::Ui::Core.
99
+ email:
100
+ - jonas@basemate.io
101
+ - pascal@basemate.io
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - MIT-LICENSE
107
+ - README.md
108
+ - Rakefile
109
+ - app/assets/config/basemate_ui_core_manifest.js
110
+ - app/assets/javascripts/basemate/ui/core/application.js
111
+ - app/assets/stylesheets/basemate/ui/core/application.css
112
+ - app/concepts/app/cell/app.rb
113
+ - app/concepts/app/js/app.js
114
+ - app/concepts/app/js/store.js
115
+ - app/concepts/app/utils/app_node.rb
116
+ - app/concepts/app/view/app.haml
117
+ - app/concepts/component/cell/dynamic.rb
118
+ - app/concepts/component/cell/static.rb
119
+ - app/concepts/component/js/component.js
120
+ - app/concepts/component/view/children.haml
121
+ - app/concepts/component/view/dynamic.haml
122
+ - app/concepts/component/view/static.haml
123
+ - app/concepts/core/js/core.js
124
+ - app/concepts/div/cell/div.rb
125
+ - app/concepts/div/view/div.haml
126
+ - app/concepts/header/cell/header.rb
127
+ - app/concepts/header/view/header.haml
128
+ - app/concepts/heading/cell/heading.rb
129
+ - app/concepts/heading/view/heading.haml
130
+ - app/concepts/html/cell/html.rb
131
+ - app/concepts/html/js/html.js
132
+ - app/concepts/html/view/html.haml
133
+ - app/concepts/img/cell/img.rb
134
+ - app/concepts/img/view/img.haml
135
+ - app/concepts/link/cell/link.rb
136
+ - app/concepts/link/view/link.haml
137
+ - app/concepts/main/cell/main.rb
138
+ - app/concepts/main/view/main.haml
139
+ - app/concepts/nav/cell/nav.rb
140
+ - app/concepts/nav/view/nav.haml
141
+ - app/concepts/navigation/cell/button.rb
142
+ - app/concepts/navigation/view/button.haml
143
+ - app/concepts/page/cell/content.rb
144
+ - app/concepts/page/cell/page.rb
145
+ - app/concepts/page/utils/page_node.rb
146
+ - app/concepts/page/view/content.haml
147
+ - app/concepts/page/view/page.haml
148
+ - app/concepts/partial/cell/partial.rb
149
+ - app/concepts/partial/view/partial.haml
150
+ - app/concepts/plain/cell/plain.rb
151
+ - app/concepts/section/cell/section.rb
152
+ - app/concepts/section/view/section.haml
153
+ - app/concepts/shared/utils/to_cell.rb
154
+ - app/concepts/span/cell/span.rb
155
+ - app/concepts/span/view/span.haml
156
+ - app/concepts/transition/cell/transition.rb
157
+ - app/concepts/transition/js/transition.js
158
+ - app/concepts/transition/view/transition.haml
159
+ - app/controllers/basemate/ui/core/application_controller.rb
160
+ - app/helpers/basemate/ui/core/application_helper.rb
161
+ - config/routes.rb
162
+ - lib/basemate/ui/core.rb
163
+ - lib/basemate/ui/core/engine.rb
164
+ - lib/basemate/ui/core/version.rb
165
+ - lib/tasks/basemate/ui/core_tasks.rake
166
+ homepage: https://basemate.io
167
+ licenses:
168
+ - MIT
169
+ metadata: {}
170
+ post_install_message:
171
+ rdoc_options: []
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0'
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubyforge_project:
186
+ rubygems_version: 2.7.3
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: Summary of Basemate::Ui::Core.
190
+ test_files: []