Sha256: fedd97530e896f5a54483ce82d25e7e919f9fd89d9167e27acf34bc6d8f506e6

Contents?: true

Size: 1.11 KB

Versions: 17

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

# HtmlFile Module
module KepplerFrontend
  module Concerns
    module ViewJsFile
      extend ActiveSupport::Concern

      def view_js_code
        html=File.readlines("#{url_front}/app/views/keppler_frontend/app/frontend/#{name}.js.erb")
        html.join
      end

      def install_view_js
        out_file = File.open("#{url_front}/app/views/keppler_frontend/app/frontend/#{name}.js.erb", "w")
        out_file.puts("// #{name} javascript Erb template");
        out_file.close
        true
      end

      def uninstall_view_js
        file = "#{url_front}/app/views/keppler_frontend/app/frontend/#{name}.js.erb"
        File.delete(file) if File.exist?(file)
        true
      end

      def update_view_js(view_js)
        obj = View.find(id)
        old_name = "#{url_front}/app/views/keppler_frontend/app/frontend/#{obj.name}.js.erb"
        new_name = "#{url_front}/app/views/keppler_frontend/app/frontend/#{html[:name]}.js.erb"
        File.rename(old_name, new_name)
      end

      private

      def url_front
        "#{Rails.root}/rockets/keppler_frontend"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.4 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.3 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.2 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1.pre.p1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb
keppler-2.1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/view_js_file.rb