rails_api_documentation 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -14
- data/app/assets/javascripts/table.js.coffee +41 -1
- data/app/assets/stylesheets/rails_api_doc/application.css +78 -0
- data/app/assets/stylesheets/rails_api_doc/table.sass +35 -1
- data/app/views/rails_api_doc/api_docs/_request_api_table.slim +1 -40
- data/app/views/rails_api_doc/api_docs/_response_api_table.slim +1 -1
- data/app/views/rails_api_doc/api_docs/_side_menu.slim +2 -2
- data/app/views/rails_api_doc/api_docs/index.slim +13 -9
- data/app/views/shared/_response_table.slim +21 -5
- data/lib/rails_api_doc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdf183cc6b6c0fda395a7562bc1d114b87bb1478
|
4
|
+
data.tar.gz: 6dd2a3f83b5cac67029bc216d87ab76d14db884b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1394d326673eab65074575a2de2ea16801c8c8f406302f06e7197e325131a5271b38636ca5ba3afc0816a7a56f1980d0ae52287593cef52218a44207310a11fd
|
7
|
+
data.tar.gz: 2a8b66d882789e7d4fd81aa40b8bed53dda409c67a375d00dc0bc6cd86401cd4df5c339bb7aa505b789b64fdf7a4b01b86b6f859d7eb517d50ac8090e3dbf01c
|
data/Rakefile
CHANGED
@@ -14,21 +14,8 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
17
|
require 'bundler/gem_tasks'
|
23
18
|
|
24
19
|
require 'rake/testtask'
|
25
20
|
|
26
|
-
|
27
|
-
t.libs << 'lib'
|
28
|
-
t.libs << 'test'
|
29
|
-
t.pattern = 'test/**/*_test.rb'
|
30
|
-
t.verbose = false
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
task default: :test
|
21
|
+
task default: :release
|
@@ -1,3 +1,6 @@
|
|
1
|
+
_header_height = 0
|
2
|
+
_side_menu = null
|
3
|
+
|
1
4
|
$ ->
|
2
5
|
$('.next-is-nested').on 'click', (e) ->
|
3
6
|
self = $(this)
|
@@ -5,4 +8,41 @@ $ ->
|
|
5
8
|
|
6
9
|
$('.request-action-title').on 'click', (e) ->
|
7
10
|
self = $(this)
|
8
|
-
self.next()
|
11
|
+
next = self.next()
|
12
|
+
return unless next.hasClass('flex-table')
|
13
|
+
next.toggle()
|
14
|
+
|
15
|
+
$('.add-ico, .edit-ico').on 'click', (e) ->
|
16
|
+
self = $(this)
|
17
|
+
self.closest('.row').toggleClass('is-active')
|
18
|
+
|
19
|
+
_header_height = $('.aside').offset().top
|
20
|
+
|
21
|
+
_side_menu = $('#side-menu')
|
22
|
+
|
23
|
+
$(document).on 'scroll', ->
|
24
|
+
_window = $(window)
|
25
|
+
_scrollTop = _window.scrollTop()
|
26
|
+
|
27
|
+
console.log _header_height
|
28
|
+
if _scrollTop > _header_height
|
29
|
+
_side_menu.addClass('fixed')
|
30
|
+
else
|
31
|
+
_side_menu.removeClass('fixed')
|
32
|
+
|
33
|
+
$("#side-menu li").removeClass('is-current')
|
34
|
+
|
35
|
+
$("#side-menu li a").each () ->
|
36
|
+
self = $(this)
|
37
|
+
|
38
|
+
_attached_block_id = self.attr('href')
|
39
|
+
# 0 is '#'
|
40
|
+
_attached_block = document.getElementById(_attached_block_id.substring(1))
|
41
|
+
jq_block = $(_attached_block)
|
42
|
+
|
43
|
+
# 5 is magic number to get block in sight on top get selected in menu
|
44
|
+
offset_top = jq_block.offset().top - 5
|
45
|
+
offset_height = jq_block.height()
|
46
|
+
|
47
|
+
if _scrollTop > offset_top && _scrollTop < offset_top + offset_height
|
48
|
+
self.closest('li').addClass('is-current')
|
@@ -13,3 +13,81 @@
|
|
13
13
|
*= require_tree .
|
14
14
|
*= require_self
|
15
15
|
*/
|
16
|
+
|
17
|
+
/*
|
18
|
+
*
|
19
|
+
* TOPICS:
|
20
|
+
* 1. icons / svgs / sprites
|
21
|
+
* 2. file structure
|
22
|
+
* 3. side menu
|
23
|
+
* a) from both left and right
|
24
|
+
* b) left one always on screen
|
25
|
+
* c) left should reduce font size if too much content
|
26
|
+
*
|
27
|
+
*/
|
28
|
+
|
29
|
+
.affix {
|
30
|
+
position: fixed !important;
|
31
|
+
}
|
32
|
+
.nav > li > a {
|
33
|
+
display: block;
|
34
|
+
padding: 4px 20px;
|
35
|
+
font-size: 15px;
|
36
|
+
font-weight: 500;
|
37
|
+
color: #767676;
|
38
|
+
}
|
39
|
+
|
40
|
+
.nav > li > a:hover {
|
41
|
+
padding-left: 19px;
|
42
|
+
color: #563d7c;
|
43
|
+
text-decoration: none;
|
44
|
+
background-color: transparent;
|
45
|
+
border-left: 1px solid #563d7c;
|
46
|
+
}
|
47
|
+
|
48
|
+
.bs-docs-sidebar.affix {
|
49
|
+
position: fixed;
|
50
|
+
top: 20px;
|
51
|
+
padding-left: 20px;
|
52
|
+
margin: 0;
|
53
|
+
}
|
54
|
+
.nav {
|
55
|
+
padding-left: 0;
|
56
|
+
}
|
57
|
+
|
58
|
+
.bs-docs-sidebar .nav>.is-current:focus>a, .bs-docs-sidebar .nav>.is-current:hover>a, .bs-docs-sidebar .nav>.is-current>a {
|
59
|
+
padding-left: 18px;
|
60
|
+
font-weight: 700;
|
61
|
+
color: #563d7c;
|
62
|
+
background-color: transparent;
|
63
|
+
border-left: 2px solid #563d7c;
|
64
|
+
}
|
65
|
+
|
66
|
+
.nav>li>ul>.is-current>a {
|
67
|
+
padding-left: 28px;
|
68
|
+
font-weight: 500;
|
69
|
+
}
|
70
|
+
|
71
|
+
.bs-docs-sidebar .nav .nav>li>a {
|
72
|
+
padding-top: 1px;
|
73
|
+
padding-bottom: 1px;
|
74
|
+
padding-left: 30px;
|
75
|
+
font-size: 14px;
|
76
|
+
font-weight: 500;
|
77
|
+
}
|
78
|
+
|
79
|
+
.blue {
|
80
|
+
background-color: #A0A0E5;
|
81
|
+
}
|
82
|
+
|
83
|
+
.title{
|
84
|
+
background-color: #f5f3f3;
|
85
|
+
}
|
86
|
+
.table-column {
|
87
|
+
border: 1px solid black;
|
88
|
+
}
|
89
|
+
|
90
|
+
.nopadding {
|
91
|
+
padding: 0 !important;
|
92
|
+
margin: 0 !important;
|
93
|
+
}
|
@@ -51,9 +51,16 @@
|
|
51
51
|
// display: -ms-flexbox
|
52
52
|
// display: -webkit-flex
|
53
53
|
//
|
54
|
-
|
55
54
|
&.row
|
56
55
|
display: flex
|
56
|
+
|
57
|
+
&.is-active
|
58
|
+
|
59
|
+
input
|
60
|
+
display: inline-block
|
61
|
+
|
62
|
+
.mod-submit
|
63
|
+
display: inline-block
|
57
64
|
// flex-flow: row wrap
|
58
65
|
// justify-content: space-between
|
59
66
|
|
@@ -84,6 +91,13 @@
|
|
84
91
|
.row &
|
85
92
|
width: calc(100%/var(--row-count))
|
86
93
|
min-height: 20px
|
94
|
+
|
95
|
+
&.mod-submit
|
96
|
+
display: none
|
97
|
+
|
98
|
+
input
|
99
|
+
display: none
|
100
|
+
|
87
101
|
// Что я сделал ?? - оно почемуто заработало было flex-grow: 1
|
88
102
|
// В статье написано что это тоже самое, а на практике - не так ?
|
89
103
|
// flex: 1
|
@@ -100,6 +114,26 @@
|
|
100
114
|
.column &
|
101
115
|
width: 100%
|
102
116
|
|
117
|
+
.header
|
118
|
+
text-align: center
|
119
|
+
|
120
|
+
.content
|
121
|
+
display: flex
|
122
|
+
|
123
|
+
.aside
|
124
|
+
flex: 1
|
125
|
+
|
126
|
+
.main-block
|
127
|
+
flex: 4
|
128
|
+
|
129
|
+
#side-menu
|
130
|
+
position: static
|
131
|
+
|
132
|
+
&.fixed
|
133
|
+
position: fixed
|
134
|
+
top: 0
|
135
|
+
|
103
136
|
.request-action-title
|
104
137
|
text-align: center
|
138
|
+
|
105
139
|
background-color: lightblue
|
@@ -1,43 +1,4 @@
|
|
1
1
|
- @request_headers = { enum: 'Values(if type is enum)' }
|
2
2
|
|
3
|
-
div[
|
3
|
+
div[id="#{locals[:model]}.request" style="--row-count: #{@request_headers.length}"]
|
4
4
|
= render 'shared/table', locals: { model: locals[:model], rows: locals[:params] }
|
5
|
-
|
6
|
-
/ .row
|
7
|
-
/ = form_tag(api_doc_path, method: 'post', remote: true, class: 'form-horizontal') do
|
8
|
-
|
9
|
-
/ - ([:name] + headers).each do |field_name|
|
10
|
-
/ div.field(class="col-md-#{col_num - 1}")
|
11
|
-
/ / Add parameter name second argument
|
12
|
-
/ = text_field_tag field_name, nil, placeholder: field_name, class: 'form-control'
|
13
|
-
/
|
14
|
-
/ div.actions(class="col-md-#{col_num - 1}")
|
15
|
-
/ = button_tag 'Add table parameter', class: 'btn btn-primary'
|
16
|
-
/ = render 'edit_field'
|
17
|
-
|
18
|
-
/ .table
|
19
|
-
/ div.nopadding[class="col-md-#{col_num}"]
|
20
|
-
/ = link_to new_api_doc_path, class: 'btn btn-primary btn-xs' do
|
21
|
-
/ span.glyphicon.glyphicon-plus
|
22
|
-
/ | Parameter
|
23
|
-
/
|
24
|
-
/ - headers.each do |param_header|
|
25
|
-
/ div.nopadding[class="col-md-#{col_num}"] = param_header
|
26
|
-
/
|
27
|
-
/ - locals[:params].each do |param_key, param_values|
|
28
|
-
/ .row.blue
|
29
|
-
/ div.nopadding[class="col-md-#{col_num}" style="white-space: nowrap;"]
|
30
|
-
/ - unless param_values.nested?
|
31
|
-
/ = link_to edit_api_doc_path, class: 'btn btn-primary btn-xs' do
|
32
|
-
/ span.glyphicon.glyphicon-pencil
|
33
|
-
/ = link_to api_doc_path(param_key: param_key, nesting: locals[:nesting]), class: 'btn btn-primary btn-xs', method: :delete do
|
34
|
-
/ span.glyphicon.glyphicon-minus
|
35
|
-
/ | #{param_key}#{'*' if param_values.required?}
|
36
|
-
/
|
37
|
-
/ - if param_values.nested?
|
38
|
-
/ .table-column[class="col-md-#{12 - col_num}"]
|
39
|
-
/ - nested_params = locals[:nesting].to_a.push(locals[:model])
|
40
|
-
/ = render 'request_api_table', locals: { model: param_values[:model] || param_key, params: param_values[:nested], nesting: nested_params }
|
41
|
-
/ - else
|
42
|
-
/ - headers.each do |param_header|
|
43
|
-
/ .table-column[class="col-md-#{col_num}"] = param_values[param_header]
|
@@ -1,5 +1,5 @@
|
|
1
|
-
nav.bs-docs-sidebar.hidden-print.hidden-sm.hidden-xs
|
2
|
-
ul.nav.bs-docs-sidenav
|
1
|
+
nav.bs-docs-sidebar.hidden-print.hidden-sm.hidden-xs
|
2
|
+
ul.side-menu.nav.bs-docs-sidenav
|
3
3
|
- locals[:models].each do |model|
|
4
4
|
li
|
5
5
|
a[href=('#' + model.to_s)] = model.to_s
|
@@ -1,12 +1,19 @@
|
|
1
|
-
.
|
2
|
-
.
|
1
|
+
.layout
|
2
|
+
.header
|
3
3
|
= render 'title'
|
4
|
-
.
|
5
|
-
.
|
4
|
+
.content
|
5
|
+
div.aside
|
6
|
+
div#side-menu
|
7
|
+
= render 'side_menu', locals: { models: @request_repository.keys }
|
8
|
+
|
9
|
+
div.main-block
|
6
10
|
|
7
11
|
- @request_repository.each do |model, params|
|
8
|
-
|
9
|
-
|
12
|
+
|
13
|
+
div[id=(model.to_s)]
|
14
|
+
|
15
|
+
h2 = model.to_s
|
16
|
+
|
10
17
|
p
|
11
18
|
| Scopes
|
12
19
|
| #{model.scopes_configuration.keys.map { |key| ":#{key}"}.join(', ')}
|
@@ -18,6 +25,3 @@
|
|
18
25
|
p
|
19
26
|
| Response
|
20
27
|
= render 'response_api_table', model: model, repo: @response_repository
|
21
|
-
|
22
|
-
.col-md-3[role="complementary"]
|
23
|
-
= render 'side_menu', locals: { models: @request_repository.keys }
|
@@ -1,14 +1,30 @@
|
|
1
|
+
- nesting = locals[:nesting] || []
|
2
|
+
|
1
3
|
div.flex-table
|
2
|
-
|
4
|
+
|
5
|
+
= form_tag(api_doc_url(nesting: nesting), method: :put, remote: true, class: 'flex-line row') do
|
3
6
|
/ Угловой елемент
|
4
|
-
div.flex-item
|
7
|
+
div.flex-item
|
8
|
+
// TODO: use icon with + to indicate adding
|
9
|
+
span.add-ico = '( + )'
|
10
|
+
= text_field_tag 'name', nil, placeholder: 'Enter param name'
|
11
|
+
span Parameter
|
12
|
+
|
5
13
|
div.flex-item Value
|
14
|
+
|
15
|
+
= submit_tag 'Save', class: 'flex-item mod-submit'
|
16
|
+
|
6
17
|
- locals[:rows].each do |row_name, node|
|
7
|
-
|
8
|
-
div.flex-item
|
18
|
+
= form_tag(api_doc_url(nesting: nesting), method: :put, remote: true, class: 'flex-line row') do
|
19
|
+
div.flex-item
|
20
|
+
span.edit-ico = '(edit)'
|
21
|
+
= text_field_tag 'name', row_name, placeholder: 'Enter param name'
|
22
|
+
span #{row_name}
|
9
23
|
- if node.nested?
|
10
24
|
div.flex-item.next-is-nested #{node.attr}(Nested)
|
11
25
|
- else
|
12
26
|
div.flex-item #{node.attr}
|
27
|
+
= submit_tag 'Save', class: 'flex-item mod-submit'
|
28
|
+
|
13
29
|
- if node.nested?
|
14
|
-
= render 'shared/response_table', locals: { rows: node.nested }
|
30
|
+
= render 'shared/response_table', locals: { rows: node.nested, nesting: nesting + [row_name] }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_api_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|