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.
@@ -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
+
@@ -24,6 +24,7 @@
24
24
  .action_controller > .action_menu
25
25
  & > .button
26
26
  max-width: 25%
27
+ min-width: 150px
27
28
 
28
29
 
29
30
  .entity_card, .entity_list_card, .action_card
@@ -0,0 +1,11 @@
1
+
2
+ .documented.segment
3
+ .hidden.documentation
4
+ display: none
5
+ .help.label
6
+ opacity: 0.1
7
+ i
8
+ margin: 0 !important
9
+ &:hover > .help.label
10
+ opacity: 1
11
+
@@ -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
- +opacity(0.2)
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)
@@ -0,0 +1,10 @@
1
+ .ui.very.basic.documented.segment
2
+
3
+ = yield
4
+
5
+ %a.ui.floating.teal.circular.help.label
6
+ %i.help.icon
7
+ .ui.very.basic.hidden.documentation
8
+ - require 'kramdown'
9
+ = Kramdown::Document.new(markdown).to_html
10
+
@@ -1,50 +1,55 @@
1
- .action_card.ui.very.basic.segment
2
- .title.ui.header
3
- .name
4
- - case page_type
5
- - when 'entity_action'
6
- = @entity.respond_to?(:name) ? @entity.name || @entity : @entity
7
- - when 'entity_list_action'
8
- = Misc.humanize page_entity_list
9
- - when 'entity_map_action'
10
- = Misc.humanize page_entity_map
11
- .long_name
12
- = Misc.humanize page_action if page_action
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
- - if card.description
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
- - if card.action_parameters
25
- = action_parameters &card.action_parameters
29
+ - if card.action_parameters
30
+ = action_parameters &card.action_parameters
26
31
 
27
- - exception_html = nil
28
- - require_parameters = false
29
- - card.requires.each do |input|
30
- - if Array === input
31
- - inputs, input_block = input
32
- - if inputs.select{|input| @params[input.to_s].nil? }.any?
33
- - require_parameters = true
34
- - exception_html = capture_haml &input_block
35
- - break
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
- - else
38
- - if @params[input.to_s].nil?
39
- - require_parameters = true
40
- - break
42
+ - else
43
+ - if @params[input.to_s].nil?
44
+ - require_parameters = true
45
+ - break
41
46
 
42
- - if exception_html
43
- = exception_html
47
+ - if exception_html
48
+ = exception_html
44
49
 
45
- .action_content
46
- - if require_parameters
47
- %p Please configure the parameters to execute the action
48
- - else
49
- = capture_haml &block
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,6 +1,6 @@
1
1
  - entity = controller.entity
2
2
  - if controller.actions.any?
3
- .card_actions.ui.segment
3
+ .card_actions.ui.segment#entity_actions
4
4
  .action_controller
5
5
  .ui.buttons.controls
6
6
  %a.item.reload.ui.icon.disabled.button(href="#" title="Refresh action")
@@ -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
- .long_name
17
- - case card.long_name
18
- - when nil
19
- = entity.respond_to?(:long_name) ? entity.long_name : nil
20
- - when String
21
- = card.long_name
22
- - when Proc
23
- = fragment :long_name, &card.long_name
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
- .content
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
- /-- sidebar --
31
- .info.ui.compact.segment
32
- .meta
33
- - if info.any?
34
- .entity_info
35
- = hash2dl(info)
17
+ %h3 Meta data
18
+ .meta
19
+ - if info.any?
20
+ .entity_info
21
+ = hash2dl(info)
36
22
 
37
- - case card.meta
38
- - when nil
39
- - when Hash
40
- = hash2dl(card.meta)
41
- - when Proc
42
- = fragment :meta, &card.meta
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
- /-- content --
50
- - case card.description
51
- - when nil
52
- - if entity.respond_to?(:description) and entity.description
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.compact.basic.segment<
55
- %p= entity.description
56
- - when String
57
- /-- description --
58
- .description.ui.compact.basic.segment<
59
- :documentation
60
- #{card.description}
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
- - if defined? block and block
67
- /-- content block --
68
- .description.ui.compact.basic.segment<
69
- = capture_haml &block
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, &section_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
- .entity_list_card.ui.very.basic.segment(id="#{ list_id.gsub(/\s/,'_') }_card" data-list=list_id data-list-type="#{list.base_type}")
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, &section_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
+