Sha256: 421881bd423cc6fabab9026807251a78340d4a248447ae158662972be6bab8be

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

# HtmlFile Module
module KepplerFrontend
  module Concerns
    module Partials
      module JsFile
        extend ActiveSupport::Concern

        def js_code
          File.read("#{url_front}/app/assets/javascripts/keppler_frontend/app/partials/#{name}.js")
        end

        def install_js
          out_file = File.open("#{url_front}/app/assets/javascripts/keppler_frontend/app/partials/#{name}.js", "w")
          out_file.puts("// Insert js code here...");
          out_file.close
          true
        end

        def uninstall_js
          file = "#{url_front}/app/assets/javascripts/keppler_frontend/app/partials/#{name}.js"
          File.delete(file) if File.exist?(file)
          true
        end

        def update_js(js)
          obj = Partial.find(id)
          old_name = "#{url_front}/app/assets/javascripts/keppler_frontend/app/partials/#{obj.name}.js"
          new_name = "#{url_front}/app/assets/javascripts/keppler_frontend/app/partials/#{js[:name]}.js"
          File.rename(old_name, new_name)
        end

        private

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.21 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.20 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.19 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.18 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.17 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.16 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.4 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb
keppler-2.1.3 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/partials/js_file.rb