lib/controllers/generate.rb in evertils-0.2.7 vs lib/controllers/generate.rb in evertils-0.2.7.1
- old
+ new
@@ -27,52 +27,52 @@
super
end
# generate daily notes
def daily
+ title = @format.date_templates[NOTEBOOK_DAILY]
+ body = @format.template_contents
+ parent_notebook = NOTEBOOK_DAILY
+
if !@force
- if @model.note_exists
+ if @model.note_exists(title)
Notify.error("There's already a log for today!")
end
end
- title = @format.date_templates[NOTEBOOK_DAILY]
- body = @format.template_contents
- parent_notebook = NOTEBOOK_DAILY
-
@model.create_note(title, body, parent_notebook)
end
# generate weekly notes
def weekly
+ title = @format.date_templates[NOTEBOOK_WEEKLY]
+ body = @format.template_contents
+ parent_notebook = NOTEBOOK_WEEKLY
+
if !@force
- if @model.note_exists
+ if @model.note_exists(title)
Notify.error("There's already a log for this week!")
end
if !Date.today.monday?
Notify.error("Sorry, you can only create new weekly logs on Mondays")
end
end
- title = @format.date_templates[NOTEBOOK_WEEKLY]
- body = @format.template_contents
- parent_notebook = NOTEBOOK_WEEKLY
-
@model.create_note(title, body, parent_notebook)
end
# generate monthly notes
def monthly
+ title = @format.date_templates[NOTEBOOK_MONTHLY]
+ body = @format.template_contents
+ parent_notebook = NOTEBOOK_MONTHLY
+
if !@force
- if @model.note_exists
+ if @model.note_exists(title)
Notify.error("There's already a log for this month!")
end
end
-
- title = @format.date_templates[NOTEBOOK_MONTHLY]
- body = @format.template_contents
- parent_notebook = NOTEBOOK_MONTHLY
@model.create_note(title, body, parent_notebook)
end
end
end