Skip to content

Commit 14f4977

Browse files
authored
Merge pull request #87 from onozaty/develop/v3.0.0
* Zeitwerk support #84 * Add ViewCustomize.context.project.id #86
2 parents 4524e12 + 4e14798 commit 14f4977

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

Diff for: README.ja.md

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ ViewCustomize = {
115115
]
116116
},
117117
"project": {
118+
"id": 1,
118119
"identifier": "project-a",
119120
"name": "Project A",
120121
"roles": [

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ ViewCustomize = {
120120
]
121121
},
122122
"project": {
123+
"id": 1,
123124
"identifier": "project-a",
124125
"name": "Project A",
125126
"roles": [

Diff for: after_init.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
require_dependency 'view_customize/view_hook'
1+
require File.expand_path('../lib/redmine_view_customize/view_hook', __FILE__)

Diff for: init.rb

+1-1
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.8.1'
6+
version '3.0.0'
77
url 'https://github.com/onozaty/redmine-view-customize'
88
author_url 'https://github.com/onozaty'
99

Diff for: lib/view_customize/view_hook.rb renamed to lib/redmine_view_customize/view_hook.rb

+1
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def create_view_customize_context(view_hook_context)
115115
project = view_hook_context[:project]
116116
if project
117117
context["project"] = {
118+
"id" => project.id,
118119
"identifier" => project.identifier,
119120
"name" => project.name,
120121
"roles" => user.roles_for_project(project).map {|role| { "id" => role.id, "name" => role.name }},

Diff for: test/unit/view_customize_view_hook_test.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
require File.expand_path('../../test_helper', __FILE__)
2-
require File.expand_path('../../../lib/view_customize/view_hook', __FILE__)
2+
require File.expand_path('../../../lib/redmine_view_customize/view_hook', __FILE__)
33

44
class ViewCustomizeViewHookTest < ActiveSupport::TestCase
5-
fixtures :view_customizes, :projects, :users, :issues, :custom_fields, :custom_values
5+
fixtures :projects, :users, :email_addresses, :user_preferences, :members, :member_roles, :roles,
6+
:issues, :custom_fields, :custom_fields_projects, :custom_values,
7+
:view_customizes
68

79
class Request
810
def initialize(path)
@@ -74,7 +76,7 @@ def test_view_layouts_base_html_head
7476
expected << "[0-9]+"
7577
expected << Regexp.escape("\" /><script type=\"text/javascript\">\n")
7678
expected << Regexp.escape("//<![CDATA[\n")
77-
expected << Regexp.escape("ViewCustomize = { context: {\"user\":{\"id\":1,\"login\":\"admin\",\"admin\":true,\"firstname\":\"Redmine\",\"lastname\":\"Admin\",\"lastLoginOn\":\"2006-07-19T20:57:52Z\",\"groups\":[],\"apiKey\":null,\"customFields\":[{\"id\":4,\"name\":\"Phone number\",\"value\":null},{\"id\":5,\"name\":\"Money\",\"value\":null}]},\"project\":{\"identifier\":\"ecookbook\",\"name\":\"eCookbook\",\"roles\":[{\"id\":1,\"name\":\"Non member\"}],\"customFields\":[{\"id\":3,\"name\":\"Development status\",\"value\":\"Stable\"}]}} };\n")
79+
expected << Regexp.escape("ViewCustomize = { context: {\"user\":{\"id\":1,\"login\":\"admin\",\"admin\":true,\"firstname\":\"Redmine\",\"lastname\":\"Admin\",\"lastLoginOn\":\"2006-07-19T20:57:52Z\",\"groups\":[],\"apiKey\":null,\"customFields\":[{\"id\":4,\"name\":\"Phone number\",\"value\":null},{\"id\":5,\"name\":\"Money\",\"value\":null}]},\"project\":{\"id\":1,\"identifier\":\"ecookbook\",\"name\":\"eCookbook\",\"roles\":[{\"id\":4,\"name\":\"Non member\"}],\"customFields\":[{\"id\":3,\"name\":\"Development status\",\"value\":\"Stable\"}]}} };\n")
7880
expected << Regexp.escape("//]]>\n")
7981
expected << Regexp.escape("</script>\n")
8082
expected << Regexp.escape("<!-- view customize id:1 -->\n")

0 commit comments

Comments
 (0)