diff --git a/app/assets/stylesheets/_grids.scss b/app/assets/stylesheets/_grids.scss index 00f8809e6..cdd68defe 100644 --- a/app/assets/stylesheets/_grids.scss +++ b/app/assets/stylesheets/_grids.scss @@ -35,6 +35,10 @@ margin-bottom: $gutter-half; } +.bottom-gutter-3-2 { + margin-bottom: $gutter * 3/2; +} + .bottom-gutter-2 { margin-bottom: $gutter * 2; } diff --git a/app/assets/stylesheets/app.scss b/app/assets/stylesheets/app.scss index 8144e50ba..878d94497 100644 --- a/app/assets/stylesheets/app.scss +++ b/app/assets/stylesheets/app.scss @@ -214,3 +214,12 @@ summary::-webkit-details-marker { details .arrow { font-size: 16px; } + +.block-label-hint { + @include core-16; + margin-top: 5px; +} + +.block-label input[disabled] { + opacity: 0.5; +} diff --git a/app/main/forms.py b/app/main/forms.py index a1c6db9bb..95afc47c6 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -391,8 +391,8 @@ class RequestToGoLiveForm(Form): ), choices=[ ('yes', 'Yes'), - ('no', 'No – we’ll send you a copy'), - ('don’t know', 'I don’t know – we’ll check for you') + ('no', 'No'), + ('don’t know', 'I don’t know') ], validators=[DataRequired()] ) diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index de7c65181..fd3352a54 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -1,4 +1,4 @@ -from flask import request, render_template, redirect, url_for, flash +from flask import request, render_template, redirect, url_for, flash, Markup, abort from flask_login import login_required from app.main import main from app.main.forms import CreateKeyForm, Whitelist @@ -68,13 +68,22 @@ def create_api_key(service_id): key['name'] for key in api_key_api_client.get_api_keys(service_id=service_id)['apiKeys'] ] form = CreateKeyForm(key_names) - form.key_type.choices = filter(None, [ - (KEY_TYPE_NORMAL, 'Send messages to anyone') - if not current_service['restricted'] else None, - (KEY_TYPE_TEST, 'Simulate sending messages to anyone'), - (KEY_TYPE_TEAM, 'Only send messages to your team or whitelist') - ]) + form.key_type.choices = [ + (KEY_TYPE_NORMAL, 'Send messages to anyone'), + (KEY_TYPE_TEAM, 'Send messages to anyone on my whitelist'), + (KEY_TYPE_TEST, 'Pretend to send messages to anyone'), + ] + if current_service['restricted']: + disabled_options = [KEY_TYPE_NORMAL] + option_hints = {KEY_TYPE_NORMAL: Markup( + 'This option is not available because your service is in ' + 'trial mode'.format(url_for(".trial_mode")) + )} + else: + disabled_options, option_hints = [], {} if form.validate_on_submit(): + if form.key_type.data in disabled_options: + abort(400) secret = api_key_api_client.create_api_key( service_id=service_id, key_name=form.key_name.data, @@ -88,7 +97,9 @@ def create_api_key(service_id): ) return render_template( 'views/api/keys/create.html', - form=form + form=form, + disabled_options=disabled_options, + option_hints=option_hints ) diff --git a/app/templates/components/radios.html b/app/templates/components/radios.html index c361c443e..a24c49d1c 100644 --- a/app/templates/components/radios.html +++ b/app/templates/components/radios.html @@ -1,6 +1,8 @@ {% macro radios( field, - hint=None + hint=None, + disable=[], + option_hints={} ) %}
@@ -14,8 +16,21 @@ {% for option in field %} {% endfor %}
diff --git a/app/templates/views/api/index.html b/app/templates/views/api/index.html index cd650bc85..7b6144e04 100644 --- a/app/templates/views/api/index.html +++ b/app/templates/views/api/index.html @@ -13,15 +13,6 @@ API integration - {% if current_service.restricted %} - {% call banner_wrapper(type='warning') %} -

Your service is in trial mode

-

- You can only send messages to people in your team or whitelist. -

- {% endcall %} - {% endif %} -