|
1 | | -Redmine view customize plugin |
2 | | -=========================== |
| 1 | +# Redmine view customize plugin |
3 | 2 |
|
4 | 3 | This a plugin allows you to customize the view for the [Redmine](http://www.redmine.org). |
5 | 4 |
|
6 | | -Features |
7 | | ------------- |
| 5 | +## Features |
8 | 6 |
|
9 | | -By adding JavaScript or CSS to the matched path, a screen is made customizable. |
| 7 | +Customize the page by inserting JavaScript or CSS on the page that matched the condition. |
10 | 8 |
|
11 | | - |
12 | | -Installation |
13 | | ------------- |
| 9 | +## Installation |
14 | 10 |
|
15 | 11 | Install the plugin in your Redmine plugins directory, clone this repository as `view_customize`: |
16 | 12 |
|
17 | | - cd {RAILS_ROOT}/plugins |
18 | | - git clone https://github.com/onozaty/redmine-view-customize.git view_customize |
19 | | - cd ../ |
20 | | - bundle exec rake redmine:plugins:migrate RAILS_ENV=production |
| 13 | +``` |
| 14 | +cd {RAILS_ROOT}/plugins |
| 15 | +git clone https://github.com/onozaty/redmine-view-customize.git view_customize |
| 16 | +cd ../ |
| 17 | +bundle exec rake redmine:plugins:migrate RAILS_ENV=production |
| 18 | +``` |
21 | 19 |
|
22 | 20 | **note: The directory name must be a `view_customize`. Directory name is different, it will fail to run the Plugin.** |
23 | 21 |
|
24 | | -Usage |
25 | | ------------- |
26 | | - |
27 | | -### Setting |
28 | | - |
29 | | -1. After you install the Plugin, "View customize" the administrator menu is added. |
30 | | - |
31 | | - |
32 | | -2. Add a new setting. |
33 | | - |
34 | | -3. Path pattern is specified with a regular expression. (ex. /issues/[0-9]+) |
35 | | -If there is a match with the path of the page, the code(JavaScript/StyleSheet) is executed. |
36 | | - |
37 | | -4. Input code. |
38 | | - |
39 | | - |
40 | | -5. Matches the path, StyleSheet or JavaScrpt is embedded, the screen display is changed. |
41 | | - |
42 | | - |
43 | | - |
44 | | -Supported versions |
45 | | ------------------- |
| 22 | +## Usage |
| 23 | + |
| 24 | +### Add |
| 25 | + |
| 26 | +When installing the plugin, "View customize" is added to the administrator menu. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +Click "View customize" go to the list screen. |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +Click "New view customize" and enter items. |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +"Path pattern" is specified by regular expression. If it matches the path of the page, insert the code and execute it. |
| 39 | + |
| 40 | +The following is an example. |
| 41 | +* `.*` : All pages |
| 42 | +* `/issues$` : Issue list |
| 43 | +* `/issues/[0-9]+` : Issue detail page |
| 44 | + |
| 45 | +"Insertion position" is the code insertion position. It becomes item added in v1.2.0. |
| 46 | + |
| 47 | +* "Head of all pages" (The same position as the version before v1.2.0) |
| 48 | +* "Bottom of issue form"<br> |
| 49 | +Issue input fields are reconstructed when trackers or statuses are changed. If "Bottom of issue form" is specified, it will be executed again when reconstructed. |
| 50 | +* "Bottom of issue detail" |
| 51 | + |
| 52 | +If there is no part corresponding to the insertion position of the code on the page, the code is not insert. |
| 53 | +For example, even if you specify `.*` in "Path pattern", if "Bottom of issue detail" is specified for "Insertion position", it will be executed only on the issue detail page. |
| 54 | + |
| 55 | +In "Type", select the type of code ("JavaScript" or "CSS") and enter the actual code in "Code". |
| 56 | + |
| 57 | +For "Comment" you can put an overview on customization. The contents entered here are displayed in the list display. |
| 58 | +When "Comment" is entered, "Comment" is displayed on the list. |
| 59 | +If "Comment" is not entered, "Code" is displayed in the list. |
| 60 | + |
| 61 | +Addition is completed by clicking "Create" button. |
| 62 | + |
| 63 | +The specified code is executed on the page that matches "Path pattern", and the page will be customized. |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +### Edit / Delete |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +When you click the number of the customize list, go to the detail page. |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | +You can delete it by clicking "Delete". |
| 76 | + |
| 77 | +Click "Edit" to switch to the edit page. |
| 78 | +The input item is the same as when creating a new one. |
| 79 | + |
| 80 | +### Disable / Private |
| 81 | + |
| 82 | +You can disable it by unchecking "Enabled". If you check "Private", it will be enable only for the author. |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +If you check the operation with "Private" and there is no problem in operation, it will be good to release it to the all. |
| 87 | + |
| 88 | +### ViewCustomize.context (JavaScript) |
| 89 | + |
| 90 | +You can access information on users and projects using `ViewCustomize.context`. |
| 91 | + |
| 92 | +`ViewCustomize.context` is as follows. |
| 93 | + |
| 94 | +```javascript |
| 95 | +ViewCustomize = { |
| 96 | + "context": { |
| 97 | + "user": { |
| 98 | + "id": 1, |
| 99 | + "login": "admin", |
| 100 | + "admin": true, |
| 101 | + "firstname": "Redmine", |
| 102 | + "lastname": "Admin", |
| 103 | + "groups": [ |
| 104 | + {"id": 5, "name": "Group1"} |
| 105 | + ], |
| 106 | + "roles": [ // All roles associated with users (all projects) |
| 107 | + {"id": 4, "name": "Developer"}, |
| 108 | + {"id": 6, "name": "RoleX"} |
| 109 | + ], |
| 110 | + "apiKey": "3dd35b5ad8456d90d21ef882f7aea651d367a9d8", |
| 111 | + "customFields": [ |
| 112 | + {"id": 1, "name": "[Custom field] Text", "value": "text"}, |
| 113 | + {"id": 2, "name": "[Custom field] List", "value": ["B", "A"]}, |
| 114 | + {"id": 3, "name": "[Custom field] Boolean", "value": "1"} |
| 115 | + ] |
| 116 | + }, |
| 117 | + "project": { |
| 118 | + "identifier": "project-a", |
| 119 | + "name": "Project A", |
| 120 | + "roles": [ // Roles in the project |
| 121 | + {"id": 6, "name": "RoleX"} |
| 122 | + ] |
| 123 | + }, |
| 124 | + "issue": { |
| 125 | + "id": 1 |
| 126 | + } |
| 127 | + } |
| 128 | +} |
| 129 | +``` |
| 130 | + |
| 131 | +For example, to access the user's API key is `ViewCustomize.context.user.apiKey`. |
| 132 | + |
| 133 | +## Examples |
| 134 | + |
| 135 | +* [onozaty/redmine\-view\-customize\-scripts: Script list for "Redmine View Customize Plugin"](https://github.com/onozaty/redmine-view-customize-scripts) |
| 136 | + |
| 137 | +## Redmine 2.0.x or later |
46 | 138 |
|
47 | 139 | * Redmine 2.0.x or later |
48 | 140 |
|
49 | | -License |
50 | | -------- |
| 141 | +## License |
51 | 142 |
|
52 | 143 | The plugin is available under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl-2.0.html), version 2 or later. |
0 commit comments