Skip to content

Commit 6545f21

Browse files
authored
Merge pull request #46 from onozaty/develp/2.4.0
Development for 2.4.0
2 parents 68a0818 + 2963a12 commit 6545f21

File tree

10 files changed

+38
-6
lines changed

10 files changed

+38
-6
lines changed

app/controllers/view_customizes_controller.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class ViewCustomizesController < ApplicationController
22
layout 'admin'
33

44
before_action :require_admin
5-
before_action :find_view_customize, :except => [:index, :new, :create]
5+
before_action :find_view_customize, :except => [:index, :new, :create, :update_all]
66

77
helper :sort
88
include SortHelper
@@ -47,6 +47,13 @@ def update
4747
render :action => 'edit'
4848
end
4949

50+
def update_all
51+
ViewCustomize.update_all(view_customize_params.to_hash)
52+
53+
flash[:notice] = l(:notice_successful_update)
54+
redirect_to view_customizes_path
55+
end
56+
5057
def destroy
5158
@view_customize.destroy
5259
redirect_to view_customizes_path

app/views/view_customizes/index.html.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,14 @@
3737

3838
</table>
3939

40+
<p class="buttons">
41+
<%= link_to l(:label_disable_all),
42+
view_customizes_path(view_customize: {is_enabled: 0}),
43+
:data => {:confirm => l(:text_are_you_sure)}, :method => :put,
44+
:class => 'icon icon-view_customize-disable' %>
45+
<%= link_to l(:label_enable_all),
46+
view_customizes_path(view_customize: {is_enabled: 1}),
47+
:data => {:confirm => l(:text_are_you_sure)}, :method => :put,
48+
:class => 'icon icon-view_customize-enable' %>
49+
</p>
4050
<% end %>

assets/images/disable.png

587 Bytes
Loading

assets/images/enable.png

781 Bytes
Loading

assets/stylesheets/view_customize.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,11 @@ input#view_customize_comments {
6161
.icon-view_customize {
6262
background-image: url("../images/view_customize.png");
6363
}
64+
65+
.icon-view_customize-disable {
66+
background-image: url("../images/disable.png");
67+
}
68+
69+
.icon-view_customize-enable {
70+
background-image: url("../images/enable.png");
71+
}

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ en:
33
label_view_customize: "View customize"
44
label_view_customize_plural: "View customizes"
55
label_view_customizes_new: "New view customize"
6+
label_disable_all: "Disable all"
7+
label_enable_all: "Enable all"
68
label_javascript: "JavaScript"
79
label_css: "CSS"
810
label_html: "HTML"

config/locales/ja.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ ja:
22
label_view_customize: "表示のカスタマイズ"
33
label_view_customize_plural: "表示のカスタマイズ"
44
label_view_customizes_new: "新しい表示のカスタマイズ"
5+
label_disable_all: "すべて無効に"
6+
label_enable_all: "すべて有効に"
57
label_javascript: "JavaScript"
68
label_css: "CSS"
79
label_html: "HTML"
8-
label_insertion_position_html_head: "全てのページのヘッダ"
10+
label_insertion_position_html_head: "全ページのヘッダ"
911
label_insertion_position_issue_form: "チケット入力欄の下"
1012
label_insertion_position_issue_show: "チケット詳細の下"
1113
field_path_pattern: "パスのパターン"

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# See: http://guides.rubyonrails.org/routing.html
33
Rails.application.routes.draw do
44
resources :view_customizes
5+
put :view_customizes, to: 'view_customizes#update_all'
56
end

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name 'View Customize plugin'
44
author 'onozaty'
55
description 'View Customize plugin for Redmine'
6-
version '2.3.0'
6+
version '2.4.0'
77
url 'https://github.com/onozaty/redmine-view-customize'
88
author_url 'https://github.com/onozaty'
99

lib/view_customize/view_hook.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module RedmineViewCustomize
22
class ViewHook < Redmine::Hook::ViewListener
33
def view_layouts_base_html_head(context={})
44

5-
path = context[:request].path_info;
5+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
66

77
html = "\n<!-- [view customize plugin] path:#{path} -->\n"
88
html << stylesheet_link_tag("view_customize", plugin: "view_customize")
@@ -17,7 +17,8 @@ def view_layouts_base_html_head(context={})
1717

1818
def view_issues_form_details_bottom(context={})
1919

20-
return create_view_customize_html(context[:request].path_info, ViewCustomize::INSERTION_POSITION_ISSUE_FORM)
20+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
21+
return create_view_customize_html(path, ViewCustomize::INSERTION_POSITION_ISSUE_FORM)
2122
end
2223

2324
def view_issues_show_details_bottom(context={})
@@ -26,7 +27,8 @@ def view_issues_show_details_bottom(context={})
2627
html << "ViewCustomize.context.issue = { id: #{context[:issue].id} };"
2728
html << "\n//]]>\n</script>"
2829

29-
html << create_view_customize_html(context[:request].path_info, ViewCustomize::INSERTION_POSITION_ISSUE_SHOW)
30+
path = Redmine::CodesetUtil.replace_invalid_utf8(context[:request].path_info);
31+
html << create_view_customize_html(path, ViewCustomize::INSERTION_POSITION_ISSUE_SHOW)
3032

3133
return html
3234
end

0 commit comments

Comments
 (0)