Skip to content

Commit

Permalink
Merge pull request #26 from appirio-tech/admin-permissions
Browse files Browse the repository at this point in the history
disable message send and file upload for admin
  • Loading branch information
samsep committed Feb 5, 2016
2 parents 2b27170 + ad6f261 commit 42091c0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion example/views/messaging.jade
Original file line number Diff line number Diff line change
@@ -1 +1 @@
messaging.dark-bg.flex.column.middle(work-id="123" thread-id="123" subscriber-id="abc" flush-height=true)
messaging.dark-bg.flex.column.middle(work-id="123" thread-id="123" subscriber-id="abc" flush-height=true permissions="['CREATE']")
2 changes: 2 additions & 0 deletions src/scripts/messaging.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ MessagingController = ($scope, $document, $filter, API_URL, MessagesAPIService,
vm.workId = $scope.workId
vm.threadId = $scope.threadId
vm.subscriberId = $scope.subscriberId
vm.permissions = $scope.permissions
vm.uploaderUploading = null
vm.uploaderHasErrors = null
vm.uploaderHasFiles = null
Expand Down Expand Up @@ -74,6 +75,7 @@ MessagingController = ($scope, $document, $filter, API_URL, MessagesAPIService,
name: "#{assetType}-uploader-#{threadId}-#{Date.now()}"
allowMultiple: true
allowCaptions: false
disabled: vm.permissions.indexOf('CREATE') == -1
onUploadSuccess: (data) ->
vm.newAttachments.push
ownerId: $scope.subscriberId
Expand Down
7 changes: 4 additions & 3 deletions src/scripts/messaging.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ directive = ->
controller : 'MessagingController'
controllerAs: 'vm'
scope :
threadId : '@threadId'
workId : '@workId'
subscriberId: '@subscriberId'
threadId: '@'
workId: '@'
subscriberId: '@'
permissions: '='

directive.$inject = []

Expand Down
1 change: 0 additions & 1 deletion src/styles/messaging.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ messaging {

.name {
@include ellipsis;

font-weight: 400;
font-size : 16px;
}
Expand Down
6 changes: 3 additions & 3 deletions src/views/messaging.directive.jade
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ ul.messages(id="messaging-message-list")
)

form.flex.middle.center(ng-submit="vm.sendMessage()")
textarea(placeholder="Send a message..." ng-model="vm.newMessage" ng-class="{resizeDisabled: vm.showImageSlideViewer}")
textarea(ng-if="vm.permissions.indexOf('CREATE') > -1" placeholder="Send a message..." ng-model="vm.newMessage" ng-class="{resizeDisabled: vm.showImageSlideViewer}")

button.action(type="submit" ng-hide="vm.disableSend") reply
textarea(ng-if="vm.permissions.indexOf('CREATE') == -1" placeholder="Messages Disabled" ng-class="{resizeDisabled: vm.showImageSlideViewer}" disabled)

button.action(disabled=true ng-show="vm.disableSend") reply
button.action(type="submit" ng-disabled="vm.disableSend || vm.permissions.indexOf('CREATE') == -1") reply

attachment-viewer(ng-if="vm.showImageSlideViewer")
include attachments-viewer

0 comments on commit 42091c0

Please sign in to comment.