This commit is contained in:
despiegk 2025-04-22 06:44:29 +04:00
parent 093aff3851
commit af4f09a67b
21 changed files with 616 additions and 586 deletions

View File

@ -62,9 +62,15 @@ impl ContractController {
context.insert("draft_contracts", &draft_contracts);
Ok(HttpResponse::Ok().content_type("text/html").body(
tmpl.render("contracts/index.html", &context).unwrap()
))
let rendered = tmpl.render("contracts/index.html", &context)
.map_err(|e| {
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", context);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
}
// Display the list of all contracts
@ -83,9 +89,15 @@ impl ContractController {
context.insert("contracts", &contracts_data);
context.insert("filter", &"all");
Ok(HttpResponse::Ok().content_type("text/html").body(
tmpl.render("contracts/contracts.html", &context).unwrap()
))
let rendered = tmpl.render("contracts/contracts.html", &context)
.map_err(|e| {
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", context);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
}
// Display the list of user's contracts
@ -103,9 +115,15 @@ impl ContractController {
context.insert("contracts", &contracts_data);
Ok(HttpResponse::Ok().content_type("text/html").body(
tmpl.render("contracts/my_contracts.html", &context).unwrap()
))
let rendered = tmpl.render("contracts/my_contracts.html", &context)
.map_err(|e| {
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", context);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
}
// Display a specific contract
@ -128,9 +146,15 @@ impl ContractController {
context.insert("contract", &contract_json);
context.insert("user_has_signed", &false); // Mock data
Ok(HttpResponse::Ok().content_type("text/html").body(
tmpl.render("contracts/contract_detail.html", &context).unwrap()
))
let rendered = tmpl.render("contracts/contract_detail.html", &context)
.map_err(|e| {
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", context);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
},
None => {
Ok(HttpResponse::NotFound().finish())
@ -156,9 +180,15 @@ impl ContractController {
context.insert("contract_types", &contract_types);
Ok(HttpResponse::Ok().content_type("text/html").body(
tmpl.render("contracts/create_contract.html", &context).unwrap()
))
let rendered = tmpl.render("contracts/create_contract.html", &context)
.map_err(|e| {
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", context);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
}
// Process the create contract form

View File

@ -27,9 +27,9 @@ impl FlowController {
let rendered = tmpl.render("flows/index.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
@ -48,9 +48,9 @@ impl FlowController {
let rendered = tmpl.render("flows/flows.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
@ -78,9 +78,9 @@ impl FlowController {
let rendered = tmpl.render("flows/flow_detail.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
@ -91,9 +91,9 @@ impl FlowController {
let rendered = tmpl.render("error.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
@ -111,9 +111,9 @@ impl FlowController {
let rendered = tmpl.render("flows/create_flow.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
@ -150,9 +150,9 @@ impl FlowController {
let rendered = tmpl.render("flows/my_flows.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
eprintln!("Error details: {:?}", e);
eprintln!("Context: {:?}", ctx);
log::error!("Template rendering error: {}", e);
log::error!("Error details: {:?}", e);
log::error!("Context: {:?}", ctx);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;

View File

@ -154,10 +154,10 @@
<!-- Main Content -->
<div class="main-content">
<!-- Page Content -->
<main class="container py-3">
<main class="py-3 w-100">
<div class="container-fluid">
{% block content %}{% endblock %}
</main>
</div>
</main>
</div>
</div>

View File

@ -3,7 +3,7 @@
{% block title %}Calendar{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<h1>Calendar</h1>
<p>View Mode: {{ view_mode }}</p>

View File

@ -3,7 +3,7 @@
{% block title %}New Calendar Event{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<h1>Create New Event</h1>
{% if error %}

View File

@ -3,7 +3,7 @@
{% block title %}Contract Details{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">

View File

@ -3,7 +3,7 @@
{% block title %}All Contracts{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">

View File

@ -3,7 +3,7 @@
{% block title %}Create New Contract{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">

View File

@ -3,7 +3,7 @@
{% block title %}Contracts Dashboard{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-3">Contracts Dashboard</h1>

View File

@ -3,7 +3,7 @@
{% block title %}My Contracts{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">

View File

@ -3,8 +3,7 @@
{% block title %}Create New Flow{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@ -13,16 +12,16 @@
</ol>
</nav>
</div>
</div>
</div>
<div class="row mb-4">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-3">Create New Flow</h1>
<p class="lead">Start a new workflow process by filling out the form below.</p>
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="col-lg-8">
<div class="card">
<div class="card-body">
@ -97,6 +96,6 @@
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,8 +3,7 @@
{% block title %}{{ flow.name }} - Flow Details{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@ -14,22 +13,22 @@
</ol>
</nav>
</div>
</div>
</div>
<!-- Success message if present -->
{% if success %}
<div class="row mb-4">
<!-- Success message if present -->
{% if success %}
<div class="row mb-4">
<div class="col-12">
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ success }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
<!-- Flow Overview -->
<div class="row mb-4">
<!-- Flow Overview -->
<div class="row mb-4">
<div class="col-md-8">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
@ -159,10 +158,10 @@
</div>
{% endif %}
</div>
</div>
</div>
<!-- Flow Steps -->
<div class="row mb-4">
<!-- Flow Steps -->
<div class="row mb-4">
<div class="col-12">
<div class="card">
<div class="card-header">
@ -217,10 +216,10 @@
</div>
</div>
</div>
</div>
</div>
<!-- Mark as Stuck Modal -->
<div class="modal fade" id="markStuckModal" tabindex="-1" aria-labelledby="markStuckModalLabel" aria-hidden="true">
<!-- Mark as Stuck Modal -->
<div class="modal fade" id="markStuckModal" tabindex="-1" aria-labelledby="markStuckModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form action="/flows/{{ flow.id }}/stuck" method="post">
@ -242,6 +241,6 @@
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,8 +3,7 @@
{% block title %}All Flows{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@ -13,9 +12,9 @@
</ol>
</nav>
</div>
</div>
</div>
<div class="row mb-4">
<div class="row mb-4">
<div class="col-md-8">
<h1 class="display-5 mb-0">All Flows</h1>
</div>
@ -24,10 +23,10 @@
<i class="bi bi-plus-circle me-1"></i> Create New Flow
</a>
</div>
</div>
</div>
<!-- Filter Controls -->
<div class="row mb-4">
<!-- Filter Controls -->
<div class="row mb-4">
<div class="col-12">
<div class="card">
<div class="card-body">
@ -68,10 +67,10 @@
</div>
</div>
</div>
</div>
</div>
<!-- Flows Table -->
<div class="row">
<!-- Flows Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
@ -99,14 +98,18 @@
</td>
<td>{{ flow.flow_type }}</td>
<td>
<span class="badge {% if flow.status == 'In Progress' %}bg-primary{% elif flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-secondary{% endif %}">
<span
class="badge {% if flow.status == 'In Progress' %}bg-primary{% elif flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-secondary{% endif %}">
{{ flow.status }}
</span>
</td>
<td>{{ flow.owner_name }}</td>
<td>
<div class="progress mb-2" style="height: 20px;">
<div class="progress-bar {% if flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-primary{% endif %}" role="progressbar" style="width: {{ flow.progress_percentage }}%;" aria-valuenow="{{ flow.progress_percentage }}" aria-valuemin="0" aria-valuemax="100">{{ flow.progress_percentage }}%</div>
<div class="progress-bar {% if flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-primary{% endif %}"
role="progressbar" style="width: {{ flow.progress_percentage }}%;"
aria-valuenow="{{ flow.progress_percentage }}" aria-valuemin="0"
aria-valuemax="100">{{ flow.progress_percentage }}%</div>
</div>
</td>
<td>{{ flow.created_at | date(format="%Y-%m-%d") }}</td>
@ -148,6 +151,6 @@
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,7 +3,6 @@
{% block title %}Flows Dashboard{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-3">Flows Dashboard</h1>
@ -70,5 +69,5 @@
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,8 +3,7 @@
{% block title %}My Flows{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
@ -13,9 +12,9 @@
</ol>
</nav>
</div>
</div>
</div>
<div class="row mb-4">
<div class="row mb-4">
<div class="col-md-8">
<h1 class="display-5 mb-0">My Flows</h1>
</div>
@ -24,10 +23,10 @@
<i class="bi bi-plus-circle me-1"></i> Create New Flow
</a>
</div>
</div>
</div>
<!-- Flows Table -->
<div class="row">
<!-- Flows Table -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
@ -54,13 +53,17 @@
</td>
<td>{{ flow.flow_type }}</td>
<td>
<span class="badge {% if flow.status == 'In Progress' %}bg-primary{% elif flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-secondary{% endif %}">
<span
class="badge {% if flow.status == 'In Progress' %}bg-primary{% elif flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-secondary{% endif %}">
{{ flow.status }}
</span>
</td>
<td>
<div class="progress mb-2" style="height: 20px;">
<div class="progress-bar {% if flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-primary{% endif %}" role="progressbar" style="width: {{ flow.progress_percentage }}%;" aria-valuenow="{{ flow.progress_percentage }}" aria-valuemin="0" aria-valuemax="100">{{ flow.progress_percentage }}%</div>
<div class="progress-bar {% if flow.status == 'Completed' %}bg-success{% elif flow.status == 'Stuck' %}bg-danger{% else %}bg-primary{% endif %}"
role="progressbar" style="width: {{ flow.progress_percentage }}%;"
aria-valuenow="{{ flow.progress_percentage }}" aria-valuemin="0"
aria-valuemax="100">{{ flow.progress_percentage }}%</div>
</div>
</td>
<td>
@ -109,6 +112,5 @@
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}Create Proposal - Governance Dashboard{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-4">Create Governance Proposal</h1>

View File

@ -3,7 +3,6 @@
{% block title %}Governance Dashboard - Actix MVC App{% endblock %}
{% block content %}
<div class="container">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-4">Governance Dashboard</h1>
@ -160,5 +159,4 @@
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block title %}My Votes - Governance Dashboard{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-4">My Votes</h1>

View File

@ -3,7 +3,7 @@
{% block title %}{{ proposal.title }} - Governance Proposal{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<nav aria-label="breadcrumb">

View File

@ -3,7 +3,7 @@
{% block title %}Proposals - Governance Dashboard{% endblock %}
{% block content %}
<div class="container">
<div class="container-fluid">
<div class="row mb-4">
<div class="col-12">
<h1 class="display-5 mb-4">Governance Proposals</h1>

View File

@ -3,7 +3,7 @@
{% block title %}Ticket #{{ ticket.id | truncate(length=8) }} - Actix MVC App{% endblock %}
{% block content %}
<div class="container" up-main>
<div class="container-fluid" up-main>
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Ticket #{{ ticket.id | truncate(length=8) }}</h1>
<div>