Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
arsnova.cards
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Leon George
arsnova.cards
Commits
60aa05b8
Commit
60aa05b8
authored
Oct 28, 2018
by
Klaus-Dieter Quibeldey-Cirkel
🏀
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'staging' of git.thm.de:arsnova/flashcards into staging
parents
5e800617
12db96da
Changes
123
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
123 changed files
with
3727 additions
and
3117 deletions
+3727
-3117
cardsetNavigation.js
imports/api/cardsetNavigation.js
+50
-0
cardsetVisuals.js
imports/api/cardsetVisuals.js
+10
-0
import.js
imports/api/import.js
+51
-53
cardset.html
imports/ui/cardset/cardset.html
+0
-1453
cardset.js
imports/ui/cardset/cardset.js
+9
-1611
bonus.html
imports/ui/cardset/index/bonus/bonus.html
+93
-0
bonus.js
imports/ui/cardset/index/bonus/bonus.js
+91
-0
cards.html
imports/ui/cardset/index/cards/cards.html
+68
-0
cards.js
imports/ui/cardset/index/cards/cards.js
+201
-0
editors.html
imports/ui/cardset/index/editors/editors.html
+52
-0
editors.js
imports/ui/cardset/index/editors/editors.js
+41
-0
bonus.html
imports/ui/cardset/info/box/bonus.html
+26
-0
bonus.js
imports/ui/cardset/info/box/bonus.js
+27
-0
cardset.html
imports/ui/cardset/info/box/cardset.html
+40
-0
cardset.js
imports/ui/cardset/info/box/cardset.js
+54
-0
activeLearners.html
imports/ui/cardset/info/box/item/activeLearners.html
+12
-0
activeLearners.js
imports/ui/cardset/info/box/item/activeLearners.js
+2
-0
author.html
imports/ui/cardset/info/box/item/author.html
+14
-0
author.js
imports/ui/cardset/info/box/item/author.js
+2
-0
bonusButton.html
imports/ui/cardset/info/box/item/bonusButton.html
+20
-0
bonusButton.js
imports/ui/cardset/info/box/item/bonusButton.js
+24
-0
bonusDeadline.html
imports/ui/cardset/info/box/item/bonusDeadline.html
+6
-0
bonusDeadline.js
imports/ui/cardset/info/box/item/bonusDeadline.js
+19
-0
bonusEnd.html
imports/ui/cardset/info/box/item/bonusEnd.html
+6
-0
bonusEnd.js
imports/ui/cardset/info/box/item/bonusEnd.js
+15
-0
bonusPoints.html
imports/ui/cardset/info/box/item/bonusPoints.html
+8
-0
bonusPoints.js
imports/ui/cardset/info/box/item/bonusPoints.js
+2
-0
bonusRegistrationPeriod.html
...rts/ui/cardset/info/box/item/bonusRegistrationPeriod.html
+6
-0
bonusRegistrationPeriod.js
imports/ui/cardset/info/box/item/bonusRegistrationPeriod.js
+15
-0
bonusStart.html
imports/ui/cardset/info/box/item/bonusStart.html
+7
-0
bonusStart.js
imports/ui/cardset/info/box/item/bonusStart.js
+15
-0
bonusStatus.html
imports/ui/cardset/info/box/item/bonusStatus.html
+6
-0
bonusStatus.js
imports/ui/cardset/info/box/item/bonusStatus.js
+19
-0
bonusWorkload.html
imports/ui/cardset/info/box/item/bonusWorkload.html
+6
-0
bonusWorkload.js
imports/ui/cardset/info/box/item/bonusWorkload.js
+19
-0
cardCount.html
imports/ui/cardset/info/box/item/cardCount.html
+8
-0
cardCount.js
imports/ui/cardset/info/box/item/cardCount.js
+2
-0
cardType.html
imports/ui/cardset/info/box/item/cardType.html
+12
-0
cardType.js
imports/ui/cardset/info/box/item/cardType.js
+16
-0
dateCreated.html
imports/ui/cardset/info/box/item/dateCreated.html
+6
-0
dateCreated.js
imports/ui/cardset/info/box/item/dateCreated.js
+2
-0
dateUpdated.html
imports/ui/cardset/info/box/item/dateUpdated.html
+6
-0
dateUpdated.js
imports/ui/cardset/info/box/item/dateUpdated.js
+2
-0
difficulty.html
imports/ui/cardset/info/box/item/difficulty.html
+14
-0
difficulty.js
imports/ui/cardset/info/box/item/difficulty.js
+23
-0
kind.html
imports/ui/cardset/info/box/item/kind.html
+10
-0
kind.js
imports/ui/cardset/info/box/item/kind.js
+2
-0
learningMode.html
imports/ui/cardset/info/box/item/learningMode.html
+10
-0
learningMode.js
imports/ui/cardset/info/box/item/learningMode.js
+38
-0
license.html
imports/ui/cardset/info/box/item/license.html
+17
-0
license.js
imports/ui/cardset/info/box/item/license.js
+17
-0
originalAuthor.html
imports/ui/cardset/info/box/item/originalAuthor.html
+12
-0
originalAuthor.js
imports/ui/cardset/info/box/item/originalAuthor.js
+19
-0
pomodoroBreakTime.html
imports/ui/cardset/info/box/item/pomodoroBreakTime.html
+6
-0
pomodoroBreakTime.js
imports/ui/cardset/info/box/item/pomodoroBreakTime.js
+15
-0
pomodoroCount.html
imports/ui/cardset/info/box/item/pomodoroCount.html
+6
-0
pomodoroCount.js
imports/ui/cardset/info/box/item/pomodoroCount.js
+20
-0
pomodoroWorkTime.html
imports/ui/cardset/info/box/item/pomodoroWorkTime.html
+6
-0
pomodoroWorkTime.js
imports/ui/cardset/info/box/item/pomodoroWorkTime.js
+15
-0
price.html
imports/ui/cardset/info/box/item/price.html
+12
-0
price.js
imports/ui/cardset/info/box/item/price.js
+18
-0
purchased.html
imports/ui/cardset/info/box/item/purchased.html
+10
-0
purchased.js
imports/ui/cardset/info/box/item/purchased.js
+20
-0
ratings.html
imports/ui/cardset/info/box/item/ratings.html
+27
-0
ratings.js
imports/ui/cardset/info/box/item/ratings.js
+44
-0
reviewer.html
imports/ui/cardset/info/box/item/reviewer.html
+12
-0
reviewer.js
imports/ui/cardset/info/box/item/reviewer.js
+33
-0
info.html
imports/ui/cardset/info/info.html
+45
-0
info.js
imports/ui/cardset/info/info.js
+63
-0
bonus.html
imports/ui/cardset/navigation/item/bonus.html
+54
-0
bonus.js
imports/ui/cardset/navigation/item/bonus.js
+67
-0
deleteAllCards.html
imports/ui/cardset/navigation/item/deleteAllCards.html
+17
-0
deleteAllCards.js
imports/ui/cardset/navigation/item/deleteAllCards.js
+20
-0
editCardset.html
imports/ui/cardset/navigation/item/editCardset.html
+11
-0
editCardset.js
imports/ui/cardset/navigation/item/editCardset.js
+2
-0
editLicense.html
imports/ui/cardset/navigation/item/editLicense.html
+13
-0
editLicense.js
imports/ui/cardset/navigation/item/editLicense.js
+3
-0
editRepetitorium.html
imports/ui/cardset/navigation/item/editRepetitorium.html
+12
-0
editRepetitorium.js
imports/ui/cardset/navigation/item/editRepetitorium.js
+15
-0
export.html
imports/ui/cardset/navigation/item/export.html
+15
-0
export.js
imports/ui/cardset/navigation/item/export.js
+35
-0
import.html
imports/ui/cardset/navigation/item/import.html
+14
-0
import.js
imports/ui/cardset/navigation/item/import.js
+25
-0
learning.html
imports/ui/cardset/navigation/item/learning.html
+10
-0
learning.js
imports/ui/cardset/navigation/item/learning.js
+118
-0
manage.html
imports/ui/cardset/navigation/item/manage.html
+37
-0
manage.js
imports/ui/cardset/navigation/item/manage.js
+33
-0
newCard.html
imports/ui/cardset/navigation/item/newCard.html
+14
-0
newCard.js
imports/ui/cardset/navigation/item/newCard.js
+18
-0
presentation.html
imports/ui/cardset/navigation/item/presentation.html
+15
-0
presentation.js
imports/ui/cardset/navigation/item/presentation.js
+32
-0
publishCardset.html
imports/ui/cardset/navigation/item/publishCardset.html
+15
-0
publishCardset.js
imports/ui/cardset/navigation/item/publishCardset.js
+42
-0
workload.html
imports/ui/cardset/navigation/item/workload.html
+37
-0
workload.js
imports/ui/cardset/navigation/item/workload.js
+65
-0
chooseFlashcards.html
imports/ui/cardset/navigation/modal/chooseFlashcards.html
+146
-0
chooseFlashcards.js
imports/ui/cardset/navigation/modal/chooseFlashcards.js
+120
-0
deleteAllCards.html
imports/ui/cardset/navigation/modal/deleteAllCards.html
+25
-0
deleteAllCards.js
imports/ui/cardset/navigation/modal/deleteAllCards.js
+19
-0
editors.html
imports/ui/cardset/navigation/modal/editors.html
+22
-0
editors.js
imports/ui/cardset/navigation/modal/editors.js
+21
-0
endBonus.html
imports/ui/cardset/navigation/modal/endBonus.html
+27
-0
endBonus.js
imports/ui/cardset/navigation/modal/endBonus.js
+22
-0
import.html
imports/ui/cardset/navigation/modal/import.html
+68
-0
import.js
imports/ui/cardset/navigation/modal/import.js
+99
-0
leaveBonus.html
imports/ui/cardset/navigation/modal/leaveBonus.html
+22
-0
leaveBonus.js
imports/ui/cardset/navigation/modal/leaveBonus.js
+25
-0
leaveCardset.html
imports/ui/cardset/navigation/modal/leaveCardset.html
+22
-0
leaveCardset.js
imports/ui/cardset/navigation/modal/leaveCardset.js
+26
-0
leitner.html
imports/ui/cardset/navigation/modal/leitner.html
+25
-0
leitner.js
imports/ui/cardset/navigation/modal/leitner.js
+17
-0
license.html
imports/ui/cardset/navigation/modal/license.html
+122
-0
license.js
imports/ui/cardset/navigation/modal/license.js
+82
-0
publish.html
imports/ui/cardset/navigation/modal/publish.html
+83
-0
publish.js
imports/ui/cardset/navigation/modal/publish.js
+105
-0
report.html
imports/ui/cardset/navigation/modal/report.html
+55
-0
report.js
imports/ui/cardset/navigation/modal/report.js
+52
-0
wozniak.html
imports/ui/cardset/navigation/modal/wozniak.html
+25
-0
wozniak.js
imports/ui/cardset/navigation/modal/wozniak.js
+17
-0
navigation.html
imports/ui/cardset/navigation/navigation.html
+21
-0
navigation.js
imports/ui/cardset/navigation/navigation.js
+37
-0
preview.html
imports/ui/cardset/preview.html
+29
-0
preview.js
imports/ui/cardset/preview.js
+50
-0
No files found.
imports/api/cardsetNavigation.js
0 → 100644
View file @
60aa05b8
export
let
CardsetNavigation
=
class
CardsetNavigation
{
/**
* Creates a web push subscription for the current device.
* The Browser ask the user for permissions and creates the subscription.
* Afterwards the subscription will be saved for the current user via the
* Meteor-method addWebPushSubscription.
*/
static
subscribeForPushNotification
()
{
try
{
navigator
.
serviceWorker
.
getRegistration
()
.
then
(
function
(
registration
)
{
return
registration
.
pushManager
.
getSubscription
()
.
then
(
function
(
subscription
)
{
if
(
!
subscription
)
{
return
registration
.
pushManager
.
subscribe
({
userVisibleOnly
:
true
});
}
});
})
.
then
(
function
(
subscription
)
{
if
(
subscription
)
{
var
rawKey
=
subscription
.
getKey
?
subscription
.
getKey
(
'p256dh'
)
:
''
;
const
key
=
rawKey
?
btoa
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
rawKey
)))
:
''
;
var
rawAuthSecret
=
subscription
.
getKey
?
subscription
.
getKey
(
'auth'
)
:
''
;
const
authSecret
=
rawAuthSecret
?
btoa
(
String
.
fromCharCode
.
apply
(
null
,
new
Uint8Array
(
rawAuthSecret
)))
:
''
;
const
endpoint
=
subscription
.
endpoint
;
const
sub
=
{
endpoint
:
endpoint
,
key
:
key
,
authSecret
:
authSecret
};
Meteor
.
call
(
"addWebPushSubscription"
,
sub
,
function
(
error
)
{
if
(
error
)
{
throw
new
Meteor
.
Error
(
error
.
statusCode
,
'Error subscription failed'
);
}
});
}
});
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
/**
* Add the current user to the leitner algorithm.
*/
static
addToLeitner
(
cardset_id
)
{
this
.
subscribeForPushNotification
();
Meteor
.
call
(
'addToLeitner'
,
cardset_id
);
}
};
imports/api/cardsetVisuals.js
View file @
60aa05b8
...
...
@@ -7,4 +7,14 @@ export let CardsetVisuals = class CardsetVisuals {
$
(
'.markdeepCardsetContent'
).
css
(
'height'
,
'auto'
);
}
}
static
changeCollapseIcon
(
iconId
)
{
if
(
$
(
iconId
).
hasClass
(
"glyphicon-collapse-down"
))
{
$
(
iconId
).
removeClass
(
"glyphicon-collapse-down"
);
$
(
iconId
).
addClass
(
"glyphicon-collapse-up"
);
}
else
{
$
(
iconId
).
removeClass
(
"glyphicon-collapse-up"
);
$
(
iconId
).
addClass
(
"glyphicon-collapse-down"
);
}
}
};
imports/api/import.js
View file @
60aa05b8
...
...
@@ -51,61 +51,59 @@ function importCards(data, cardset, importType) {
}
if
(
importType
===
1
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
let
item
=
data
[
i
];
let
subject
,
front
,
back
,
hint
,
lecture
,
top
,
bottom
;
try
{
// If the string is UTF-8, this will work and not throw an error.
subject
=
decodeURIComponent
(
encodeURIComponent
(
item
.
subject
));
front
=
decodeURIComponent
(
encodeURIComponent
(
item
.
front
));
back
=
decodeURIComponent
(
encodeURIComponent
(
item
.
back
));
hint
=
decodeURIComponent
(
encodeURIComponent
(
item
.
hint
));
lecture
=
decodeURIComponent
(
encodeURIComponent
(
item
.
lecture
));
top
=
decodeURIComponent
(
encodeURIComponent
(
item
.
top
));
bottom
=
decodeURIComponent
(
encodeURIComponent
(
item
.
bottom
));
}
catch
(
e
)
{
// If it isn't, an error will be thrown, and we can assume that we have an ISO string.
subject
=
item
.
subject
;
front
=
item
.
front
;
back
=
item
.
back
;
hint
=
item
.
hint
;
lecture
=
item
.
lecture
;
top
=
item
.
top
;
bottom
=
item
.
bottom
;
}
let
item
=
data
[
i
];
let
subject
,
front
,
back
,
hint
,
lecture
,
top
,
bottom
;
try
{
// If the string is UTF-8, this will work and not throw an error.
subject
=
decodeURIComponent
(
encodeURIComponent
(
item
.
subject
));
front
=
decodeURIComponent
(
encodeURIComponent
(
item
.
front
));
back
=
decodeURIComponent
(
encodeURIComponent
(
item
.
back
));
hint
=
decodeURIComponent
(
encodeURIComponent
(
item
.
hint
));
lecture
=
decodeURIComponent
(
encodeURIComponent
(
item
.
lecture
));
top
=
decodeURIComponent
(
encodeURIComponent
(
item
.
top
));
bottom
=
decodeURIComponent
(
encodeURIComponent
(
item
.
bottom
));
}
catch
(
e
)
{
// If it isn't, an error will be thrown, and we can assume that we have an ISO string.
subject
=
item
.
subject
;
front
=
item
.
front
;
back
=
item
.
back
;
hint
=
item
.
hint
;
lecture
=
item
.
lecture
;
top
=
item
.
top
;
bottom
=
item
.
bottom
;
}
let
hlcodeReplacement
=
"
\n
```
\n
"
;
let
regex
=
/<hlcode>|<
\/
hlcode>/g
;
front
=
front
.
replace
(
regex
,
hlcodeReplacement
);
back
=
back
.
replace
(
regex
,
hlcodeReplacement
);
let
originalAuthorName
;
if
(
item
.
originalAuthor
!==
undefined
)
{
originalAuthorName
=
{
legacyName
:
item
.
originalAuthor
};
}
else
{
originalAuthorName
=
item
.
originalAuthorName
;
}
Cards
.
insert
({
subject
:
subject
.
trim
(),
front
:
front
,
back
:
back
,
hint
:
hint
,
cardset_id
:
cardset
.
_id
,
cardGroup
:
-
1
,
lecture
:
lecture
,
top
:
top
,
bottom
:
bottom
,
centerTextElement
:
item
.
centerTextElement
,
alignType
:
item
.
alignType
,
learningGoalLevel
:
item
.
learningGoalLevel
,
backgroundStyle
:
item
.
backgroundStyle
,
learningUnit
:
item
.
learningUnit
,
date
:
item
.
date
,
dateUpdated
:
item
.
dateUpdated
,
originalAuthorName
:
originalAuthorName
},
{
trimStrings
:
false
});
let
hlcodeReplacement
=
"
\n
```
\n
"
;
let
regex
=
/<hlcode>|<
\/
hlcode>/g
;
front
=
front
.
replace
(
regex
,
hlcodeReplacement
);
back
=
back
.
replace
(
regex
,
hlcodeReplacement
);
let
originalAuthorName
;
if
(
item
.
originalAuthor
!==
undefined
)
{
originalAuthorName
=
{
legacyName
:
item
.
originalAuthor
};
}
else
{
originalAuthorName
=
item
.
originalAuthorName
;
}
Cards
.
insert
({
subject
:
subject
.
trim
(),
front
:
front
,
back
:
back
,
hint
:
hint
,
cardset_id
:
cardset
.
_id
,
cardGroup
:
-
1
,
lecture
:
lecture
,
top
:
top
,
bottom
:
bottom
,
centerTextElement
:
item
.
centerTextElement
,
alignType
:
item
.
alignType
,
learningGoalLevel
:
item
.
learningGoalLevel
,
backgroundStyle
:
item
.
backgroundStyle
,
learningUnit
:
item
.
learningUnit
,
date
:
item
.
date
,
dateUpdated
:
item
.
dateUpdated
,
originalAuthorName
:
originalAuthorName
},
{
trimStrings
:
false
});
}
else
{
Cards
.
insert
({
subject
:
item
.
subject
,
...
...
imports/ui/cardset/cardset.html
View file @
60aa05b8
This diff is collapsed.
Click to expand it.
imports/ui/cardset/cardset.js
View file @
60aa05b8
This diff is collapsed.
Click to expand it.
imports/ui/cardset/index/bonus/bonus.html
0 → 100644
View file @
60aa05b8
<template
name=
"cardsetLearnActivityStatistic"
>
{{#if isInRole 'firstLogin'}}
{{> first_login_content_only}}
{{else}}
{{#if isInRole 'blocked'}}
{{> access_denied_content_only}}
{{else}}
{{#unless isEditor}}
{{> access_denied_content_only}}
{{else}}
<div
class=
"container"
>
<div
id=
"cardsetInfoDetail"
>
<div
class=
"panel panel-default cardsetInfo"
>
<div
class=
"panel-body"
>
<h4>
{{this.name}}
</h4>
<hr>
<div
class=
"row"
>
<span
class=
"col-sm-6 collapseCardsetInfoContainer"
>
{{> cardsetInfoBox}}
</span>
<span
class=
"col-sm-6 collapseCardsetInfoContainer"
>
{{> bonusInfoBox}}
</span>
</div>
</div>
<div
class=
"panel-footer"
>
<button
id=
"exportCSV"
class=
"btn btn-success btn-raised btn-default"
>
{{_
"box_export"}}
</button>
</div>
</div>
</div>
<div
style=
"overflow-x:auto;"
>
<table
class=
"table table-striped table-hover table-user-list"
>
<tbody>
<tr
class=
"active"
>
<th>
{{_ "panel-body.birthname"}}
</th>
<th>
{{_ "panel-body.givenname"}}
</th>
<th>
{{_ "panel-body.email"}}
</th>
<th>
{{_ "leitnerProgress.box" number=1}} [{{this.learningInterval.[0]}}]
</th>
<th>
{{_ "leitnerProgress.box" number=2}} [{{this.learningInterval.[1]}}]
</th>
<th>
{{_ "leitnerProgress.box" number=3}} [{{this.learningInterval.[2]}}]
</th>
<th>
{{_ "leitnerProgress.box" number=4}} [{{this.learningInterval.[3]}}]
</th>
<th>
{{_ "leitnerProgress.box" number=5}} [{{this.learningInterval.[4]}}]
</th>
<th>
{{_ "leitnerProgress.learned"}}
</th>
<th>
{{_ "details"}}
</th>
</tr>
{{#each getCardsetStats}}
<tr>
<td>
{{this.birthname}}
</td>
<td>
{{this.givenname}}
</td>
<td><a
href=
"mailto:{{this.email}}"
>
{{this.email}}
</a></td>
<td>
{{this.box1}}
</td>
<td>
{{this.box2}}
</td>
<td>
{{this.box3}}
</td>
<td>
{{this.box4}}
</td>
<td>
{{this.box5}}
</td>
<td>
{{#if earnedTrophy}}
<span
class=
"green-learning-text"
>
{{this.box6}}{{{getPercentage this.box6}}}
</span>
<i
class=
"fa fa-trophy pull-right"
></i>
{{else}}
<span
class=
"red-learning-text"
>
{{this.box6}}{{{getPercentage this.box6}}}
</span>
{{/if}}
</td>
<td>
<button
data-id=
"{{this.user_id}}"
class=
"btn btn-block detailed-stats"
><i
class=
"glyphicon glyphicon glyphicon-stats"
data-id=
"{{this.user_id}}"
></i></button>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<button
class=
"btn btn-block btn-raised btn-danger"
id=
"backButton"
>
<span
class=
"pull-left"
><i
class=
"fa fa-arrow-left"
></i>
{{_ "backbutton"}}
</span>
</button>
</div>
{{/unless}}
{{/if}}
{{/if}}
</template>
imports/ui/cardset/index/bonus/bonus.js
0 → 100644
View file @
60aa05b8
//------------------------ IMPORTS
import
{
Meteor
}
from
"meteor/meteor"
;
import
{
Session
}
from
"meteor/session"
;
import
{
Template
}
from
"meteor/templating"
;
import
{
Cardsets
}
from
"../../../../api/cardsets"
;
import
"./bonus.html"
;
/*
* ############################################################################
* cardsetLearnActivityStatistic
* ############################################################################
*/
Template
.
cardsetLearnActivityStatistic
.
onRendered
(
function
()
{
Session
.
set
(
'activeCardset'
,
Cardsets
.
findOne
({
_id
:
Router
.
current
().
params
.
_id
}));
});
Template
.
cardsetLearnActivityStatistic
.
helpers
({
getCardsetStats
:
function
()
{
return
Session
.
get
(
"learnerStats"
);
},
getPercentage
:
function
(
count
)
{
let
percentage
=
Math
.
round
(
count
/
Session
.
get
(
'activeCardset'
).
quantity
*
100
);
if
(
percentage
>
0
)
{
return
'<span class="cardPercentage">['
+
percentage
+
' %]</span>'
;
}
},
earnedTrophy
:
function
()
{
let
totalCards
=
this
.
box1
+
this
.
box2
+
this
.
box3
+
this
.
box4
+
this
.
box5
+
this
.
box6
;
let
box6Percentage
=
(
this
.
box6
/
totalCards
)
*
100
;
return
box6Percentage
>=
95
;
}
});
Template
.
cardsetLearnActivityStatistic
.
events
({
"click #exportCSV"
:
function
()
{
var
cardset
=
Cardsets
.
findOne
({
_id
:
this
.
_id
});
var
hiddenElement
=
document
.
createElement
(
'a'
);
var
header
=
[];
header
[
0
]
=
TAPi18n
.
__
(
'leitnerProgress.box'
,
{
number
:
1
});
header
[
1
]
=
TAPi18n
.
__
(
'leitnerProgress.box'
,
{
number
:
2
});
header
[
2
]
=
TAPi18n
.
__
(
'leitnerProgress.box'
,
{
number
:
3
});
header
[
3
]
=
TAPi18n
.
__
(
'leitnerProgress.box'
,
{
number
:
4
});
header
[
4
]
=
TAPi18n
.
__
(
'leitnerProgress.box'
,
{
number
:
5
});
header
[
5
]
=
TAPi18n
.
__
(
'leitnerProgress.learned'
);
header
[
6
]
=
TAPi18n
.
__
(
'box_export_birth_name'
);
header
[
7
]
=
TAPi18n
.
__
(
'box_export_given_name'
);
header
[
8
]
=
TAPi18n
.
__
(
'box_export_mail'
);
header
[
9
]
=
TAPi18n
.
__
(
'leitnerProgress.percentage'
);
Meteor
.
call
(
"getCSVExport"
,
cardset
.
_id
,
header
,
function
(
error
,
result
)
{
if
(
error
)
{
throw
new
Meteor
.
Error
(
error
.
statusCode
,
'Error could not receive content for .csv'
);
}
if
(
result
)
{
var
statistics
=
TAPi18n
.
__
(
'box_export_statistics'
);
hiddenElement
.
href
=
'data:text/csv;charset=utf-8,%EF%BB%BF'
+
encodeURIComponent
(
result
);
hiddenElement
.
target
=
'_blank'
;
var
str
=
(
cardset
.
name
+
"_"
+
statistics
+
"_"
+
new
Date
()
+
".csv"
);
hiddenElement
.
download
=
str
.
replace
(
/ /g
,
"_"
).
replace
(
/:/g
,
"_"
);
document
.
body
.
appendChild
(
hiddenElement
);
hiddenElement
.
click
();
}
});
},
"click #backButton"
:
function
()
{
Router
.
go
(
'cardsetdetailsid'
,
{
_id
:
this
.
_id
});
},
"click .detailed-stats"
:
function
(
event
)
{
Router
.
go
(
'progress'
,
{
_id
:
Router
.
current
().
params
.
_id
,
user_id
:
$
(
event
.
target
).
data
(
'id'
)
});
},
"click #showIntervalHelp"
:
function
(
event
)
{
event
.
stopPropagation
();
Session
.
set
(
'helpFilter'
,
"leitner"
);
Router
.
go
(
'help'
);
}
});
Template
.
cardsetLearnActivityStatistic
.
created
=
function
()
{
Session
.
set
(
"learnerStats"
,
""
);
Meteor
.
call
(
"getLearningData"
,
Router
.
current
().
params
.
_id
,
function
(
error
,
result
)
{
if
(
error
)
{
throw
new
Meteor
.
Error
(
error
.
statusCode
,
'Error could not receive content for stats'
);
}
if
(
result
)
{
Session
.
set
(
"learnerStats"
,
result
);
}
});
};
imports/ui/cardset/index/cards/cards.html
0 → 100644
View file @
60aa05b8
<template
name=
"cardsetList"
>
<div
id=
"cardset-list"
>
{{#if gotCards}}
{{#each cardsetList}}
{{#if isShuffledCardset this._id}}
<div
class=
"cardListName btn-raised {{getColors}}"
>
{{this.name}}
{{#unless isActiveRoute regex='demo|demolist|making|makinglist'}}
<span
class=
"cardListOwner hidden-xs"
>
{{getAuthorName this.owner}}
</span>
{{/unless}}
<br>
<span
class=
"badge"
title=
"{{_ "
cardset
.
info
.
quantity
"}}"
>
{{this.quantity}}
</span>
{{{getCardTypeLabel this.cardType}}}
{{{getDifficultyLabel this.cardType this.difficulty}}}
</div>
{{/if}}
{{#each cardSubject}}
<div
class=
"cardListSubject"
>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
<span>
{{this.subject}}
</span>
<span
class=
"badge cardset-list-badge"
>
{{cardList true}}
</span>
</th>
</tr>
</thead>
<tbody>
{{#each cardList false}}
<tr
class=
"cardListRow"
>
<td
class=
"{{getCardsetBackground this.difficulty this.cardType 1}}"
data-id=
"{{this._id}}"
data-card-type=
"{{this.cardType}}"
>
<div
class=
"cardListNumber"
data-id=
"{{this._id}}"
>
{{getPriority @index}}
</div>
<div
class=
"col-xs-11 listCard"
data-id=
"{{this._id}}"
data-card-type=
"{{this.cardType}}"
>
{{cleanContent getText}}
</div>
<i
class=
"glyphicon glyphicon-menu-right pull-right"
data-id=
"{{this._id}}"
data-card-type=
"{{this.cardType}}"
></i>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/each}}
{{/each}}
{{else}}
<table
class=
"table table-bordered table-hover"
>
<tbody>
<tr
class=
"empty-listitem"
>
<td
colspan=
"3"
align=
"center"
>
<span>
{{#if isActiveRoute 'cardsetlistid'}}{{_ "nocards"}}{{else}}{{_
"learningUnit.noUnitsFound"}}{{/if}}
</span>
</td>
</tr>
</tbody>
</table>
{{/if}}
</div>
</template>
imports/ui/cardset/index/cards/cards.js
0 → 100644
View file @
60aa05b8
//------------------------ IMPORTS
import
{
Session
}
from
"meteor/session"
;
import
{
Template
}
from
"meteor/templating"
;
import
{
Cards
}
from
"../../../../api/cards"
;
import
{
CardVisuals
}
from
"../../../../api/cardVisuals"
;
import
{
CardType
}
from
"../../../../api/cardTypes"
;
import
{
Cardsets
}
from
"../../../../api/cardsets"
;
import
{
Route
}
from
"../../../../api/route"
;
import
{
CardNavigation
}
from
"../../../../api/cardNavigation"
;
import
"./cards.html"
;
/*
* ############################################################################
* cardsetList
* ############################################################################
*/
Template
.
cardsetList
.
helpers
({
isShuffledCardset
:
function
()
{
if
(
Router
.
current
().
route
.
getName
()
===
"demolist"
)
{
return
Cardsets
.
findOne
({
kind
:
'demo'
,
name
:
"DemoCardset"
,
shuffled
:
true
}).
shuffled
;
}
else
if
(
Router
.
current
().
route
.
getName
()
===
"makinglist"
)
{
return
Cardsets
.
findOne
({
kind
:
'demo'
,
name
:
"MakingOfCardset"
,
shuffled
:
true
}).
shuffled
;
}
else
{
return
Cardsets
.
findOne
({
_id
:
Router
.
current
().
params
.
_id
}).
shuffled
;
}
},
cardsetList
:
function
()
{
let
isDemo
=
(
Router
.
current
().
route
.
getName
()
===
"demolist"
||
Router
.
current
().
route
.
getName
()
===
"makinglist"
);
if
(
Router
.
current
().
route
.
getName
()
===
"cardsetlistid"
||
Router
.
current
().
route
.
getName
()
===
"presentationlist"
||
isDemo
)
{
let
cardsetId
=
Router
.
current
().
params
.
_id
;
if
(
isDemo
)
{
if
(
Route
.
isDemo
())
{
cardsetId
=
Cardsets
.
findOne
({
kind
:
'demo'
,
name
:
"DemoCardset"
,
shuffled
:
true
}).
_id
;
}
else
{
cardsetId
=
Cardsets
.
findOne
({
kind
:
'demo'
,
name
:
"MakingOfCardset"
,
shuffled
:
true
}).
_id
;
}
}
if
(
this
.
shuffled
)
{
let
cardsetFilter
=
[];
let
sortCardsets
=
Cardsets
.
find
({
_id
:
{
$in
:
this
.
cardGroups
}},
{
sort
:
{
name
:
1
},
fields
:
{
_id
:
1
,
name
:
1
,
kind
:
1
,
owner
:
1
,
quantity
:
1
,
difficulty
:
1
,
cardType
:
1
}
}).
fetch
();
sortCardsets
.
forEach
(
function
(
cardset
)
{
if
(
cardset
.
_id
!==
cardsetId
)
{
cardsetFilter
.
push
(
cardset
);
}
});
return
cardsetFilter
;
}
else
{
return
Cardsets
.
find
({
_id
:
this
.
_id
}).
fetch
();
}
}
else
{
return
Cardsets
.
find
({
_id
:
Session
.
get
(
'tempLearningIndex'
)}).
fetch
();
}
},
getPriority
:
function
(
index
)
{
return
index
+
1
;
},
cleanContent
:
function
(
text
)
{
return
CardVisuals
.
removeMarkdeepTags
(
text
);
},
gotCards
:
function
()
{
if
(
Router
.
current
().
route
.
getName
()
===
"cardsetlistid"
||
Router
.
current
().
route
.
getName
()
===
"presentationlist"
||
Router
.
current
().
route
.
getName
()
===
"demolist"
||
Router
.
current
().
route
.
getName
()
===
"makinglist"
)
{
if
(
this
.
shuffled
)
{
return
Cards
.
find
({
cardset_id
:
{
$in
:
this
.
cardGroups
}}).
count
();
}
else
{
return
Cards
.
find
({
cardset_id
:
this
.
_id
}).
count
();
}
}
else
{
return
Cards
.
find
({
cardset_id
:
Session
.
get
(
'tempLearningIndex'
),
cardType
:
0
}).
count
();
}
},
cardSubject
:
function
()
{
if
(
Router
.
current
().
route
.
getName
()
===
"cardsetlistid"
||
Router
.
current
().
route
.
getName
()
===
"presentationlist"
||
Router
.
current
().
route
.
getName
()
===
"demolist"
||
Router
.
current
().
route
.
getName
()
===
"makinglist"
)
{
return
_
.
uniq
(
Cards
.
find
({
cardset_id
:
this
.
_id
},
{
cardset_id
:
1
,
subject
:
1
,
sort
:
{
subject
:
1
}
}).
fetch
(),
function
(
card
)
{
return
card
.
subject
;
});
}
else
{
return
_
.
uniq
(
Cards
.
find
({
cardset_id
:
this
.
_id
},
{
cardset_id
:
1
,
subject
:
1
,
sort
:
{
subject
:
1
}
}).
fetch
(),
function
(
card
)
{
return
card
.
subject
;
});
}
},
cardList
:
function
(
countCards
)
{
let
sortQuery
;
sortQuery
=
CardType
.
getSortQuery
(
Cardsets
.
findOne
({
_id
:
this
.
cardset_id
}).
cardType
);
if
(
countCards
)
{
return
Cards
.
find
({
cardset_id
:
this
.
cardset_id
,
subject
:
this
.
subject
},
{
fields
:
{
_id
:
1
,
front
:
1
,
back
:
1
,
hint
:
1
,
lecture
:
1
,
top
:
1
,
bottom
:
1
,
cardset_id
:
1
},
sort
:
sortQuery
}).
count
();
}
let
cards
=
Cards
.
find
({
cardset_id
:
this
.
cardset_id
,
subject
:
this
.
subject
},
{
fields
:
{
_id
:
1
,
front
:
1
,
back
:
1
,
hint
:
1
,
lecture
:
1
,
top
:
1
,
bottom
:
1
,
cardset_id
:
1
},
sort
:
sortQuery
}).
fetch
();
return
CardVisuals
.
setTypeAndDifficulty
(
cards
);
},
getColors
:
function
()
{
switch
(
this
.
kind
)
{
case
"personal"
:
return
"btn-warning"
;
case
"free"
:
return
"btn-info"
;
case
"edu"
:
return
"btn-success"
;
case
"pro"
:
return
"btn-danger"
;
case
"demo"
:
return
"btn-demo"
;
}
},
gotReferences
:
function
()
{
return
Cardsets
.
findOne
({
_id
:
Router
.
current
().
params
.
_id
}).
cardGroups
!==
[
""
];
},
getText
:
function
()
{
let
cubeSides
=
CardType
.
getCardTypeCubeSides
(
this
.
cardType
);
switch
(
cubeSides
[
0
].
contentId
)
{
case
1
:
return
this
.
front
;
case
2
:
return
this
.
back
;
case
3
:
return
this
.
hint
;
case
4
:
return
this
.
lecture
;
case
5
:
return
this
.
top
;
case
6
:
return
this
.
bottom
;
}
}
});
Template
.
cardsetList
.
events
({
'click .cardListRow'
:
function
(
evt
)
{
let
cubeSides
=
CardType
.
getCardTypeCubeSides
(
$
(
evt
.
target
).
data
(
'card-type'
));
Session
.
set
(
'cardType'
,
$
(
evt
.
target
).
data
(
'card-type'
));
Session
.
set
(
'activeCardContentId'
,
cubeSides
[
0
].
contentId
);
if
(
Router
.
current
().
route
.
getName
()
===
"cardsetlistid"
||
Router
.
current
().
route
.
getName
()
===
"presentationlist"
||
Router
.
current
().
route
.
getName
()
===
"demolist"
||
Router
.
current
().
route
.
getName
()
===
"makinglist"
)
{
CardNavigation
.
setActiveCardData
(
$
(
evt
.
target
).
data
(
'id'
));
if
(
Router
.
current
().
route
.
getName
()
===
"presentationlist"
)
{
Router
.
go
(
'presentation'
,
{
_id
:
Router
.
current
().
params
.
_id
});
}
else
if
(
Router
.
current
().
route
.
getName
()
===
"demolist"
)
{
Router
.
go
(
'demo'
);
}
else
if
(
Router
.
current
().
route
.
getName
()
===
"makinglist"
)
{
Router
.
go
(
'making'
);
}
else
{
Router
.
go
(
'cardsetcard'
,
{
_id
:
Router
.
current
().
params
.
_id
,
card_id
:
$
(
evt
.
target
).
data
(
'id'
)
});
}
}
else
{
let
learningUnit
=
$
(
evt
.
target
).
data
(
'id'
);
Session
.
set
(
'learningIndex'
,
Session
.
get
(
'tempLearningIndex'
));
Session
.
set
(
'learningUnit'
,
learningUnit
);
Session
.
set
(
'subject'
,
Cards
.
findOne
({
_id
:
learningUnit
}).
subject
);
$
(
'#showSelectLearningUnitModal'
).
modal
(
'hide'
);
}
}
});
imports/ui/cardset/index/editors/editors.html
0 → 100644
View file @
60aa05b8
<template
name=
"cardsetManageEditors"
>
{{#if isInRole 'firstLogin'}}
{{> first_login_content_only}}
{{else}}
{{#if isInRole 'blocked'}}