drg_manual 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -47
- data/app/models/dc_manual.rb +6 -12
- data/app/models/dc_manual_page.rb +6 -1
- data/lib/drg_manual/version.rb +1 -1
- metadata +2 -6
- data/app/controllers/drgcms_controls/dc_book_chapter_dc_reply_control.rb +0 -50
- data/app/views/dc_manual/_chapter.html.erb +0 -36
- data/app/views/dc_manual/_chapter_old.html.erb +0 -34
- data/app/views/dc_manual/_toc.html.erb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0eb5487551076bd4b456c53d17eb011bc5f5892
|
4
|
+
data.tar.gz: d59223949730f3a49bb0122a86d9d99dc29cc963
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bf0504aaea30375fddfc971c3c1c89637ec796911738d5dc908ec922e8957d8fc193ad3bf9fb53b68526443ec684b93acc46a4bb83961277dce395cd8ce6299
|
7
|
+
data.tar.gz: ec02129fe0f099f0fab2652a5594ee7e71edf8c4b8b2db35460634c1c8afd61aa2af6e82f3a0f3b96f487e478fc7c9e4d7f9340836365544f29bbe988f832fdc
|
data/README.md
CHANGED
@@ -1,60 +1,30 @@
|
|
1
|
-
#
|
1
|
+
# DrgManual
|
2
2
|
|
3
|
-
|
3
|
+
DrgManual implements documentation manual web element for DRG CMS.
|
4
4
|
|
5
|
-
|
6
|
-
----------------
|
7
|
-
|
8
|
-
Usage:
|
5
|
+
##Usage:
|
9
6
|
|
10
7
|
Add this line to your Gemfile:
|
11
|
-
```ruby
|
12
|
-
gem 'drg_books'
|
13
|
-
```
|
14
|
-
|
15
|
-
Create apropriate dc_page document with related design. Use this line in design.
|
16
|
-
```irb
|
17
|
-
div id="docs"><%= dc_render(:dc_book) %></div>
|
18
|
-
```
|
19
8
|
|
20
|
-
Update routes.rb
|
21
9
|
```ruby
|
22
|
-
|
23
|
-
get '/books/:method/:book_id/:chapter_id', to: 'dc_main#page', :defaults => { path: 'books' }
|
24
|
-
get '/books/:method/:book_id/:chapter_id/:version', to: 'dc_main#page', :defaults => { path: 'books' }
|
10
|
+
gem 'drg_manual'
|
25
11
|
```
|
12
|
+
Create new Design document and put this line of code into it.
|
26
13
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
[www.drgcms.org](http://www.drgcms.org)
|
32
|
-
|
33
|
-
License
|
34
|
-
-------
|
35
|
-
|
36
|
-
Copyright (c) 2012-2015 Damjan Rems
|
14
|
+
```irb
|
15
|
+
<%= dc_render :dc_manual %>
|
16
|
+
```
|
17
|
+
then create new Page document and link it to design.
|
37
18
|
|
38
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
39
|
-
a copy of this software and associated documentation files (the
|
40
|
-
"Software"), to deal in the Software without restriction, including
|
41
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
42
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
43
|
-
permit persons to whom the Software is furnished to do so, subject to
|
44
|
-
the following conditions:
|
45
19
|
|
46
|
-
|
47
|
-
included in all copies or substantial portions of the Software.
|
20
|
+
You may wrap code with div element.
|
48
21
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
53
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
54
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
55
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
```irb
|
23
|
+
<%= dc_render(:dc_manual, div: 'wrap-class my-manual-class') %>
|
24
|
+
```
|
56
25
|
|
57
|
-
|
58
|
-
|
26
|
+
## Contributing
|
27
|
+
Fork this repository on GitHub and issue a pull request
|
59
28
|
|
60
|
-
|
29
|
+
## License
|
30
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/app/models/dc_manual.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2018 Damjan Rems
|
2
|
+
# Copyright (c) 2018+ Damjan Rems
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -21,7 +21,9 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
-
|
24
|
+
##########################################################################
|
25
|
+
# DcManual model definition. DcManual defines common data for manual document.
|
26
|
+
##########################################################################
|
25
27
|
class DcManual
|
26
28
|
include Mongoid::Document
|
27
29
|
include Mongoid::Timestamps
|
@@ -108,15 +110,7 @@ def self.update_menu(document)
|
|
108
110
|
end
|
109
111
|
|
110
112
|
######################################################################
|
111
|
-
#
|
112
|
-
######################################################################
|
113
|
-
#def self.all_manuals_menu()
|
114
|
-
# manuals = self.only(:id, :title, :link).where(active: true).order_by(title: 1).to_a
|
115
|
-
# manuals.inject([]) { |result, manual| result += self.meni_en_prirocnik(element) }
|
116
|
-
#end
|
117
|
-
|
118
|
-
######################################################################
|
119
|
-
# Returns menu for manual
|
113
|
+
# Returns menu for single manual
|
120
114
|
######################################################################
|
121
115
|
def self.get_menu(manual)
|
122
116
|
manual.menu.split("\n").each.inject([]) do |result, line|
|
@@ -125,7 +119,7 @@ def self.get_menu(manual)
|
|
125
119
|
end
|
126
120
|
|
127
121
|
######################################################################
|
128
|
-
#
|
122
|
+
# Returns menu for all manuals
|
129
123
|
######################################################################
|
130
124
|
def self.get_all_menus()
|
131
125
|
manuals = self.only(:menu).where(active: true).order_by(title: 1).to_a
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2018 Damjan Rems
|
2
|
+
# Copyright (c) 2018+ Damjan Rems
|
3
3
|
#
|
4
4
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
@@ -21,6 +21,11 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
+
##########################################################################
|
25
|
+
# DcManualPage model definition.
|
26
|
+
#
|
27
|
+
# DcManualPage defines data for single page on manual document.
|
28
|
+
##########################################################################
|
24
29
|
class DcManualPage
|
25
30
|
include Mongoid::Document
|
26
31
|
include Mongoid::Timestamps
|
data/lib/drg_manual/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_manual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: drg_cms
|
@@ -35,7 +35,6 @@ files:
|
|
35
35
|
- README.md
|
36
36
|
- Rakefile
|
37
37
|
- app/assets/stylesheets/drg_manual.css
|
38
|
-
- app/controllers/drgcms_controls/dc_book_chapter_dc_reply_control.rb
|
39
38
|
- app/forms/cms_menu.yml
|
40
39
|
- app/forms/dc_manual.yml
|
41
40
|
- app/forms/dc_manual_page.yml
|
@@ -43,10 +42,7 @@ files:
|
|
43
42
|
- app/helpers/dc_manual_renderer.rb
|
44
43
|
- app/models/dc_manual.rb
|
45
44
|
- app/models/dc_manual_page.rb
|
46
|
-
- app/views/dc_manual/_chapter.html.erb
|
47
|
-
- app/views/dc_manual/_chapter_old.html.erb
|
48
45
|
- app/views/dc_manual/_list.html.erb
|
49
|
-
- app/views/dc_manual/_toc.html.erb
|
50
46
|
- config/locales/dc_manual_en.yml
|
51
47
|
- config/locales/dc_manual_sl.yml
|
52
48
|
- config/routes.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
#encoding: utf-8
|
2
|
-
#--
|
3
|
-
# Copyright (c) 2014+ Damjan Rems
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
# a copy of this software and associated documentation files (the
|
7
|
-
# "Software"), to deal in the Software without restriction, including
|
8
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
# the following conditions:
|
12
|
-
#
|
13
|
-
# The above copyright notice and this permission notice shall be
|
14
|
-
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
16
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
#++
|
24
|
-
|
25
|
-
######################################################################
|
26
|
-
# DrgcmsControls for DcBlog.DcReply form
|
27
|
-
######################################################################
|
28
|
-
module DrgcmsControls::DcBookChapterDcReplyControl
|
29
|
-
|
30
|
-
######################################################################
|
31
|
-
# Called when new empty record is created
|
32
|
-
######################################################################
|
33
|
-
def dc_new_record()
|
34
|
-
# fill with quote when reply_to is present
|
35
|
-
if params[:reply_to]
|
36
|
-
replyto = @record._parent.dc_replies.find(params[:reply_to])
|
37
|
-
@record.subject = "Re: #{replyto.subject}"
|
38
|
-
@record.body = "<div class='dc-forum-quote'>#{replyto.body}</div><br>"
|
39
|
-
end
|
40
|
-
@record.created_by_name = session[:user_name] if session[:user_name]
|
41
|
-
end
|
42
|
-
|
43
|
-
######################################################################
|
44
|
-
# Called before save. Reloads browser.
|
45
|
-
######################################################################
|
46
|
-
def dc_before_save()
|
47
|
-
params[:return_to] = 'parent.reload'
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<div class="book-top"><%= chapter.dc_book.title %></div>
|
2
|
-
|
3
|
-
<div class="book-chapter-title"><%= chapter.title %></div>
|
4
|
-
<div class="book-chapter-prev-next">
|
5
|
-
<%= dc_link_to(prev_chapter.title, 'hand-o-left', controller: :books, method: 'chapter',
|
6
|
-
book_id: prev_chapter.dc_book.link, chapter_id: prev_chapter.link ) if prev_chapter %> |
|
7
|
-
<%= dc_link_to(' ','hand-o-up', book_id: chapter.dc_book.link, method: 'toc' ) %> |
|
8
|
-
<%= dc_link_to(next_chapter.title, 'hand-o-right', controller: :books, method: 'chapter',
|
9
|
-
book_id: next_chapter.dc_book.link, chapter_id: next_chapter.link ) if next_chapter %>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<div class="book-chapter-text">
|
13
|
-
<%= if dc_edit_mode?
|
14
|
-
dc_link_for_edit({ controller: 'cmsedit', action: 'edit', id: text._id, ids: chapter._id,
|
15
|
-
table: 'dc_book_chapter;dc_book_text', title: "#{t('drgcms.edit')}" })
|
16
|
-
end %>
|
17
|
-
|
18
|
-
<%= text.body.html_safe %>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<div class="book-chapter-prev-next">
|
22
|
-
<%= dc_link_to(prev_chapter.title, 'hand-o-left', method: 'chapter',
|
23
|
-
book_id: prev_chapter.dc_book.link, chapter_id: prev_chapter.link ) if prev_chapter %> |
|
24
|
-
<%= dc_link_to(' ','hand-o-up', book_id: chapter.dc_book.link, method: 'toc' ) %> |
|
25
|
-
<%= dc_link_to(next_chapter.title, 'hand-o-right', method: 'chapter',
|
26
|
-
book_id: next_chapter.dc_book.link, chapter_id: next_chapter.link ) if next_chapter %>
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<div class="book-replies">
|
30
|
-
<h2><%= t('dc_blog.comments') %></h2>
|
31
|
-
<%= render partial: 'dc_replay/reply', formats: [:html],
|
32
|
-
locals: { replies: replies, parent_doc: chapter, parent_document: 'dc_book_chapter' } %>
|
33
|
-
</div>
|
34
|
-
<br>
|
35
|
-
|
36
|
-
<iframe id="iframe_edit" name="iframe_edit" scrolling="no"></iframe>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
<div class="book-top">
|
2
|
-
<%= chapter.dc_book.title %>
|
3
|
-
<div style="font-size:0.6em;"><%= chapter.title %></div>
|
4
|
-
</div>
|
5
|
-
<div class="book-chapter-versions"><%= t('drgcms.version', 'Version') %>:
|
6
|
-
<% versions.each do |v| %>
|
7
|
-
<%= text.version == v[0] ? v[0] :
|
8
|
-
link_to(v[0], method: 'chapter', book_id: chapter.dc_book_id, chapter_id: chapter._id, text_id: v[1] ) %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
<div class="book-chapter-prev-next">
|
12
|
-
<%= dc_link_to(prev_chapter.title, 'hand-o-left', method: 'chapter',
|
13
|
-
book_id: prev_chapter.dc_book.link, chapter_id: prev_chapter.link ) if prev_chapter %> |
|
14
|
-
<%= dc_link_to(' ','hand-o-up', book_id: chapter.dc_book.link, method: 'toc' ) %> |
|
15
|
-
<%= dc_link_to(next_chapter.title, 'hand-o-right', method: 'chapter',
|
16
|
-
book_id: next_chapter.dc_book.link, chapter_id: next_chapter.link ) if next_chapter %>
|
17
|
-
|
18
|
-
</div>
|
19
|
-
<div class="book-chapter-text">
|
20
|
-
<%= if dc_edit_mode?
|
21
|
-
dc_link_for_edit({ controller: 'cmsedit', action: 'edit', id: text._id, ids: chapter._id,
|
22
|
-
table: 'dc_book_chapter;dc_book_text', title: "#{t('drgcms.edit')}" })
|
23
|
-
end %>
|
24
|
-
|
25
|
-
<%= text.body.html_safe %>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div class="book-replies">
|
29
|
-
<h2><%= t('dc_blog.comments') %></h2>
|
30
|
-
<%= render partial: 'dc_replay/reply', formats: [:html],
|
31
|
-
locals: { replies: replies, parent_id: chapter.id, parent_document: 'dc_book_chapter' } %>
|
32
|
-
</div>
|
33
|
-
|
34
|
-
<iframe id="iframe_edit" name="iframe_edit" scrolling="no"></iframe>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div class="book-top"><%= book.title %>
|
2
|
-
<div class="book-contents">
|
3
|
-
<% chapters.each do |chapter| %>
|
4
|
-
<% a=chapter.chapter.split('.'); last=a.last; level=a.size%>
|
5
|
-
<div class="book-contents-level<%= level %>">
|
6
|
-
<%= link_to(chapter.title, method: 'chapter', book_id: chapter.dc_book.link, chapter_id: chapter.link ) %>
|
7
|
-
</div>
|
8
|
-
<% end %>
|
9
|
-
</div>
|
10
|
-
</div>
|