drg_books 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6200e22549ee905d46da73e11858658c2c3c76b9
4
- data.tar.gz: 539ce28d5f7386b91d0279721cc583cfe7a89f68
3
+ metadata.gz: dce0e4e335d1c80fe9ae39259c8c859fc8873bab
4
+ data.tar.gz: b30fd324f9d06be71f032e2a4cb8bc47f4722c1e
5
5
  SHA512:
6
- metadata.gz: b2617901e37e0cfc2777313765245b413dec8f611538a5be515d0e006e2f50793bb40d66881a12240d428065caa1664104e2cec4dc247692b2fafeff7d8a53fc
7
- data.tar.gz: 746119f252559e526834415595b060f652778d31cffcf7192bb0ed76debc03cb8da778d8f66e4ec74d334cbc791029c4a310ddbf74063c2642262d19bff31387
6
+ metadata.gz: e5e1f1e4c02eb565628a5f514a6cc9e86ee362f7390a9012764f80f1f88eec4442adb250532de482ec4782757305b7db12d621ca8609d6390ecf245f0c1b0a37
7
+ data.tar.gz: 57aee972ed68912d0557f27fdd62d1003aed52cc8ac84aa759aea7376b6a99adb03b2ae5ab7e270262eaf6a611af427a47919c5e9591ab30d193de2dc8d82e38
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DrgBlogNewsForum
1
+ # DrgBooks
2
2
 
3
3
  DrgBooks plugin implements documentation management in DRG CMS enabled web site.
4
4
 
@@ -0,0 +1,50 @@
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
@@ -56,10 +56,8 @@ form:
56
56
 
57
57
  50:
58
58
  name: dc_book_id
59
- type: text_autocomplete
60
- search: dc_book.title
61
- html:
62
- size: 30
59
+ type: select
60
+ eval: dc_choices4('dc_book','title')
63
61
 
64
62
  2texts:
65
63
  10:
@@ -77,12 +77,15 @@ def chapter
77
77
  if chapter
78
78
  texts = chapter.dc_book_texts.where(active: true).to_a
79
79
  if texts.size > 0
80
+ replies = chapter.dc_replies.where(active: true).order(created_at: 1).
81
+ page(@parent.params[:page]).per(20)
80
82
  versions = texts.inject([]) {|r,e| r << [e.version, e._id] }
81
83
  # display specific version when text_id is specified
82
84
  text = @parent.params[:text_id] ? chapter.dc_book_texts.find(@parent.params[:text_id]) : texts.last
83
85
  html << @parent.render( partial: 'dc_book/chapter',
84
- locals: { chapter: chapter, text: text, versions: versions,
85
- prev_chapter: prev_chapter, next_chapter: next_chapter}, formats: [:html] )
86
+ locals: { chapter: chapter, replies: replies, text: text, versions: versions,
87
+ prev_chapter: prev_chapter, next_chapter: next_chapter},
88
+ formats: [:html] )
86
89
  end
87
90
  end
88
91
  html
@@ -37,6 +37,7 @@ class DcBookChapter
37
37
 
38
38
  belongs_to :dc_book
39
39
  embeds_many :dc_book_texts
40
+ embeds_many :dc_replies, as: :replies
40
41
 
41
42
  index( { dc_book_id: 1, link: 1 } )
42
43
 
@@ -22,5 +22,13 @@
22
22
  table: 'dc_book_chapter;dc_book_text', title: "#{t('drgcms.edit')}" })
23
23
  end %>
24
24
 
25
- <%= text.body.html_safe %></div>
26
- <div class="book-chapter-comments">Comments</div>
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,3 +1,3 @@
1
1
  module DrgBooks
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
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.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damjan Rems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-10 00:00:00.000000000 Z
11
+ date: 2015-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: drg_cms
@@ -36,6 +36,7 @@ files:
36
36
  - Rakefile
37
37
  - app/assets/stylesheets/drg_books.css
38
38
  - app/controllers/books_controller.rb
39
+ - app/controllers/drgcms_controls/dc_book_chapter_dc_reply_control.rb
39
40
  - app/forms/cms_menu.yml
40
41
  - app/forms/dc_book.yml
41
42
  - app/forms/dc_book_chapter.yml
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.2.3
111
+ rubygems_version: 2.2.5
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: 'DRG CMS: Documentation plugin'