From 2f44b646281aacdde9c44a32d4740e99e504ce33 Mon Sep 17 00:00:00 2001 From: uu59 Date: Mon, 26 May 2014 16:22:23 +0900 Subject: [PATCH] fancy start/stop/reload buttons --- app/helpers/application_helper.rb | 2 +- app/views/fluentd/agents/show.html.haml | 22 +++++++++++++++------- app/views/fluentd/settings/show.html.haml | 1 + app/views/shared/_fluentd_nav.html.haml | 12 ++++++++++++ config/locales/translation_ja.yml | 2 ++ 5 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 app/views/shared/_fluentd_nav.html.haml diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1b5c7dc..6c45662 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,7 +37,7 @@ module ApplicationHelper end def icon(classes, inner=nil) - %Q!#{inner}!.html_safe + %Q!#{inner} !.html_safe end def page_title(title) diff --git a/app/views/fluentd/agents/show.html.haml b/app/views/fluentd/agents/show.html.haml index f663bf4..e678110 100644 --- a/app/views/fluentd/agents/show.html.haml +++ b/app/views/fluentd/agents/show.html.haml @@ -1,13 +1,21 @@ - page_title t('.page_title', label: @fluentd.label) +%h4 + - if @fluentd.agent.running? + %span.text.text-success= icon("fa-check") + = t("fluentd.common.running") + - else + %span.text.text-info= icon("fa-circle-o") + = t("fluentd.common.stopped") + - if flash[:error] %div.alert.alert-danger= flash[:error] -%h4 - = @fluentd.agent.running? ? t(".running") : t(".stopped") +%p.operations + = link_to icon("fa-play") << t("fluentd.common.start"), start_fluentd_agent_path(@fluentd), method: :put, class: "btn #{@fluentd.agent.running? ? "disabled btn-default" : "btn-primary"}" + = link_to icon("fa-pause") << t("fluentd.common.stop"), stop_fluentd_agent_path(@fluentd), method: :put, class: "btn #{@fluentd.agent.running? ? "btn-danger" : "disabled btn-default"}" + = link_to icon("fa-refresh") << t("fluentd.common.restart"), restart_fluentd_agent_path(@fluentd), method: :put, class: "btn #{@fluentd.agent.running? ? "btn-warning" : "disabled btn-default"}" -= link_to t(".start"), start_fluentd_agent_path(@fluentd), method: :put -= link_to t(".stop"), stop_fluentd_agent_path(@fluentd), method: :put -= link_to t(".restart"), restart_fluentd_agent_path(@fluentd), method: :put -= link_to t(".log"), log_fluentd_agent_path(@fluentd) -= link_to t(".setting"), fluentd_setting_path(@fluentd) +%p + = link_to t("fluentd.common.log"), log_fluentd_agent_path(@fluentd) + = link_to t("fluentd.common.config_file"), fluentd_setting_path(@fluentd) diff --git a/app/views/fluentd/settings/show.html.haml b/app/views/fluentd/settings/show.html.haml index 098b011..9c50bf5 100644 --- a/app/views/fluentd/settings/show.html.haml +++ b/app/views/fluentd/settings/show.html.haml @@ -5,3 +5,4 @@ = @config = link_to t(".edit"), edit_fluentd_setting_path(@fluentd) + diff --git a/app/views/shared/_fluentd_nav.html.haml b/app/views/shared/_fluentd_nav.html.haml new file mode 100644 index 0000000..3dfd479 --- /dev/null +++ b/app/views/shared/_fluentd_nav.html.haml @@ -0,0 +1,12 @@ +%h4 + = @fluentd.agent.running? ? t("fluentd.common.running") : t("fluentd.common.stopped") + +- if flash[:error] + %div.alert.alert-danger= flash[:error] + += link_to t("fluentd.common.detail"), fluentd_agent_path(@fluentd) += link_to t("fluentd.common.start"), start_fluentd_agent_path(@fluentd), method: :put += link_to t("fluentd.common.stop"), stop_fluentd_agent_path(@fluentd), method: :put += link_to t("fluentd.common.restart"), restart_fluentd_agent_path(@fluentd), method: :put += link_to t("fluentd.common.log"), log_fluentd_agent_path(@fluentd) += link_to t("fluentd.common.config_file"), fluentd_setting_path(@fluentd) diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index 0da82e1..4bd9f7a 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -16,6 +16,7 @@ ja: fluent_version: "fluentd %{version}" no_alert: なし update_password: パスワード更新 + detail: 詳細 create: 作成 update: 更新 edit: 編集 @@ -61,6 +62,7 @@ ja: running: 稼働中 operation: プロセス詳細 setting: 設定 + config_file: 設定ファイル page_title: "%{label}" form: <<: *fluentd_common