Commit 331df64f authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-c/fix-tips-without-config' into 'dev'

Make tips appear without config

See merge request !121
parents 7f05f76e 12f8a168
Pipeline #10948 passed with stages
in 16 seconds
......@@ -94,7 +94,10 @@ try {
new VidjilAutoComplete(db);
var my_tips = new TipsOfTheDay(tips, new TipDecorator(), config.available_tips);
var available_tips;
if (typeof config !== 'undefined')
available_tips = config.available_tips;
var my_tips = new TipsOfTheDay(tips, new TipDecorator(), available_tips);
my_tips.set_container(document.getElementById('tip-container'))
my_tips.display()
} catch(err) {
......
function TipsOfTheDay(data, decorator, ids) {
this.storage_key = "vidjil.tips.seen";
this.tips = this.load(data, ids);
this.seen = this.get_seen_ids();
this.cur_unseen = -1;
this.unseen = this.get_unseen_ids();
this.path = typeof config !== 'undefined' ? config.doc_address : 'doctips/';
this.decorator = decorator;
}
......@@ -153,7 +156,8 @@ TipDecorator.prototype = {
var tip_div = document.createElement('div');
tip_div.className = "left";
var tmp = elem.content;
tmp += "<br><img class=\"tip_img\" src=\"" + config.doc_address + "/tips/" + elem.id + ".png\" onerror=\"this.src='images/transparent_back.png';\" />";
tmp += "<br><img class=\"tip_img\" src=\"" + this.path + "/tips/" + elem.id + ".png\" onerror=\"this.src='images/transparent_back.png';\" />";
tip_div.innerHTML = tmp;
div.appendChild(tip_div);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment