fix the sending logic

This commit is contained in:
2023-02-08 22:49:47 +02:00
parent 9080e458c4
commit 654b989e90
8 changed files with 58 additions and 33 deletions

View File

@ -1,21 +1,29 @@
#app
#app.mt-40
.flex.justify-center
= #@image.attributes
.flex.justify-center
%a.underline{ e_click: "bg_change" , r_class: 'back(50)'}
.p-20
{{ back }}
%a.p-20.underline{ e_click: "bg_change(200)" , r_class: 'back'}
{{ text1 }}
%a.p-20.underline{ e_click: "bg_change(100)" , r_class: 'back'}
{{ text2 }}
:opal
class Clicker < VueR::Application
def bg_change
self.state = !self.state
def bg_change(num)
self.state = num
end
def back(arg)
puts "Arg:#{arg}:#{arg.class}"
str = self.state ? "bg-cyan-50" : "bg-cyan-200"
str + " " + arg.to_s
def back
'bg-cyan-' + self.state.to_s
end
def text1
"click for dark"
end
def text2
"click for light"
end
end
click = Clicker.new(bg: 'bg-cyan-200' , state: true)
click = Clicker.new( state: 200)
click.mount("#app")

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Dummy</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
</head>
<body>
<%= yield %>
</body>
</html>

View File

@ -0,0 +1,13 @@
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title Dummy
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
= csrf_meta_tags
= csp_meta_tag
= stylesheet_link_tag "application"
= javascript_include_tag "application"
%script{:src => "https://cdn.tailwindcss.com"}
%body
= yield