app/helpers/lesli/assets_helper.rb in lesli-5.0.11 vs app/helpers/lesli/assets_helper.rb in lesli-5.0.13

- old
+ new

@@ -17,11 +17,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. Lesli · Ruby on Rails SaaS Development Framework. -Made with ♥ by https://www.lesli.tech +Made with ♥ by LesliTech Building a better future, one line of code at a time. @contact hello@lesli.tech @website https://www.lesli.tech @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html @@ -37,33 +37,51 @@ # lesli_application_stylesheet_path() -> stylesheet from main app # lesli_application_stylesheet_path(:lesli) -> stylesheet from Lesli # lesli_application_stylesheet_path(:engine) (TODO) -> stylesheet from engine current # lesli_application_stylesheet_path(:cloud_driver) -> stylesheet from engine specific def lesli_application_stylesheet_path(engine = nil) + + # Stylesheets from specific engine return "#{engine}/templates/application" if engine - "#{lesli_engine(:code)}/application" + # Get current engine information + lesli_engine_code = lesli_engine(:code) + + # Rails main host app stylesheets + return "application" if lesli_engine_code == "root" + + # Rails engines stylesheets + "#{lesli_engine_code}/application" end # Return a string path to load the main engine stylesheet def application_stylesheet_engine_path - cloud_module = lesli_engine(:code) + lesli_engine = lesli_engine(:code) return "administration/application" if is_lesli_administration? return "onboardings/application" if is_lesli_onboarding? - "#{cloud_module}/application" + "#{lesli_engine}/application" end # Return a string path to load the main javascript app of the engine def lesli_application_javascript_path # get the namespace to load specific javascript file # for engine or specific javascript file for core controller - path_segments = controller_path.split("/") - cloud_module = path_segments.shift + # path_segments = controller_path.split("/") + # lesli_engine = path_segments.shift - return "onboardings/application" if is_lesli_onboarding? + # return "onboardings/application" if is_lesli_onboarding? - "#{cloud_module}/application" + + + # Get current engine information + lesli_engine_code = lesli_engine(:code) + + # Rails main host app stylesheets + return "application" if lesli_engine_code == "root" + + # Rails engines stylesheets + "#{lesli_engine_code}/application" end def javascript_googlemaps_sdk "<script type=\"application/javascript\" src=\"https://maps.googleapis.com/maps/api/js?key=#{Rails.application.credentials.dig( :providers, :google, :maps_sdk_token