rbbt-rest 1.8.43 → 1.8.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/rest/common/locate.rb +135 -73
  3. data/lib/rbbt/rest/common/misc.rb +16 -0
  4. data/lib/rbbt/rest/entity/locate.rb +0 -2
  5. data/share/views/public/js/app.js +1 -1
  6. data/share/views/public/js/rbbt.entity.js +14 -0
  7. data/share/views/public/js/rbbt.entity_list.js +17 -4
  8. data/share/views/public/js/rbbt.favourites.js +13 -6
  9. data/share/views/public/js/rbbt.plots/rbbt.plots.aesthetics.js +18 -0
  10. metadata +2 -71
  11. data/share/views/compass/old/base/backgrounds.sass +0 -41
  12. data/share/views/compass/old/base/blocks.sass +0 -92
  13. data/share/views/compass/old/base/color.sass +0 -66
  14. data/share/views/compass/old/base/colors.sass +0 -66
  15. data/share/views/compass/old/base/font-scale.sass +0 -20
  16. data/share/views/compass/old/base/fonts.sass +0 -56
  17. data/share/views/compass/old/base/hide.sass +0 -95
  18. data/share/views/compass/old/base/icon_content.scss +0 -569
  19. data/share/views/compass/old/base/icons.sass +0 -75
  20. data/share/views/compass/old/base/material.sass +0 -223
  21. data/share/views/compass/old/base/misc.sass +0 -2
  22. data/share/views/compass/old/base/screen_sizes.sass +0 -16
  23. data/share/views/compass/old/base/text.sass +0 -70
  24. data/share/views/compass/old/base/util.sass +0 -6
  25. data/share/views/compass/old/base/variables.sass +0 -68
  26. data/share/views/compass/old/base/variables/color.sass +0 -27
  27. data/share/views/compass/old/blocks.sass +0 -0
  28. data/share/views/compass/old/cards.sass +0 -131
  29. data/share/views/compass/old/color.sass +0 -10
  30. data/share/views/compass/old/color/blocks.sass +0 -0
  31. data/share/views/compass/old/color/buttons.sass +0 -36
  32. data/share/views/compass/old/color/elements.sass +0 -2
  33. data/share/views/compass/old/color/font.sass +0 -13
  34. data/share/views/compass/old/color/top_bar.sass +0 -18
  35. data/share/views/compass/old/elements.sass +0 -218
  36. data/share/views/compass/old/elements/buttons.sass +0 -18
  37. data/share/views/compass/old/elements/forms.sass +0 -197
  38. data/share/views/compass/old/elements/lists.sass +0 -14
  39. data/share/views/compass/old/elements/materials.sass +0 -1
  40. data/share/views/compass/old/elements/movement.sass +0 -84
  41. data/share/views/compass/old/elements/positions.sass +0 -18
  42. data/share/views/compass/old/elements/table.sass +0 -176
  43. data/share/views/compass/old/elements/tool.sass +0 -60
  44. data/share/views/compass/old/grid.sass +0 -3
  45. data/share/views/compass/old/init.sass +0 -9
  46. data/share/views/compass/old/layout.sass +0 -5
  47. data/share/views/compass/old/layout/body.sass +0 -23
  48. data/share/views/compass/old/layout/footer.sass +0 -44
  49. data/share/views/compass/old/layout/result.sass +0 -6
  50. data/share/views/compass/old/layout/reveal.sass +0 -50
  51. data/share/views/compass/old/layout/top_bar.sass +0 -99
  52. data/share/views/compass/old/layout/top_menu.sass +0 -87
  53. data/share/views/compass/old/menu.sass +0 -43
  54. data/share/views/compass/old/menu/accordion_menu.sass +0 -30
  55. data/share/views/compass/old/menu/actionable.sass +0 -1
  56. data/share/views/compass/old/menu/dropdown_menu.sass +0 -31
  57. data/share/views/compass/old/menu/hide.sass +0 -14
  58. data/share/views/compass/old/menu/menu.sass +0 -98
  59. data/share/views/compass/old/menu/tab_menu.sass +0 -14
  60. data/share/views/compass/old/menu/top_bar.sass +0 -105
  61. data/share/views/compass/old/menu/vertical_menu.sass +0 -21
  62. data/share/views/compass/old/mixins/_all.sass +0 -24
  63. data/share/views/compass/old/mixins/_blocks.sass +0 -79
  64. data/share/views/compass/old/mixins/_compass.sass +0 -0
  65. data/share/views/compass/old/mixins/_deps.sass +0 -5
  66. data/share/views/compass/old/mixins/_hide.sass +0 -76
  67. data/share/views/compass/old/mixins/_keyframes.scss +0 -4
  68. data/share/views/compass/old/mixins/_semantic-ui.sass +0 -2
  69. data/share/views/compass/old/new.sass +0 -1
  70. data/share/views/compass/old/offcanvas.sass +0 -52
  71. data/share/views/compass/old/position/basic.sass +0 -0
  72. data/share/views/compass/old/responsive.sass +0 -53
  73. data/share/views/compass/old/semantic-ui.css +0 -1
  74. data/share/views/compass/old/semantic-ui/semantic-ui.css +0 -19776
  75. data/share/views/compass/old/space/button.sass +0 -74
  76. data/share/views/compass/old/table.sass +0 -142
  77. data/share/views/compass/old/text.sass +0 -48
  78. data/share/views/compass/old/variables/colors.sass +0 -7
  79. data/share/views/compass/old/variables/sizes.sass +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29526f96e92a2c8cbad48da652bcf714ca4ab8f9
4
- data.tar.gz: f965b864cb23fbebdf0f05837126b1d758f1189c
3
+ metadata.gz: 60976796315c49b16fb12420e4dd05e3172431af
4
+ data.tar.gz: 515901d61eb491544dc75c863fe1b72ac0e3bdff
5
5
  SHA512:
6
- metadata.gz: a8750d42b17e64c1e29968d64e960ca2f91a0871b00fd2bd60db6b0ffd6e6e1063328b2aded017204fd0adeff8c71d59030c4e570e3fe9f4df557b0d9c85e7b4
7
- data.tar.gz: f49fa374c6561cb60ae60171abba73fcd5d1fb8129db50f27ec5a316566bdc293d1e79ef46ffc22f12402626325aab968ab2638b073accd8afef48b34d5aae7f
6
+ metadata.gz: 7d2d29a01a654bc06241b2df611b7df3b26a788e5925dda59436c88676e1983d81c7c1a756fe499868310541bf5c6f243eb66938ade86601662ff9aa9b49caae
7
+ data.tar.gz: 57a34fe10f44f56ef698bfd2b276d136f43d80fe4cc2d7531febd3318bd8d0f7c98bfb571a95008935e0ca7fac90ebe47eb658f52724f48b00b01b2bd12bbacf
@@ -3,6 +3,23 @@ module RbbtRESTHelpers
3
3
 
4
4
  class TemplateMissing < StandardError; end
5
5
 
6
+ #{{{ Common
7
+
8
+ def add_search_paths(path, resources)
9
+ resources.reverse.each do |resource|
10
+ name = Misc.snake_case(resource.to_s.gsub('/','_'))
11
+ path.prepend_search_path(name, resource)
12
+ end
13
+ end
14
+
15
+ def locate_server_file(template, resources, extension = nil)
16
+ path = Path.setup(template)
17
+ add_search_paths(path, resources)
18
+ return path.find if path.exists? and not path.directory?
19
+ path = path.set_extension(extension) if extension
20
+ return path.find if path.exists?
21
+ end
22
+
6
23
  #{{{ TEMPLATE
7
24
 
8
25
  def self.template_resources
@@ -12,24 +29,15 @@ module RbbtRESTHelpers
12
29
  def template_resources
13
30
  [Rbbt.www.views] + RbbtRESTHelpers.template_resources
14
31
  end
15
-
16
- def locate_template_from_resource(resource, template)
17
- resource[template + '.haml']
18
- end
19
32
 
20
33
  def locate_template(template)
21
- return Path.setup(template) if Open.exists?(template)
22
- return Path.setup(template+'.haml') if Open.exists?(template+'.haml')
23
- template_resources.each do |resource|
24
- path = locate_template_from_resource(resource, template)
25
- return path if path.exists?
26
- end
27
-
28
- raise TemplateMissing, "Template #{ template } not found"
34
+ path = locate_server_file(template, template_resources, 'haml')
35
+ raise TemplateMissing, "Template #{ template } not found" if path.nil?
36
+ path
29
37
  end
30
-
31
- #{{{ TEMPLATE
32
-
38
+
39
+ # {{{ FILE
40
+
33
41
  def self.file_resources
34
42
  @file_resources ||= template_resources
35
43
  end
@@ -37,33 +45,26 @@ module RbbtRESTHelpers
37
45
  def file_resources
38
46
  [Rbbt.www.views] + RbbtRESTHelpers.file_resources
39
47
  end
40
-
41
- def locate_file_from_resource(resource, file)
42
- resource[file]
43
- end
44
48
 
45
49
  def locate_file(file)
46
- file_resources.each do |resource|
47
- path = locate_file_from_resource(resource, file)
48
- return path if path.exists?
49
- end
50
-
51
- raise TemplateMissing, "File #{ file } not found"
50
+ path = locate_server_file(file, file_resources)
51
+ raise TemplateMissing, "File #{ file } not found" if path.nil?
52
+ path
52
53
  end
53
54
 
54
- def find_all_from_resource(resource, pattern)
55
- resource.glob(pattern)
56
- end
57
-
58
- def find_all(pattern)
59
- paths = []
60
- file_resources.each do |resource|
61
- paths.concat find_all_from_resource(resource, pattern)
62
- end
55
+ def find_all(file)
56
+ path = Path.setup(file)
57
+ add_search_paths(path, file_resources)
58
+ path.find_all
59
+ end
63
60
 
64
- paths
61
+ def glob_all(file)
62
+ path = Path.setup(file)
63
+ add_search_paths(path, file_resources)
64
+ path.glob_all
65
65
  end
66
66
 
67
+
67
68
  #{{{ SASS
68
69
 
69
70
  def self.add_sass_load_path(path)
@@ -78,43 +79,26 @@ module RbbtRESTHelpers
78
79
  [Rbbt.www.views.compass] + RbbtRESTHelpers.sass_resources
79
80
  end
80
81
 
81
- def locate_sass_from_resource(resource, template)
82
- resource[template + '.sass']
83
- end
84
-
85
82
  def locate_sass(template)
86
- sass_resources.each do |resource|
87
- path = locate_sass_from_resource(resource, template)
88
- return path if path.exists?
89
- end
90
-
91
- raise TemplateMissing, "Sass template #{ template } not found"
83
+ path = locate_server_file(template, sass_resources, 'sass')
84
+ raise TemplateMissing, "Sass file #{ template } not found" if path.nil?
85
+ path
92
86
  end
93
87
 
94
88
  #{{{ JAVASCRIPT
95
89
 
96
90
  def self.javascript_resources
97
- @javascript_resources ||= [Rbbt.share.views.public.find(:lib), Rbbt.share.views.public.js.find(:lib), Rbbt.share.views.public.plugins.find(:lib)]
91
+ @@javascript_resources ||= [Rbbt.share.views.public.find(:lib), Rbbt.share.views.public.js.find(:lib), Rbbt.share.views.public.plugins.find(:lib)]
98
92
  end
99
93
 
100
94
  def javascript_resources
101
95
  RbbtRESTHelpers.javascript_resources
102
96
  end
103
97
 
104
-
105
- def locate_javascript_from_resource(resource, script)
106
- path = resource[script + '.js']
107
- return path if path.exists?
108
- resource[script]
109
- end
110
-
111
- def locate_javascript(script)
112
- javascript_resources.each do |resource|
113
- path = locate_javascript_from_resource(resource, script)
114
- return path if path.exists?
115
- end
116
-
117
- raise TemplateMissing, "Script #{ script } not found"
98
+ def locate_javascript(template)
99
+ path = locate_server_file(template, javascript_resources, 'js')
100
+ raise TemplateMissing, "Javascript file #{ template } not found" if path.nil?
101
+ path
118
102
  end
119
103
 
120
104
  #{{{ CSS
@@ -127,19 +111,97 @@ module RbbtRESTHelpers
127
111
  RbbtRESTHelpers.css_resources
128
112
  end
129
113
 
130
-
131
- def locate_css_from_resource(resource, script)
132
- path = resource[script + '.css']
133
- return path if path.exists?
134
- resource[script]
114
+ def locate_css(template)
115
+ path = locate_server_file(template, css_resources, 'css')
116
+ raise TemplateMissing, "CSS file #{ template } not found" if path.nil?
117
+ path
135
118
  end
136
-
137
- def locate_css(script)
138
- css_resources.each do |resource|
139
- path = locate_css_from_resource(resource, script)
140
- return path if path.exists?
141
- end
142
119
 
143
- raise TemplateMissing, "Script #{ script } not found"
144
- end
120
+
121
+
122
+ #def locate_template_from_resource(resource, template)
123
+ # resource[template + '.haml']
124
+ #end
125
+
126
+ #def locate_template(template)
127
+ # return Path.setup(template) if Open.exists?(template)
128
+ # return Path.setup(template+'.haml') if Open.exists?(template+'.haml')
129
+ # template_resources.each do |resource|
130
+ # path = locate_template_from_resource(resource, template)
131
+ # return path if path.exists?
132
+ # end
133
+
134
+ # raise TemplateMissing, "Template #{ template } not found"
135
+ #end
136
+
137
+ #{{{ FILE
138
+
139
+ #def locate_file_from_resource(resource, file)
140
+ # resource[file]
141
+ #end
142
+
143
+ #def locate_file(file)
144
+ # file_resources.each do |resource|
145
+ # path = locate_file_from_resource(resource, file)
146
+ # return path if path.exists?
147
+ # end
148
+
149
+ # raise TemplateMissing, "File #{ file } not found"
150
+ #end
151
+
152
+ #def find_all_from_resource(resource, pattern)
153
+ # resource.glob(pattern)
154
+ #end
155
+ #
156
+ #def find_all(pattern)
157
+ # paths = []
158
+ # file_resources.each do |resource|
159
+ # paths.concat find_all_from_resource(resource, pattern)
160
+ # end
161
+
162
+ # paths
163
+ #end
164
+
165
+ #def locate_sass_from_resource(resource, template)
166
+ # resource[template + '.sass']
167
+ #end
168
+
169
+ #def locate_sass(template)
170
+ # sass_resources.each do |resource|
171
+ # path = locate_sass_from_resource(resource, template)
172
+ # return path if path.exists?
173
+ # end
174
+
175
+ # raise TemplateMissing, "Sass template #{ template } not found"
176
+ #end
177
+
178
+ #def locate_javascript_from_resource(resource, script)
179
+ # path = resource[script + '.js']
180
+ # return path if path.exists?
181
+ # resource[script]
182
+ #end
183
+
184
+ #def locate_javascript(script)
185
+ # javascript_resources.each do |resource|
186
+ # path = locate_javascript_from_resource(resource, script)
187
+ # return path if path.exists?
188
+ # end
189
+
190
+ # raise TemplateMissing, "Script #{ script } not found"
191
+ #end
192
+
193
+ #def locate_css_from_resource(resource, script)
194
+ # path = resource[script + '.css']
195
+ # return path if path.exists?
196
+ # resource[script]
197
+ #end
198
+
199
+ #def locate_css(script)
200
+ # css_resources.each do |resource|
201
+ # path = locate_css_from_resource(resource, script)
202
+ # return path if path.exists?
203
+ # end
204
+
205
+ # raise TemplateMissing, "Script #{ script } not found"
206
+ #end
145
207
  end
@@ -31,6 +31,22 @@ module RbbtRESTHelpers
31
31
  end
32
32
  end
33
33
 
34
+ def traverse(items, msg = nil, max = nil, options = {}, &block)
35
+ options[:msg] = msg if msg
36
+ options[:max] = max if max
37
+ msg, max = Misc.process_options options, :msg, :max
38
+ max = TSV.guess_max max if max.nil?
39
+ msg = "Processing" if msg.nil?
40
+ bar = @step.progress_bar(msg, :max => max)
41
+ TSV.traverse items, options.merge(:bar => bar), &block
42
+ end
43
+
44
+ def progress(msg = nil, max = nil, &block)
45
+ msg = "Processing" if msg.nil?
46
+ bar = @step.progress_bar(msg, :max => max)
47
+ block.call(bar)
48
+ end
49
+
34
50
  def development?
35
51
  ENV["RACK_ENV"] == "develoment"
36
52
  end
@@ -27,8 +27,6 @@ module EntityRESTHelpers
27
27
  return ! accept
28
28
  rescue
29
29
  Log.exception $!
30
- iii path
31
- ppp code
32
30
  return true
33
31
  end
34
32
  false
@@ -1,5 +1,5 @@
1
1
  function fit_content(){
2
- var height = window.innerHeight - $('footer').outerHeight(true);
2
+ var height = window.innerHeight //- $('#footer').outerHeight(true);
3
3
  var top_offset = $('#content').get()[0].offsetTop
4
4
  $('#content').css('min-height', height - top_offset - 48)
5
5
  $('#top_menu dl.rbbt_menu').css('max-height', height - 100)
@@ -41,6 +41,20 @@ var Entity = function(data){
41
41
  if (undefined !== args) url = add_parameter(url, "args", JSON.stringify(args))
42
42
  return rbbt.insist_request({url: url})
43
43
  }
44
+
45
+ this.highlight = function(color){
46
+ var id = this.code
47
+ var links = $('.entity[id=' + id + ']')
48
+ forArray(links, function(link){
49
+ link.prepend($('span').addClass('bullet').addClass(color))
50
+ })
51
+ }
52
+
53
+ this.get_elems = function(){
54
+ if (undefined === this.elems && this.elem) this.elems = $([this.elem])
55
+ if (undefined === this.elems) this.elems = $('.entity[data-entity-id=' + this.code +']')
56
+ return this.elems
57
+ }
44
58
  }
45
59
 
46
60
  var FavouriteEntities = function(by_type){
@@ -25,6 +25,12 @@ var EntityArray = function(array){
25
25
  return(result.promise)
26
26
  }
27
27
 
28
+ this.highlight = function(color){
29
+ var entities = this.get_entities().then(function(entities){
30
+ if (undefined === color) color = 'green'
31
+ rbbt.aesthetics.apply_aes({targets: entities, aes:'color', value:color})
32
+ })
33
+ }
28
34
 
29
35
  this.property = function(name, args){
30
36
  var result = m.deferred();
@@ -40,9 +46,6 @@ var EntityArray = function(array){
40
46
  return(result.promise)
41
47
  }
42
48
 
43
- this.codes = function(){
44
- }
45
-
46
49
  this.children = function(knowledgebase, database){
47
50
  var db_key = [database, knowledgebase].join("@")
48
51
  return rbbt.knowledge_base.list_children(db_key, this)
@@ -57,6 +60,7 @@ var EntityArray = function(array){
57
60
  var db_key = [database, knowledgebase].join("@")
58
61
  return rbbt.knowledge_base.list_subset(db_key, this)
59
62
  }
63
+
60
64
  }
61
65
 
62
66
  var EntityList = function(data){
@@ -90,7 +94,7 @@ var EntityList = function(data){
90
94
  }
91
95
  }
92
96
 
93
- this.get_entities = function(func){
97
+ this.get_entities = function(){
94
98
  var result = m.deferred();
95
99
 
96
100
  this.get().then(function(list_data){
@@ -103,6 +107,14 @@ var EntityList = function(data){
103
107
 
104
108
  return(result.promise)
105
109
  }
110
+
111
+ this.get_array = function(){
112
+ return this.get_entities().then(function(array){ return new EntityArray(array)})
113
+ }
114
+
115
+ this.highlight = function(color){
116
+ this.get_array().then(function(array){ array.highlight(color)})
117
+ }
106
118
 
107
119
  this.property = function(name, args){
108
120
  var url = "/entity_list_property/" + name + "/" + this.full_type() + "/" + clean_element(this.id)
@@ -128,6 +140,7 @@ var EntityList = function(data){
128
140
  var db_key = [database, knowledgebase].join("@")
129
141
  return rbbt.knowledge_base.list_subset(db_key, this)
130
142
  }
143
+
131
144
  }
132
145
 
133
146
  //{{{ FAVOURITES
@@ -94,7 +94,7 @@ fav_module.draw_favourite_menu = function(){
94
94
  var types = Object.keys(favourites)
95
95
 
96
96
  return rbbt.mview.dropdown('Entities',
97
- [m('a.item',{onclick: fav_module.highlight}, 'highlight')].concat(types.map(function(type, index){
97
+ [m('.item.buttons', [m('.ui.button',{onclick: fav_module.highlight}, 'highlight'),m('.ui.button',{onclick: fav_module.clear_highlight}, 'clear')])].concat(types.map(function(type, index){
98
98
  var _type = favourites[type]
99
99
  var entities = Object.keys(_type)
100
100
 
@@ -120,7 +120,7 @@ fav_module.draw_favourite_list_menu = function(){
120
120
  return rbbt.mview.dropdown(type, lists.map(function(list, index){
121
121
  url = _type[list].url()
122
122
  var link = m('a.item', {href: url, style: 'display: inline-block'}, _type[list].name)
123
- return [m('span.bullet.green', {onclick: function(){_type[list].highlight('green'); return false}},''),link,m('br')]
123
+ return [m('span.bullet.green.highlight', {onclick: function(){_type[list].highlight('green'); return false}},''),link,m('br')]
124
124
  }))
125
125
  })
126
126
 
@@ -250,14 +250,21 @@ fav_module.update_map_selects= function(){
250
250
  }
251
251
 
252
252
  fav_module.highlight = function(){
253
- var targets = []
253
+ var all_targets = []
254
+
254
255
  for (type in fav_module.entities.types()){
255
256
  var _type = fav_module.entities.types()[type]
257
+ console.log(_type)
256
258
  var n = Object.keys(_type)
257
- var nt = n.map(function(e){ return _type[e].id})
258
- targets = targets.concat(nt)
259
+ var targets = n.map(function(e){ return _type[e]})
260
+ all_targets = all_targets.concat(targets)
259
261
  }
260
- rbbt.aesthetics.apply_aesthetic({selector: targets, aes: 'color', value: 'gold'})
262
+
263
+ rbbt.aesthetics.apply_aes({targets: all_targets, aes: 'color', value: 'gold'})
264
+ }
265
+
266
+ fav_module.clear_highlight = function(){
267
+ rbbt.aesthetics.apply_aes({selector: '.entity', aes: 'color', value: 'remove'})
261
268
  }
262
269
 
263
270
  fav_module.new_list = function(type){
@@ -199,6 +199,24 @@ aes_module.add = function(rule){
199
199
  aes_module.store()
200
200
  }
201
201
 
202
+ aes_module.apply_aes = function(info){
203
+ var elems = info.elems;
204
+
205
+ if (undefined === elems && info.targets){
206
+ elems = []
207
+ forArray(info.targets, function(target){ elems = $.merge(elems, target.get_elems()) })
208
+ elems = $(elems)
209
+ }
210
+
211
+ if (undefined === elems && info.selector){
212
+ elems = $(info.selector)
213
+ }
214
+
215
+ if (info.value == 'remove') elems.css(info.aes, '')
216
+ else elems.css(info.aes, info.value)
217
+ }
218
+
202
219
  aes_module.apply = function(){ }
203
220
 
221
+
204
222
  aes_module.load()