evertils 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/evertils/actions/default.rb +11 -0
- data/lib/evertils/controllers/log.rb +7 -11
- data/lib/evertils/controllers/render.rb +9 -4
- data/lib/evertils/version.rb +1 -1
- data/lib/evertils.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40f5e46e19024a064b17efcb49eb6f405422632c6128be5995530da0bdf8e867
|
4
|
+
data.tar.gz: b67fbc4dc7595ec219e80f5d252adbd5c4ccb25d99e3d579930936e61b3378a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a38b8cb932b499dcc003704f94e992c2b0db83150f6a83c8cc21652db53c4d2489fb0e2705f526ba17ed8b46bf8b0a8833bbea1539429db619ed31896bb33c8d
|
7
|
+
data.tar.gz: 3de009e90382e2f1098d3e0d1f57f02f5f5c96cf5245268e80b2c4ab427b4f557e659e7cb38f376d50ed8a8440ed15e62010eed0175e9dbea8c16408d829e147
|
@@ -13,39 +13,35 @@ module Evertils
|
|
13
13
|
return Notify.error('A message is required', {}) if text.nil?
|
14
14
|
|
15
15
|
note = @note_helper.wait_for_by_notebook(:Daily)
|
16
|
-
edit_conf = {
|
17
|
-
search: 'Triage',
|
18
|
-
append: text
|
19
|
-
}
|
20
16
|
|
21
17
|
return Notify.error('Note not found') if note.entity.nil?
|
22
18
|
|
23
|
-
modify(note,
|
19
|
+
modify(note, text)
|
24
20
|
end
|
25
21
|
|
26
22
|
private
|
27
23
|
|
28
24
|
# Update a note with content
|
29
|
-
def modify(note,
|
25
|
+
def modify(note, text)
|
30
26
|
xml = @api_helper.from_str(note.entity.content)
|
31
|
-
xml_helper = Evertils::Helper.load('Xml', xml)
|
32
27
|
|
33
28
|
time = Time.now.strftime('%I:%M')
|
34
|
-
target = xml.search(
|
29
|
+
target = xml.search('en-note>div').first
|
35
30
|
|
36
31
|
return Notify.error('Unable to log message, triage section not found') if target.nil?
|
37
32
|
|
38
|
-
log_message_txt =
|
39
|
-
log_message_el = xml_helper.li(log_message_txt)
|
33
|
+
log_message_txt = "* #{time} - #{text}<br clear='none'/>"
|
40
34
|
|
41
35
|
# append the log message to the target
|
42
|
-
target.add_child(
|
36
|
+
target.add_child(log_message_txt)
|
37
|
+
|
43
38
|
# remove XML processing definition if it is the second element
|
44
39
|
if xml.children[1].is_a?(Nokogiri::XML::ProcessingInstruction)
|
45
40
|
xml.children[1].remove
|
46
41
|
end
|
47
42
|
|
48
43
|
note.entity.content = xml.to_s
|
44
|
+
|
49
45
|
Notify.success("Item logged at #{time}") if note.update
|
50
46
|
end
|
51
47
|
end
|
@@ -10,7 +10,7 @@ module Evertils
|
|
10
10
|
|
11
11
|
Notify.info 'Note not found, creating a new one'
|
12
12
|
|
13
|
-
execute_action(@config[:action]
|
13
|
+
execute_action(@config[:action])
|
14
14
|
end
|
15
15
|
|
16
16
|
def note_exists?
|
@@ -22,11 +22,16 @@ module Evertils
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def execute_action(action)
|
25
|
-
case action
|
26
|
-
when
|
25
|
+
case action
|
26
|
+
when nil
|
27
|
+
Notify.info 'Action not provided, creation new note...'
|
28
|
+
Action::Create.new(@config)
|
29
|
+
when 'create'
|
30
|
+
Action::Create.new(@config)
|
31
|
+
when 'duplicate_previous'
|
27
32
|
Action::DuplicatePrevious.new(@config)
|
28
33
|
else
|
29
|
-
Action::
|
34
|
+
Action::Default.new(action: action)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
data/lib/evertils/version.rb
CHANGED
data/lib/evertils.rb
CHANGED
@@ -22,6 +22,7 @@ require 'evertils/version'
|
|
22
22
|
require 'evertils/base'
|
23
23
|
require 'evertils/type'
|
24
24
|
require 'evertils/action'
|
25
|
+
require 'evertils/actions/default'
|
25
26
|
require 'evertils/actions/create'
|
26
27
|
require 'evertils/actions/duplicate_previous'
|
27
28
|
require 'evertils/helpers/time'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evertils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Priebe
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/evertils.rb
|
113
113
|
- lib/evertils/action.rb
|
114
114
|
- lib/evertils/actions/create.rb
|
115
|
+
- lib/evertils/actions/default.rb
|
115
116
|
- lib/evertils/actions/duplicate_previous.rb
|
116
117
|
- lib/evertils/base.rb
|
117
118
|
- lib/evertils/config.rb
|