diff --git a/Gemfile b/Gemfile
index 5dbce23..16b3544 100644
--- a/Gemfile
+++ b/Gemfile
@@ -7,8 +7,9 @@ gemspec
gem "rails"
gem "sprockets-rails"
gem "puma" , "5.6.5"
-
+gem "haml-rails"
gem "sqlite3"
+gem "active_hash"
# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"
diff --git a/Gemfile.lock b/Gemfile.lock
index 0523933..2c3f15f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -53,6 +53,8 @@ GEM
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
+ active_hash (3.1.1)
+ activesupport (>= 5.0.0)
activejob (7.0.4.2)
activesupport (= 7.0.4.2)
globalid (>= 0.3.6)
@@ -81,6 +83,15 @@ GEM
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
+ haml (6.1.1)
+ temple (>= 0.8.2)
+ thor
+ tilt
+ haml-rails (2.1.0)
+ actionpack (>= 5.1)
+ activesupport (>= 5.1)
+ haml (>= 4.0.6)
+ railties (>= 5.1)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
loofah (2.19.1)
@@ -166,6 +177,7 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.6.0-x86_64-linux)
+ temple (0.10.0)
thor (1.2.1)
tilt (2.0.11)
timeout (0.3.1)
@@ -180,6 +192,8 @@ PLATFORMS
x86_64-linux
DEPENDENCIES
+ active_hash
+ haml-rails
puma (= 5.6.5)
rails
sprockets-rails
diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
new file mode 100644
index 0000000..cf88dc5
--- /dev/null
+++ b/app/assets/config/manifest.js
@@ -0,0 +1 @@
+//= link_directory ../javascript .js
\ No newline at end of file
diff --git a/app/assets/config/vue_r_manifest.js b/app/assets/config/vue_r_manifest.js
index e549779..8fd0797 100644
--- a/app/assets/config/vue_r_manifest.js
+++ b/app/assets/config/vue_r_manifest.js
@@ -1 +1,2 @@
//= link_directory ../stylesheets/vue_r .css
+//= link_directory ../../javascript .js
diff --git a/app/assets/javascript/application.js.rb b/app/assets/javascript/application.js.rb
new file mode 100644
index 0000000..9c9be8a
--- /dev/null
+++ b/app/assets/javascript/application.js.rb
@@ -0,0 +1,12 @@
+require "opal"
+
+# Uncomment the following to print out you're hello-world with Opal:
+#
+# puts "hello world!"
+#
+# The following will append a hello-world to your
element:
+#
+# require "native"
+# $$[:document].addEventListener :DOMContentLoaded do
+# $$[:document][:body][:innerHTML] += 'Hello World!
'
+# end
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
new file mode 100644
index 0000000..e69de29
diff --git a/config/initializers/opal.rb b/config/initializers/opal.rb
new file mode 100644
index 0000000..aaba247
--- /dev/null
+++ b/config/initializers/opal.rb
@@ -0,0 +1,22 @@
+# Check out the full list of the available configuration options at
+# https://github.com/opal/opal/blob/master/lib/opal/config.rb
+
+Rails.application.configure do
+ # We suggest keeping the configuration above as default for all environments,
+ # disabling some of them might slightly reduce the bundle size or reduce performance
+ # by degrading some ruby features.
+ config.opal.method_missing_enabled = true
+ config.opal.const_missing_enabled = true
+ config.opal.arity_check_enabled = true
+ config.opal.freezing_stubs_enabled = true
+ config.opal.dynamic_require_severity = :ignore
+
+ # To enable passing assigns from the controller to the opal template handler
+ # change the following configuration to one of these values:
+ #
+ # - true # both locals and instance variables
+ # - :locals # only locals
+ # - :ivars # only instance variables
+ #
+ config.opal.assigns_in_templates = false
+end
diff --git a/lib/opal/rails/haml_filter.rb b/lib/opal/rails/haml_filter.rb
new file mode 100644
index 0000000..6d41a8e
--- /dev/null
+++ b/lib/opal/rails/haml_filter.rb
@@ -0,0 +1,19 @@
+require "haml"
+require "haml/filters"
+require "haml/filters/base"
+
+module Haml
+ class Filters
+ class Opal < Base
+ def compile(node)
+ temple = [:multi]
+ temple << [:static, ""]
+ temple
+ end
+ end
+ end
+end
+
+Haml::Filters.registered[:opal] ||= Haml::Filters::Opal
diff --git a/lib/vue_r/engine.rb b/lib/vue_r/engine.rb
index bdec2a1..dbf3654 100644
--- a/lib/vue_r/engine.rb
+++ b/lib/vue_r/engine.rb
@@ -1,3 +1,5 @@
+require "opal-rails"
+
module VueR
class Engine < ::Rails::Engine
isolate_namespace VueR
diff --git a/test/dummy/app/models/image.rb b/test/dummy/app/models/image.rb
index 66c77f2..a4c5bd0 100644
--- a/test/dummy/app/models/image.rb
+++ b/test/dummy/app/models/image.rb
@@ -1,2 +1,2 @@
-class Image
+class Image < ActiveYaml::Base
end
diff --git a/test/dummy/app/views/images/_form.html.erb b/test/dummy/app/views/images/_form.html.erb
deleted file mode 100644
index 34755a3..0000000
--- a/test/dummy/app/views/images/_form.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<%= form_with(model: image) do |form| %>
- <% if image.errors.any? %>
-
-
<%= pluralize(image.errors.count, "error") %> prohibited this image from being saved:
-
-
- <% image.errors.each do |error| %>
- - <%= error.full_message %>
- <% end %>
-
-
- <% end %>
-
-
- <%= form.submit %>
-
-<% end %>
diff --git a/test/dummy/app/views/images/_image.html.erb b/test/dummy/app/views/images/_image.html.erb
deleted file mode 100644
index e152014..0000000
--- a/test/dummy/app/views/images/_image.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/test/dummy/app/views/images/edit.html.erb b/test/dummy/app/views/images/edit.html.erb
deleted file mode 100644
index 3a426c6..0000000
--- a/test/dummy/app/views/images/edit.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-Editing image
-
-<%= render "form", image: @image %>
-
-
-
-
- <%= link_to "Show this image", @image %> |
- <%= link_to "Back to images", images_path %>
-
diff --git a/test/dummy/app/views/images/index.html.erb b/test/dummy/app/views/images/index.html.erb
deleted file mode 100644
index 7afd925..0000000
--- a/test/dummy/app/views/images/index.html.erb
+++ /dev/null
@@ -1,14 +0,0 @@
-<%= notice %>
-
-Images
-
-
- <% @images.each do |image| %>
- <%= render image %>
-
- <%= link_to "Show this image", image %>
-
- <% end %>
-
-
-<%= link_to "New image", new_image_path %>
diff --git a/test/dummy/app/views/images/new.html.erb b/test/dummy/app/views/images/new.html.erb
deleted file mode 100644
index 7548a9d..0000000
--- a/test/dummy/app/views/images/new.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-New image
-
-<%= render "form", image: @image %>
-
-
-
-
- <%= link_to "Back to images", images_path %>
-
diff --git a/test/dummy/app/views/images/show.html.erb b/test/dummy/app/views/images/show.html.erb
deleted file mode 100644
index d661e23..0000000
--- a/test/dummy/app/views/images/show.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-<%= notice %>
-
-<%= render @image %>
-
-
- <%= link_to "Edit this image", edit_image_path(@image) %> |
- <%= link_to "Back to images", images_path %>
-
- <%= button_to "Destroy this image", @image, method: :delete %>
-
diff --git a/test/dummy/config/routes.rb b/test/dummy/config/routes.rb
index 09d1d06..f804b3d 100644
--- a/test/dummy/config/routes.rb
+++ b/test/dummy/config/routes.rb
@@ -1,3 +1,4 @@
Rails.application.routes.draw do
resources :images
+ root to: "images#show" , id: 1
end
diff --git a/test/dummy/images.yml b/test/dummy/images.yml
new file mode 100644
index 0000000..21b919b
--- /dev/null
+++ b/test/dummy/images.yml
@@ -0,0 +1,7 @@
+- id: 1
+ name: US
+- id: 2
+ name: Canada
+- id: 3
+ name: Mexico
+