drg_books 0.5.3.1 → 0.5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/drg_books.css +5 -6
- data/app/forms/cms_menu.yml +6 -7
- data/app/forms/dc_book_chapter.yml +1 -1
- data/app/helpers/dc_book_renderer.rb +8 -4
- data/app/models/dc_book.rb +16 -0
- data/app/models/dc_book_chapter.rb +20 -0
- data/app/models/dc_book_text.rb +15 -0
- data/lib/drg_books/version.rb +1 -1
- metadata +3 -4
- data/app/models/dc_book_comment.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 397216fa45fc6a1d60ce5134b6ddb5fd9157e943
|
4
|
+
data.tar.gz: bd50b2dafda80409f1c032e3962e86361de3ac55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce9d1c60a1fcbea9c19ba9a2dc434eb4ee62c32567badd76979e610eba9f6162200395be11a8e612338bb34726ded259b3473ac6917eee657eb5f4fa465b0fef
|
7
|
+
data.tar.gz: 43b232c1b35f589153c50356c6dba0e9225bb6b47a4871ce969f641a5cceca6242645084fae0ab765820d37fff5438c5ed54badc600be086917fcdded2be4575
|
@@ -45,19 +45,18 @@ font-size: 12px;
|
|
45
45
|
font-size: 18px;
|
46
46
|
font-weight: bold;
|
47
47
|
background-color: #ff8973;
|
48
|
-
border: 1px solid #
|
48
|
+
border: 1px solid #ff8973;
|
49
49
|
border-bottom: 0px;
|
50
50
|
}
|
51
51
|
|
52
52
|
.book-chapter-prev-next {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
background-color: #eee;
|
54
|
+
border: 1px solid #ddd;
|
55
|
+
font-size: 1.1em;
|
56
|
+
padding: 4px;
|
57
57
|
}
|
58
58
|
|
59
59
|
.book-chapter-text {
|
60
|
-
font-size: 13px;
|
61
60
|
}
|
62
61
|
|
63
62
|
.book-content {
|
data/app/forms/cms_menu.yml
CHANGED
@@ -22,19 +22,18 @@
|
|
22
22
|
#++
|
23
23
|
|
24
24
|
menu:
|
25
|
-
|
25
|
+
80_dc_books:
|
26
26
|
caption: Books
|
27
|
+
icon: book lg
|
27
28
|
items:
|
28
29
|
10:
|
29
30
|
caption: helpers.label.dc_book.tabletitle
|
30
31
|
controller: cmsedit
|
31
|
-
|
32
|
-
|
33
|
-
table: dc_book
|
32
|
+
icon: book lg
|
33
|
+
table: dc_book
|
34
34
|
20:
|
35
35
|
caption: helpers.label.dc_book_chapter.tabletitle
|
36
36
|
controller: cmsedit
|
37
|
-
|
38
|
-
|
39
|
-
table: dc_book_chapter
|
37
|
+
icon: file-text-o lg
|
38
|
+
table: dc_book_chapter
|
40
39
|
|
@@ -31,33 +31,36 @@ include DcApplicationHelper
|
|
31
31
|
# List all books
|
32
32
|
########################################################################
|
33
33
|
def list
|
34
|
-
html = ''
|
34
|
+
html = "<div class='#{@opts[:div]}'>"
|
35
35
|
if @opts[:edit_mode] > 1
|
36
36
|
html << dc_link_for_create({ controller: 'cmsedit', table: 'dc_book', title: t('dc_book.new_book') })
|
37
37
|
end
|
38
38
|
books = DcBook.where(active: true).sort(title: 1).to_a
|
39
39
|
html << @parent.render( partial: 'dc_book/list', locals: { books: books }, formats: [:html] )
|
40
|
+
html << '</div>'
|
40
41
|
end
|
41
42
|
|
42
43
|
#########################################################################
|
43
44
|
# Table of contents
|
44
45
|
########################################################################
|
45
46
|
def toc
|
46
|
-
html = ''
|
47
|
+
html = "<div class='#{@opts[:div]}'>"
|
47
48
|
if @opts[:edit_mode] > 1
|
48
49
|
dc_add2_record_cookie( { "dc_book_chapter.dc_book_id" => @parent.params[:book_id] } )
|
49
50
|
html << dc_link_for_create({ controller: 'cmsedit', table: 'dc_book_chapter', title: t('dc_book.new_chapter') })
|
50
51
|
end
|
51
52
|
book = DcBook.find_by(link: @parent.params[:book_id])
|
53
|
+
@parent.page_title = book.title
|
52
54
|
chapters = DcBookChapter.where(dc_book_id: book._id, active: true).sort(chapter: 1).to_a
|
53
55
|
html << @parent.render( partial: 'dc_book/toc', locals: { chapters: chapters, book: book }, formats: [:html] )
|
56
|
+
html << '</div>'
|
54
57
|
end
|
55
58
|
|
56
59
|
#########################################################################
|
57
60
|
# chapter
|
58
61
|
########################################################################
|
59
62
|
def chapter
|
60
|
-
html = ''
|
63
|
+
html = "<div class='#{@opts[:div]}'>"
|
61
64
|
# texts = DcBookChapter.where(_id: @parent.params[:book_id], active: true).sort(chapter: 1).to_a
|
62
65
|
book = DcBook.find_by(link: @parent.params[:book_id])
|
63
66
|
chapter = DcBookChapter.find_by(dc_book_id: book.id, link: @parent.params[:chapter_id])
|
@@ -83,13 +86,14 @@ def chapter
|
|
83
86
|
versions = texts.inject([]) {|r,e| r << [e.version, e._id] }
|
84
87
|
# display specific version when text_id is specified
|
85
88
|
text = @parent.params[:text_id] ? chapter.dc_book_texts.find(@parent.params[:text_id]) : texts.last
|
89
|
+
@parent.page_title = "#{book.title}-#{chapter.title}"
|
86
90
|
html << @parent.render( partial: 'dc_book/chapter',
|
87
91
|
locals: { chapter: chapter, replies: replies, text: text, versions: versions,
|
88
92
|
prev_chapter: prev_chapter, next_chapter: next_chapter},
|
89
93
|
formats: [:html] )
|
90
94
|
end
|
91
95
|
end
|
92
|
-
html
|
96
|
+
html << '</div>'
|
93
97
|
end
|
94
98
|
|
95
99
|
#########################################################################
|
data/app/models/dc_book.rb
CHANGED
@@ -21,6 +21,22 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
+
######################################################################
|
25
|
+
# == Schema information
|
26
|
+
#
|
27
|
+
# Collection name: dc_book : Books
|
28
|
+
#
|
29
|
+
# _id BSON::ObjectId _id
|
30
|
+
# created_at Time created_at
|
31
|
+
# updated_at Time updated_at
|
32
|
+
# title String Book title
|
33
|
+
# link String link
|
34
|
+
# description String Short description of the book
|
35
|
+
# active Mongoid::Boolean Active
|
36
|
+
# author String Author's name
|
37
|
+
# created_by BSON::ObjectId created_by
|
38
|
+
# updated_by BSON::ObjectId updated_by
|
39
|
+
######################################################################
|
24
40
|
class DcBook
|
25
41
|
include Mongoid::Document
|
26
42
|
include Mongoid::Timestamps
|
@@ -21,6 +21,26 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
+
######################################################################
|
25
|
+
# == Schema information
|
26
|
+
#
|
27
|
+
# Collection name: dc_book_chapter : Chapter
|
28
|
+
#
|
29
|
+
# _id BSON::ObjectId _id
|
30
|
+
# created_at Time created_at
|
31
|
+
# updated_at Time updated_at
|
32
|
+
# title String Chapter title
|
33
|
+
# chapter String Chapter number. Can be nested 01.10.08.1
|
34
|
+
# link String link
|
35
|
+
# author String Author's name
|
36
|
+
# can_comment Mongoid::Boolean Comments are allowed
|
37
|
+
# active Mongoid::Boolean active
|
38
|
+
# created_by BSON::ObjectId created_by
|
39
|
+
# updated_by BSON::ObjectId updated_by
|
40
|
+
# dc_book_id Object Book title
|
41
|
+
# dc_book_texts Embedded:DcBookText dc_book_texts
|
42
|
+
# dc_replies Embedded:DcReply dc_replies
|
43
|
+
######################################################################
|
24
44
|
class DcBookChapter
|
25
45
|
include Mongoid::Document
|
26
46
|
include Mongoid::Timestamps
|
data/app/models/dc_book_text.rb
CHANGED
@@ -21,6 +21,21 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#++
|
23
23
|
|
24
|
+
######################################################################
|
25
|
+
# == Schema information
|
26
|
+
#
|
27
|
+
# Collection name: dc_book_text : Chapter text
|
28
|
+
#
|
29
|
+
# _id BSON::ObjectId _id
|
30
|
+
# created_at Time created_at
|
31
|
+
# updated_at Time updated_at
|
32
|
+
# body String Text body
|
33
|
+
# version String Version number
|
34
|
+
# author String Author's name
|
35
|
+
# active Mongoid::Boolean active
|
36
|
+
# created_by BSON::ObjectId created_by
|
37
|
+
# updated_by BSON::ObjectId updated_by
|
38
|
+
######################################################################
|
24
39
|
class DcBookText
|
25
40
|
include Mongoid::Document
|
26
41
|
include Mongoid::Timestamps
|
data/lib/drg_books/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg_books
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.3.
|
4
|
+
version: 0.5.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damjan Rems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: drg_cms
|
@@ -44,7 +44,6 @@ files:
|
|
44
44
|
- app/helpers/dc_book_renderer.rb
|
45
45
|
- app/models/dc_book.rb
|
46
46
|
- app/models/dc_book_chapter.rb
|
47
|
-
- app/models/dc_book_comment.rb
|
48
47
|
- app/models/dc_book_text.rb
|
49
48
|
- app/views/dc_book/_chapter.html.erb
|
50
49
|
- app/views/dc_book/_chapter_old.html.erb
|
@@ -110,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
109
|
version: '0'
|
111
110
|
requirements: []
|
112
111
|
rubyforge_project:
|
113
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.6.14
|
114
113
|
signing_key:
|
115
114
|
specification_version: 4
|
116
115
|
summary: 'DRG CMS: Documentation plugin'
|
@@ -1,41 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2013+ Damjan Rems
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
-
# a copy of this software and associated documentation files (the
|
6
|
-
# "Software"), to deal in the Software without restriction, including
|
7
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
-
# the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
-
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
-
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
-
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
-
#++
|
23
|
-
|
24
|
-
class DcBookComment
|
25
|
-
include Mongoid::Document
|
26
|
-
include Mongoid::Timestamps
|
27
|
-
|
28
|
-
field :body, type: String
|
29
|
-
field :author, type: String, default: ''
|
30
|
-
field :thumbs_up, type: Integer
|
31
|
-
field :thumbs_down, type: Integer
|
32
|
-
field :thumbs, type: Integer
|
33
|
-
field :active, type: Boolean, default: true
|
34
|
-
|
35
|
-
field :created_by, type: BSON::ObjectId
|
36
|
-
field :updated_by, type: BSON::ObjectId
|
37
|
-
|
38
|
-
belongs_to :dc_book_page
|
39
|
-
|
40
|
-
index( { dc_book_page_id: 1 } )
|
41
|
-
end
|