mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
move activeCols into config/
This commit is contained in:
parent
5fd79d9246
commit
95dea7f20a
2 changed files with 17 additions and 8 deletions
|
@ -78,14 +78,8 @@ fn card_render_required(columns: &[String]) -> bool {
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub fn browser_row_for_card(&mut self, id: CardID) -> Result<Row> {
|
pub fn browser_row_for_card(&mut self, id: CardID) -> Result<Row> {
|
||||||
let columns: Vec<String> = self.get_config_optional("activeCols").unwrap_or_else(|| {
|
// this is inefficient; we may want to use an enum in the future
|
||||||
vec![
|
let columns = self.get_desktop_browser_card_columns();
|
||||||
"noteFld".to_string(),
|
|
||||||
"template".to_string(),
|
|
||||||
"cardDue".to_string(),
|
|
||||||
"deck".to_string(),
|
|
||||||
]
|
|
||||||
});
|
|
||||||
let mut context = RowContext::new(self, id, card_render_required(&columns))?;
|
let mut context = RowContext::new(self, id, card_render_required(&columns))?;
|
||||||
|
|
||||||
Ok(Row {
|
Ok(Row {
|
||||||
|
|
|
@ -62,6 +62,9 @@ pub(crate) enum ConfigKey {
|
||||||
NextNewCardPosition,
|
NextNewCardPosition,
|
||||||
#[strum(to_string = "schedVer")]
|
#[strum(to_string = "schedVer")]
|
||||||
SchedulerVersion,
|
SchedulerVersion,
|
||||||
|
|
||||||
|
#[strum(to_string = "activeCols")]
|
||||||
|
DesktopBrowserCardColumns,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
|
#[derive(PartialEq, Serialize_repr, Deserialize_repr, Clone, Copy, Debug)]
|
||||||
|
@ -129,6 +132,18 @@ impl Collection {
|
||||||
self.get_config_default(ConfigKey::BrowserSortKind)
|
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> {
|
pub(crate) fn get_creation_utc_offset(&self) -> Option<i32> {
|
||||||
self.get_config_optional(ConfigKey::CreationOffset)
|
self.get_config_optional(ConfigKey::CreationOffset)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue