From 0a7995004655f471f6160141b0f9f55724fe29dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Wed, 31 Aug 2022 10:38:21 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=B0=83=E6=95=B4nps=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/nps_controller.rb | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/app/controllers/nps_controller.rb b/app/controllers/nps_controller.rb index 2e1b552b0..35dac164c 100644 --- a/app/controllers/nps_controller.rb +++ b/app/controllers/nps_controller.rb @@ -1,28 +1,15 @@ class NpsController < ApplicationController + # close,关闭 + # createIssue,创建issue + # createPullRequest,创建PR + # auditPullRequest,审核PR + # indexProject,项目主页 + # createProject,创建项目 + # createOrganization,创建组织 def create - tip_exception "缺少参数" if params[:action_id].blank? - action_type ||= begin - case params[:action_id].to_s - when '0' then - 'close' - when '1' then - 'createIssue' - when '2' then - 'createPullRequest' - when '3' then - 'auditPullRequest' - when '4' then - 'forkProject' - when '5' then - 'createProject' - when '6' then - 'createOrganization' - else - "#{params[:action_type].to_s}" - end - end - UserNp.create(:action_id => params[:action_id], :action_type => "#{action_type}", :user_id => User.current.id, :score => params[:score].to_f, memo: params[:memo]) + tip_exception "缺少参数" if params[:action_id].blank? || params[:action_type].blank? + UserNp.create(:action_id => params[:action_id].to_i, :action_type => params[:action_type], :user_id => User.current.id, :score => params[:score].to_f, memo: params[:memo]) render_ok end end From 32a9d762d8dc3aa17b77281148399bd81e66d5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Wed, 31 Aug 2022 10:39:52 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E8=B0=83=E6=95=B4nps=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E8=B0=83=E7=A0=94=E6=8E=A5=E5=8F=A3,=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/nps_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/nps_controller.rb b/app/controllers/nps_controller.rb index 35dac164c..f16b2606f 100644 --- a/app/controllers/nps_controller.rb +++ b/app/controllers/nps_controller.rb @@ -1,5 +1,7 @@ class NpsController < ApplicationController + before_action :require_login + # close,关闭 # createIssue,创建issue # createPullRequest,创建PR From d03b45eecf5f2a4c77846a88b3c18dc343256b89 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 6 Sep 2022 08:59:24 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E4=BB=B6=E5=AF=B9=E5=88=86=E6=94=AF=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E8=BF=9B=E8=A1=8C=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/contents/create_form.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/forms/contents/create_form.rb b/app/forms/contents/create_form.rb index 6a0294887..1e1b0f99f 100644 --- a/app/forms/contents/create_form.rb +++ b/app/forms/contents/create_form.rb @@ -3,6 +3,8 @@ class Contents::CreateForm < BaseForm validates :filepath, presence: true + validates :branch, :new_branch, length: { maximum: 50 } + validate :check_branch def check_branch From 5acd45bf85674646af20ab49f68c45bd86973391 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 6 Sep 2022 09:00:05 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/contents/create_form.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/forms/contents/create_form.rb b/app/forms/contents/create_form.rb index 1e1b0f99f..431199c59 100644 --- a/app/forms/contents/create_form.rb +++ b/app/forms/contents/create_form.rb @@ -3,7 +3,7 @@ class Contents::CreateForm < BaseForm validates :filepath, presence: true - validates :branch, :new_branch, length: { maximum: 50 } + validates :new_branch, length: { maximum: 50 }, message: "分支名称过长,仅支持50的长度" validate :check_branch From 632ade9d259fbe1f214adf4cdff12a7a88390d0d Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 6 Sep 2022 09:02:30 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/contents/create_form.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/forms/contents/create_form.rb b/app/forms/contents/create_form.rb index 431199c59..71709026d 100644 --- a/app/forms/contents/create_form.rb +++ b/app/forms/contents/create_form.rb @@ -3,7 +3,7 @@ class Contents::CreateForm < BaseForm validates :filepath, presence: true - validates :new_branch, length: { maximum: 50 }, message: "分支名称过长,仅支持50的长度" + validates :new_branch, length: { maximum: 50} validate :check_branch From 4878d6662035306a9c8eb8c0db02236b0a13df77 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 6 Sep 2022 09:04:46 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/contents/create_form.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/forms/contents/create_form.rb b/app/forms/contents/create_form.rb index 71709026d..73341661c 100644 --- a/app/forms/contents/create_form.rb +++ b/app/forms/contents/create_form.rb @@ -3,7 +3,7 @@ class Contents::CreateForm < BaseForm validates :filepath, presence: true - validates :new_branch, length: { maximum: 50} + validates :new_branch, length: { maximum: 50, too_long: "分支名称过长,仅支持%{count}的长度"} validate :check_branch From 925b05e004913a624e6fa1928a71ca0c6268190a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Mon, 5 Sep 2022 11:38:23 +0800 Subject: [PATCH 7/9] =?UTF-8?q?nps=E5=B7=B2=E6=89=93=E5=88=86=E5=8C=BA?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/nps_controller.rb | 1 + app/views/admins/nps/_user_np_list.html.erb | 2 +- app/views/admins/nps/index.html.erb | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/admins/nps_controller.rb b/app/controllers/admins/nps_controller.rb index 4eacba4e7..491e62778 100644 --- a/app/controllers/admins/nps_controller.rb +++ b/app/controllers/admins/nps_controller.rb @@ -7,6 +7,7 @@ class Admins::NpsController < Admins::BaseController sql = 'CONCAT(users.lastname, users.firstname) LIKE :keyword OR users.nickname LIKE :keyword OR users.login LIKE :keyword OR users.mail LIKE :keyword OR users.phone LIKE :keyword' @user_nps = @user_nps.where(sql, keyword: "%#{keyword}%") end + @user_nps = @user_nps.where("action_type != 'close'") if params[:done_score].present? @user_nps = paginate @user_nps.includes(:user) end diff --git a/app/views/admins/nps/_user_np_list.html.erb b/app/views/admins/nps/_user_np_list.html.erb index f4246c701..f2d5196e9 100644 --- a/app/views/admins/nps/_user_np_list.html.erb +++ b/app/views/admins/nps/_user_np_list.html.erb @@ -21,7 +21,7 @@ <%= display_text(nps.created_at&.strftime('%Y-%m-%d %H:%M')) %> <%= display_text(nps.user.last_login_on&.strftime('%Y-%m-%d %H:%M')) %> - <%= nps.score %> + <%= nps.action_type == 'close' ? '--' : nps.score %> <%= nps.memo %> <% end %> diff --git a/app/views/admins/nps/index.html.erb b/app/views/admins/nps/index.html.erb index f599d00a1..e36066cb8 100644 --- a/app/views/admins/nps/index.html.erb +++ b/app/views/admins/nps/index.html.erb @@ -6,6 +6,10 @@ <%= form_tag(admins_nps_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %> <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %> + + <%= check_box_tag("done_score", true, false, id: "done_score", style: 'margin-left: 2px;') %> <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> NPS系统开关 From 60894f00b1586285a4f459f50297bd8421984975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Mon, 5 Sep 2022 11:42:57 +0800 Subject: [PATCH 8/9] =?UTF-8?q?nps=E5=B7=B2=E6=89=93=E5=88=86=E5=8C=BA?= =?UTF-8?q?=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admins/nps/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/nps/index.html.erb b/app/views/admins/nps/index.html.erb index e36066cb8..cc3eb94ad 100644 --- a/app/views/admins/nps/index.html.erb +++ b/app/views/admins/nps/index.html.erb @@ -7,7 +7,7 @@ <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: 'ID/姓名/邮箱/手机号检索') %> <%= check_box_tag("done_score", true, false, id: "done_score", style: 'margin-left: 2px;') %> <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> From a438ab6f3ef72dd82585db7f7bb0d55ef47e5fd4 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 6 Sep 2022 14:57:54 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=ADlocale=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/contents/create_form.rb | 2 +- config/locales/forms/create_file_form.zh-CN.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 config/locales/forms/create_file_form.zh-CN.yml diff --git a/app/forms/contents/create_form.rb b/app/forms/contents/create_form.rb index 73341661c..ec60697d6 100644 --- a/app/forms/contents/create_form.rb +++ b/app/forms/contents/create_form.rb @@ -3,7 +3,7 @@ class Contents::CreateForm < BaseForm validates :filepath, presence: true - validates :new_branch, length: { maximum: 50, too_long: "分支名称过长,仅支持%{count}的长度"} + validates :new_branch, length: { maximum: 100, too_long: "过长,仅支持%{count}的长度"} validate :check_branch diff --git a/config/locales/forms/create_file_form.zh-CN.yml b/config/locales/forms/create_file_form.zh-CN.yml new file mode 100644 index 000000000..0f9ea86a7 --- /dev/null +++ b/config/locales/forms/create_file_form.zh-CN.yml @@ -0,0 +1,5 @@ +'zh-CN': + activemodel: + attributes: + contents/create_form: + new_branch: 分支名称 \ No newline at end of file