Add action to update a note.

This commit is contained in:
hassaku 2015-01-07 14:05:09 +09:00
parent e2e884e317
commit 7e062f860f
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,20 @@
class Fluentd::Settings::NotesController < ApplicationController
before_action :login_required
before_action :find_fluentd
before_action :find_note, only: [:update]
def update
if @note.update(params[:note][:content])
flash[:success] = t('messages.note_updating_success')
else
flash[:error] = t('errors.messages.note_updating_failed')
end
redirect_to daemon_setting_path
end
private
def find_note
@note = Fluentd::SettingArchive::Note.find_by_file_id(@fluentd.agent.config_backup_dir, params[:id])
end
end

View File

@ -12,6 +12,7 @@ en:
fluentd_status_running: Running
fluentd_status_stopped: Stopped
config_successfully_copied: "Config has been copied successfully. Please restart %{brand} to use the new config"
note_updating_success: "Note successfully updated."
terms: &terms
name: Name
@ -284,6 +285,7 @@ en:
is_a_directory: is a directory. should be a file
duplicated_conf: Configurations is duplicated
out_forward_blank_server: server settings should be at least one
note_updating_failed: Updating the note is failed. See application logs.
activemodel: &activemodel
errors:

View File

@ -12,6 +12,7 @@ ja:
fluentd_status_running: 稼働中
fluentd_status_stopped: 停止中
config_successfully_copied: "設定をコピーしました。反映させるには、 %{brand}を再起動してください。"
note_updating_success: "メモを更新しました。"
terms: &terms
name: アカウント名
@ -289,6 +290,7 @@ ja:
is_a_directory: はディレクトリです。ファイルを指定してください
duplicated_conf: 同じ内容の設定がすでに存在しています
out_forward_blank_server: serverの設定がありません。
note_updating_failed: メモの更新に失敗しました。ログを確認して下さい。
activemodel: &activemodel
errors:

View File

@ -68,6 +68,8 @@ Rails.application.routes.draw do
post "reuse", action: 'reuse', on: :member, as: 'reuse'
end
resources :notes, only: [:update], module: :settings, controller: :notes
resource :running_backup, only: [:show], module: :settings, controller: :running_backup do
post "reuse", action: 'reuse', on: :member, as: 'reuse'
end