move activeCols into config/
This commit is contained in:
parent
5fd79d9246
commit
95dea7f20a
@ -78,14 +78,8 @@ fn card_render_required(columns: &[String]) -> bool {
|
||||
|
||||
impl Collection {
|
||||
pub fn browser_row_for_card(&mut self, id: CardID) -> Result<Row> {
|
||||
let columns: Vec<String> = self.get_config_optional("activeCols").unwrap_or_else(|| {
|
||||
vec![
|
||||
"noteFld".to_string(),
|
||||
"template".to_string(),
|
||||
"cardDue".to_string(),
|
||||
"deck".to_string(),
|
||||
]
|
||||
});
|
||||
// this is inefficient; we may want to use an enum in the future
|
||||
let columns = self.get_desktop_browser_card_columns();
|
||||
let mut context = RowContext::new(self, id, card_render_required(&columns))?;
|
||||
|
||||
Ok(Row {
|
||||
|
@ -62,6 +62,9 @@ pub(crate) enum ConfigKey {
|
||||
NextNewCardPosition,
|
||||
#[strum(to_string = "schedVer")]
|
||||
SchedulerVersion,
|
||||
|
||||
#[strum(to_string = "activeCols")]
|
||||
DesktopBrowserCardColumns,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
|
||||
@ -129,6 +132,18 @@ impl Collection {
|
||||
self.get_config_default(ConfigKey::BrowserSortKind)
|
||||
}
|
||||
|
||||
pub(crate) fn get_desktop_browser_card_columns(&self) -> Vec<String> {
|
||||
self.get_config_optional(ConfigKey::DesktopBrowserCardColumns)
|
||||
.unwrap_or_else(|| {
|
||||
vec![
|
||||
"noteFld".to_string(),
|
||||
"template".to_string(),
|
||||
"cardDue".to_string(),
|
||||
"deck".to_string(),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn get_creation_utc_offset(&self) -> Option<i32> {
|
||||
self.get_config_optional(ConfigKey::CreationOffset)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user