drg_blog_news_forum 0.0.6 → 0.0.7

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: 45e516c4354491ad4f7ff2471ffe5ba3f070c4a0
4
- data.tar.gz: 7f0685e4f74699c8a2eea92858cfb0ea4f87b049
3
+ metadata.gz: 559f79314aca5006d0e1a4d9d69e36bc7348f9f4
4
+ data.tar.gz: 0580df1d75a613069ffdefcec44cb25e5d0945c2
5
5
  SHA512:
6
- metadata.gz: 57c7114fccdaed2c123acd2a25cdb5e78f3fd97bfac40ef715aa10fe9ee7d14fbeefc420e3fb258d5533354ec183d31cd340a94dc51d1f31e8b6307c4dda561e
7
- data.tar.gz: b54765d4fe626cf2dcb33303403accabab62148e5f5758f8f40a0db072bf48341bbd570348e8421aad1af3487a142d4595837c4059a1085e08d187eb847d6474
6
+ metadata.gz: 5b5672ea31510550a15b5429d866ff8b9bcfaaa1d7082850502f8ce66c692e20a3cf848b1b4fdacf05a95d15420d5586cae3fb64e9785f73e4c9852136d2112b
7
+ data.tar.gz: 2057a2828b65a6da3c82ce3caf2d00e927a55083f431b94ba7c4e078c6a315cc3b17244ead5efa20ce4a20543def2ab3a246b3ba3aa822b32f8acf9752f2f83c
@@ -37,13 +37,13 @@ def dc_new_record()
37
37
  @record.subject = "Re: #{replyto.subject}"
38
38
  @record.body = "<div class='dc-forum-quote'>#{replyto.body}</div><br>"
39
39
  end
40
+ @record.created_by_name = session[:user_name] if session[:user_name]
40
41
  end
41
42
 
42
43
  ######################################################################
43
44
  # Called before save. Reloads browser.
44
45
  ######################################################################
45
46
  def dc_before_save()
46
- @record.created_by_name = session[:user_name]
47
47
  params[:return_to] = 'parent.reload'
48
48
  end
49
49
 
@@ -1,5 +1,3 @@
1
- ## YAML Template for Blog
2
- ---
3
1
  table: dc_blog
4
2
 
5
3
  index:
@@ -27,13 +25,13 @@ form:
27
25
  name: subject
28
26
  type: text_field
29
27
  html:
30
- size: 50
28
+ size: 80
31
29
 
32
30
  20:
33
31
  name: link
34
32
  type: text_field
35
33
  html:
36
- size: 50
34
+ size: 80
37
35
 
38
36
  30:
39
37
  name: body
@@ -41,7 +39,7 @@ form:
41
39
  options: 'height: 500'
42
40
 
43
41
  50:
44
- name: replies
42
+ name: dc_replies
45
43
  type: embedded
46
44
  formname: dc_reply
47
45
  table: dc_reply
@@ -1,5 +1,3 @@
1
- ## YAML Template for Polls
2
- ---
3
1
  table: dc_forum
4
2
 
5
3
  index:
@@ -1,4 +1,2 @@
1
- ## YAML Template for Polls
2
- ---
3
1
  extend: dc_policy_rule
4
2
  table: dc_forum_policy_rule
@@ -1,5 +1,3 @@
1
- ## YAML Template for Polls
2
- ---
3
1
  table: dc_forum_topic
4
2
 
5
3
 
@@ -0,0 +1,47 @@
1
+ table: dc_news
2
+
3
+ index:
4
+ filter: subject, created_by_name
5
+ actions: standard
6
+
7
+ result_set:
8
+ actions: standard
9
+
10
+ columns:
11
+ 1:
12
+ name: subject
13
+ 2:
14
+ name: created_by_name
15
+ 4:
16
+ name: created_at
17
+
18
+ edit_title: subject
19
+
20
+ form:
21
+ actions: standard
22
+
23
+ fields:
24
+ 10:
25
+ name: subject
26
+ type: text_field
27
+ html:
28
+ size: 80
29
+
30
+ 20:
31
+ name: link
32
+ type: text_field
33
+ html:
34
+ size: 80
35
+
36
+ 30:
37
+ name: body
38
+ type: html_field
39
+ options: 'height: 500'
40
+
41
+ 50:
42
+ name: dc_replies
43
+ type: embedded
44
+ formname: dc_reply
45
+ table: dc_reply
46
+ html:
47
+ height: 400
@@ -1,12 +1,19 @@
1
- ## YAML Template for Polls
2
- ---
3
1
  table: dc_reply
4
2
 
3
+ result_set:
4
+ actions: standard
5
+
6
+ columns:
7
+ 1:
8
+ name: created_by_name
9
+ 2:
10
+ name: subject
11
+ 3:
12
+ name: created_at
13
+
5
14
  form:
6
15
  height: 750
7
- labels_pos: top
8
- actions:
9
- 1: save
16
+ actions: standard
10
17
 
11
18
  fields:
12
19
  10:
@@ -0,0 +1,27 @@
1
+
2
+ table: dc_reply
3
+
4
+ form:
5
+ height: 750
6
+ labels_pos: top
7
+ actions:
8
+ 1: save
9
+
10
+ fields:
11
+ 10:
12
+ name: created_by_name
13
+ type: text_field
14
+ html:
15
+ size: 30
16
+
17
+ 20:
18
+ name: subject
19
+ type: text_field
20
+ html:
21
+ size: 80
22
+
23
+ 30:
24
+ name: body
25
+ type: html_field
26
+ options: "height: 420, toolbar: 'basic', allowedContent: false"
27
+
@@ -27,6 +27,7 @@
27
27
  class DcForumRenderer < DcRenderer
28
28
  include DcApplicationHelper
29
29
 
30
+
30
31
  ########################################################################
31
32
  #
32
33
  ########################################################################
@@ -47,7 +48,7 @@ include DcApplicationHelper
47
48
  def topic
48
49
  forum = DcForum.find(@parent.params[:forum])
49
50
  topic = DcForumTopic.find(@parent.params[:topic])
50
- replies = topic.dc_replies.where(active: true).order(created_at: 1).page(@parent.params[:page]).per(5)
51
+ replies = topic.dc_replies.where(active: true).order(created_at: 1).page(@parent.params[:page]).per(10)
51
52
  @parent.render partial: 'dc_forum/topic', formats: [:html],
52
53
  locals: { forum: forum, topic: topic, replies: replies }
53
54
  end
@@ -28,44 +28,33 @@ class DcNewsRenderer < DcRenderer
28
28
  include DcApplicationHelper
29
29
 
30
30
  ########################################################################
31
- # Show one blog entry
31
+ # Show one news entry
32
32
  ########################################################################
33
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?
34
+ entry = DcNews.find_by(link: @parent.params[:link])
35
+ return t('dc_news.entry_not_found') if entry.nil?
37
36
 
38
37
  replies = entry.dc_replies.where(active: true).order(created_at: 1).
39
- page(@parent.params[:page]).per(5)
38
+ page(@parent.params[:page]).per(10)
40
39
  @parent.render partial: 'dc_news/entry', formats: [:html],
41
40
  locals: { entry: entry, replies: replies, opts: @opts }
42
41
  end
43
42
 
44
43
  ########################################################################
45
- # List all blogs from one bloger
44
+ # List all news
46
45
  ########################################################################
47
46
  def list_all
48
47
  entries = DcNews.only(:created_by_name, :link, :subject, :created_at)
49
- .where(created_by_name: @parent.params[:name]).order_by(created_at: -1)
48
+ .where(active: true).order_by(created_at: -1)
50
49
  .page(@parent.params[:page]).per(10)
51
50
  @parent.render partial: 'dc_news/entries', formats: [:html], locals: { entries: entries }
52
51
  end
53
52
 
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
53
  ########################################################################
63
54
  # Default method will dispatch to proper method.
64
55
  ########################################################################
65
56
  def default
66
- if @parent.params[:name].nil?
67
- list_blogers
68
- elsif @parent.params[:link].nil? or @parent.params[:link] == 'all'
57
+ if @parent.params[:link].nil?
69
58
  list_all
70
59
  else
71
60
  show_entry
@@ -53,7 +53,7 @@ included do
53
53
  ########################################################################
54
54
  def do_before_save
55
55
  if self.link.size < 5
56
- self.link = Time.now.strftime('%Y-%m-%d-') + UnicodeUtils.downcase(self.subject)
56
+ self.link = UnicodeUtils.downcase(self.subject) + Time.now.strftime('-%Y-%m-%d')
57
57
  end
58
58
  if self.created_by_name.nil?
59
59
  self.created_by_name = DcUser.find(self.created_by).name
@@ -28,6 +28,8 @@ class DcNews
28
28
  field :subject, type: String, default: ''
29
29
  field :body, type: String, default: ''
30
30
  field :active, type: Boolean, default: true
31
+ field :link, type: String
32
+
31
33
  field :valid_from, type: Date
32
34
  field :valid_to, type: Date
33
35
  field :categories, type: Array
@@ -35,10 +37,23 @@ class DcNews
35
37
  field :created_by, type: BSON::ObjectId
36
38
  field :created_by_name, type: String
37
39
 
38
- embeds_many :replies
40
+ embeds_many :dc_replies, as: :replies
39
41
 
40
42
  validates_length_of :subject, minimum: 4
41
43
  validates_length_of :body, minimum: 10
42
44
 
45
+ before_save :do_before_save
43
46
 
47
+ ########################################################################
48
+ # Update link when left blank.
49
+ ########################################################################
50
+ def do_before_save
51
+ if self.link.size < 5
52
+ self.link = UnicodeUtils.downcase(self.subject) + Time.now.strftime('-%Y-%m-%d')
53
+ end
54
+ if self.created_by_name.nil?
55
+ self.created_by_name = DcUser.find(self.created_by).name
56
+ end
57
+ end
58
+
44
59
  end
@@ -11,7 +11,7 @@
11
11
  <div class="blog-subject"><%= blog.subject %></div>
12
12
  <div style="clear:both;"></div>
13
13
 
14
- <div class="blog-body"><%= blog.body%></div>
14
+ <div class="blog-body"><%= blog.body %></div>
15
15
 
16
16
  <div class="blog-replies">
17
17
  <%= render partial: 'dc_reply/reply', formats: [:html],
@@ -1,13 +1,10 @@
1
- <div class="blog-title">
2
- <h1><%= params[:name] %>, <%= t('dc_blog.my_blog') %></h1>
1
+ <div class="news-title">
2
+ <h1><%= t('dc_news.news') %></h1>
3
3
  </div>
4
4
  <% for entry in entries %>
5
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>
6
+ <div class="news-entry">
7
+ <h3><%= link_to( entry.subject, { path: 'news', link: entry.link } )%></h3>
8
+ <%= dc_pretty_date(entry.created_at) %>
12
9
  </div>
13
10
  <% end %>
@@ -5,9 +5,10 @@
5
5
  <%= dc_link_for_edit(controller: 'cmsedit', table: 'dc_news', title: 'dc_news.edit_entry', id: entry.id ) %>
6
6
  <% end %>
7
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>
8
+ <div class="news-subject"><h2><%= entry.subject %></h2></div>
9
+ <div class="news-date"><h3>
10
+ <%= t('dc_blog.author') + ' ' + entry.created_by_name + ', ' + dc_pretty_date(entry.created_at) %>
11
+ </h3></div><br>
11
12
 
12
13
  <div class="news-body"><%= entry.body.html_safe %></div>
13
14
  <div class="social-sites"><%= social_sites %></div>
@@ -4,7 +4,7 @@
4
4
  <div class="reply-top-<%= oddeven %>">
5
5
  <span style="float: right; top-margin: 5px;">
6
6
  <%= link_to( t('dc_forum.new_reply'), { controller: 'cmsedit', table: "#{parent_document};dc_reply",
7
- formname: 'dc_reply', action: 'new', ids: parent_id,
7
+ formname: 'reply', action: 'new', ids: parent_id,
8
8
  reply_to: reply.id}, target: 'iframe_edit') %>
9
9
  </span>
10
10
  <b><%= reply.subject %></b><br>
@@ -17,7 +17,7 @@
17
17
  <table id="dc-reply-menu"><tr>
18
18
  <td class="dc-link dc-animate" style="white-space: nowrap;">
19
19
  <%= link_to( t('dc_forum.new_reply'), { controller: 'cmsedit', table: "#{parent_document};dc_reply",
20
- formname: 'dc_reply', action: 'new', ids: parent_id },
20
+ formname: 'reply', action: 'new', ids: parent_id },
21
21
  target: 'iframe_edit') %>
22
22
  </td>
23
23
  <td style="text-align: right; width: 100%;"><%= paginate replies %></td>
@@ -36,6 +36,7 @@ en:
36
36
  last: Last
37
37
 
38
38
  dc_blog:
39
+ author: Author
39
40
  blogers: List of our blogers
40
41
  published: Published on,
41
42
  new_entry: New blog entry
@@ -43,5 +44,9 @@ en:
43
44
  entry_not_found: Blog entry not found
44
45
  my_blog: my blog
45
46
  comments: Comments
46
-
47
47
 
48
+ dc_news:
49
+ news: News
50
+ new_entry: Create new news article
51
+ edit_entry: Edit news entry
52
+ entry_not_found: News article not found
@@ -36,6 +36,7 @@ sl:
36
36
  last: Zadnji
37
37
 
38
38
  dc_blog:
39
+ author: Avtor
39
40
  blogers: Seznam naših blogerjev
40
41
  published: Objava,
41
42
  new_entry: Nov vpis v blog
@@ -44,5 +45,13 @@ sl:
44
45
  my_blog: moj blog
45
46
  comments: Komentarji
46
47
 
48
+ dc_news:
49
+ news: Novice
50
+ new_entry: Nova novica
51
+ edit_entry: Urejanje novice
52
+ entry_not_found: Novica ne obstaja
53
+
54
+
55
+
47
56
 
48
57
 
@@ -80,6 +80,18 @@ en:
80
80
  link: Link
81
81
  active: Active
82
82
 
83
+ dc_news:
84
+ tabletitle: News
85
+
86
+ subject: Subject
87
+ body: Body
88
+ replies: Replies
89
+ created_at: Created at
90
+ created_by_id: Creator
91
+ created_by_name: Creator
92
+ link: Link
93
+ active: Active
94
+
83
95
  help:
84
96
  dc_forum:
85
97
  name: Forum name (short description)
@@ -118,4 +130,13 @@ en:
118
130
  created_by_name: Name of the creator
119
131
  link: Link to blog entry
120
132
  active: Active
133
+
134
+ dc_news:
135
+ subject: Subject of the news
136
+ body: Body
137
+ created_at: Time of creation
138
+ created_by: ID of the creator
139
+ created_by_name: Name of the creator
140
+ link: Link to blog entry
141
+ active: Active
121
142
 
@@ -64,6 +64,30 @@ sl:
64
64
  body: Vsebina
65
65
  created_at: Ustvarjeno
66
66
  created_by_name: Ustvaril
67
+ active: Aktiven
68
+
69
+ dc_blog:
70
+ tabletitle: Blogi
71
+
72
+ subject: Zadeva
73
+ body: Vsebina
74
+ replies: Odgovori
75
+ created_at: Ustvarjeno
76
+ created_by_id: Ustvaril
77
+ created_by_name: Ustvaril
78
+ link: Povezava
79
+ active: Aktiven
80
+
81
+ dc_news:
82
+ tabletitle: Novice
83
+
84
+ subject: Zadeva
85
+ body: Vsebina
86
+ replies: Odgovori
87
+ created_at: Ustvarjeno
88
+ created_by_id: Ustvaril
89
+ created_by_name: Ustvaril
90
+ link: Povezava
67
91
  active: Aktiven
68
92
 
69
93
  help:
@@ -97,4 +121,21 @@ sl:
97
121
  dc_forum_topic_id: Tema
98
122
  active: Aktiven
99
123
 
100
-
124
+ dc_blog:
125
+ subject: Naslov bloga
126
+ body: Vsebina (tekst) bloga
127
+ created_at: Ustvarjeno
128
+ created_by: Ustvaril
129
+ created_by_name: Ustvaril ime
130
+ link: Povezava do bloga
131
+ active: Blog zapis je aktiven
132
+
133
+ dc_news:
134
+ subject: Naslov novice
135
+ body: Vsebina (tekst) novice
136
+ created_at: Ustvarjeno
137
+ created_by: Ustvaril
138
+ created_by_name: Ustvaril ime
139
+ link: Povezava do novice
140
+ active: Novica je aktivna
141
+
@@ -1,3 +1,3 @@
1
1
  module DrgBlogNewsForum
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
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.6
4
+ version: 0.0.7
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-04-06 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -59,7 +59,9 @@ files:
59
59
  - app/forms/dc_forum.yml
60
60
  - app/forms/dc_forum_policy_rule.yml
61
61
  - app/forms/dc_forum_topic.yml
62
+ - app/forms/dc_news.yml
62
63
  - app/forms/dc_reply.yml
64
+ - app/forms/reply.yml
63
65
  - app/helpers/application_helper.rb
64
66
  - app/helpers/dc_blog_renderer.rb
65
67
  - app/helpers/dc_forum_helper.rb
@@ -114,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
116
  version: '0'
115
117
  requirements: []
116
118
  rubyforge_project:
117
- rubygems_version: 2.2.2
119
+ rubygems_version: 2.2.3
118
120
  signing_key:
119
121
  specification_version: 4
120
122
  summary: 'DRG CMS: Blog, news and forum plugin for DRG CMS'