From e1edb25ffaa9932b80c6f9a6764ae610316d756e Mon Sep 17 00:00:00 2001 From: Zoker Date: Thu, 6 Oct 2016 23:13:45 +0800 Subject: [PATCH] add enter event and remove form element --- app/views/lists/_form.html.haml | 5 +++-- app/views/plans/_form.html.haml | 2 +- app/views/tasks/_form.html.haml | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/lists/_form.html.haml b/app/views/lists/_form.html.haml index 8f7e9d0..c460a35 100644 --- a/app/views/lists/_form.html.haml +++ b/app/views/lists/_form.html.haml @@ -1,6 +1,7 @@ -%form.form.form-horizontal.plan#new_list +.form.form-horizontal.plan#new_list .field - = text_field_tag :list_title, nil, class: 'form-control', required: true, 'v-model' => 'list.title', placeholder: '名称' + = text_field_tag :list_title, nil, class: 'form-control', required: true, placeholder: '名称', + 'v-model' => 'list.title', 'v-on:keyup.enter' => 'addList' .field .color-select-feild = collection_radio_buttons :list_color_tag, nil, options_for_color, :last, :first do |b| diff --git a/app/views/plans/_form.html.haml b/app/views/plans/_form.html.haml index a163eca..e462b22 100644 --- a/app/views/plans/_form.html.haml +++ b/app/views/plans/_form.html.haml @@ -1,4 +1,4 @@ -%form.form.form-horizontal.plan#new_plan +.form.form-horizontal.plan#new_plan .field = text_field_tag :title, nil, class: 'form-control', required: true, 'v-model' => 'plan.title', placeholder: '名称' .field diff --git a/app/views/tasks/_form.html.haml b/app/views/tasks/_form.html.haml index afae1fc..b3aacba 100644 --- a/app/views/tasks/_form.html.haml +++ b/app/views/tasks/_form.html.haml @@ -1,6 +1,7 @@ -%form.form.form-horizontal.plan#new_task +.form.form-horizontal.plan#new_task .field - = text_field_tag :task_title, nil, class: 'form-control', required: true, 'v-model' => 'task.title', placeholder: '任务名称' + = text_field_tag :task_title, nil, class: 'form-control', required: true, placeholder: '任务名称', + 'v-model' => 'task.title', 'v-on:keyup.enter' => 'addTask' = hidden_field_tag :new_task_path, nil, ':value' => 'list.new_task_path' .field.add-task-buttons %button.btn.btn-sm.btn-default{ :type => "button", 'v-on:click' => 'cancelTask' } 取消