Skip to content

Commit

Permalink
Users::PasswordWidget: allow horizontal layout (FATE#322328)
Browse files Browse the repository at this point in the history
If `little_space` is `false` (the default), the widget will
use a vertical layout, and include a "don't forget this" label.

If `little_space` is `true`, the helpful label is omitted
  • Loading branch information
mvidner committed Jan 13, 2017
1 parent 8a76ab2 commit e7c616f
Showing 1 changed file with 37 additions and 18 deletions.
55 changes: 37 additions & 18 deletions src/lib/users/widgets.rb
Expand Up @@ -30,30 +30,49 @@
Yast.import "UsersSimple"

module Users
# The widget contains 2 password input fields
# to type and retype the password
class PasswordWidget < CWM::CustomWidget
def initialize
# If `little_space` is `false` (the default), the widget will
# use a vertical layout, and include a "don't forget this" label.
#
# If `little_space` is `true`, the helpful label is omitted
# and the password fields are laid out horizontally.
def initialize(little_space: false)
textdomain "users"
@little_space = little_space
end

def contents
VBox(
# advise users to remember their new password
Left(Label(_("Do not forget what you enter here."))),
VSpacing(0.8),
Password(
Id(:pw1),
Opt(:hstretch),
# Label: get password for user root
_("&Password for root User")
),
VSpacing(0.8),
Password(
Id(:pw2),
Opt(:hstretch),
# Label: get same password again for verification
_("Con&firm Password")
)
pw1 = Password(
Id(:pw1),
Opt(:hstretch),
# Label: get password for user root
_("&Password for root User")
)
pw2 = Password(
Id(:pw2),
Opt(:hstretch),
# Label: get same password again for verification
_("Con&firm Password")
)

if @little_space
HBox(
pw1,
HSpacing(1),
pw2
)
else
VBox(
# advise users to remember their new password
Left(Label(_("Do not forget what you enter here."))),
VSpacing(0.8),
pw1,
VSpacing(0.8),
pw2
)
end
end

def init
Expand Down

0 comments on commit e7c616f

Please sign in to comment.