mod window;
mod backend;
mod newnotebook;
+mod notebook;
use std::env;
use entity::collection::{create_notebook_hierarchy, Node};
--- /dev/null
+use ui_rs::{action, ui_actions, UiModel};
+use ui_rs::ui::*;
+
+use entity::note::Model as Note;
+
+#[derive(UiModel, Default)]
+pub struct Notebook {
+ #[bind]
+ pub notes: UiList<Note>
+}
+
+#[ui_actions]
+impl Notebook {
+ pub fn new() -> Self {
+ Default::default()
+ }
+}
use entity::collection::{Model as Collection, Node};
use crate::backend::{BackendHandle, BroadcastMessage};
use crate::newnotebook::new_notebook_dialog;
+use crate::notebook::Notebook;
#[derive(UiModel)]
pub struct MainWindow {
pub backend: BackendHandle,
+ selected_notebook: Option<UiDoc<Notebook>>,
+
groups: Vec<Collection>,
#[bind]
MainWindow {
obj: UiObjRef::default(),
backend: app.backend.clone(),
+ selected_notebook: None,
groups: Vec::new(),
notebooks: UiSourceList::default()
}
b.getvalue(|elm,_row,item|{
item.label = Some(elm.name.clone());
});
+ b.onactivate(|e|{
+
+ });
});
});
mod prelude;
pub mod profile;
-pub mod collection;
\ No newline at end of file
+pub mod collection;
+pub mod note;
\ No newline at end of file
--- /dev/null
+use sea_orm::entity::prelude::*;
+
+
+#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
+#[sea_orm(table_name = "note")]
+pub struct Model {
+ #[sea_orm(primary_key)]
+ pub note_id: i32,
+ pub collection_id: i32,
+
+ pub kind: NoteType,
+ pub title: String,
+ pub content: String,
+
+ pub lastmodified: DateTimeWithTimeZone,
+ pub created_at: DateTimeWithTimeZone,
+}
+
+#[derive(EnumIter, DeriveActiveEnum, Clone, Debug, PartialEq)]
+#[sea_orm(rs_type = "i32", db_type = "Integer")]
+pub enum NoteType {
+ PlainTextNote = 0,
+ MDTextNote = 1,
+}
+
+#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
+pub enum Relation {}
+
+impl ActiveModelBehavior for ActiveModel {}