rbbt-rest 1.8.45 → 1.8.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/render.rb +28 -3
- data/lib/rbbt/rest/entity/entity_card.rb +11 -0
- data/lib/rbbt/rest/entity/entity_list_card.rb +9 -0
- data/lib/rbbt/rest/entity/locate.rb +33 -383
- data/lib/rbbt/rest/helpers.rb +12 -0
- data/share/views/compass/app.sass +60 -0
- data/share/views/compass/card_templates.sass +1 -0
- data/share/views/compass/documentation.sass +11 -0
- data/share/views/compass/layout.sass +3 -1
- data/share/views/compass/tab_menu.sass +12 -4
- data/share/views/documented_section.haml +10 -0
- data/share/views/entity_partials/action_card.haml +42 -37
- data/share/views/entity_partials/action_controller.haml +1 -1
- data/share/views/entity_partials/entity_card.haml +75 -56
- data/share/views/entity_partials/entity_list_card.haml +109 -1
- data/share/views/entity_partials/entity_map_card.haml +2 -1
- data/share/views/layout.haml +0 -1
- data/share/views/layout/header.haml +1 -1
- data/share/views/partials/tabs.haml +0 -2
- data/share/views/public/js/app.js +18 -1
- data/share/views/public/js/helpers/_ajax_replace.js +5 -1
- data/share/views/public/js/rbbt.documentation.js +25 -0
- data/share/views/public/js/rbbt.modal.js +5 -3
- data/share/views/tools/nvd3.haml +1 -1
- data/share/views/tools/nvd3/chart.haml +6 -1
- data/share/views/tools/nvd3/histogram.haml +1 -1
- metadata +5 -2
data/lib/rbbt/rest/helpers.rb
CHANGED
@@ -47,5 +47,17 @@ module Sinatra
|
|
47
47
|
clean_name = parts * "_"
|
48
48
|
"<span class='name' jobname='#{ name }'>#{ clean_name }</span> <span class='hash'>#{ hash }</span>"
|
49
49
|
end
|
50
|
+
|
51
|
+
def values2d3(data)
|
52
|
+
data = data.to_single if data.respond_to? :to_single and not data.type == :single
|
53
|
+
|
54
|
+
values = []
|
55
|
+
data.each do |key, value|
|
56
|
+
name = key.respond_to?(:name) ? key.name || key : key
|
57
|
+
values << {:label => name, :value => value}
|
58
|
+
end
|
59
|
+
|
60
|
+
values
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
@import 'layout'
|
4
4
|
@import 'card_templates'
|
5
5
|
@import 'tab_menu'
|
6
|
+
@import 'documentation'
|
6
7
|
@import 'misc'
|
7
8
|
|
8
9
|
|
@@ -64,3 +65,62 @@ table > caption
|
|
64
65
|
&.small > a
|
65
66
|
padding: .78571429em !important
|
66
67
|
display: inline-block
|
68
|
+
|
69
|
+
body, html
|
70
|
+
font-size: 16px
|
71
|
+
|
72
|
+
#modal
|
73
|
+
& > .header
|
74
|
+
font-size: 2em
|
75
|
+
|
76
|
+
.entity_card, .entity_list_card, .entity_map_card
|
77
|
+
width: calc(100% + 2rem)
|
78
|
+
.card_sidebar_open
|
79
|
+
margin-left: -1em !important
|
80
|
+
padding-left: 2em !important
|
81
|
+
.card_sidebar
|
82
|
+
min-width: 400px
|
83
|
+
transition: margin-left 0.3s, margin-right 0.3s, max-height 0.3s, min-width 0.5s
|
84
|
+
& + .column
|
85
|
+
transition: width 0.1s
|
86
|
+
max-width: calc(100% - 400px)
|
87
|
+
&.hidden
|
88
|
+
overflow: hidden
|
89
|
+
margin-left: calc(-25% - 32px) !important
|
90
|
+
margin-right: 32px !important
|
91
|
+
min-width: 25% !important
|
92
|
+
max-height: 500px
|
93
|
+
&.hidden + .column
|
94
|
+
//min-width: 100% !important
|
95
|
+
transition: width 0.3s, max-width 0.5s
|
96
|
+
max-width: 100% !important
|
97
|
+
width: 100% !important
|
98
|
+
margin: 0px
|
99
|
+
|
100
|
+
.card_sidebar
|
101
|
+
.sub.item
|
102
|
+
margin-left: 2em
|
103
|
+
|
104
|
+
.card_actions
|
105
|
+
width: 100% !important
|
106
|
+
|
107
|
+
@media only screen and (max-width: 600px)
|
108
|
+
.card_sidebar:not(.hidden) + .column
|
109
|
+
max-width: calc(100% + 400px) !important
|
110
|
+
margin-right: -500px !important
|
111
|
+
|
112
|
+
.table.loading
|
113
|
+
tfoot
|
114
|
+
display: none !important
|
115
|
+
&:after
|
116
|
+
content: "Loading..."
|
117
|
+
line-height: 60px
|
118
|
+
padding-left: 2em
|
119
|
+
display: inline-block
|
120
|
+
color: red
|
121
|
+
font-size: 1.5em
|
122
|
+
|
123
|
+
dl > dd
|
124
|
+
margin-left: 1em
|
125
|
+
|
126
|
+
|
@@ -55,6 +55,9 @@ body
|
|
55
55
|
form input
|
56
56
|
width: calc(100% - 16px)
|
57
57
|
|
58
|
+
.ui.modal
|
59
|
+
width: 75%
|
60
|
+
margin: 0 0 0 -37%
|
58
61
|
.entity_card, .entity_list_card
|
59
62
|
> .content
|
60
63
|
> .info
|
@@ -79,7 +82,6 @@ body
|
|
79
82
|
margin-right: 10%
|
80
83
|
float: left
|
81
84
|
|
82
|
-
|
83
85
|
#footer
|
84
86
|
clear: both
|
85
87
|
|
@@ -41,9 +41,11 @@ $jiffy: 0.14s
|
|
41
41
|
+keyframes(grow-down)
|
42
42
|
0%
|
43
43
|
max-height: 0px
|
44
|
-
padding-top: 0px
|
45
|
-
padding-bottom: 0px
|
46
|
-
|
44
|
+
padding-top: 0px !important
|
45
|
+
padding-bottom: 0px !important
|
46
|
+
margin-top: 0px !important
|
47
|
+
margin-bottom: 0px !important
|
48
|
+
//+opacity(0.2)
|
47
49
|
|
48
50
|
100%
|
49
51
|
max-height: 500px
|
@@ -100,10 +102,15 @@ dl.rbbt_tabs
|
|
100
102
|
padding: 1em
|
101
103
|
display: inline-block
|
102
104
|
min-width: 20%
|
105
|
+
background: white
|
103
106
|
&.active
|
104
107
|
font-weight: bold
|
108
|
+
border-bottom: none
|
109
|
+
padding-bottom: calc(1em + 12px)
|
110
|
+
margin-bottom: -13px
|
111
|
+
z-index: 10
|
105
112
|
border: 1px solid #D4D4D5
|
106
|
-
&:hover
|
113
|
+
&:not(.active):hover
|
107
114
|
border: 1px solid darken(#D4D4D5,30)
|
108
115
|
dd
|
109
116
|
font-size: 14px
|
@@ -113,6 +120,7 @@ dl.rbbt_tabs
|
|
113
120
|
overflow-y: auto
|
114
121
|
min-width: calc(100% - 16px)
|
115
122
|
padding: 1em
|
123
|
+
background: white
|
116
124
|
|
117
125
|
&:not(.show)
|
118
126
|
+animation(shrink-up $jiffy forwards)
|
@@ -1,50 +1,55 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
:sass
|
2
|
+
.action_card > .content
|
3
|
+
width: 100%
|
4
|
+
//& > .action_parameters, & > .action_content
|
5
|
+
width: 100%
|
6
|
+
.action_card.ui.grid
|
7
|
+
.ui.basic.segment.content
|
8
|
+
.ui.header.basic.segment
|
9
|
+
%h1.name
|
10
|
+
- case page_type
|
11
|
+
- when 'entity_action'
|
12
|
+
= @entity.respond_to?(:name) ? @entity.name || @entity : @entity
|
13
|
+
- when 'entity_list_action'
|
14
|
+
= Misc.humanize page_entity_list
|
15
|
+
- when 'entity_map_action'
|
16
|
+
= Misc.humanize page_entity_map
|
17
|
+
%p.long_name
|
18
|
+
= Misc.humanize page_action if page_action
|
13
19
|
|
14
|
-
|
15
|
-
.action_description.ui.basic.segment
|
20
|
+
- if card.description
|
16
21
|
- case card.description
|
17
22
|
- when String
|
18
|
-
= card.description
|
23
|
+
%p= card.description
|
19
24
|
- when Proc
|
20
25
|
= capture_haml &card.description
|
21
26
|
- else
|
22
27
|
- raise "Unknown description: #{fff card.description}"
|
23
28
|
|
24
|
-
|
25
|
-
|
29
|
+
- if card.action_parameters
|
30
|
+
= action_parameters &card.action_parameters
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
- exception_html = nil
|
33
|
+
- require_parameters = false
|
34
|
+
- card.requires.each do |input|
|
35
|
+
- if Array === input
|
36
|
+
- inputs, input_block = input
|
37
|
+
- if inputs.select{|input| @params[input.to_s].nil? }.any?
|
38
|
+
- require_parameters = true
|
39
|
+
- exception_html = capture_haml &input_block
|
40
|
+
- break
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
- else
|
43
|
+
- if @params[input.to_s].nil?
|
44
|
+
- require_parameters = true
|
45
|
+
- break
|
41
46
|
|
42
|
-
|
43
|
-
|
47
|
+
- if exception_html
|
48
|
+
= exception_html
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
.action_content
|
51
|
+
- if require_parameters
|
52
|
+
%p Please configure the parameters to execute the action
|
53
|
+
- else
|
54
|
+
= capture_haml &block
|
50
55
|
|
@@ -1,72 +1,91 @@
|
|
1
1
|
- entity = card.entity
|
2
2
|
- entity_id = "entity__" + entity.id
|
3
3
|
- default = entity.respond_to?(:default)? entity.default || entity.to_s : entity.to_s
|
4
|
-
.entity_card.ui.very.basic.segment(data-entity=entity data-entity-id=default data-entity-type="#{entity.base_type}" data-entity-format="#{entity.respond_to?(:format) ? entity.format : ""}" data-entity-info="#{entity.info.to_json}")
|
5
|
-
/-- title --
|
6
|
-
.ui.header.title
|
7
|
-
.name
|
8
|
-
- case card.name
|
9
|
-
- when nil
|
10
|
-
= entity.respond_to?(:name) ? entity.name || entity : entity
|
11
|
-
- when String
|
12
|
-
= card.name
|
13
|
-
- when Proc
|
14
|
-
= fragment :name, &card.name
|
15
4
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
-
|
23
|
-
=
|
5
|
+
|
6
|
+
.entity_card.ui.grid(data-entity=entity data-entity-id=default data-entity-type="#{entity.base_type}" data-entity-format="#{entity.respond_to?(:format) ? entity.format : ""}" data-entity-info="#{entity.info.to_json}")
|
7
|
+
/-- card_sidebar --
|
8
|
+
.ui.four.wide.column.vertical.card_sidebar.menu.hidden
|
9
|
+
- if card.sections.any?
|
10
|
+
%h3 Sections
|
11
|
+
- card.sections.each do |name,section|
|
12
|
+
%a.item(href="##{Misc.snake_case(name)}")= Misc.humanize(name)
|
13
|
+
%a.item(href="#entity_actions") Entity actions
|
24
14
|
|
25
|
-
|
26
|
-
- info = entity.info.dup
|
27
|
-
- info.delete :annotated_array
|
28
|
-
- info.delete :annotation_types
|
15
|
+
- info = card.entity.info
|
29
16
|
- if info.any? or card.meta or card.list_container
|
30
|
-
|
31
|
-
.
|
32
|
-
.
|
33
|
-
|
34
|
-
|
35
|
-
= hash2dl(info)
|
17
|
+
%h3 Meta data
|
18
|
+
.meta
|
19
|
+
- if info.any?
|
20
|
+
.entity_info
|
21
|
+
= hash2dl(info)
|
36
22
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
23
|
+
- case card.meta
|
24
|
+
- when nil
|
25
|
+
- when Hash
|
26
|
+
= hash2dl(card.meta)
|
27
|
+
- when Proc
|
28
|
+
= fragment :meta, &card.meta
|
29
|
+
|
30
|
+
- if card.list_container
|
31
|
+
%h3 Related lists
|
32
|
+
.list_container
|
33
|
+
= list_container_render(card.list_container)
|
43
34
|
|
44
|
-
- if card.list_container
|
45
|
-
= list_container_render(card.list_container)
|
46
35
|
|
36
|
+
.ui.twelve.wide.column.content
|
37
|
+
.ui.header.basic.segment
|
38
|
+
.content
|
39
|
+
%h1.header.name
|
40
|
+
- case card.name
|
41
|
+
- when nil
|
42
|
+
= entity.respond_to?(:name) ? entity.name || entity : entity
|
43
|
+
- when String
|
44
|
+
= card.name
|
45
|
+
- when Proc
|
46
|
+
= fragment :name, &card.name
|
47
|
+
%p.long_name
|
48
|
+
- case card.long_name
|
49
|
+
- when nil
|
50
|
+
= entity.respond_to?(:long_name) ? entity.long_name : entity.base_type.to_s
|
51
|
+
- when String
|
52
|
+
= card.long_name
|
53
|
+
- when Proc
|
54
|
+
= fragment :long_name, &card.long_name
|
47
55
|
|
56
|
+
.ui.basic.segment.controls.buttons
|
57
|
+
.ui.icon.button.card_sidebar_open
|
58
|
+
%i.bars.icon
|
48
59
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
-
|
60
|
+
.ui.basic.segment(id='description')
|
61
|
+
/-- content --
|
62
|
+
- case card.description
|
63
|
+
- when nil
|
64
|
+
- if entity.respond_to?(:description) and entity.description
|
65
|
+
/-- description --
|
66
|
+
.description.ui.very.basic.segment<
|
67
|
+
%p= entity.description
|
68
|
+
- when String
|
69
|
+
/-- description --
|
70
|
+
.description.ui.very.basic.segment<
|
71
|
+
:documentation
|
72
|
+
#{card.description}
|
73
|
+
- when Proc
|
53
74
|
/-- description --
|
54
|
-
.description.ui.
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
- when Proc
|
62
|
-
/-- description --
|
63
|
-
.description.ui.compact.basic.segment<
|
64
|
-
= fragment :description, &card.description
|
75
|
+
.description.ui.very.basic.segment<
|
76
|
+
= fragment :description, &card.description
|
77
|
+
|
78
|
+
- if defined? block and block
|
79
|
+
/-- description block --
|
80
|
+
.description.ui.basic.segment<
|
81
|
+
= capture_haml &block
|
65
82
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
83
|
+
- card.sections.each do |name,section_block|
|
84
|
+
.ui.very.basic.segment(id="#{Misc.snake_case(name)}")
|
85
|
+
%h2.header
|
86
|
+
= Misc.humanize(name)
|
87
|
+
.content
|
88
|
+
= fragment name, §ion_block
|
70
89
|
|
71
90
|
- if card.action_controller
|
72
91
|
/-- actions --
|
@@ -1,6 +1,113 @@
|
|
1
1
|
- list = card.list
|
2
2
|
- list_id = card.list_id
|
3
|
-
|
3
|
+
|
4
|
+
.entity_list_card.ui.grid(id="#{ list_id.gsub(/\s/,'_') }_card" data-list=list_id data-list-type="#{list.base_type}")
|
5
|
+
.ui.four.wide.column.vertical.card_sidebar.menu.hidden
|
6
|
+
- if card.sections.any?
|
7
|
+
%h3 Sections
|
8
|
+
- card.sections.each do |name,section|
|
9
|
+
%a.item(href="##{Misc.snake_case(name)}")= Misc.humanize(name)
|
10
|
+
|
11
|
+
.list_management.ui.small.buttons.flex-wrap
|
12
|
+
%a.compare_list.ui.button(href="#" data-reveal-id='modal1') Compare
|
13
|
+
%a.list_list.ui.button(href="#{request.path_info + "?_format=list"}") List
|
14
|
+
|
15
|
+
- if list.respond_to? :name
|
16
|
+
%a.name_list.ui.button(href="#{request.path_info + "?_format=name"}") As Name
|
17
|
+
|
18
|
+
- if list.respond_to? :ensembl
|
19
|
+
%a.ensembl_list.ui.button(href="#{request.path_info + "?_format=ensembl"}") As Ensembl
|
20
|
+
|
21
|
+
%a.download_list.ui.button(href="#{request.path_info + "?_format=raw"}") Raw
|
22
|
+
%a.edit_list.ui.button(href="#") Edit
|
23
|
+
|
24
|
+
- info = card.list.info
|
25
|
+
- if info.any? or card.meta or card.list_container
|
26
|
+
/-- sidebar --
|
27
|
+
%h3 Meta data
|
28
|
+
.meta
|
29
|
+
- if info.any?
|
30
|
+
.entity_info
|
31
|
+
= hash2dl(info)
|
32
|
+
|
33
|
+
- case card.meta
|
34
|
+
- when nil
|
35
|
+
- when Hash
|
36
|
+
= hash2dl(card.meta)
|
37
|
+
- when Proc
|
38
|
+
= fragment :meta, &card.meta
|
39
|
+
|
40
|
+
.entities
|
41
|
+
%h3 Entities
|
42
|
+
%p #{list.length} entities
|
43
|
+
- if (defined? force and force) or list.length < 500
|
44
|
+
%ul.entity_list.clean_list
|
45
|
+
- list = list.sort_by{|g| g.name || "Z" << g} if list.respond_to? :name
|
46
|
+
- list.link.each do |link|
|
47
|
+
%li= link
|
48
|
+
- else
|
49
|
+
%p
|
50
|
+
= reveal "Too many entities to list (#{list.length})" do
|
51
|
+
= fragment do
|
52
|
+
- list = list.sort_by{|g| g.name || "Z" << g} if list.respond_to? :name
|
53
|
+
%ul.entity_list.clean_list
|
54
|
+
- list.link.each do |link|
|
55
|
+
%li= link
|
56
|
+
|
57
|
+
- if card.list_container
|
58
|
+
%h3 Related lists
|
59
|
+
.list_container
|
60
|
+
= list_container_render(card.list_container)
|
61
|
+
|
62
|
+
.ui.twelve.wide.column.content
|
63
|
+
.ui.header.basic.segment
|
64
|
+
.content
|
65
|
+
%h1.name
|
66
|
+
= Misc.humanize list_id
|
67
|
+
%p.type
|
68
|
+
= list.base_type
|
69
|
+
List
|
70
|
+
|
71
|
+
.ui.basic.segment.controls.buttons
|
72
|
+
.ui.icon.button.card_sidebar_open
|
73
|
+
%i.bars.icon
|
74
|
+
|
75
|
+
.ui.basic.segment(id='description')
|
76
|
+
/-- content --
|
77
|
+
- case card.description
|
78
|
+
- when nil
|
79
|
+
- if entity.respond_to?(:description) and entity.description
|
80
|
+
/-- description --
|
81
|
+
.description.ui.very.basic.segment<
|
82
|
+
%p= entity.description
|
83
|
+
- when String
|
84
|
+
/-- description --
|
85
|
+
.description.ui.very.basic.segment<
|
86
|
+
:documentation
|
87
|
+
#{card.description}
|
88
|
+
- when Proc
|
89
|
+
/-- description --
|
90
|
+
.description.ui.very.basic.segment<
|
91
|
+
= fragment :description, &card.description
|
92
|
+
|
93
|
+
- if defined? block and block
|
94
|
+
/-- description block --
|
95
|
+
.description.ui.basic.segment<
|
96
|
+
= capture_haml &block
|
97
|
+
|
98
|
+
- card.sections.each do |name,section_block|
|
99
|
+
.ui.very.basic.segment(id="#{Misc.snake_case(name)}")
|
100
|
+
%h2.header
|
101
|
+
= Misc.humanize(name)
|
102
|
+
.content
|
103
|
+
= fragment name, §ion_block
|
104
|
+
|
105
|
+
- if card.action_controller
|
106
|
+
/-- actions --
|
107
|
+
= action_controller_render(card.action_controller)
|
108
|
+
|
109
|
+
// LIIIIIIIIIII
|
110
|
+
-#.entity_list_card.ui.very.basic.segment(id="#{ list_id.gsub(/\s/,'_') }_card" data-list=list_id data-list-type="#{list.base_type}")
|
4
111
|
|
5
112
|
/-- title --
|
6
113
|
.title.ui.header
|
@@ -78,3 +185,4 @@
|
|
78
185
|
- if card.action_controller
|
79
186
|
/-- actions --
|
80
187
|
= action_controller_render(card.action_controller)
|
188
|
+
|