drg_blog_news_forum 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3f2bcf9149eb30a3d7d8739b8cb6d9a3586ea5c
4
- data.tar.gz: 6b7c3bed9658f9399fee24c05478606fb94f1401
3
+ metadata.gz: 91f2d65be879d27057f55fdc392ef96979710d3d
4
+ data.tar.gz: 91886f9216f41b20d84c1805547cd7ade47432d4
5
5
  SHA512:
6
- metadata.gz: 07141aed1b47f5fe2a0e294dfbfb4872e9b4547d62665d8ec36bf94fe4a2f0f7a542ebd5a40f0bef87e41cfc04db94969eab544e3a8c16d04960f252f77ff250
7
- data.tar.gz: 8343b36ab04dd047514d3db2dae22e6be106b7994420c46a982a4b67a982e537aef0cf5eb25c8dd937b84d4c3c3b4747753a9e4985f0dfd54aa4b95fd6fa02e7
6
+ metadata.gz: 79e6b274b42ad04ba727b936b6a789b2471f4f88f1d02a018e3ce17eb0b6036b8acbe6489284d673cdbba50e45c8ba576f88826152d878ad2fac25ba9dd8b6fa
7
+ data.tar.gz: 69d5f431ec4553278d6cc3da26377c0221a41374f45a0c076ddbc591f44a35e8e6b2c0398d629d621ae66298d8fd8d0d3d954632f7738bf8d44fc6710e9cd2eb
@@ -72,6 +72,11 @@ height: 1px;
72
72
  border-top: none;
73
73
  }
74
74
 
75
+ #dc-reply-menu {
76
+ border: none;
77
+ padding: 5px 0px;
78
+ }
79
+
75
80
  #dc-forum .reply-top-odd, #dc-forum .reply-top-even {
76
81
  margin-top: 10px;
77
82
  padding: 4px;
@@ -23,23 +23,21 @@
23
23
  menu:
24
24
  80_dc_forum_menu:
25
25
  caption: dc_forum.menu_caption
26
+ icon: cubes lg
26
27
  items:
27
28
  10:
28
- caption: helpers.label.dc_forum.tabletitle
29
+ caption: helpers.label.dc_blog.tabletitle
29
30
  controller: cmsedit
30
- picture: forum.png
31
- params:
32
- table: dc_forum
31
+ icon: comment-o lg
32
+ table: dc_blog
33
33
  20:
34
- caption: helpers.label.dc_blog.tabletitle
34
+ caption: helpers.label.dc_news.tabletitle
35
35
  controller: cmsedit
36
- picture: blog.png
37
- params:
38
- table: dc_blog
36
+ icon: info lg
37
+ table: dc_news
39
38
  30:
40
- caption: helpers.label.dc_news.tabletitle
39
+ caption: helpers.label.dc_forum.tabletitle
41
40
  controller: cmsedit
42
- picture: news.png
43
- params:
44
- table: dc_news
41
+ icon: server lg
42
+ table: dc_forum
45
43
 
@@ -59,6 +59,22 @@ def list_blogers
59
59
  @parent.render partial: 'dc_blog/blogers', formats: [:html], locals: { blogers: blogers }
60
60
  end
61
61
 
62
+ ########################################################################
63
+ # List last blogs on home page. But no more than 3 entries and not older than 2 months.
64
+ ########################################################################
65
+ def last_blogs
66
+ limit = @opts[:limit] || 3
67
+ entries = DcBlog.only(:created_by_name, :link, :subject, :created_at)
68
+ .where(active: true, :created_at.gt => 2.months.ago)
69
+ .order_by(created_at: -1).limit(limit).to_a
70
+ if entries.size > 0
71
+ @parent.render partial: 'dc_blog/last_blogs', formats: [:html], locals: { entries: entries }
72
+ else
73
+ ''
74
+ end
75
+ end
76
+
77
+
62
78
  ########################################################################
63
79
  # Default method will dispatch to proper method.
64
80
  ########################################################################
@@ -50,6 +50,21 @@ def list_all
50
50
  @parent.render partial: 'dc_news/entries', formats: [:html], locals: { entries: entries }
51
51
  end
52
52
 
53
+ ########################################################################
54
+ # List last news on home page. But no more than 3 entries and not older than 2 months.
55
+ ########################################################################
56
+ def last_news
57
+ limit = @opts[:limit] || 3
58
+ entries = DcNews.only(:created_by_name, :link, :subject, :created_at)
59
+ .where(active: true, :created_at.gt => 2.months.ago)
60
+ .order_by(created_at: -1).limit(limit).to_a
61
+ if entries.size > 0
62
+ @parent.render partial: 'dc_news/last_news', formats: [:html], locals: { entries: entries }
63
+ else
64
+ ''
65
+ end
66
+ end
67
+
53
68
  ########################################################################
54
69
  # Default method will dispatch to proper method.
55
70
  ########################################################################
@@ -0,0 +1,10 @@
1
+ <div id="last-blogs">
2
+ <h3><%= t('dc_blog.last_blogs') %></h3>
3
+
4
+ <% for entry in entries %>
5
+ <div class="entry">
6
+ <span class="date"><%= dc_pretty_date(entry.created_at) %></span>
7
+ <span class="title"><%= link_to( entry.subject, { path: 'news', link: entry.link } )%></span>
8
+ </div>
9
+ <% end %>
10
+ </div>
@@ -0,0 +1,10 @@
1
+ <div id="last-news">
2
+ <h3><%= t('dc_news.last_news') %></h3>
3
+
4
+ <% for entry in entries %>
5
+ <div class="entry">
6
+ <span class="date"><%= dc_pretty_date(entry.created_at) %></span>
7
+ <span class="title"><%= link_to( entry.subject, { path: 'news', link: entry.link } )%></span>
8
+ </div>
9
+ <% end %>
10
+ </div>
@@ -44,9 +44,11 @@ en:
44
44
  entry_not_found: Blog entry not found
45
45
  my_blog: my blog
46
46
  comments: Comments
47
+ last_blogs: Last blogs
47
48
 
48
49
  dc_news:
49
50
  news: News
50
51
  new_entry: Create new news article
51
52
  edit_entry: Edit news entry
52
53
  entry_not_found: News article not found
54
+ last_news: Last news
@@ -44,12 +44,14 @@ sl:
44
44
  entry_not_found: Vpis v blog ne obstaja
45
45
  my_blog: moj blog
46
46
  comments: Komentarji
47
+ last_blogs: Zadnje objave na blogu
47
48
 
48
49
  dc_news:
49
50
  news: Novice
50
51
  new_entry: Nova novica
51
52
  edit_entry: Urejanje novice
52
53
  entry_not_found: Novica ne obstaja
54
+ last_news: Zadnje novice
53
55
 
54
56
 
55
57
 
@@ -1,3 +1,3 @@
1
1
  module DrgBlogNewsForum
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
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.5.2
4
+ version: 0.5.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: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2015-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -73,17 +73,18 @@ files:
73
73
  - app/models/dc_forum_topic.rb
74
74
  - app/models/dc_news.rb
75
75
  - app/models/dc_reply.rb
76
- - app/models/dc_reply_concern.rb
77
76
  - app/views/dc_blog/_blog.html.erb
78
77
  - app/views/dc_blog/_blogers.html.erb
79
78
  - app/views/dc_blog/_entries.html.erb
80
79
  - app/views/dc_blog/_entry.html.erb
80
+ - app/views/dc_blog/_last_blogs.erb
81
81
  - app/views/dc_forum/_forums.html.erb
82
82
  - app/views/dc_forum/_topic.html.erb
83
83
  - app/views/dc_forum/_topics.html.erb
84
84
  - app/views/dc_news/___news.html.erb
85
85
  - app/views/dc_news/_entries.html.erb
86
86
  - app/views/dc_news/_entry.html.erb
87
+ - app/views/dc_news/_last_news.erb
87
88
  - app/views/dc_news/_news.html.erb
88
89
  - app/views/dc_replay/_reply.html.erb
89
90
  - config/locales/dc_forum_en.yml
@@ -1,45 +0,0 @@
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
- module DcReplyConcern
25
- extend ActiveSupport::Concern
26
- included do
27
-
28
- include Mongoid::Document
29
- include Mongoid::Timestamps
30
-
31
- field :subject, type: String, default: ''
32
- field :body, type: String, default: ''
33
- field :active, type: Boolean, default: true
34
-
35
- field :created_by, type: BSON::ObjectId
36
-
37
- embedded_in :dc_forum_topic
38
-
39
- index( { dc_forum_topic_id: 1 } )
40
-
41
- validates_length_of :subject, minimum: 4
42
- validates_length_of :body, minimum: 10
43
-
44
- end
45
- end