summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/shared/gr-diff-preferences/gr-diff-preferences.html
blob: d7bc704cce975a4ff3aef65269ad09ec7edafec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<!--
@license
Copyright (C) 2016 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/iron-input/iron-input.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../gr-button/gr-button.html">
<link rel="import" href="../gr-rest-api-interface/gr-rest-api-interface.html">
<link rel="import" href="../gr-select/gr-select.html">

<dom-module id="gr-diff-preferences">
  <template>
    <style include="shared-styles"></style>
    <style include="gr-form-styles"></style>
    <div id="diffPreferences" class="gr-form-styles">
      <section>
        <span class="title">Context</span>
        <span class="value">
          <gr-select
              id="contextSelect"
              bind-value="{{diffPrefs.context}}">
            <select
                on-keypress="_handleDiffPrefsChanged"
                on-change="_handleDiffPrefsChanged">
              <option value="3">3 lines</option>
              <option value="10">10 lines</option>
              <option value="25">25 lines</option>
              <option value="50">50 lines</option>
              <option value="75">75 lines</option>
              <option value="100">100 lines</option>
              <option value="-1">Whole file</option>
            </select>
          </gr-select>
        </span>
      </section>
      <section>
        <span class="title">Fit to screen</span>
        <span class="value">
          <input
              id="lineWrappingInput"
              type="checkbox"
              checked$="[[diffPrefs.line_wrapping]]"
              on-change="_handleLineWrappingTap">
        </span>
      </section>
      <section>
        <span class="title">Diff width</span>
        <span class="value">
          <input
              is="iron-input"
              type="number"
              id="columnsInput"
              prevent-invalid-input
              allowed-pattern="[0-9]"
              bind-value="{{diffPrefs.line_length}}"
              on-keypress="_handleDiffPrefsChanged"
              on-change="_handleDiffPrefsChanged">
        </span>
      </section>
      <section>
        <span class="title">Tab width</span>
        <span class="value">
          <input
              is="iron-input"
              type="number"
              id="tabSizeInput"
              prevent-invalid-input
              allowed-pattern="[0-9]"
              bind-value="{{diffPrefs.tab_size}}"
              on-keypress="_handleDiffPrefsChanged"
              on-change="_handleDiffPrefsChanged">
        </span>
      </section>
      <section hidden$="[[!diffPrefs.font_size]]">
        <span class="title">Font size</span>
        <span class="value">
          <input
              is="iron-input"
              type="number"
              id="fontSizeInput"
              prevent-invalid-input
              allowed-pattern="[0-9]"
              bind-value="{{diffPrefs.font_size}}"
              on-keypress="_handleDiffPrefsChanged"
              on-change="_handleDiffPrefsChanged">
        </span>
      </section>
      <section>
        <span class="title">Show tabs</span>
        <span class="value">
          <input
              id="showTabsInput"
              type="checkbox"
              checked$="[[diffPrefs.show_tabs]]"
              on-change="_handleShowTabsTap">
        </span>
      </section>
      <section>
        <span class="title">Show trailing whitespace</span>
        <span class="value">
          <input
              id="showTrailingWhitespaceInput"
              type="checkbox"
              checked$="[[diffPrefs.show_whitespace_errors]]"
              on-change="_handleShowTrailingWhitespaceTap">
        </span>
      </section>
      <section>
        <span class="title">Syntax highlighting</span>
        <span class="value">
          <input
              id="syntaxHighlightInput"
              type="checkbox"
              checked$="[[diffPrefs.syntax_highlighting]]"
              on-change="_handleSyntaxHighlightTap">
        </span>
      </section>
      <section>
        <span class="title">Automatically mark viewed files reviewed</span>
        <span class="value">
          <input
              id="automaticReviewInput"
              type="checkbox"
              checked$="[[diffPrefs.manual_review]]"
              on-change="_handleAutomaticReviewTap">
        </span>
      </section>
      <section>
        <div class="pref">
          <span class="title">Ignore Whitespace</span>
          <span class="value">
            <gr-select bind-value="{{diffPrefs.ignore_whitespace}}">
              <select
                  on-keypress="_handleDiffPrefsChanged"
                  on-change="_handleDiffPrefsChanged">
                <option value="IGNORE_NONE">None</option>
                <option value="IGNORE_TRAILING">Trailing</option>
                <option value="IGNORE_LEADING_AND_TRAILING">Leading & trailing</option>
                <option value="IGNORE_ALL">All</option>
              </select>
            </gr-select>
          </span>
        </div>
      </section>
    </div>
    <gr-rest-api-interface id="restAPI"></gr-rest-api-interface>
  </template>
  <script src="gr-diff-preferences.js"></script>
</dom-module>