fix the sending logic
This commit is contained in:
parent
9080e458c4
commit
654b989e90
@ -13,3 +13,5 @@ gem "sqlite3"
|
|||||||
gem "active_hash"
|
gem "active_hash"
|
||||||
|
|
||||||
gem "opal-rails"
|
gem "opal-rails"
|
||||||
|
gem 'opal-optimizer', git: "https://github.com/hmdne/opal-optimizer" , require: false
|
||||||
|
gem "terser"
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/hmdne/opal-optimizer
|
||||||
|
revision: d958b7f68bfcec7e4d28707b382138c9436db8be
|
||||||
|
specs:
|
||||||
|
opal-optimizer (0.1.7)
|
||||||
|
opal (>= 1.0.0)
|
||||||
|
rkelly-turbo
|
||||||
|
|
||||||
PATH
|
PATH
|
||||||
remote: ..
|
remote: ..
|
||||||
specs:
|
specs:
|
||||||
@ -81,6 +89,7 @@ GEM
|
|||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
date (3.3.3)
|
date (3.3.3)
|
||||||
erubi (1.12.0)
|
erubi (1.12.0)
|
||||||
|
execjs (2.8.1)
|
||||||
globalid (1.1.0)
|
globalid (1.1.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
haml (6.1.1)
|
haml (6.1.1)
|
||||||
@ -169,6 +178,7 @@ GEM
|
|||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.5)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
|
rkelly-turbo (0.1.1)
|
||||||
sprockets (4.2.0)
|
sprockets (4.2.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (>= 2.2.4, < 4)
|
rack (>= 2.2.4, < 4)
|
||||||
@ -178,6 +188,8 @@ GEM
|
|||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.6.0-x86_64-linux)
|
sqlite3 (1.6.0-x86_64-linux)
|
||||||
temple (0.10.0)
|
temple (0.10.0)
|
||||||
|
terser (1.1.13)
|
||||||
|
execjs (>= 0.3.0, < 3)
|
||||||
thor (1.2.1)
|
thor (1.2.1)
|
||||||
tilt (2.0.11)
|
tilt (2.0.11)
|
||||||
timeout (0.3.1)
|
timeout (0.3.1)
|
||||||
@ -194,10 +206,12 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
active_hash
|
active_hash
|
||||||
haml-rails
|
haml-rails
|
||||||
|
opal-optimizer!
|
||||||
opal-rails
|
opal-rails
|
||||||
puma (= 5.6.5)
|
puma (= 5.6.5)
|
||||||
rails
|
rails
|
||||||
sqlite3
|
sqlite3
|
||||||
|
terser
|
||||||
vue_r!
|
vue_r!
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
|
@ -1,21 +1,29 @@
|
|||||||
#app
|
#app.mt-40
|
||||||
.flex.justify-center
|
.flex.justify-center
|
||||||
= #@image.attributes
|
= #@image.attributes
|
||||||
|
|
||||||
.flex.justify-center
|
.flex.justify-center
|
||||||
%a.underline{ e_click: "bg_change" , r_class: 'back(50)'}
|
.p-20
|
||||||
{{ back }}
|
{{ 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
|
:opal
|
||||||
class Clicker < VueR::Application
|
class Clicker < VueR::Application
|
||||||
def bg_change
|
def bg_change(num)
|
||||||
self.state = !self.state
|
self.state = num
|
||||||
end
|
end
|
||||||
def back(arg)
|
def back
|
||||||
puts "Arg:#{arg}:#{arg.class}"
|
'bg-cyan-' + self.state.to_s
|
||||||
str = self.state ? "bg-cyan-50" : "bg-cyan-200"
|
end
|
||||||
str + " " + arg.to_s
|
def text1
|
||||||
|
"click for dark"
|
||||||
|
end
|
||||||
|
def text2
|
||||||
|
"click for light"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
click = Clicker.new(bg: 'bg-cyan-200' , state: true)
|
click = Clicker.new( state: 200)
|
||||||
click.mount("#app")
|
click.mount("#app")
|
||||||
|
@ -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>
|
|
13
dummy/app/views/layouts/application.html.haml
Normal file
13
dummy/app/views/layouts/application.html.haml
Normal 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
|
@ -2,6 +2,7 @@ require_relative "boot"
|
|||||||
|
|
||||||
require "rails/all"
|
require "rails/all"
|
||||||
require 'sprockets/railtie'
|
require 'sprockets/railtie'
|
||||||
|
#require "opal/optimizer/sprockets"
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
|
@ -29,7 +29,8 @@ Rails.application.configure do
|
|||||||
# config.assets.js_compressor = :terser
|
# config.assets.js_compressor = :terser
|
||||||
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
config.assets.compile = false
|
config.assets.compile = false
|
||||||
|
config.assets.js_compressor = :terser
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
# config.asset_host = "http://assets.example.com"
|
# config.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
@ -75,23 +75,25 @@ module VueR
|
|||||||
end
|
end
|
||||||
|
|
||||||
def decompose(expression)
|
def decompose(expression)
|
||||||
matches = expression.match(/\b[^()]+\((.*)\)$/)
|
parts = expression.split("(")
|
||||||
return expression if matches.nil?
|
method = parts.shift
|
||||||
method = expression.split("(").first
|
raise "No nested brackets" if parts.length > 1
|
||||||
puts "METHOD:#{method}"
|
puts "METHOD:#{method}"
|
||||||
return [method , [] ] if matches[1].empty?
|
return [method , [] ] if parts.empty?
|
||||||
args = matches[1].split(",").collect{| arg | transform_arg(arg) }
|
args = parts.first.split(")").first.split(",")
|
||||||
|
args = args.collect{| arg | transform_arg(arg) }
|
||||||
return [method , args]
|
return [method , args]
|
||||||
end
|
end
|
||||||
|
|
||||||
def transform_arg(argument)
|
def transform_arg(argument)
|
||||||
arg = argument.strip
|
arg = argument.strip
|
||||||
#puts "Arg:#{arg}:"
|
puts "Arg:#{arg}:"
|
||||||
return true if arg == "true"
|
return true if arg == "true"
|
||||||
return false if arg == "false"
|
return false if arg == "false"
|
||||||
return nil if arg == "nil"
|
return nil if arg == "nil"
|
||||||
return arg.to_i if arg == arg.to_i.to_s
|
return arg.to_i if arg == arg.to_i.to_s
|
||||||
return arg
|
arg.gsub('"' ,"").gsub("'" , "")
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user