Merge pull request #889 from dod-ccpo/funding-page-ctas

Funding page CTAs
This commit is contained in:
richard-dds 2019-06-12 11:27:37 -04:00 committed by GitHub
commit 92b80d1e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 16 deletions

View File

@ -64,14 +64,34 @@ class TaskOrder(Base, mixins.TimestampsMixin):
else: else:
raise TypeError("Could not set attachment with invalid type") raise TypeError("Could not set attachment with invalid type")
@property
def is_draft(self):
return self.status == Status.DRAFT
@property @property
def is_active(self): def is_active(self):
return self.status == Status.ACTIVE return self.status == Status.ACTIVE
@property
def is_upcoming(self):
return self.status == Status.UPCOMING
@property @property
def is_expired(self): def is_expired(self):
return self.status == Status.EXPIRED return self.status == Status.EXPIRED
@property
def is_unsigned(self):
return self.status == Status.UNSIGNED
@property
def has_begun(self):
return Clock.today() >= self.start_date
@property
def has_ended(self):
return Clock.today() >= self.end_date
@property @property
def is_completed(self): def is_completed(self):
return all([self.pdf, self.number, len(self.clins)]) return all([self.pdf, self.number, len(self.clins)])
@ -146,10 +166,6 @@ class TaskOrder(Base, mixins.TimestampsMixin):
def portfolio_name(self): def portfolio_name(self):
return self.portfolio.name return self.portfolio.name
@property
def is_pending(self):
return self.status == Status.PENDING
def to_dictionary(self): def to_dictionary(self):
return { return {
"portfolio_name": self.portfolio_name, "portfolio_name": self.portfolio_name,

View File

@ -82,6 +82,10 @@
min-width: 10rem; min-width: 10rem;
} }
.task-order-card__buttons .usa-button-secondary {
min-width: 14rem;
}
.task-order-summary { .task-order-summary {
margin-top: $gap * 4; margin-top: $gap * 4;

View File

@ -6,8 +6,14 @@
{% block portfolio_content %} {% block portfolio_content %}
{% macro ViewLink(task_order, text="Edit") %} {% macro TaskOrderReviewButton(task_order, text="Edit", secondary=False, modal=None) %}
<a href="{{ url_for('task_orders.view_task_order', task_order_id=task_order.id) }}" class="usa-button"> <a href="{{ url_for('task_orders.review_task_order', task_order_id=task_order.id, modal=modal) }}" class="usa-button {{ 'usa-button-secondary' if secondary else '' }}">
{{ text }}
</a>
{% endmacro %}
{% macro TaskOrderEditButton(task_order, text="Edit", secondary=False) %}
<a href="{{ url_for('task_orders.edit', portfolio_id=task_order.portfolio_id, task_order_id=task_order.id) }}" class="usa-button {{ 'usa-button-secondary' if secondary else '' }}">
{{ text }} {{ text }}
</a> </a>
{% endmacro %} {% endmacro %}
@ -18,24 +24,49 @@
{% macro TaskOrderDate(task_order) %} {% macro TaskOrderDate(task_order) %}
<span class="datetime"> <span class="datetime">
{% if task_order.is_active %} <!-- Draft: {Begins, Began} start_date -->
Began {{ TaskOrderDateTime(task_order.start_date) }} &nbsp;&nbsp;|&nbsp;&nbsp; Ends {{ TaskOrderDateTime(task_order.end_date) }} <!-- Everything else: {Starts, Started} start_date | {Ends, Ended} end_date -->
{% elif task_order.is_expired %}
Started {{ TaskOrderDateTime(task_order.start_date) }} &nbsp;&nbsp;|&nbsp;&nbsp; Ended {{ TaskOrderDateTime(task_order.end_date) }} {% if task_order.is_draft %}
{% if task_order.has_begun %}
Started on
{% else %} {% else %}
Started {{ TaskOrderDateTime(task_order.start_date) }} Starts on
{% endif %}
{{ TaskOrderDateTime(task_order.time_created) }}
{% else %}
{% if task_order.has_begun %}
Began
{% else %}
Begins
{% endif %}
{{ TaskOrderDateTime(task_order.start_date) }}
{% endif %}
{% if not task_order.is_draft %}
&nbsp;&nbsp;|&nbsp;&nbsp;
{% if task_order.has_ended %}
Ended
{% else %}
Ends
{% endif %}
{{ TaskOrderDateTime(task_order.end_date) }}
{% endif %} {% endif %}
</span> </span>
{% endmacro %} {% endmacro %}
{% macro TaskOrderActions(task_order) %} {% macro TaskOrderActions(task_order) %}
<div class="task-order-card__buttons"> <div class="task-order-card__buttons">
{% if task_order.is_pending %} {% if task_order.is_draft %}
{{ ViewLink(task_order, text="Edit") }} {{ TaskOrderEditButton(task_order, text="Edit") }}
{% elif task_order.is_active %} {% elif task_order.is_expired %}
{{ ViewLink(task_order, text="Modify") }} {{ TaskOrderReviewButton(task_order, text="View") }}
{% elif task_order.is_unsigned %}
{{ TaskOrderReviewButton(task_order, text="Sign", secondary=True, modal="submit-to-1") }}
{{ TaskOrderReviewButton(task_order, text="View") }}
{% else %} {% else %}
{{ ViewLink(task_order, text="View") }}
{% endif %} {% endif %}
</div> </div>
{% endmacro %} {% endmacro %}