drg_blog_news_forum 0.0.4 → 0.0.5

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: 22ddad8c605ed8303a940594c896c6e221252009
4
- data.tar.gz: 130307d97ac3e1834e48e9c57b2a345a4f51f8ea
3
+ metadata.gz: d4837fd6c77dad9f6f476277d07d9ed7cbebaa9a
4
+ data.tar.gz: aaa48e13bb70f838d7a2ffdc2a8fb61455e84564
5
5
  SHA512:
6
- metadata.gz: f25660676278eb78992e5db0adb2629d7ceb45be4fa8a69c91bce4bc091f0c8db5a5c5282d4f812e0c8a14b4062b78b5b8971fa690c1e8b311384e0a6020579d
7
- data.tar.gz: d62f37100fe7193da265ff3c3547ee604a820ddad4348fc78659a0b8a8493b34b5f4ced07448761120a140469ff7de88838940e49ed0dc9fbae323ad7335d86c
6
+ metadata.gz: fe493dfb684ef435a6b428fd433655e960543c00af1e938d724e8fd0756d023b47b4a734cbaf23d65880002b2bb2f1b292fc8ec8988c2248d90f4da6644c3cdc
7
+ data.tar.gz: 11c27a3adc9b8a012837ec3f5ce9fb419e59152eb25d8b15a56ce17e51f8e3db66465371e6f3230a7eeef4640fe735ed0ad40648c6da3d71ee1e89608e7f6744
data/README.md CHANGED
@@ -1,29 +1,17 @@
1
1
  # DrgBlogNewsForum
2
2
 
3
- DRG CMS DrgBlogNewsForum plugin implements basic funcionality for enabling blog, news or forum on your web site.
3
+ DRG CMS DrgBlogNewsForum plugin implements basic funcionality for enabling blog, news or forum on DRG CMS enabled web site.
4
4
 
5
5
  Configuration
6
6
  ----------------
7
7
 
8
- Add this line to your gem file:
8
+ Add this line to your Gemfile:
9
9
  ```ruby
10
10
  gem 'drg_blog_news_forum'
11
11
  ```
12
12
 
13
- Usage:
14
- ```yaml
15
- fields:
16
- 10:
17
- name: body
18
- type: html_field
19
- options: "height: 500, width: 550, toolbar: 'basic'"
20
-
21
- 20:
22
- name: picture
23
- type: file_select
24
- html:
25
- size: 50
26
- ```
13
+ Usage: Add this line to design.
14
+ div id="dc-blog"><%= dc_render(:dc_blog) %></div>
27
15
 
28
16
  Optional configuration in Site document:
29
17
  ```yaml
@@ -142,11 +142,10 @@ color: #aaa;
142
142
  .blog-body {
143
143
  }
144
144
  .blog-replies {
145
- margin: 5px;
146
145
  }
147
146
  .reply-top-even {
148
147
  padding:5px;
149
- background-color: #ddd;
148
+ background-color: #fff;
150
149
  }
151
150
  .reply-top-odd {
152
151
  padding:5px;
@@ -161,10 +160,8 @@ font-weight: bold;
161
160
  }
162
161
 
163
162
  .social-sites {
164
- margin-top: 20px;
165
- margin-bottom: 20px;
163
+ margin-top: 30px;
164
+ margin-bottom: 40px;
166
165
  padding-top: 5px;
167
166
  padding-bottom: 5px;
168
- border-top: 1px solid #888;
169
- border-bottom: 1px solid #888;
170
167
  }
@@ -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::DcNewsDcReplyControl
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
+ end
41
+
42
+ ######################################################################
43
+ # Called before save. Reloads browser.
44
+ ######################################################################
45
+ def dc_before_save()
46
+ @record.created_by_name = session[:user_name]
47
+ params[:return_to] = 'parent.reload'
48
+ end
49
+
50
+ end
@@ -27,7 +27,19 @@ menu:
27
27
  10:
28
28
  caption: helpers.label.dc_forum.tabletitle
29
29
  controller: cmsedit
30
- picture: partner.png
30
+ picture: forum.png
31
31
  params:
32
32
  table: dc_forum
33
+ 20:
34
+ caption: helpers.label.dc_blog.tabletitle
35
+ controller: cmsedit
36
+ picture: blog.png
37
+ params:
38
+ table: dc_blog
39
+ 30:
40
+ caption: helpers.label.dc_news.tabletitle
41
+ controller: cmsedit
42
+ picture: news.png
43
+ params:
44
+ table: dc_news
33
45
 
@@ -3,23 +3,26 @@
3
3
  table: dc_reply
4
4
 
5
5
  form:
6
- height: 600
6
+ height: 750
7
7
  labels_pos: top
8
8
  actions:
9
9
  1: save
10
10
 
11
11
  fields:
12
12
  10:
13
+ name: created_by_name
14
+ type: text_field
15
+ html:
16
+ size: 30
17
+
18
+ 20:
13
19
  name: subject
14
20
  type: text_field
15
21
  html:
16
22
  size: 80
17
23
 
18
- 20:
24
+ 30:
19
25
  name: body
20
26
  type: html_field
21
- options: "height: 420, toolbar: 'basic'"
27
+ options: "height: 420, toolbar: 'basic', allowedContent: false"
22
28
 
23
- 110:
24
- name: created_by_name
25
- type: hidden_field
@@ -0,0 +1,75 @@
1
+ #--
2
+ # Copyright (c) 2014+ 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
+ ########################################################################
25
+ #
26
+ ########################################################################
27
+ class DcNewsRenderer < DcRenderer
28
+ include DcApplicationHelper
29
+
30
+ ########################################################################
31
+ # Show one blog entry
32
+ ########################################################################
33
+ def show_entry
34
+ # blog = @parent.params[:blog_id] ? DcNews.find(@parent.params[:blog_id]) : DcNews.last
35
+ entry = DcNews.find_by(created_by_name: @parent.params[:name], link: @parent.params[:link])
36
+ return t('dc_blog.entry_not_found') if entry.nil?
37
+
38
+ replies = entry.dc_replies.where(active: true).order(created_at: 1).
39
+ page(@parent.params[:page]).per(5)
40
+ @parent.render partial: 'dc_news/entry', formats: [:html],
41
+ locals: { entry: entry, replies: replies, opts: @opts }
42
+ end
43
+
44
+ ########################################################################
45
+ # List all blogs from one bloger
46
+ ########################################################################
47
+ def list_all
48
+ entries = DcNews.only(:created_by_name, :link, :subject, :created_at)
49
+ .where(created_by_name: @parent.params[:name]).order_by(created_at: -1)
50
+ .page(@parent.params[:page]).per(10)
51
+ @parent.render partial: 'dc_news/entries', formats: [:html], locals: { entries: entries }
52
+ end
53
+
54
+ ########################################################################
55
+ # List all blogers
56
+ ########################################################################
57
+ def list_blogers
58
+ blogers = DcNews.all.distinct(:created_by_name)
59
+ @parent.render partial: 'dc_news/blogers', formats: [:html], locals: { blogers: blogers }
60
+ end
61
+
62
+ ########################################################################
63
+ # Default method will dispatch to proper method.
64
+ ########################################################################
65
+ def default
66
+ if @parent.params[:name].nil?
67
+ list_blogers
68
+ elsif @parent.params[:link].nil? or @parent.params[:link] == 'all'
69
+ list_all
70
+ else
71
+ show_entry
72
+ end
73
+ end
74
+
75
+ end
@@ -39,4 +39,6 @@ class DcNews
39
39
 
40
40
  validates_length_of :subject, minimum: 4
41
41
  validates_length_of :body, minimum: 10
42
+
43
+
42
44
  end
@@ -34,6 +34,7 @@ class DcReply
34
34
 
35
35
  embedded_in :replies, polymorphic: true
36
36
 
37
- validates_length_of :subject, minimum: 4
38
- validates_length_of :body, minimum: 10
37
+ validates_length_of :subject, minimum: 4
38
+ validates_length_of :body, minimum: 10
39
+ validates_length_of :created_by_name, minimum: 5
39
40
  end
@@ -1,3 +1,6 @@
1
+ <% if session[:edit_mode] > 1 %>
2
+ <%= dc_link_for_create(controller: 'cmsedit', table: 'dc_blog', title: 'dc_blog.new_entry' ) %>
3
+ <% end %>
1
4
  <div class="blog-title">
2
5
  <h1><%= t('dc_blog.blogers') %></h1>
3
6
  </div>
@@ -1,5 +1,5 @@
1
1
 
2
- <% if opts[:edit_mode] > 1 %>
2
+ <% if session[:edit_mode] > 1 %>
3
3
  <%= dc_link_for_create(controller: 'cmsedit', table: 'dc_blog', title: 'dc_blog.new_entry' ) %>
4
4
  <br><br>
5
5
  <%= dc_link_for_edit(controller: 'cmsedit', table: 'dc_blog', title: 'dc_blog.edit_entry', id: entry.id ) %>
@@ -12,6 +12,7 @@
12
12
  <div class="social-sites"><%= social_sites %></div>
13
13
 
14
14
  <div class="blog-replies">
15
+ <h2><%= t('dc_blog.comments') %></h2>
15
16
  <%= render partial: 'dc_replay/reply', formats: [:html],
16
17
  locals: { replies: replies, parent_id: entry.id, parent_document: 'dc_blog' } %>
17
18
  </div>
@@ -1,4 +1,4 @@
1
- <%= if opts[:edit_mode] > 1
1
+ <%= if session[:edit_mode] > 1
2
2
  dc_link_for_create(controller: 'cmsedit', table: 'dc_forum', title: 'dc_forum.add_new_forum' )
3
3
  end %>
4
4
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  <% for forum in forums %>
11
11
  <div class="topic-<%= cycle("odd", "even") %>">
12
- <%= if opts[:edit_mode] > 1 then
12
+ <%= if session[:edit_mode] > 1 then
13
13
  dc_link_for_edit(controller: 'cmsedit', table: 'dc_forum', id: forum._id, title: 'dc_forum.edit_forum' ); end %>
14
14
  <div class="name">
15
15
  <%= link_to(forum.name,{ path: params[:path], forum: forum.id} ) %>
@@ -0,0 +1,13 @@
1
+ <div class="blog-title">
2
+ <h1><%= params[:name] %>, <%= t('dc_blog.my_blog') %></h1>
3
+ </div>
4
+ <% for entry in entries %>
5
+
6
+ <div class="blog-entry">
7
+
8
+ <%= link_to( entry.subject,
9
+ { path: 'blog', name: params[:name], link: entry.link } )%>
10
+
11
+ <div class="blog-date"><h3><%= dc_pretty_date(entry.created_at) %></h3></div>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,21 @@
1
+
2
+ <% if session[:edit_mode] > 1 %>
3
+ <%= dc_link_for_create(controller: 'cmsedit', table: 'dc_news', title: 'dc_news.new_entry' ) %>
4
+ <br><br>
5
+ <%= dc_link_for_edit(controller: 'cmsedit', table: 'dc_news', title: 'dc_news.edit_entry', id: entry.id ) %>
6
+ <% end %>
7
+
8
+ <div class="news-subject"><h1><%= entry.subject %></h1></div>
9
+ <div class="news-date"><h3><%= t('dc_blog.author') + ' ' + dc_pretty_date(entry.created_at) %></h3></div>
10
+ <div class="news-date"><h3><%= t('dc_blog.published') + ' ' + dc_pretty_date(entry.created_by_name) %></h3></div>
11
+
12
+ <div class="news-body"><%= entry.body.html_safe %></div>
13
+ <div class="social-sites"><%= social_sites %></div>
14
+
15
+ <div class="news-replies">
16
+ <h2><%= t('dc_blog.comments') %></h2>
17
+ <%= render partial: 'dc_replay/reply', formats: [:html],
18
+ locals: { replies: replies, parent_id: entry.id, parent_document: 'dc_news' } %>
19
+ </div>
20
+
21
+ <iframe id="iframe_edit" name="iframe_edit" scrolling="no"></iframe>
@@ -0,0 +1,24 @@
1
+ <div class="news-title">
2
+ <%= title %>
3
+ </div>
4
+
5
+ <%= if session[:edit_mode] > 1
6
+ dc_link_for_create(controller: 'cmsedit', table: 'dc_news', title: 'dc_blog.new_entry' )
7
+ end %>
8
+
9
+ <% if news %>
10
+ <div class="news-date"><%= dc_pretty_date(news.created_at) %></div>
11
+ <div class="news-subject"><%= news.subject %></div>
12
+ <div style="clear:both;"></div>
13
+
14
+ <div class="news-body"><%= news.body%></div>
15
+
16
+ <div class="news-replies">
17
+ <%= render partial: 'dc_reply/reply', formats: [:html],
18
+ locals: { replies: replies, parent_id: news.id } %>
19
+ </div>
20
+
21
+ <iframe id="iframe_edit" name="iframe_edit" scrolling="no"></iframe>
22
+ <% else %>
23
+ <br><br><br>Sorry no news. Yet ;-)
24
+ <% end %>
@@ -24,6 +24,7 @@
24
24
  # English (en) localization for dc_forum
25
25
  en:
26
26
  dc_forum:
27
+ menu_caption: Forums, news and blogs
27
28
  forums_list: All forums
28
29
  new_reply: New reply
29
30
  new_topic: New topic
@@ -41,5 +42,6 @@ en:
41
42
  edit_entry: Edit blog entry
42
43
  entry_not_found: Blog entry not found
43
44
  my_blog: my blog
45
+ comments: Comments
44
46
 
45
47
 
@@ -24,6 +24,7 @@
24
24
  # Slovenian (sl) localization for dc_forum
25
25
  sl:
26
26
  dc_forum:
27
+ menu_caption: Forumi, novice and blogi
27
28
  forums_list: Vsi forumi
28
29
  new_reply: Nov odgovor
29
30
  new_topic: Nova tema
@@ -41,6 +42,7 @@ sl:
41
42
  edit_entry: Uredi vpis v blog
42
43
  entry_not_found: Vpis v blog ne obstaja
43
44
  my_blog: moj blog
45
+ comments: Komentarji
44
46
 
45
47
 
46
48
 
@@ -1,3 +1,3 @@
1
1
  module DrgBlogNewsForum
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drg_blog_news_forum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
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-03-07 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,8 +38,8 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: DrgBlogNewsForum plugin implements basic funcionality for enabling blog,
42
- news or forum on your web site.
41
+ description: 'DRG CMS: drg_blog_news_forum plugin implements basic funcionality for
42
+ enabling blog, news or forum.'
43
43
  email:
44
44
  - damjan.rems@gmail.com
45
45
  executables: []
@@ -53,6 +53,7 @@ files:
53
53
  - app/controllers/drgcms_controls/dc_blog_dc_reply_control.rb
54
54
  - app/controllers/drgcms_controls/dc_forum_topic_control.rb
55
55
  - app/controllers/drgcms_controls/dc_forum_topic_dc_reply_control.rb
56
+ - app/controllers/drgcms_controls/dc_news_dc_reply_control.rb
56
57
  - app/forms/cms_menu.yml
57
58
  - app/forms/dc_blog.yml
58
59
  - app/forms/dc_forum.yml
@@ -63,6 +64,7 @@ files:
63
64
  - app/helpers/dc_blog_renderer.rb
64
65
  - app/helpers/dc_forum_helper.rb
65
66
  - app/helpers/dc_forum_renderer.rb
67
+ - app/helpers/dc_news_renderer.rb
66
68
  - app/models/dc_blog.rb
67
69
  - app/models/dc_forum.rb
68
70
  - app/models/dc_forum_policy_rule.rb
@@ -77,6 +79,9 @@ files:
77
79
  - app/views/dc_forum/_forums.html.erb
78
80
  - app/views/dc_forum/_topic.html.erb
79
81
  - app/views/dc_forum/_topics.html.erb
82
+ - app/views/dc_news/_entries.html.erb
83
+ - app/views/dc_news/_entry.html.erb
84
+ - app/views/dc_news/_news.html.erb
80
85
  - app/views/dc_replay/_reply.html.erb
81
86
  - config/locales/dc_forum_en.yml
82
87
  - config/locales/dc_forum_sl.yml