Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
f722ba72
Commit
f722ba72
authored
Jul 21, 2016
by
Vladimir Baranov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rref #5392. Add popups to add user/unit to channel
parent
964b97b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
14 deletions
+69
-14
messaging.js
app/components/messaging/messaging.js
+58
-10
add_user_unit.html
app/components/messaging/templates/add_user_unit.html
+9
-2
conversation.html
app/components/messaging/templates/conversation.html
+2
-2
No files found.
app/components/messaging/messaging.js
View file @
f722ba72
...
...
@@ -10,6 +10,18 @@ angular.module("ulakbus.messaging")
return
channelKey
;
}
function
searchWrapper
(
scope
,
promiseWrapper
){
scope
.
loading
=
true
;
scope
.
searchResult
=
[];
promiseWrapper
()
.
then
(
function
(
result
){
scope
.
searchResult
=
result
;
})
.
finally
(
function
(){
scope
.
loading
=
false
;
})
}
return
{
templateUrl
:
'components/messaging/templates/index.html'
,
restrict
:
'E'
,
...
...
@@ -31,15 +43,9 @@ angular.module("ulakbus.messaging")
rootElement
:
popupRootElement
,
link
:
function
(
scope
){
scope
.
onChange
=
function
(
query
){
scope
.
loading
=
true
;
scope
.
searchResult
=
[];
MessagingService
.
search_user
(
query
)
.
then
(
function
(
users
){
scope
.
searchResult
=
users
;
})
.
finally
(
function
(){
scope
.
loading
=
false
;
})
searchWrapper
(
scope
,
function
(){
return
MessagingService
.
search_user
(
query
);
})
};
scope
.
onChange
(
""
);
}
...
...
@@ -56,10 +62,48 @@ angular.module("ulakbus.messaging")
scope
.
channel
=
{};
}
}).
then
(
function
(
channel
){
return
MessagingService
.
create_channel
(
channel
.
name
,
channel
.
description
);
return
MessagingService
.
create_channel
(
channel
.
name
,
channel
.
description
||
""
);
});
};
iScope
.
addUserToChannel
=
function
(
channel
){
MessagingPopup
.
show
({
templateUrl
:
"components/messaging/templates/add_user_unit.html"
,
rootElement
:
popupRootElement
,
link
:
function
(
scope
){
scope
.
title
=
"Add User"
;
scope
.
placeholder
=
"Search User to Add"
;
scope
.
onChange
=
function
(
query
){
searchWrapper
(
scope
,
function
(){
return
MessagingService
.
search_user
(
query
);
})
};
scope
.
onChange
(
""
);
}
}).
then
(
function
(
userKey
){
return
MessagingService
.
add_members
([
userKey
]);
});
};
iScope
.
addUnitToChannel
=
function
(){
MessagingPopup
.
show
({
templateUrl
:
"components/messaging/templates/add_user_unit.html"
,
rootElement
:
popupRootElement
,
link
:
function
(
scope
){
scope
.
title
=
"Add Unit"
;
scope
.
placeholder
=
"Search Unit to Add"
;
scope
.
onChange
=
function
(
query
){
searchWrapper
(
scope
,
function
(){
return
MessagingService
.
search_unit
(
query
);
})
};
scope
.
onChange
(
""
);
}
}).
then
(
function
(
unitKey
){
var
channelKey
=
getKey
(
iScope
.
selectedChannel
);
return
MessagingService
.
add_members
(
channelKey
,
unitKey
);
});
};
},
controller
:
function
(
$scope
)
{
...
...
@@ -117,6 +161,10 @@ angular.module("ulakbus.messaging")
$scope
.
shared
.
message
=
""
;
});
}
$scope
.
canAddUserAndChannel
=
function
(
channel
)
{
return
channel
&&
channel
.
type
==
MessagingService
.
CHANNEL_TYPE
.
PUBLIC
;
}
}
};
})
...
...
app/components/messaging/templates/add_user_unit.html
View file @
f722ba72
<div
class=
"chat-popup-window add-user-unit"
style=
"display:block;"
>
<div
class=
"close-chat-popup-window"
><span
class=
"glyphicon glyphicon-remove"
></span></div>
<h3>
Add User/Unit
</h3>
<h3>
{{title}}
</h3>
<div
class=
"text-center"
>
<input
type=
"text"
placeholder=
"Search User/Unit to Add"
><br>
<input
type=
"text"
placeholder=
"{{placeholder}}"
>
<div
class=
"search-results"
>
<span
class=
"loader"
ng-show=
"loading"
></span>
<div
class=
"user"
ng-repeat=
"item in searchResult"
ng-click=
"done(item[1])"
>
<img
ng-src=
"{{item[2]}}"
ng-show=
"item[2]"
>
<div
class=
"user-name"
>
{{item[0]}}
</div>
</div>
</div>
</div>
</div>
app/components/messaging/templates/conversation.html
View file @
f722ba72
...
...
@@ -26,8 +26,8 @@
<li><a
ng-click=
"applyChannelAction(action)"
ng-repeat=
"action in selectedChannel.actions"
>
{{action[0]}}
</a></li>
</ul>
</div>
<div
class=
"close-chat-app"
>
<span
class=
"glyphicon glyphicon-remove"
ng-click=
"hideApp()"
></span>
<div
class=
"close-chat-app"
ng-click=
"hideApp()"
>
<span
class=
"glyphicon glyphicon-remove"
></span>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment