drg_blog_news_forum 0.6.0 → 0.6.1

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
  SHA256:
3
- metadata.gz: e307b17051749b2428f07d7615dd33737f23f600ae71c753dccab91cd11ea180
4
- data.tar.gz: f90a7aa381787ce561f8936b9ba018af524755392dc45cdaa48328d73bebb432
3
+ metadata.gz: 7a6ee97f5e6a504d5a73e26cd89139540a69aed9afaf9fa920653d978a9c6231
4
+ data.tar.gz: ffaa7785803e8fbec870aa86197e021ba306d331f78f685c9e8a8efbaf5ea370
5
5
  SHA512:
6
- metadata.gz: 7c8626aa7bb8a48b97a3ec7a04f8d09341082cce69980ba373e29091dd431b69d0d9cc95603f6358095423a5fc77aff03c2c55a55fa7e6b9696eb526137e6355
7
- data.tar.gz: dd9b14a931d2720ac83d51fb1d0bacd91eac54e852d693028e1557f3d0d24516a9a7d6fefe84f77b64daa7e05a0ee70414cccb20ebd33aed53ba01e5f3a595dc
6
+ metadata.gz: 172373b43d2cde7ee76864c97b0a3a1c291d12dbe6c563a765f42df024f3f3c476d235f3af9940be98f0f2579fedb9249f870fd2b6bbb924828a469c8c8934a8
7
+ data.tar.gz: 83d52cd7d5bac8dc2d5a0a9bb229112a7fad12bdb99e219761469173e3f0bd33e2e570009dd76872f9fb3c665b04fa14bafd1b1e974f25161512aca783188eb2
@@ -48,6 +48,7 @@ included do
48
48
  field :body, type: String, default: ''
49
49
  field :active, type: Boolean, default: true
50
50
  field :link, type: String
51
+ field :replies, type: Integer, default: 0
51
52
 
52
53
  field :created_by, type: BSON::ObjectId
53
54
  field :created_by_name, type: String
@@ -71,9 +72,9 @@ def do_before_save
71
72
  if self.link.size < 5
72
73
  self.link = UnicodeUtils.downcase(DcPage.clear_link(self.subject)) + Time.now.strftime('-%Y-%m-%d')
73
74
  end
74
- if self.created_by_name.nil?
75
- self.created_by_name = DcUser.find(self.created_by).name
76
- end
75
+ #if self.created_by_name.nil?
76
+ self.created_by_name = DcUser.find(self.created_by).name.downcase.gsub(' ','-')
77
+ #end
77
78
  end
78
79
 
79
80
  ########################################################################
@@ -48,6 +48,7 @@ class DcNews
48
48
  field :body, type: String, default: ''
49
49
  field :active, type: Boolean, default: true
50
50
  field :link, type: String
51
+ field :replies, type: Integer, default: 0
51
52
 
52
53
  field :valid_from, type: Date
53
54
  field :valid_to, type: Date
@@ -49,10 +49,17 @@ end
49
49
  ########################################################################
50
50
  def list(path)
51
51
  # get blogger id from document path
52
- blogger_id = path.last.split('-').last
53
- documents = DcBlog.only(:created_by, :link, :subject, :created_at)
54
- .where(created_by: blogger_id, active: true).order_by(created_at: -1)
55
- .page(@parent.params[:page]).per(10)
52
+ blogger_id = path.last.split('-').last
53
+ documents = if BSON::ObjectId.legal?(blogger_id)
54
+ DcBlog.only(:created_by, :link, :subject, :created_at)
55
+ .where(created_by: blogger_id, active: true).order_by(created_at: -1)
56
+ .page(@parent.params[:page]).per(10)
57
+ else
58
+ blogger_name = path.last
59
+ DcBlog.only(:created_by, :link, :subject, :created_at)
60
+ .where(created_by_name: blogger_name, active: true).order_by(created_at: -1)
61
+ .page(@parent.params[:page]).per(10)
62
+ end
56
63
 
57
64
  @parent.render partial: 'dc_blog/list', formats: [:html], locals: { documents: documents }
58
65
  end
@@ -9,6 +9,6 @@
9
9
 
10
10
  <% for blogger in bloggers %>
11
11
  <div class="blog-entry">
12
- <%= link_to( blogger.name, { path: "blog/#{blogger.name.downcase.gsub(' ','-')}-#{blogger.id}" } )%>
12
+ <%= link_to( blogger.name, { path: "blog/#{blogger.name.downcase.gsub(' ','-')}" } )%>
13
13
  </div>
14
14
  <% end %>
@@ -6,7 +6,7 @@
6
6
  <div class="entry">
7
7
  <div class="date"><%= dc_pretty_date(document.created_at) %></div>
8
8
  <div class="title">
9
- <%= link_to( path: "#{(@options[:path] << document.link).join('/')}" ) do %>
9
+ <%= link_to( path: "#{(@options[:path] + [document.link]).join('/')}" ) do %>
10
10
  <h2><%= document.subject %> </h2>
11
11
  <% end %>
12
12
  </div>
@@ -1,5 +1,6 @@
1
1
 
2
- <%= pp opts; "<div id=\"#{opts[:div_id]}\">".html_safe if opts[:div_id] %>
2
+ <%= "<div id=\"#{opts[:div_id]}\">".html_safe if opts[:div_id] %>
3
+
3
4
  <%= if session[:edit_mode] > 1
4
5
  dc_link_for_create(controller: 'cmsedit', table: 'dc_forum', title: 'dc_forum.add_new_forum' )
5
6
  end %>
@@ -40,4 +41,5 @@
40
41
  </div>
41
42
  <% end %>
42
43
  </div>
44
+
43
45
  <%= "</div>".html_safe if opts[:div_id] %>
@@ -28,7 +28,7 @@
28
28
  <h2><%= forum.name %></h2>
29
29
 
30
30
  <div class="topic-top"><h3><%= topic.subject %></h3>
31
- <%= t('dc_forum.created_by') %>: <%= topic.created_by_name %> <%= dc_pretty_date(topic.created_at) %>
31
+ <%= t('dc_forum.created_by') %>: <%= dc_pretty_date(topic.created_at) %>, <%= topic.created_by_name %>
32
32
  </div>
33
33
  <div class="topic-body"><%= topic.body.html_safe %></div>
34
34
 
@@ -22,15 +22,15 @@
22
22
  <%= link_to(topic.subject, { path: params[:path], forum: params[:forum], topic: topic._id } ) %><br>
23
23
 
24
24
  <b><%= t('dc_forum.created_by') %>:</b> <%= topic.created_by_name %>
25
- <%= dc_pretty_date(topic.created_at) %> &nbsp;|&nbsp;
25
+ &nbsp;|&nbsp; <%= dc_pretty_date(topic.created_at) %> &nbsp;|&nbsp;
26
26
 
27
27
  <b><%= t('dc_forum.replies') %>:</b>
28
28
  <%= topic.replies %>
29
29
 
30
30
  <% if topic.updated_at != topic.created_at %>
31
- &nbsp;|&nbsp; <b><%= t('dc_forum.last') %>:</b>
31
+ &nbsp;|&nbsp; <b><%= t('dc_forum.last') %>:</b>
32
32
  <%= topic.updated_by_name %>
33
- <%= dc_pretty_date(topic.updated_at) %>
33
+ &nbsp;|&nbsp; <%= dc_pretty_date(topic.updated_at) %>
34
34
  <% end %>
35
35
  </div>
36
36
  <% end %>
@@ -9,8 +9,7 @@
9
9
  target: 'iframe_edit', ref: 'nofollow') %>
10
10
  </span>
11
11
  <b><%= reply.subject %></b><br>
12
- <%= t('dc_forum.replied_by') %>: <%= reply.created_by_name %>,
13
- <%= dc_pretty_date(reply.created_at) %>&nbsp;&nbsp;<br>
12
+ <%= t('dc_forum.replied_by') %>: <%= dc_pretty_date(reply.created_at) %>, <%= reply.created_by_name %> <br>
14
13
  </div>
15
14
  <div class="reply-body <%= oddeven %>"><%= reply.body.html_safe %></div>
16
15
  <% end %>
@@ -52,6 +52,7 @@ sl:
52
52
  body: Vsebina
53
53
  created_at: Ustvarjeno
54
54
  dc_user_id: Ustvaril
55
+ created_by_name: Ustvaril
55
56
  dc_forum_id: Forum
56
57
  active: Aktiven
57
58
  replies: Odgovorov
@@ -1,3 +1,3 @@
1
1
  module DrgBlogNewsForum
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
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.6.0
4
+ version: 0.6.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: 2019-12-27 00:00:00.000000000 Z
11
+ date: 2020-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails