Skip to content

Commit

Permalink
Only zw963 can change user editable.
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed May 31, 2024
1 parent 978333c commit 4b0df8f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/pages/me/show_page.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,13 @@ class Me::ShowPage < MainLayout

br

a(
"新建用户",
href: "#modal2",
class: "waves-effect waves-light btn modal-trigger",
# script: "
# on click put '修改 #{user.email} 的密码' into the <#modal1 h5/>
# then set @hx-put of <#modal1 a[hx-put]/> to '#{User::Htmx::Password.with(user_id).path}'
# then js htmx.process(document.body) end
# "
)
if current_user.email == "[email protected]"
a(
"新建用户",
href: "#modal2",
class: "waves-effect waves-light btn modal-trigger",
)
end

user_list

Expand Down Expand Up @@ -103,6 +100,8 @@ class Me::ShowPage < MainLayout
"hx-include": "[name='_csrf']",
}

args = args.merge(disabled: "disabled") if current_user.email != "[email protected]"

if user.is_editable
input(args.merge(checked: "checked"))
else
Expand Down

0 comments on commit 4b0df8f

Please sign in to comment.