Skip to content

Commit

Permalink
+ Sponsor Ad
Browse files Browse the repository at this point in the history
  • Loading branch information
bbeaulant committed Dec 19, 2019
1 parent 087aba4 commit dd7301a
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ in 1.x and 0.x versions.
* 1.8.3

* Cutlist highlight multiple parts improvements
* Sponsor ad

* 1.8.2 (2019-12-12)

Expand Down
Binary file modified dist/ladb_opencutlist-dev.rbz
Binary file not shown.
53 changes: 47 additions & 6 deletions src/ladb_opencutlist/js/plugins/jquery.ladb.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,39 @@
{
name: 'materials',
bar: 'leftbar',
icon: 'ladb-opencutlist-icon-materials'
icon: 'ladb-opencutlist-icon-materials',
sponsorAd: false
},
{
name: 'cutlist',
bar: 'leftbar',
icon: 'ladb-opencutlist-icon-cutlist'
icon: 'ladb-opencutlist-icon-cutlist',
sponsorAd: true
},
{
name: 'importer',
bar: 'leftbar',
icon: 'ladb-opencutlist-icon-import'
icon: 'ladb-opencutlist-icon-import',
sponsorAd: true
},
{
name: 'settings',
bar: 'bottombar',
icon: 'ladb-opencutlist-icon-settings'
icon: 'ladb-opencutlist-icon-settings',
sponsorAd: true
},
{
name: 'sponsor',
bar: 'bottombar',
icon: 'ladb-opencutlist-icon-sponsor',
classes: 'ladb-highlighted-sponsor'
classes: 'ladb-highlighted-sponsor',
sponsorAd: false
},
{
name: 'about',
bar: 'bottombar',
icon: null
icon: null,
sponsorAd: false
}
]
};
Expand Down Expand Up @@ -234,6 +240,14 @@
callback($tab);
}

} else {

// Try to show sponsor ad
var tabDef = this.getTabDef(tabName);
if (tabDef && tabDef.sponsorAd && callback === undefined) {
this.showSponsorAd();
}

}

// Close all Noty
Expand All @@ -259,8 +273,35 @@

};

LadbDialog.prototype.showSponsorAd = function () {
var that = this;

// Render ad in bottombar
$('#ladb_bottombar').append(Twig.twig({ ref: "tabs/sponsor/_ad.twig" }).render());

// Auto hide
$(window).on('mousedown', function() {
that.hideSponsorAd();
});

};

LadbDialog.prototype.hideSponsorAd = function () {
$('#ladb_sponsor_ad').remove();
};

// Internals /////

LadbDialog.prototype.getTabDef = function (tabName) {
for (var i = 0; i < this.options.tabDefs.length; i++) {
var tabDef = this.options.tabDefs[i];
if (tabDef.name === tabName) {
return tabDef;
}
}
return null;
};

LadbDialog.prototype.notify = function (text, type, buttons, timeout) {
if (undefined === type) {
type = 'alert';
Expand Down
21 changes: 21 additions & 0 deletions src/ladb_opencutlist/less/tabs/sponsor.less
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,24 @@
}

}

#ladb_sponsor_ad {
position: fixed;
bottom: 30px;
right: 100px;
color: #E84FA9;
font-size: 18px;
font-family: 'Indie Flower', cursive;

.ladb-sponsor-ad-text {
display: inline-block;
vertical-align: top;
margin-top: 5px;
margin-right: 10px;
}

.ladb-sponsor-ad-arrrow {

}

}
2 changes: 1 addition & 1 deletion src/ladb_opencutlist/ruby/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module Ladb::OpenCutList

EXTENSION_NAME = 'OpenCutList'.freeze
EXTENSION_VERSION = '1.8.3-dev'.freeze
EXTENSION_BUILD = '201912121537'.freeze
EXTENSION_BUILD = '201912191008'.freeze

end
1 change: 1 addition & 0 deletions src/ladb_opencutlist/twig/dialog.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<link rel="stylesheet" href="../css/lib/jquery-ui.theme.min.css">
<link rel="stylesheet" href="../css/ladb-opencutlist.css">
<link rel="stylesheet" href="../css/ladb-opencutlist-icons.css">
<link href="https://fonts.googleapis.com/css?family=Indie+Flower&display=swap" rel="stylesheet">
<!--<![endif]-->
</head>
<body>
Expand Down
7 changes: 7 additions & 0 deletions src/ladb_opencutlist/twig/tabs/sponsor/_ad.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<div id="ladb_sponsor_ad">
<div class="ladb-sponsor-ad-text">{{ 'tab.sponsor.ad'|i18next }}</div>
<svg class="ladb-sponsor-ad-arrow" width="60" height="60" viewBox="0 0 50 50" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="M3.281,14.755c15.032,-0.22 32.323,2.482 41.719,27.245" style="fill:none;stroke:#e84fa9;stroke-width:1px;stroke-linecap:round;stroke-miterlimit:1.5;"/>
<path d="M47.652,48.702l-5.018,-6.058l4.769,-1.565l0.249,7.623Z" style="fill:#e84fa9;"/>
</svg>
</div>
1 change: 1 addition & 0 deletions src/ladb_opencutlist/yaml/i18n/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ tab:
contribute: Beitragen
backers: "{{count}} finanzieller Sponsor"
backers_plural: "{{count}} finanzielle Sponsoren"
ad: Vous aimez OpenCutList ?
settings:
label: Benutzereinstellungen
title: Benutzereinstellungen
Expand Down
1 change: 1 addition & 0 deletions src/ladb_opencutlist/yaml/i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ tab:
contribute: Contribute
backers: "{{count}} financial contributor"
backers_plural: "{{count}} financial contributors"
ad: You love OpenCutList ?
settings:
label: Preferences
title: Preferences
Expand Down
1 change: 1 addition & 0 deletions src/ladb_opencutlist/yaml/i18n/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ tab:
contribute: Contribuer
backers: "{{count}} contributeur financier"
backers_plural: "{{count}} contributeurs financiers"
ad: Vous aimez OpenCutList ?
settings:
label: Préférences
title: Préférences
Expand Down

0 comments on commit dd7301a

Please sign in to comment.