opal / opal-rails

Bringing Ruby to Rails · Rails bindings for Opal
http://opalrb.com/#getting-started-rails
488 stars 65 forks source link

review await# generators - fixed plural singular, roadmap #85

Closed mibamur closed 7 years ago

mibamur commented 8 years ago

Hello!

plural bug - fixed here

controller_class_name

controller_name

rails g controller home index

#app/assets/javascripts/homes_view.js.rb
Class HomesView

I tried to find it ...

mibamur commented 8 years ago

All done

now looked clearly

#assets_generator.rb
require 'rails/generators/named_base'

module Opal
  module Generators
    class AssetsGenerator < ::Rails::Generators::NamedBase
      source_root __dir__+'/templates'
      def copy_opal
        template 'javascript.js.rb', File.join('app/assets/javascripts', class_path, "#{file_name}.js.rb")
      end
    end
  end
end

and we should use class_name instead controller_class_name in templates

mibamur commented 8 years ago

ping @elia @meh @vais @Mogztter

I`d test it rails 5.0 ruby 2.3.1

README.md should have something about generators I do it all later

mibamur commented 8 years ago

Roadmap

opal-rails generators? For what?

Document.on 'turbolinks:load' do |evt|
  puts "turbolinks:load #{evt}"
end
  %body{ class: "#{controller_name} #{action_name}", "data-controller-name"=>"#{controller_name}" }

Something else here? Sockets? I do not have idea now

Rails.application do |config|
  if Rails.env.production?
    config.opal.source_map_enabled  = false
  end
  config.opal.optimized_operators = true
  config.opal.arity_check         = false
end
ggrossetie commented 8 years ago

@mibamur Hello, are you waiting something from me ?

mibamur commented 8 years ago

@Mogztter what should ClassView do? General idea is bind to action or anything, like controller.coffee?

elia commented 8 years ago

@mibamur sorry for the delay, I was quite busy in july and your PRs went off the radar.

I merged everything so far, thank you!

I like very much:

PRs for those would be very appreciated 😄.

As of sprockets4, support for it is under development. Sprockets support has been extracted to opal-sprockets to allow for independent upgrades.

elia commented 7 years ago

@mibamur is this still a work in progress or should I close the issue?

elia commented 7 years ago

Closing, let me know if you need to reopen this