evertils 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/evertils/controller.rb +0 -1
- data/lib/evertils/controllers/render.rb +20 -14
- data/lib/evertils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52e6a69464d4e124f2e77134b249c4a078ff921929355f95cd0c823453fa1c88
|
4
|
+
data.tar.gz: 10aa26578c12a747fd026040259bf26ff88a858f220c7e52c6e78fe288e3be53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62f26f68ffa20afd0aa71b606e6541963b4522557c109e43cefdcc16c9ddee8f4e6a18b9e74f72ff7aa308bc0346f03948197a5bd269e34ca12466c323b54af5
|
7
|
+
data.tar.gz: 5e9d84b4e561cc1ec482d3c1cb86c79ab86772aade652c76ad4298117e071681db8a6dc332455bab471d9a2b83d0d11bf743024e9a89810702342dad67637091
|
data/lib/evertils/controller.rb
CHANGED
@@ -3,26 +3,19 @@
|
|
3
3
|
module Evertils
|
4
4
|
module Controller
|
5
5
|
class Render < Controller::Base
|
6
|
-
def from_file
|
7
|
-
|
8
|
-
:title,
|
9
|
-
:title_format,
|
10
|
-
:notebook,
|
11
|
-
:path,
|
12
|
-
:action,
|
13
|
-
:tags
|
14
|
-
)
|
6
|
+
def from_file
|
7
|
+
set_allowed_fields
|
15
8
|
|
16
9
|
return Notify.warning("Note already exists\n- #{@link}") if note_exists?
|
17
10
|
|
18
11
|
Notify.info 'Note not found, creating a new one'
|
19
12
|
|
20
|
-
execute_action(@
|
13
|
+
execute_action(@allowed_fields[:action])
|
21
14
|
end
|
22
15
|
|
23
16
|
def note_exists?
|
24
17
|
helper = Evertils::Helper.load('Note')
|
25
|
-
note = helper.wait_for_by_title(@
|
18
|
+
note = helper.wait_for_by_title(@allowed_fields[:title], @allowed_fields[:notebook], 3)
|
26
19
|
@link = helper.external_url_for(note.entity) unless note.entity.nil?
|
27
20
|
|
28
21
|
note.exists?
|
@@ -32,15 +25,28 @@ module Evertils
|
|
32
25
|
case action
|
33
26
|
when nil
|
34
27
|
Notify.info 'Action not provided, creation new note...'
|
35
|
-
Action::Create.new(@
|
28
|
+
Action::Create.new(@allowed_fields)
|
36
29
|
when 'create'
|
37
|
-
Action::Create.new(@
|
30
|
+
Action::Create.new(@allowed_fields)
|
38
31
|
when 'duplicate_previous'
|
39
|
-
Action::DuplicatePrevious.new(@
|
32
|
+
Action::DuplicatePrevious.new(@allowed_fields)
|
40
33
|
else
|
41
34
|
Action::Default.new(action: action)
|
42
35
|
end
|
43
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def set_allowed_fields
|
41
|
+
@allowed_fields = config.translate_placeholders.pluck(
|
42
|
+
:title,
|
43
|
+
:title_format,
|
44
|
+
:notebook,
|
45
|
+
:path,
|
46
|
+
:action,
|
47
|
+
:tags
|
48
|
+
)
|
49
|
+
end
|
44
50
|
end
|
45
51
|
end
|
46
52
|
end
|
data/lib/evertils/version.rb
CHANGED