mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
add: init data button
This commit is contained in:
@@ -19,6 +19,16 @@ class Admins::MessageTemplatesController < Admins::BaseController
|
||||
end
|
||||
end
|
||||
|
||||
def init_data
|
||||
if MessageTemplate.build_init_data
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:success] = '消息模版初始化成功'
|
||||
else
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:danger] = '消息模版初始化失败'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def message_template_params
|
||||
params.require(:message_template).permit!
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
<% add_admin_breadcrumb('消息模版') %>
|
||||
<% end %>
|
||||
<div id="admins-message-templates-content">
|
||||
<div class="box search-form-container project-list-form">
|
||||
<%= link_to "初始化数据", init_data_admins_message_templates_path, class: "btn btn-primary pull-right", "data-disabled-with":"...初始化数据" %>
|
||||
</div>
|
||||
<div class="box admin-list-container message-templates-list-container">
|
||||
<%= render partial: 'admins/message_templates/list', locals: { message_templates: @message_templates } %>
|
||||
</div>
|
||||
|
||||
@@ -668,7 +668,11 @@ Rails.application.routes.draw do
|
||||
resources :project_licenses
|
||||
resources :project_ignores
|
||||
resources :reversed_keywords
|
||||
resources :message_templates, only: [:index, :edit, :update]
|
||||
resources :message_templates, only: [:index, :edit, :update] do
|
||||
collection do
|
||||
get :init_data
|
||||
end
|
||||
end
|
||||
resources :major_informations, only: [:index]
|
||||
resources :ec_templates, only: [:index, :destroy] do
|
||||
collection do
|
||||
|
||||
Reference in New Issue
Block a user