-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add button to show tracked path of a visitor into operator's chat window
- Loading branch information
Showing
10 changed files
with
162 additions
and
4 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/mibew/js/source/chat/model_views/controls/tracked_path.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/*! | ||
* This file is a part of Mibew Messenger. | ||
* | ||
* Copyright 2005-2022 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
(function(Mibew, Handlebars, _) { | ||
/** | ||
* @class Represents Tracked path control view | ||
*/ | ||
Mibew.Views.TrackedPathControl = Mibew.Views.Control.extend( | ||
/** @lends Mibew.Views.TrackedPathControl.prototype */ | ||
{ | ||
/** | ||
* Template function | ||
* @type Function | ||
*/ | ||
template: Handlebars.templates['chat/controls/tracked_path'], | ||
|
||
/** | ||
* Map ui events to view methods | ||
* The view inherits events from | ||
* {@link Mibew.Views.Control.prototype.events}. | ||
* @type Object | ||
*/ | ||
events: _.extend( | ||
{}, | ||
Mibew.Views.Control.prototype.events, | ||
{ | ||
'click': 'showTrackedPath' | ||
} | ||
), | ||
|
||
/** | ||
* Display tracked path window | ||
*/ | ||
showTrackedPath: function() { | ||
var user = Mibew.Objects.Models.user; | ||
var link = this.model.get('link'); | ||
if (user.get('isAgent') && link) { | ||
var winParams = Mibew.Utils.buildWindowParams(this.model.get('windowParams')); | ||
|
||
// TODO: Kill & at the server side | ||
link = link.replace('&', '&', 'g'); | ||
|
||
var newWindow = window.open(link, 'UserTrackedPath', winParams); | ||
if (newWindow !== null) { | ||
newWindow.focus(); | ||
newWindow.opener=window; | ||
} | ||
} | ||
} | ||
} | ||
); | ||
|
||
})(Mibew, Handlebars, _); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/*! | ||
* This file is a part of Mibew Messenger. | ||
* | ||
* Copyright 2005-2022 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
(function(Mibew, _){ | ||
|
||
/** | ||
* @class Tracked path control model | ||
*/ | ||
Mibew.Models.TrackedPathControl = Mibew.Models.Control.extend( | ||
/** @lends Mibew.Models.TrackedPathControl.prototype */ | ||
{ | ||
/** | ||
* A list of default model values. | ||
* | ||
* The model inherits defaults from | ||
* {@link Mibew.Models.Control.prototype.defaults}. | ||
* @type Object | ||
*/ | ||
defaults: _.extend( | ||
{}, | ||
Mibew.Models.Control.prototype.defaults, | ||
{ | ||
/** | ||
* An URL of the tracked path page or false by default. | ||
* @type String|Boolean | ||
*/ | ||
link: false, | ||
|
||
/** | ||
* Params string for tracked path popup window | ||
* @type String | ||
*/ | ||
windowParams: '' | ||
} | ||
), | ||
|
||
/** | ||
* Returns model type | ||
* @returns {String} Model type | ||
*/ | ||
getModelType: function() { | ||
return 'TrackedPathControl'; | ||
} | ||
|
||
} | ||
); | ||
|
||
})(Mibew, _); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
src/mibew/styles/chats/dark/templates_src/client_side/chat/controls/tracked_path.handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="tpl-image" title="{{l10n "Tracked path of visitor"}}"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
...ibew/styles/chats/default/templates_src/client_side/chat/controls/tracked_path.handlebars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div class="tpl-image" title="{{l10n "Tracked path of visitor"}}"></div> |