Skip to content

Commit b6d6b27

Browse files
committed
add input_class and button_class configuration options
1 parent 8986a78 commit b6d6b27

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ plugins:
127127
placeholder: 'another password placeholder'
128128
decryption_failure_message: 'another informational message when decryption fail'
129129
encryption_info_message: 'another information message when you dont have acess !'
130+
input_class: 'md-search__form md-search__input'
131+
button_class: 'md-search__icon'
130132
```
131133

132134
Default prefix title is `[Protected]`.
@@ -141,6 +143,7 @@ Defaut encryption information message is `Contact your administrator for access
141143

142144
> **NOTE** Adding a prefix to the title does not change the default navigation path !
143145

146+
Use `input_class` and `button_class` to optionally set a CSS class for the password field and the button.
144147

145148
# Features
146149

encryptcontent/decrypt-form.tpl.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<form id="mkdocs-decrypt-form">
44
<h1>{{ summary }}</h1>
55
{% if encryption_info_message %}<p>{{ encryption_info_message }}</p>{% endif %}
6-
<input type="password" id="mkdocs-content-password" placeholder="{{ placeholder }}" />
7-
{% if password_button %}<button id="mkdocs-decrypt-button">{{ password_button_text }}</button>{% endif %}
6+
<input{% if input_class %} class="{{ input_class }}"{% endif %} type="password" id="mkdocs-content-password" placeholder="{{ placeholder }}" />
7+
{% if password_button %}<button{% if button_class %} class="{{ button_class }}"{% endif %} id="mkdocs-decrypt-button">{{ password_button_text }}</button>{% endif %}
88
<p id="mkdocs-decrypt-msg"></p>
99
</form>
1010
</div>

encryptcontent/plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class encryptContentPlugin(BasePlugin):
5555
('encryption_info_message', config_options.Type(string_types, default=str(SETTINGS['encryption_info_message']))),
5656
('password_button_text', config_options.Type(string_types, default=str(SETTINGS['password_button_text']))),
5757
('password_button', config_options.Type(bool, default=False)),
58+
('input_class', config_options.Type(string_types, default=None)),
59+
('button_class', config_options.Type(string_types, default=None)),
5860
# password feature
5961
('global_password', config_options.Type(string_types, default=None)),
6062
('use_secret', config_options.Type(string_types, default=None)),
@@ -127,6 +129,8 @@ def __encrypt_content__(self, content, password, base_path, encryptcontent_path)
127129
'password_button': self.config['password_button'],
128130
'password_button_text': self.config['password_button_text'],
129131
'encryption_info_message': self.config['encryption_info_message'],
132+
'input_class': self.config['input_class'],
133+
'button_class': self.config['button_class'],
130134
# this benign decoding is necessary before writing to the template,
131135
# otherwise the output string will be wrapped with b''
132136
'ciphertext_bundle': b';'.join(ciphertext_bundle).decode('ascii'),

0 commit comments

Comments
 (0)