Skip to content

Commit

Permalink
fix code length text
Browse files Browse the repository at this point in the history
  • Loading branch information
ethayer committed Mar 21, 2017
1 parent 4364321 commit c96033d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions smartapps/ethayer/lock-manager.src/lock-manager.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ def lockInfoPage(params) {
}
}
}

section('Lock Settings') {
def pinLength = lockApp.pinLength()
if (pinLength) {
paragraph "Required Length: ${pinLength}"
}
}
} else {
section() {
paragraph 'Error: Can\'t find lock!'
Expand Down
16 changes: 9 additions & 7 deletions smartapps/ethayer/lock-user.src/lock-user.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ def landingPage() {
}

def setupPage() {
dynamicPage(name: "setupPage", title: "Setup Lock", nextPage: "mainPage", uninstall: true) {
section("Choose devices for this lock") {
input(name: 'userName', title: "Name for User", required: true, image: 'https://dl.dropboxusercontent.com/u/54190708/LockManager/user.png')
input(name: "userCode", type: "text", title: userCodeInputTitle(), required: false, defaultValue: settings."userCode", refreshAfterSelection: true)
input(name: "userSlot", type: "enum", options: parent.availableSlots(settings.userSlot), title: "Select slot", required: true, refreshAfterSelection: true )
dynamicPage(name: 'setupPage', title: 'Setup Lock', nextPage: 'mainPage', uninstall: true) {
section('Choose devices for this lock') {
input(name: 'userName', title: 'Name for User', required: true, image: 'https://dl.dropboxusercontent.com/u/54190708/LockManager/user.png')
input(name: 'userCode', type: 'text', title: userCodeInputTitle(), required: false, defaultValue: settings.'userCode', refreshAfterSelection: true)
input(name: 'userSlot', type: 'enum', options: parent.availableSlots(settings.userSlot), title: 'Select slot', required: true, refreshAfterSelection: true )
}
}
}
Expand All @@ -169,7 +169,7 @@ def mainPage() {
text = 'inactive'
}
paragraph "${text}/${usage}"
input(name: "userCode", type: "text", title: userCodeInputTitle(), required: false, defaultValue: settings."userCode", refreshAfterSelection: true)
input(name: 'userCode', type: 'text', title: userCodeInputTitle(), required: false, defaultValue: settings.'userCode', refreshAfterSelection: true)
}
section('Additional Settings') {
def actions = location.helloHome?.getPhrases()*.label
Expand Down Expand Up @@ -201,8 +201,10 @@ def mainPage() {

def userCodeInputTitle() {
def title = 'Code 4-8 digits'
def pinLength
def lockApps = parent.getLockApps()
lockApps.each { lockApp ->
def pinLength = lockApp.pinLength()
pinLength = lockApp.pinLength()
if (pinLength) {
title = "Code (Must be ${lockApp.lock.latestValue('pinLength')} digits)"
}
Expand Down

0 comments on commit c96033d

Please sign in to comment.