From fa23a0f58d19b4f630ce73092d9c57f03c3c90e8 Mon Sep 17 00:00:00 2001 From: Young Hoon Kim Date: Mon, 10 Nov 2014 02:04:54 +0900 Subject: [PATCH 1/2] fix: textarea --- app/assets/javascripts/admin/users.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/admin/users.js b/app/assets/javascripts/admin/users.js index 1b0df3a..2ea8de4 100644 --- a/app/assets/javascripts/admin/users.js +++ b/app/assets/javascripts/admin/users.js @@ -22,14 +22,16 @@ $(document).on('ready page:load', function () { }]); $("textarea").keydown(function(e){ - // Enter was pressed without shift key - if (e.keyCode == 13 && !e.shiftKey) + if ( $.inArray(this.id, ["tags","user_filter_word","search_word"]) >= 0) { - if (this.form) - this.form.submit(); - else - e.preventDefault(); - return false; + if (e.keyCode == 13 && !e.shiftKey) + { + if (this.form) + this.form.submit(); + else + e.preventDefault(); + return false; + } } }); From 4311a9aa9363145cfcc226983b06b5d896c52c79 Mon Sep 17 00:00:00 2001 From: Young Hoon Kim Date: Mon, 10 Nov 2014 09:48:32 +0900 Subject: [PATCH 2/2] feedback: sorry jquery selector... --- app/assets/javascripts/admin/users.js | 19 +++++++++---------- app/views/admin/messages/new.html.erb | 2 +- app/views/admin/users/_form.html.erb | 2 +- app/views/admin/users/index.html.erb | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/admin/users.js b/app/assets/javascripts/admin/users.js index 2ea8de4..9166e5c 100644 --- a/app/assets/javascripts/admin/users.js +++ b/app/assets/javascripts/admin/users.js @@ -21,18 +21,17 @@ $(document).on('ready page:load', function () { index: 1 }]); - $("textarea").keydown(function(e){ - if ( $.inArray(this.id, ["tags","user_filter_word","search_word"]) >= 0) + $("textarea.shift-enter").keydown(function(e){ + + if (e.keyCode == 13 && !e.shiftKey) { - if (e.keyCode == 13 && !e.shiftKey) - { - if (this.form) - this.form.submit(); - else - e.preventDefault(); - return false; - } + if (this.form) + this.form.submit(); + else + e.preventDefault(); + return false; } + }); $('#user_filter_word').textcomplete([ diff --git a/app/views/admin/messages/new.html.erb b/app/views/admin/messages/new.html.erb index 8824f68..bb6555f 100644 --- a/app/views/admin/messages/new.html.erb +++ b/app/views/admin/messages/new.html.erb @@ -4,7 +4,7 @@
검색 - <%= text_area_tag :search_word, "", autofocus: true, class: "form-control search_box textcomplete", rows: 1 %> + <%= text_area_tag :search_word, "", autofocus: true, class: "form-control search_box textcomplete shift-enter", rows: 1 %>
diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index 70b33f0..84fb99d 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -1,7 +1,7 @@
<%= label_tag :tags, "태그", class: "col-sm-2 control-label" %>
- <%= text_area_tag :tags, @user.tags, autofocus: true, class: "form-control textcomplete", rows: 1 %> + <%= text_area_tag :tags, @user.tags, autofocus: true, class: "form-control textcomplete shift-enter", rows: 1 %> '#'을 붙여서 태그를 입력해주세요. ex) #태그1 #태그2
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 64ddc32..d38532d 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -7,7 +7,7 @@
검색 - <%= text_area_tag :user_filter_word, "", autofocus: true, class: "form-control search_box textcomplete", rows: 1 %> + <%= text_area_tag :user_filter_word, "", autofocus: true, class: "form-control search_box textcomplete shift-enter", rows: 1 %>