Sha256: 27bb9f11ce1147a953827c4ca041c4d7e7b23bb3fbb7e83dd0f09349bc34a40d

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

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

      def scss_code
        File.read("#{url_front}/app/assets/stylesheets/keppler_frontend/app/views/#{name}.scss")
      end

      def install_scss
        out_file = File.open("#{url_front}/app/assets/stylesheets/keppler_frontend/app/views/#{name}.scss", "w")
        out_file.puts("/* Keppler - #{name}.scss file */");
        out_file.close
        true
      end

      def uninstall_scss
        file = "#{url_front}/app/assets/stylesheets/keppler_frontend/app/views/#{name}.scss"
        File.delete(file) if File.exist?(file)
        true
      end

      def update_css(css)
        obj = View.find(id)
        old_name = "#{url_front}/app/assets/stylesheets/keppler_frontend/app/views/#{obj.name}.scss"
        new_name = "#{url_front}/app/assets/stylesheets/keppler_frontend/app/views/#{css[:name]}.scss"
        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/scss_file.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.4 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.3 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.2 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1.pre.p1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb
keppler-2.1 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/scss_file.rb