Skip to content

Commit db89dfc

Browse files
authored
Merge pull request #162 from BuildFire/use-standard-tag-component
Use standard tag component
2 parents 15f7b40 + 3580af9 commit db89dfc

9 files changed

Lines changed: 52 additions & 24 deletions

File tree

control/settings/app.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
// Declare app level module which depends on views, and components
44
var app = angular.module('socialPluginSettings', [
55
'ngRoute',
6-
'ngTagsInput'
76
]);
8-
app.config(['$locationProvider', '$routeProvider', 'tagsInputConfigProvider', function ($locationProvider, $routeProvider, tagsInputConfigProvider) {
7+
app.config(['$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) {
98
//config for tag-input plugin
10-
tagsInputConfigProvider.setActiveInterpolation('tagsInput', { minTags: true });
119

1210
$routeProvider.when('/', {
1311
templateUrl: 'views/mainSettings.html',

control/settings/assets/css/ng-tags-input.bootstrap.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

control/settings/assets/css/ng-tags-input.min.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

control/settings/assets/js/ng-tags-input.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

control/settings/controllers/mainSettingsCtrl.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ app.controller('MainSettingsCtrl', ['$scope', function ($scope) {
1111
mainThreadUserTags: [],
1212
sideThreadUserTags: []
1313
};
14+
var mainThreadUserTagsContainer = null;
15+
var sideThreadUserTagsContainer = null;
1416

1517
var load = function () {
1618
var editor = new buildfire.components.actionItems.sortableList("#actions");
@@ -92,6 +94,7 @@ app.controller('MainSettingsCtrl', ['$scope', function ($scope) {
9294
$scope.save();
9395
})
9496
}
97+
initUserTags();
9598
}
9699
});
97100

@@ -129,6 +132,39 @@ app.controller('MainSettingsCtrl', ['$scope', function ($scope) {
129132
}
130133
}
131134

135+
var initUserTags = function () {
136+
mainThreadUserTagsContainer = new buildfire.components.control.userTagsInput("#allowMainThreadTags", {});
137+
138+
mainThreadUserTagsContainer.onUpdate = (tags) => {
139+
$scope.data.mainThreadUserTags = tags.tags.map(tag => ({ text: tag.tagName }));
140+
$scope.save();
141+
};
142+
143+
if ($scope.data.mainThreadUserTags && $scope.data.mainThreadUserTags.length) {
144+
const tags = $scope.data.mainThreadUserTags.map(tag => ({
145+
value: tag.text,
146+
tagName: tag.text,
147+
}));
148+
mainThreadUserTagsContainer.append(tags);
149+
}
150+
151+
sideThreadUserTagsContainer = new buildfire.components.control.userTagsInput("#allowSideThreadUserTags", {});
152+
153+
sideThreadUserTagsContainer.onUpdate = (tags) => {
154+
$scope.data.sideThreadUserTags = tags.tags.map(tag => ({ text: tag.tagName }));
155+
$scope.save();
156+
};
157+
158+
if ($scope.data.sideThreadUserTags && $scope.data.sideThreadUserTags.length) {
159+
const tags = $scope.data.sideThreadUserTags.map(tag => ({
160+
value: tag.text,
161+
tagName: tag.text,
162+
}));
163+
sideThreadUserTagsContainer.append(tags);
164+
}
165+
166+
}
167+
132168
$scope.handleChatFeatureActionItem = function () {
133169
var chatFeatureActionsItems = new buildfire.components.actionItems.sortableList("#chatFeatureActions");
134170
if ($scope.data.chatFeature.actionItem) {

control/settings/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
<script src="../../../../scripts/sortable.min.js"></script>
1212
<script src="../../../../scripts/buildfire/components/actionItems/sortableList.js"></script>
1313
<script src="../../../../scripts/angular/ui-bootstrap.min.js"></script>
14+
<script src="../../../../scripts/buildfire/components/control/tagsInput/tagsInput.min.js"></script>
1415

1516
<!-- Load helper.css to use our helper classes.
1617
-->
1718
<link href="../../../../styles/helper.css" rel="stylesheet" />
1819
<link href="../../../../styles/siteStyle.css" rel="stylesheet" />
1920
<link href="../../../../styles/control/siteIcons-control.css" rel="stylesheet" />
2021
<link href="../../../../styles/control/bf-base.css" rel="stylesheet" />
22+
<link href="../../../../styles/components/control/tagsInput/tagsInput.min.css" rel="stylesheet"/>
2123

2224
<!-- build:bundleCSSFiles -->
23-
<link href="assets/css/ng-tags-input.min.css" rel="stylesheet">
24-
<link href="assets/css/ng-tags-input.bootstrap.min.css" rel="stylesheet">
2525
<link href="assets/css/style.css" rel="stylesheet">
2626
<link rel="stylesheet" href="assets/css/reset.css">
2727
<link rel="stylesheet" href="assets/css/sortable.css">
@@ -31,7 +31,6 @@
3131
<!-- build:bundleJSFiles -->
3232
<script src="app.js"></script>
3333
<script src="controllers/mainSettingsCtrl.js"></script>
34-
<script src="assets/js/ng-tags-input.min.js"></script>
3534
<script src="controllers/search-table-helper.js"></script>
3635
<script src="controllers/search-table-config.js"></script>
3736
<!-- endbuild -->

control/settings/views/mainSettings.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ <h1>Post Permissions</h1>
3333
</span>
3434
</div>
3535
<div class="col-md-8">
36-
<tags-input class="margin-bottom-ten" ng-model="data.mainThreadUserTags"
37-
min-tags="{{data.allowMainThreadTags ? 1 : 0}}" on-tag-added="save()"
38-
on-tag-removed="save()">
39-
</tags-input>
36+
<div class="margin-bottom-ten" id="allowMainThreadTags"></div>
4037
</div>
4138
</div>
4239

@@ -63,9 +60,7 @@ <h1>Post Permissions</h1>
6360
</div>
6461

6562
<div class="col-md-8">
66-
<tags-input class="margin-bottom-ten" ng-model="data.sideThreadUserTags" min-tags="{{data.allowSideThreadTags ? 1 : 0}}"
67-
on-tag-added="save()" on-tag-removed="save()">
68-
</tags-input>
63+
<div class="margin-bottom-ten" id="allowSideThreadUserTags"></div>
6964
</div>
7065
</div>
7166

widget/app.service.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,13 +709,15 @@
709709
},
710710
addComment: function (data) {
711711
var deferred = $q.defer();
712-
if (data.userDetails.userTags) {
713-
delete data.userDetails.userTags
714-
delete data.userDetails.userToken
712+
const requestData = structuredClone(data);
713+
714+
if (requestData.userDetails.userTags) {
715+
delete requestData.userDetails.userTags
716+
delete requestData.userDetails.userToken
715717
}
716-
buildfire.publicData.getById(data.threadId, 'posts', function (err, post) {
718+
buildfire.publicData.getById(requestData.threadId, 'posts', function (err, post) {
717719
if (err) return deferred.reject(err);
718-
post.data.comments.push(data);
720+
post.data.comments.push(requestData);
719721
buildfire.publicData.update(post.id, post.data, 'posts', function (err, status) {
720722
if (err) return deferred.reject(err);
721723
else{

widget/controllers/widget.wall.controller.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
WidgetWall.showHidePrivateChat();
167167
WidgetWall.followLeaveGroupPermission();
168168
WidgetWall.showHideCommentBox();
169+
WidgetWall.initFabButtons();
169170
let dldActionItem = new URLSearchParams(window.location.search).get('actionItem');
170171
if (dldActionItem)
171172
WidgetWall.SocialItems.appSettings.actionItem = JSON.parse(dldActionItem);
@@ -616,6 +617,7 @@
616617
WidgetWall.stopSkeleton();
617618
return console.error("Getting user failed.", err);
618619
}
620+
WidgetWall.setSettings(result);
619621
WidgetWall.SocialItems.checkBlockedUsers();
620622
WidgetWall.getPosts(()=>{
621623
if (user) {
@@ -820,12 +822,13 @@
820822
}
821823

822824
WidgetWall.navigateToPrivateChat = function (privateChatData) {
823-
824825
WidgetWall.SocialItems.isPrivateChat = true;
825826
WidgetWall.SocialItems.wid = privateChatData.wid;
826827
WidgetWall.SocialItems.showMorePosts = false;
827828
WidgetWall.SocialItems.pageSize = 5;
828829
WidgetWall.SocialItems.page = 0;
830+
WidgetWall.allowCreateThread = true;
831+
WidgetWall.initFabButtons();
829832
WidgetWall.SocialItems.setPrivateChatTitle(privateChatData.wid).then(() => {
830833
if (WidgetWall.isFromDeepLink) {
831834
buildfire.appearance.titlebar.setText({ text: WidgetWall.SocialItems.pluginTitle}, (err) => {
@@ -858,12 +861,10 @@
858861
if (result) {
859862
WidgetWall.SocialItems.appSettings = result.data && result.data.appSettings ? result.data.appSettings : {};
860863
WidgetWall.setSettings(result);
861-
WidgetWall.initFabButtons();
862864

863865
Buildfire.datastore.onUpdate(function (response) {
864866
if (response.tag === "Social") {
865867
WidgetWall.setSettings(response);
866-
WidgetWall.initFabButtons()
867868
setTimeout(function () {
868869
if (!response.data.appSettings.disableFollowLeaveGroup) {
869870
let wallSVG = document.getElementById("WidgetWallSvg")

0 commit comments

Comments
 (0)