Skip to content

Commit

Permalink
feat(code base): add gulp build
Browse files Browse the repository at this point in the history
add gulpfile and handle plugin build
  • Loading branch information
AlaaN-Smadi committed Nov 8, 2024
1 parent 2894e05 commit 06e9ffe
Show file tree
Hide file tree
Showing 20 changed files with 857 additions and 810 deletions.
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
"no-undef": 0,
"no-console": 0,
"no-prototype-builtins": 0,
"new-cap": 0,
"block-scoped-var": 0,
"vars-on-top": 0,
"consistent-return": 0,
"no-plusplus": 0,
"max-len": 0,
"radix": 0,
"func-names": 0
},
"parserOptions": {
"ecmaVersion": 2020,
Expand Down
1 change: 0 additions & 1 deletion build.sh

This file was deleted.

14 changes: 11 additions & 3 deletions control/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,29 @@
<script src="../../../../scripts/sortable.min.js"></script>
<script src="../../../../scripts/buildfire/components/carousel/carousel.js"></script>

<!-- build:bundleSharedJSFiles -->
<script src="../../widget/global/services/BFGamifyComponent.js"></script>
<script src="../../widget/global/services/AuthManager.js"></script>
<script src="../../widget/global/services/AnalyticsManager.js"></script>
<script src="../../widget/global/js/models/Carousel.js"></script>
<script src="../../widget/global/js/models/Wysiwyg.js"></script>
<script src="../../widget/global/js/repositories/Carousels.js"></script>
<script src="../../widget/global/js/repositories/Wysiwygs.js"></script>
<!-- endbuild -->

<link href="../../../../styles/helper.css" rel="stylesheet" />
<link href="../../../../styles/siteIcons.css" rel="stylesheet" />
<link href="../../../../styles/control/bf-base.css" rel="stylesheet" />

<!-- build:bundleCSSFiles -->
<link href="./css/style.css" rel="stylesheet" />
<!-- endbuild -->

<!-- build:bundleJSFiles -->
<script src="./js/state.js"></script>
<script src="./js/content.controller.js"></script>
<script src="./js/index.js"></script>
<!-- endbuild -->

</head>

Expand All @@ -38,7 +49,4 @@ <h1>Introduction</h1>
<textarea id="wysiwygContent" name="content"></textarea>
</section>
</body>
<script src="./js/state.js"></script>
<script src="./js/content.controller.js"></script>
<script src="./js/index.js"></script>
</html>
4 changes: 3 additions & 1 deletion control/content/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const contentPage = {
}, 500);
});
editor.on('init', () => {
editor.setContent(state.wysiwyg);
if (state.wysiwyg) {
editor.setContent(state.wysiwyg);
}
});
},
});
Expand Down
229 changes: 118 additions & 111 deletions control/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,128 +2,135 @@
<html>

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- JS -->
<script src="../../../../scripts/buildfire.min.js"></script>
<script src=" ../../../../scripts/buildfire/services/notifications/pushNotifications.js"></script>
<!-- JS -->
<script src="../../../../scripts/buildfire.min.js"></script>
<script src=" ../../../../scripts/buildfire/services/notifications/pushNotifications.js"></script>

<script src="../../widget/global/services/BFGamifyComponent.js"></script>
<script src="../../widget/global/services/AuthManager.js"></script>
<script src="../../widget/global/services/AnalyticsManager.js"></script>
<script src="../../widget/global/js/models/Setting.js"></script>
<script src="../../widget/global/js/models/Score.js"></script>
<script src="../../widget/global/js/models/UserSetting.js"></script>
<script src="../../widget/global/js/repositories/Settings.js"></script>
<script src="../../widget/global/js/repositories/Scores.js"></script>
<script src="../../widget/global/js/repositories/UserSettings.js"></script>
<script src="../../widget/global/js/constants/index.js"></script>
<!-- build:bundleSharedJSFiles -->
<script src="../../widget/global/services/BFGamifyComponent.js"></script>
<script src="../../widget/global/services/AuthManager.js"></script>
<script src="../../widget/global/services/AnalyticsManager.js"></script>
<script src="../../widget/global/js/models/Setting.js"></script>
<script src="../../widget/global/js/models/Score.js"></script>
<script src="../../widget/global/js/models/UserSetting.js"></script>
<script src="../../widget/global/js/repositories/Settings.js"></script>
<script src="../../widget/global/js/repositories/Scores.js"></script>
<script src="../../widget/global/js/repositories/UserSettings.js"></script>
<script src="../../widget/global/js/constants/index.js"></script>
<!-- endbuild -->

<script src="../../../../scripts/sortable.min.js"></script>
<script src="../../../../scripts/buildfire/components/actionItems/sortableList.js"></script>
<script src="../../../../scripts/sortable.min.js"></script>
<script src="../../../../scripts/buildfire/components/actionItems/sortableList.js"></script>

<link href="../../../../styles/control/bf-base.css" rel="stylesheet" />
<link href="../../../../styles/bootstrap.css" />
<link href="../../../../styles/control/bf-base.css" rel="stylesheet" />
<link href="../../../../styles/bootstrap.css" />

<link href="../../../../styles/helper.css" rel="stylesheet" />
<link href="../../../../styles/siteIcons.css" rel="stylesheet" />
<link href="./css/style.css" rel="stylesheet">
<link href="../../../../styles/helper.css" rel="stylesheet" />
<link href="../../../../styles/siteIcons.css" rel="stylesheet" />

<!-- build:bundleCSSFiles -->
<link href="./css/style.css" rel="stylesheet">
<!-- endbuild -->

<!-- build:bundleJSFiles -->
<script src="./js/state.js"></script>
<script src="./js/settings.controller.js"></script>
<script src="./js/index.js"></script>
<!-- endbuild -->
</head>

<body>
<section class="margin-right-twenty">
<h1>General</h1>
<div class="row">
<label class="labels col-md-4 pull-left tooltip-container">
Notifications Frequency
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">Set how often rank change notifications should be sent out for 1st, 2nd,
and 3rd place.</span>
</span>
</label>
<div class="main col-md-8 pull-right">
<span class="row">
<div class="col-md-6 checkbox checkbox-primary">
<input id="dailyChange" type="checkbox" value="dailyChange">
<label for="dailyChange">Daily Change</label>
</div>
<div class="col-md-6 checkbox checkbox-primary ">
<input id="weeklyChange" type="checkbox" value="weeklyChange">
<label for="weeklyChange">Weekly Change</label>
</div>
</span>
<span class="row">
<div class="col-md-6 checkbox checkbox-primary">
<input id="monthlyChange" type="checkbox" value="monthlyChange">
<label for="monthlyChange">Monthly Change</label>
</div>
<div class="col-md-6 checkbox checkbox-primary">
<input id="allTimeChange" type="checkbox" value="allTimeChange">
<label for="allTimeChange">Overall Change</label>
</div>
</span>
</div>
<section class="margin-right-twenty">
<h1>General</h1>
<div class="row">
<label class="labels col-md-4 pull-left tooltip-container">
Notifications Frequency
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">Set how often rank change notifications should be sent out for 1st, 2nd, and 3rd place.</span>
</span>
</label>
<div class="main col-md-8 pull-right">
<span class="row">
<div class="col-md-6 checkbox checkbox-primary">
<input id="dailyChange" type="checkbox" value="dailyChange">
<label for="dailyChange">Daily Change</label>
</div>
<div class="col-md-6 checkbox checkbox-primary ">
<input id="weeklyChange" type="checkbox" value="weeklyChange">
<label for="weeklyChange">Weekly Change</label>
</div>
</span>
<span class="row">
<div class="col-md-6 checkbox checkbox-primary">
<input id="monthlyChange" type="checkbox" value="monthlyChange">
<label for="monthlyChange">Monthly Change</label>
</div>
<div class="col-md-6 checkbox checkbox-primary">
<input id="allTimeChange" type="checkbox" value="allTimeChange">
<label for="allTimeChange">Overall Change</label>
</div>
</span>
</div>


</div>
<div class="row">
<div class="labels col-md-4 pull-left">
<span>Set How User Earns Points</span>
</div>
<div class="main col-md-8 pull-right">
<span class="row">
<div class="col-md-6 radio radio-primary radio-inline">
<input id="honorSystem" type="radio" name="userEarnPoints" value="HONOR_SYSTEM">
<label class="subtitles-labels tooltip-container" for="honorSystem">
Honor System
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">A trust-based scoring system where users submit their own
scores without verification.</span>
</span>
</label>
</div>
<div class="col-md-6 radio radio-primary radio-inline">
<input id="scoreFromFreeTextQuestionnaire" type="radio" name="userEarnPoints"
value='SCORE_FROM_FREE_TEXT_QUESTIONNAIRE'>
<label class="subtitles-labels tooltip-container" for="scoreFromFreeTextQuestionnaire">Score from Free Text Questionnaire</label>
</div>
</span>
</div>
<div class="row">
<div class="labels col-md-4 pull-left">
<span>Set How User Earns Points</span>
</div>
<div class="main col-md-8 pull-right">
<span class="row">
<div class="col-md-6 radio radio-primary radio-inline">
<input id="honorSystem" type="radio" name="userEarnPoints" value="HONOR_SYSTEM">
<label class="subtitles-labels tooltip-container" for="honorSystem">
Honor System
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">A trust-based scoring system where users submit their own
scores without verification.</span>
</span>
</label>
</div>
<div class="col-md-6 radio radio-primary radio-inline">
<input id="scoreFromFreeTextQuestionnaire" type="radio" name="userEarnPoints"
value='SCORE_FROM_FREE_TEXT_QUESTIONNAIRE'>
<label class="subtitles-labels tooltip-container" for="scoreFromFreeTextQuestionnaire">Score from Free Text Questionnaire</label>
</div>
</span>

</div>
</div>
<div id="ftqFeaturesContainer" class="row hidden">
<label class="labels col-md-4 pull-left tooltip-container">
Free Text Questionnaire
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">You must enable 'Calculate score' and 'Save Submissions to App Data'
options on connected Free Text Questionnaire. Points will be calculated and updated after you
enter Leaderboard plugin again.</span>
</span>
</label>
<div class="main col-md-8 pull-right">
<div class="ftqFeatures"></div>
</div>
</div>
<div class="row input-control side-label margin-bottom-twenty">
<label class="labels col-md-4 pull-left tooltip-container">
Calculate Loyalty Points
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">Points are imported from the Loyalty plugin. You must have this plugin
installed for this option to work.</span>
</span>
</label>
<div class="button-switch col-md-8 text-right" >
<input id="enableCalculatePoints" type="checkbox">
<label for="enableCalculatePoints" class="label-success"></label>
</div>
</div>
</div>
</div>
<div id="ftqFeaturesContainer" class="row hidden">
<label class="labels col-md-4 pull-left tooltip-container">
Free Text Questionnaire
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">You must enable 'Calculate score' and 'Save Submissions to App Data'
options on connected Free Text Questionnaire. Points will be calculated and updated after you
enter Leaderboard plugin again.</span>
</span>
</label>
<div class="main col-md-8 pull-right">
<div class="ftqFeatures"></div>
</div>
</div>
<div class="row input-control side-label margin-bottom-twenty">
<label class="labels col-md-4 pull-left tooltip-container">
Calculate Loyalty Points
<span class="btn-info-icon btn-primary">
<span class="cp-tooltip">Points are imported from the Loyalty plugin. You must have this plugin
installed for this option to work.</span>
</span>
</label>
<div class="button-switch col-md-8 text-right" >
<input id="enableCalculatePoints" type="checkbox">
<label for="enableCalculatePoints" class="label-success"></label>
</div>
</div>

<h1>Reset Leaderboard</h1>
<p class="info-note text-danger">Danger! This option will delete all entries and scores in the leaderboard!</p>
<button class="btn btn-danger pull-right rest-btn" onclick="settingsController.reset()">Reset</button>
</section>
<h1>Reset Leaderboard</h1>
<p class="info-note text-danger">Danger! This option will delete all entries and scores in the leaderboard!</p>
<button class="btn btn-danger pull-right rest-btn" onclick="settingsController.reset()">Reset</button>
</section>
</body>
<script src="./js/state.js"></script>
<script src="./js/settings.controller.js"></script>
<script src="./js/index.js"></script>
</html>
13 changes: 7 additions & 6 deletions control/settings/js/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-plusplus */
/* eslint-disable max-len */
const settingPage = {
uiElements: {},
Expand Down Expand Up @@ -84,35 +85,35 @@ const settingPage = {
},
);
};
ftqFeatures = new buildfire.components.actionItems.sortableList('.ftqFeatures');
const ftqFeatures = new buildfire.components.actionItems.sortableList('.ftqFeatures');
document.querySelector('.add-new-item').innerHTML = 'Add Feature';

ftqFeatures.onAddItems = function (item) {
ftqFeatures.onAddItems = (item) => {
item.order = state.settings.features.length;
state.settings.features.push(item);

settingPage.saveSettingsWithDelay();
changeActionItemsIcon();
};

ftqFeatures.onDeleteItem = function (item, index) {
ftqFeatures.onDeleteItem = (item, index) => {
state.settings.features.splice(index, 1);
settingPage.saveSettingsWithDelay();
};

ftqFeatures.onOrderChange = function (item, oldIndex, newIndex) {
ftqFeatures.onOrderChange = (item, oldIndex, newIndex) => {
const items = state.settings.features;

items[oldIndex].order = newIndex;

const tmp = items[oldIndex];

if (oldIndex < newIndex) {
for (var i = oldIndex + 1; i <= newIndex; i++) {
for (let i = oldIndex + 1; i <= newIndex; i++) {
items[i - 1] = items[i];
}
} else {
for (var i = oldIndex - 1; i >= newIndex; i--) {
for (let i = oldIndex - 1; i >= newIndex; i--) {
items[i + 1] = items[i];
}
}
Expand Down
8 changes: 4 additions & 4 deletions control/settings/js/settings.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ const settingsController = {
if (err) console.error(err);

if (isConfirmed) {
UserSettings.get((err, settings) => {
if (err) return console.log(err);
UserSettings.get((error, settings) => {
if (error) return console.error(error);
if (settings && settings.isSubscribedToPN) {
Scores.reset({ isSubscribedToPN: settings.isSubscribedToPN }, (err, res) => {
if (err) return console.log(err);
Scores.reset({ isSubscribedToPN: settings.isSubscribedToPN }, (e, res) => {
if (e) return console.error(e);
settingPage.syncWithWidget('reset');

buildfire.dialog.toast({
Expand Down
Loading

0 comments on commit 06e9ffe

Please sign in to comment.