lib/evertils/controllers/render.rb in evertils-1.0.0 vs lib/evertils/controllers/render.rb in evertils-1.0.1

- old
+ new

@@ -1,22 +1,25 @@ +# frozen_string_literal: true + require 'evertils/common/query/simple' module Evertils module Controller class Render < Controller::Base def from_file(config) - @config = config + @config = config.translate_placeholders.pluck(:title, :notebook) + return Notify.warning("Note already exists\n- #{@link}") if note_exists? Notify.info 'Note not found, creating a new one' query = Evertils::Common::Query::Simple.new query.create_note_from_yml(@config[:path]) end def note_exists? helper = Evertils::Helper.load('Note') - note = helper.wait_for(@config[:notebook].to_sym, 3) + note = helper.wait_for_by_title(@config[:title], @config[:notebook], 3) @link = helper.external_url_for(note.entity) unless note.entity.nil? note.exists? end end