merge from main

This commit is contained in:
Kenneth Kehl
2023-11-22 08:21:34 -08:00
14 changed files with 240 additions and 285 deletions

View File

@@ -284,6 +284,7 @@ def init_app(application):
@application.context_processor
def _attach_current_global_daily_messages():
global_limit = 0
remaining_global_messages = 0
if current_app:
if request.view_args:
@@ -301,7 +302,10 @@ def init_app(application):
remaining_global_messages = global_limit - global_messages_count.get(
"count"
)
return {"daily_global_messages_remaining": remaining_global_messages}
return {
"global_message_limit": global_limit,
"daily_global_messages_remaining": remaining_global_messages,
}
@application.before_request
def record_start_time():

View File

@@ -0,0 +1,9 @@
(function (window) {
"use strict";
// Show the current year
document.getElementById("current-year").innerHTML = new Date().getFullYear();
})(window);

View File

@@ -6,7 +6,7 @@ from app import service_api_client
from app.formatters import email_safe
from app.main import main
from app.main.forms import CreateServiceForm
from app.utils.user import user_is_gov_user, user_is_platform_admin
from app.utils.user import user_is_gov_user, user_is_logged_in
def _create_service(service_name, organization_type, email_from, form):
@@ -42,7 +42,7 @@ def _create_example_template(service_id):
@main.route("/add-service", methods=["GET", "POST"])
@user_is_gov_user
@user_is_platform_admin
@user_is_logged_in
def add_service():
default_organization_type = current_user.default_organization_type
if default_organization_type is None:

View File

@@ -689,7 +689,6 @@ def format_stats_by_service(services):
"name": service["name"],
"stats": service["statistics"],
"restricted": service["restricted"],
"research_mode": service["research_mode"],
"created_at": service["created_at"],
"active": service["active"],
}

View File

@@ -1,17 +1,12 @@
{% macro tick_cross(yes, label, truthy_hint='Can', falsey_hint='Cannot') %}
<li>
{% if yes %}
<li>
<span class="tick-cross-tick">
<span class="usa-sr-only">{{ truthy_hint }}</span>
{{ label}}
</span>
{% else %}
<span class="tick-cross-cross">
<span class="usa-sr-only">{{ falsey_hint }}</span>
{{ label}}
</span>
</li>
{% endif %}
</li>
{% endmacro %}
{% macro tick_cross_done_not_done(yes, label) %}

View File

@@ -15,7 +15,7 @@
</thead>
<tbody>
<tr>
<td>{{ big_number(40000 - sms_allowance_remaining, smaller=True) }}</td>
<td>{{ big_number(sms_sent, smaller=True) }}</td>
<td>
{% if sms_cost %}
{{ big_number(

View File

@@ -45,7 +45,7 @@
</thead>
<tbody>
<tr>
<td>{{ 5000 - daily_global_messages_remaining }}</td>
<td>{{ global_message_limit - daily_global_messages_remaining }}</td>
<td>
{{ daily_global_messages_remaining }}
</td>
@@ -54,7 +54,7 @@
</table>
{% if current_user.has_permissions('manage_service') %}
<h3 class='margin-bottom-0'>2023</h3>
<h3 class='margin-bottom-0' id="current-year"></h3>
{{ ajax_block(partials, updates_url, 'usage') }}
{{ show_more(
url_for(".usage", service_id=current_service['id']),

View File

@@ -22,7 +22,7 @@
<div class='grid-col-12'>
<h2 class="heading-small margin-bottom-1">Daily messages across all services</h2>
<p class="margin-0">You have sent {{ 5000 - daily_global_messages_remaining }} of your 5000 daily messages allowance.</p>
<p class="margin-0">You have sent {{ global_message_limit - daily_global_messages_remaining }} of your {{ global_message_limit }} daily messages allowance.</p>
<p class="margin-0"></p>You have {{ daily_global_messages_remaining }} messages remaining.</p>
<h2 class='heading-small margin-bottom-1'>Text messages</h2>
<div class="keyline-block">