mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-23 18:01:26 +01:00
feat: content reader modal
This commit is contained in:
@@ -164,3 +164,22 @@ pub async fn delete_text_content(
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn show_content_read_modal(
|
||||
State(state): State<HtmlState>,
|
||||
RequireUser(user): RequireUser,
|
||||
Path(id): Path<String>,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
// Get and validate the text content
|
||||
let text_content = User::get_and_validate_text_content(&id, &user.id, &state.db).await?;
|
||||
#[derive(Serialize)]
|
||||
pub struct TextContentReadModalData {
|
||||
pub user: User,
|
||||
pub text_content: TextContent,
|
||||
}
|
||||
|
||||
Ok(TemplateResponse::new_template(
|
||||
"content/read_content_modal.html",
|
||||
TextContentReadModalData { user, text_content },
|
||||
))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ mod handlers;
|
||||
|
||||
use axum::{extract::FromRef, routing::get, Router};
|
||||
use handlers::{
|
||||
delete_text_content, patch_text_content, show_content_page, show_text_content_edit_form,
|
||||
delete_text_content, patch_text_content, show_content_page, show_content_read_modal,
|
||||
show_text_content_edit_form,
|
||||
};
|
||||
|
||||
use crate::html_state::HtmlState;
|
||||
@@ -14,6 +15,7 @@ where
|
||||
{
|
||||
Router::new()
|
||||
.route("/content", get(show_content_page))
|
||||
.route("/content/{id}/read", get(show_content_read_modal))
|
||||
.route(
|
||||
"/content/{id}",
|
||||
get(show_text_content_edit_form)
|
||||
|
||||
@@ -18,15 +18,9 @@ use crate::{
|
||||
use common::{
|
||||
error::AppError,
|
||||
storage::types::{
|
||||
conversation::Conversation,
|
||||
file_info::{FileError, FileInfo},
|
||||
ingestion_task::IngestionTask,
|
||||
knowledge_entity::KnowledgeEntity,
|
||||
knowledge_relationship::KnowledgeRelationship,
|
||||
text_chunk::TextChunk,
|
||||
text_content::TextContent,
|
||||
user::User,
|
||||
StoredObject,
|
||||
conversation::Conversation, file_info::FileInfo, ingestion_task::IngestionTask,
|
||||
knowledge_entity::KnowledgeEntity, knowledge_relationship::KnowledgeRelationship,
|
||||
text_chunk::TextChunk, text_content::TextContent, user::User,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user