Skip to content

Commit

Permalink
Merge pull request #54 from appirio-tech/DEM-2183
Browse files Browse the repository at this point in the history
Dem 2183 - permission for read only
  • Loading branch information
vietnogi committed Feb 23, 2016
2 parents 060f7d3 + 45c2c73 commit a5dcc97
Show file tree
Hide file tree
Showing 28 changed files with 143 additions and 39 deletions.
12 changes: 12 additions & 0 deletions example/nav.jade
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,27 @@ ul#example-nav
li
a(ui-sref="submit-work") submit-work

li
a(ui-sref="submit-work-type-no-update") submit-work-type (no update permission)

li
a(ui-sref="submit-work-features") submit-work-features

li
a(ui-sref="submit-work-features-no-update") submit-work-features (no update permission)

li
a(ui-sref="submit-work-visuals") submit-work-visuals

li
a(ui-sref="submit-work-visuals-no-update") submit-work-visuals (no update permission)

li
a(ui-sref="submit-work-development") submit-work-development

li
a(ui-sref="submit-work-development-no-update") submit-work-development (no update permission)

li
a(ui-sref="submit-work-complete") submit-work-complete

Expand Down
1 change: 1 addition & 0 deletions example/scripts/development.example.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ store = require './store'
ctrl = ->
vm = this
vm.store = store
vm.permissions = []

vm

Expand Down
1 change: 1 addition & 0 deletions example/scripts/features.example.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ store = require './store'
ctrl = ->
vm = this
vm.store = store
vm.permissions = []

vm

Expand Down
25 changes: 25 additions & 0 deletions example/scripts/routes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,48 @@ config = ($stateProvider) ->
controller : 'TypeController as vm'
templateUrl : 'views/submit-work-type.example.html'

states['submit-work-type-no-update'] =
url : '/submit-work-type-no-update'
title : 'submit work type no update'
controller : 'TypeController as vm'
templateUrl : 'views/submit-work-type-no-update.example.html'

states['submit-work-features'] =
url : '/submit-work/features'
title : 'submit work features'
controller : 'FeaturesExampleController as vm'
templateUrl : 'views/submit-work-features.example.html'

states['submit-work-features-no-update'] =
url : '/submit-work/features-no-update'
title : 'submit work features no update'
controller : 'FeaturesExampleController as vm'
templateUrl : 'views/submit-work-features-no-update.example.html'

states['submit-work-visuals'] =
url : '/submit-work/visuals'
title : 'submit work visuals'
controller : 'VisualExampleController as vm'
templateUrl : 'views/submit-work-visuals.example.html'

states['submit-work-visuals-no-update'] =
url : '/submit-work/visuals-no-update'
title : 'submit work visuals no update'
controller : 'VisualExampleController as vm'
templateUrl : 'views/submit-work-visuals-no-update.example.html'

states['submit-work-development'] =
url : '/submit-work/development'
title : 'submit work development'
controller : 'DevelopmentExampleController as vm'
templateUrl : 'views/submit-work-development.example.html'

states['submit-work-development-no-update'] =
url : '/submit-work/development-no-update'
title : 'submit work development no update'
controller : 'DevelopmentExampleController as vm'
templateUrl : 'views/submit-work-development-no-update.example.html'

states['submit-work-complete'] =
url : '/submit-work/complete'
title : 'submit work complete'
Expand All @@ -38,6 +62,7 @@ config = ($stateProvider) ->
controller : 'FeatureListExample as vm'
templateUrl : 'views/feature-list.example.html'


for key, state of states
$stateProvider.state key, state

Expand Down
1 change: 1 addition & 0 deletions example/scripts/type-example.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

TypeController = ->
vm = this
vm.permissions = []

activate = ->
vm.appName = 'Big Boss App'
Expand Down
1 change: 1 addition & 0 deletions example/scripts/visual.example.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ store = require './store'
ctrl = ->
vm = this
vm.store = store
vm.permissions = []

vm

Expand Down
7 changes: 7 additions & 0 deletions example/views/submit-work-development-no-update.example.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
layout-header.elevated-bottom(role="banner" work-id="123")

main.layout-main("role"="main" layout-main=true)
submit-work-development(work-id="123" store="vm.store" permissions="vm.permissions")

layout-footer

6 changes: 6 additions & 0 deletions example/views/submit-work-features-no-update.example.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
layout-header.elevated-bottom(role="banner" work-id="123")

main.layout-main("role"="main" layout-main=true)
submit-work-features(work-id="123" store="vm.store" permissions="vm.permissions")

layout-footer
6 changes: 6 additions & 0 deletions example/views/submit-work-type-no-update.example.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
layout-header.elevated-bottom(role="banner" work-id="123")

main.layout-main("role"="main" layout-main=true)
submit-work-type(permissions="vm.permissions")

layout-footer
6 changes: 6 additions & 0 deletions example/views/submit-work-visuals-no-update.example.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
layout-header.elevated-bottom(role="banner" work-id="123")

main.layout-main("role"="main" layout-main=true)
submit-work-visuals(work-id="123" store="vm.store" permissions="vm.permissions")

layout-footer
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"appirio-tech-ng-auth": "^4.1.1",
"appirio-tech-ng-optimist": "1.x.x",
"appirio-tech-ng-ui-components": "2.x.x",
"appirio-tech-react-components": "0.0.2"
"appirio-tech-react-components": "0.x.x"
}
}
3 changes: 3 additions & 0 deletions src/scripts/controllers/development.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ SubmitWorkDevelopmentController = ($scope, $rootScope, $state, SubmitWorkService
vm.activeDevelopmentModal = null
vm.projectType = null
vm.currentApiIntegration = null
permissions = $scope.permissions || ['ALL']
vm.readOnly = permissions.indexOf('UPDATE') == -1 && permissions.indexOf('ALL') == -1
vm.dragAndDrop = true
vm.developmentModals = ['offlineAccess', 'personalInformation', 'security', 'thirdPartyIntegrations']

vm.securityLevels =
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/controllers/features.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ SubmitWorkFeaturesController = ($scope, $rootScope, SubmitWorkService, SubmitWor
vm.uploaderHasErrors = null
vm.uploaderHasFiles = null
vm.features = []
permissions = $scope.permissions || ['ALL']
vm.readOnly = permissions.indexOf('UPDATE') == -1 && permissions.indexOf('ALL') == -1
vm.dragAndDrop = true

config =
customFeatureTemplate:
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/controllers/type.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ SubmitWorkTypeController = ($scope, $rootScope, $state, $document, SubmitWorkSer
vm.projectTypeError = false
vm.briefError = false
userProjectNames = null
permissions = $scope.permissions || ['ALL']
vm.readOnly = permissions.indexOf('UPDATE') == -1 && permissions.indexOf('ALL') == -1

# TODO: move route directing out of here
if $scope.workId
Expand Down
3 changes: 3 additions & 0 deletions src/scripts/controllers/visual.controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ SubmitWorkVisualController = ($scope, $rootScope, $state, $document, SubmitWorkS
vm.urlRegEx = /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,3})+(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/
vm.serif = 'SERIF'
vm.sansSerif = 'SANS_SERIF'
permissions = $scope.permissions || ['ALL']
vm.readOnly = permissions.indexOf('UPDATE') == -1 && permissions.indexOf('ALL') == -1
vm.dragAndDrop = true

vm.scrollTo = (id) ->
element = angular.element document.getElementById id
Expand Down
1 change: 1 addition & 0 deletions src/scripts/directives/development.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ directive = ->
scope :
workId : '@workId'
store: '='
permissions: '='

angular.module('appirio-tech-ng-submit-work').directive 'submitWorkDevelopment', directive
1 change: 1 addition & 0 deletions src/scripts/directives/features.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ directive = ->
scope :
workId: '@'
store: '='
permissions: '='

angular.module('appirio-tech-ng-submit-work').directive 'submitWorkFeatures', directive
3 changes: 2 additions & 1 deletion src/scripts/directives/type.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ directive = ->
templateUrl : 'views/submit-work-type.directive.html'
controller : 'SubmitWorkTypeController as vm'
scope :
workId : '@workId'
workId: '@'
permissions: '='

angular.module('appirio-tech-ng-submit-work').directive 'submitWorkType', directive
3 changes: 2 additions & 1 deletion src/scripts/directives/visuals.directive.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ directive = ->
templateUrl : 'views/submit-work-visuals.directive.html'
controller : 'SubmitWorkVisualController as vm'
scope :
workId : '@workId'
workId : '@'
store: '='
permissions: '='

angular.module('appirio-tech-ng-submit-work').directive 'submitWorkVisuals', directive
18 changes: 9 additions & 9 deletions src/views/parts/choose-styles.jade
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ modal.full.choose-styles(show="vm.showChooseStylesModal" background-click-close=
p Classic design, good legibility for large and small text.

hr
button.clean(ng-click="vm.toggleSelection('font', vm.serif)")
button.clean(ng-click="vm.toggleSelection('font', vm.serif)" ng-disabled="vm.readOnly")
img(ng-src=require("./../../images/serif.png"))

button.action(selectable=true type="button" ng-model="vm.font" value="vm.serif")
button.action(selectable=true type="button" ng-model="vm.font" value="vm.serif" ng-disabled="vm.readOnly")

li.or(ng-repeat-end ng-if="font.name == 'Serif' ")
.house OR
Expand All @@ -47,10 +47,10 @@ modal.full.choose-styles(show="vm.showChooseStylesModal" background-click-close=

hr

button.clean(ng-click="vm.toggleSelection('font', vm.sansSerif)")
button.clean(ng-click="vm.toggleSelection('font', vm.sansSerif)" ng-disabled="vm.readOnly")
img(ng-src=require("./../../images/sans.png"))

button.action(selectable=true type="button" ng-model="vm.font" value="vm.sansSerif")
button.action(selectable=true type="button" ng-model="vm.font" value="vm.sansSerif" ng-disabled="vm.readOnly")

main.dark-bg.colors.flex.column.center.flex-grow(ng-show="vm.activeStyleModal == 'colors' ")
h2 Pick <strong>the colors</strong> that you prefer
Expand All @@ -61,10 +61,10 @@ modal.full.choose-styles(show="vm.showChooseStylesModal" background-click-close=
li(ng-repeat="color in vm.colors")
h6 {{ color.name }}

button.clean(ng-click="vm.toggleColorSelection(color, color.selected)")
button.clean(ng-click="vm.toggleColorSelection(color, color.selected)" ng-disabled="vm.readOnly")
img(ng-src="{{ color.img }}")

button.action(type="button" selectable=true ng-model="color.selected")
button.action(type="button" selectable=true ng-model="color.selected" ng-disabled="vm.readOnly")

main.dark-bg.icons.flex.column.center.flex-grow(ng-show="vm.activeStyleModal == 'icons' ")
h2 Pick the <strong>icon styles</strong> that you prefer
Expand All @@ -73,22 +73,22 @@ modal.full.choose-styles(show="vm.showChooseStylesModal" background-click-close=

ul.flex.center
li(ng-repeat="icon in vm.icons")
button.clean(ng-click="vm.toggleSelection('icon', icon.id)")
button.clean(ng-click="vm.toggleSelection('icon', icon.id)" ng-disabled="vm.readOnly")
img(ng-src="{{ icon.img }}")

h6 {{icon.name}}

p {{icon.description}}

button.action(type="button" selectable=true ng-model="vm.icon" value="icon.id")
button.action(type="button" selectable=true ng-model="vm.icon" value="icon.id" ng-disabled="vm.readOnly")

main.dark-bg.notes.flex.column.center.flex-grow(ng-show="vm.activeStyleModal == 'notes' ")
.design-notes
h2 Add any <strong>additional notes</strong>

p Add any other preferences, notes or details that you would like the designers to know.

textarea(ng-model="vm.designNotes" placeholder="Notes...")
textarea(ng-model="vm.designNotes" placeholder="Notes..." ng-disabled="vm.readOnly")

footer
button(ng-hide="vm.backButtonDisabled" ng-click="vm.viewPrevious()") back
Expand Down
12 changes: 6 additions & 6 deletions src/views/parts/define-features.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ modal.full.define-features(show="vm.showFeaturesModal" ng-if="vm.showFeaturesMod
activate-feature="vm.activateFeature(feature)"
)
li
button.clean(ng-click="vm.toggleDefineFeatures()")
button.clean(ng-click="vm.toggleDefineFeatures()" ng-disabled="vm.readOnly")
span Define a new feature

.icon +
Expand All @@ -32,11 +32,11 @@ modal.full.define-features(show="vm.showFeaturesModal" ng-if="vm.showFeaturesMod

p {{vm.activeFeature.description}}

textarea(placeholder="Notes..." ng-model="vm.activeFeature.notes" ng-change="vm.activeFeatureChangedNotes()")
textarea(placeholder="Notes..." ng-model="vm.activeFeature.notes" ng-change="vm.activeFeatureChangedNotes()" ng-disabled="vm.readOnly")

button.action(ng-if="!vm.activeFeature.selected" ng-click="vm.applyFeature()") Add this feature
button.action(ng-if="!vm.activeFeature.selected" ng-click="vm.applyFeature()" ng-disabled="vm.readOnly") Add this feature

button(ng-if="vm.activeFeature.selected" ng-click="vm.removeFeature()") remove feature
button(ng-if="vm.activeFeature.selected" ng-click="vm.removeFeature()" ng-disabled="vm.readOnly") remove feature

//- button.action(ng-if="vm.activeFeatureChangedNotes(vm.activeFeature)" ng-click="vm.saveNotes()") save notes
Expand All @@ -53,7 +53,7 @@ modal.full.define-features(show="vm.showFeaturesModal" ng-if="vm.showFeaturesMod

textarea(ng-model="vm.customFeature.description" required=true placeholder="Briefly describe the feature, including how it will be used, and provide examples that will help designers and developers understand it.")

button.action(type="submit") add
button.action(type="submit" ng-disabled="vm.readOnly") add

button.cancel(type="button" ng-click="vm.hideCustomFeatures()") Cancel

Expand All @@ -69,4 +69,4 @@ modal.full.define-features(show="vm.showFeaturesModal" ng-if="vm.showFeaturesMod
li.flex.middle.space-between
.count {{vm.selectedFeaturesCount}} features added

button.action(ng-click="vm.save()") Save
button.action(ng-click="vm.save()" ng-disabled="vm.readOnly") Save
2 changes: 1 addition & 1 deletion src/views/parts/get-style.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modal.enter-url(show="vm.showUrlStylesModal" background-click-close=true)
p Enter the URL where we can see your company’s design style or brand guidelines.

form(ng-submit="vm.save()" name="urlForm")
input(type="text" name="addressInput" ng-pattern="vm.urlRegEx" ng-change="vm.checkAddressValidity()" placeholder="http://www.example.com" ng-model="vm.url" required=true)
input(type="text" name="addressInput" ng-pattern="vm.urlRegEx" ng-change="vm.checkAddressValidity()" placeholder="http://www.example.com" ng-model="vm.url" required=true ng-disabled="vm.readOnly")

p.error.transition(ng-class="{show: urlForm.addressInput.$error.pattern }") Please enter a valid address.

Expand Down
2 changes: 1 addition & 1 deletion src/views/parts/upload-features.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ modal.upload-documents(show="vm.showUploadModal" background-click-close=true)

p Upload a brief, requirements, specs, or feature list.

file-uploader(store="vm.store")
file-uploader(store="vm.store" disable-click="vm.readOnly" drag-and-drop="vm.dragAndDrop")

button(ng-click="vm.hideUpload()") Done
2 changes: 1 addition & 1 deletion src/views/parts/upload-requirements.jade
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ modal.upload-documents(show="vm.showUploadSpecs" background-click-close=true)

h2 Upload documents

file-uploader(store="vm.store")
file-uploader(store="vm.store" disable-click="vm.readOnly" drag-and-drop="vm.dragAndDrop")

button(ng-click="vm.hideUploadSpecs()") Done
1 change: 1 addition & 0 deletions src/views/parts/visual-continue-buttons.jade
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
button.kick-off.action(
ng-if="vm.projectType != 'DESIGN_AND_CODE'"
ng-click="vm.save(true, true)"
ng-disabled="vm.readOnly"
) kick off project
2 changes: 1 addition & 1 deletion src/views/parts/visual-upload.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ modal.upload-documents(show="vm.showUploadStylesModal" background-click-close=tr

p Upload any guidelines, style guides, or prior designs.

file-uploader(store="vm.store")
file-uploader(store="vm.store" disable-click="vm.readOnly" drag-and-drop="vm.dragAndDrop")

button(ng-click="vm.hideUploadStyles()") Done
Loading

0 comments on commit a5dcc97

Please sign in to comment.