Skip to content

Commit 92c67fc

Browse files
committed
Add ViewCustomize.context.project.id #86
1 parent fa587c7 commit 92c67fc

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

README.ja.md

Lines changed: 1 addition & 0 deletions
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": [

README.md

Lines changed: 1 addition & 0 deletions
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": [

lib/redmine_view_customize/view_hook.rb

Lines changed: 1 addition & 0 deletions
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 }},

test/unit/view_customize_view_hook_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_view_layouts_base_html_head
7474
expected << "[0-9]+"
7575
expected << Regexp.escape("\" /><script type=\"text/javascript\">\n")
7676
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")
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\":{\"id\":1,\"identifier\":\"ecookbook\",\"name\":\"eCookbook\",\"roles\":[{\"id\":1,\"name\":\"Non member\"}],\"customFields\":[{\"id\":3,\"name\":\"Development status\",\"value\":\"Stable\"}]}} };\n")
7878
expected << Regexp.escape("//]]>\n")
7979
expected << Regexp.escape("</script>\n")
8080
expected << Regexp.escape("<!-- view customize id:1 -->\n")

0 commit comments

Comments
 (0)