daily_notices 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/daily_notices.rb +62 -35
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74cbff972f98cacf123eb9544164e3f07f1ca9f9
|
4
|
+
data.tar.gz: 0710c12fbc0e7c45c46c2eda5735a59ef769fb6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f6da00f0f2682b1d4ce96d0e506ef3638bd3311080895b0f4e40b88d2c669eb95cc2eade4d331fdae5721ddf7e2ad4a0c9ec6621832fad1ffb2802b37c9bdde
|
7
|
+
data.tar.gz: 1c21377e8adb07dd27a8e0e3b562b2d0de3bd3b0176f424f38cc55ccae00b9330874ca418a03573495072a786f3c95756b9c9f3ce48126252ad69d6a180dcad0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/daily_notices.rb
CHANGED
@@ -85,7 +85,7 @@ class DailyNotices
|
|
85
85
|
new_day() if @day != Time.now.day
|
86
86
|
|
87
87
|
if @dx.all.any? and
|
88
|
-
@dx.all.first.description == CGI.unescape(h[:description]) then
|
88
|
+
@dx.all.first.description == CGI.unescape(h[:description].to_s) then
|
89
89
|
|
90
90
|
return :duplicate
|
91
91
|
|
@@ -100,32 +100,7 @@ class DailyNotices
|
|
100
100
|
@dx.create(h, id: id)
|
101
101
|
@dx.save @indexpath
|
102
102
|
|
103
|
-
|
104
|
-
File.write File.join(@filepath, @archive_path, 'index.html'), \
|
105
|
-
@dx.to_html(domain: @url_base)
|
106
|
-
else
|
107
|
-
|
108
|
-
target_path = File.join(@filepath, @archive_path, id, 'index.html')
|
109
|
-
FileUtils.mkdir_p File.dirname(target_path)
|
110
|
-
|
111
|
-
rx = @dx.find(id)
|
112
|
-
|
113
|
-
kvx = rx.to_kvx
|
114
|
-
yield kvx if block_given?
|
115
|
-
|
116
|
-
rxdoc = Rexle.new(kvx.to_xml)
|
117
|
-
rxdoc.instructions << ['xml-styelsheet',\
|
118
|
-
"title='XSL_formatting' type='text/xsl' href='#{@target_xslt}'"]
|
119
|
-
File.write target_path.sub(/\.html$/,'.xml', ), rxdoc.xml(pretty: true)
|
120
|
-
|
121
|
-
unless File.exists? @target_xslt then
|
122
|
-
File.write @target_xslt,
|
123
|
-
RxSliml.new(fields: %i(description time)).to_xslt
|
124
|
-
end
|
125
|
-
|
126
|
-
File.write target_path, rx.to_html(xslt: @target_xslt)
|
127
|
-
|
128
|
-
end
|
103
|
+
render_files(id)
|
129
104
|
|
130
105
|
# Add it to the RSS document
|
131
106
|
|
@@ -141,6 +116,29 @@ class DailyNotices
|
|
141
116
|
|
142
117
|
alias add create
|
143
118
|
|
119
|
+
|
120
|
+
def delete(id)
|
121
|
+
|
122
|
+
[@dx, @rss].each {|x| x.delete(id.to_s); x.save}
|
123
|
+
|
124
|
+
archive_path = Time.at(id.to_i).strftime("%Y/%b/%-d").downcase
|
125
|
+
indexpath = File.join(@filepath, archive_path, id.to_s)
|
126
|
+
|
127
|
+
FileUtils.rm_rf indexpath
|
128
|
+
render_html_files(id.to_s)
|
129
|
+
|
130
|
+
id.to_s + ' deleted'
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
def description()
|
135
|
+
@rss.description
|
136
|
+
end
|
137
|
+
|
138
|
+
def description=(val)
|
139
|
+
@rss.description = val
|
140
|
+
end
|
141
|
+
|
144
142
|
def title()
|
145
143
|
@rss.title
|
146
144
|
end
|
@@ -156,14 +154,7 @@ class DailyNotices
|
|
156
154
|
def link=(val)
|
157
155
|
@rss.link = val
|
158
156
|
end
|
159
|
-
|
160
|
-
def description()
|
161
|
-
@rss.description
|
162
|
-
end
|
163
|
-
|
164
|
-
def description=(val)
|
165
|
-
@rss.description = val
|
166
|
-
end
|
157
|
+
|
167
158
|
|
168
159
|
# If you wish override this method or use it in block form to add a
|
169
160
|
# notifier, callback routine or webhook, whenever a new record is added.
|
@@ -178,6 +169,10 @@ class DailyNotices
|
|
178
169
|
@rss.save @rssfile
|
179
170
|
end
|
180
171
|
|
172
|
+
def to_dx()
|
173
|
+
Dynarex.new @dx.to_xml
|
174
|
+
end
|
175
|
+
|
181
176
|
private
|
182
177
|
|
183
178
|
def create_link(id)
|
@@ -207,4 +202,36 @@ class DailyNotices
|
|
207
202
|
|
208
203
|
end
|
209
204
|
|
205
|
+
def render_html_files(id)
|
206
|
+
|
207
|
+
if @target_page == :recordset then
|
208
|
+
File.write File.join(@filepath, @archive_path, 'index.html'), \
|
209
|
+
@dx.to_html(domain: @url_base)
|
210
|
+
else
|
211
|
+
|
212
|
+
target_path = File.join(@filepath, @archive_path, id, 'index.html')
|
213
|
+
FileUtils.mkdir_p File.dirname(target_path)
|
214
|
+
|
215
|
+
rx = @dx.find(id)
|
216
|
+
|
217
|
+
kvx = rx.to_kvx
|
218
|
+
yield kvx if block_given?
|
219
|
+
|
220
|
+
rxdoc = Rexle.new(kvx.to_xml)
|
221
|
+
rxdoc.instructions << ['xml-styelsheet',\
|
222
|
+
"title='XSL_formatting' type='text/xsl' href='#{@target_xslt}'"]
|
223
|
+
File.write target_path.sub(/\.html$/,'.xml', ), rxdoc.xml(pretty: true)
|
224
|
+
|
225
|
+
unless File.exists? @target_xslt then
|
226
|
+
|
227
|
+
File.write @target_xslt,
|
228
|
+
RxSliml.new(fields: %i(description time)).to_xslt
|
229
|
+
end
|
230
|
+
|
231
|
+
File.write target_path, rx.to_html(xslt: @target_xslt)
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
210
237
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|