Skip to content

Commit

Permalink
Merge pull request #3792 from 3scale/managed-services-essential-asset…
Browse files Browse the repository at this point in the history
…s-fix

Managed services essential assets fix
  • Loading branch information
josemigallas authored May 16, 2024
2 parents 1997353 + 6da03a0 commit d0686f3
Show file tree
Hide file tree
Showing 7 changed files with 1,175 additions and 8 deletions.
2 changes: 2 additions & 0 deletions app/assets/javascripts/vendor/jquery-migrate-1.2.1.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions features/developer_portal/backwards_compatibility.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@allow-rescue
Feature: Dev portal backwards compatibility

As a long time 3scale user, I don't want any new updates in 3scale to break my developer portal.

Background:
Given a provider
And the current domain is "foo.3scale.localhost"

Scenario: Essential assets
Given the provider has main layout with:
"""
<html>
<head>
{% essential_assets %}
</head>
<body>
Good news everyone!
</body>
</html>
"""
And the cms page "/" has main layout
When they go to the homepage
Then they should see "Good news everyone!"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//= require flash-buyer
//= require remote
//= require switch
//= require ajax_upload
//= require autosubmit
//= require extra_fields

Expand Down
14 changes: 14 additions & 0 deletions lib/developer_portal/app/views/shared/_essential_assets.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<%= csrf_meta_tag %>

<%= javascript_include_tag "vendor/jquery-#{defined?(jquery) ? jquery : '2.1.4'}.min.js" %>

<%= javascript_include_tag 'vendor/jquery-migrate-1.2.1.min.js' %>

<%= javascript_include_tag 'vendor/colorbox/jquery.colorbox-min.js' %>
<%= stylesheet_link_tag 'colorbox/colorbox.css' %>

<%= javascript_include_tag 'highlight/highlight.pack.js' %>
<%= javascript_include_tag 'flash', 'remote', 'switch', 'extra_fields' %>
<%= javascript_include_tag 'application' %>

<%= yield :javascripts %>
4 changes: 3 additions & 1 deletion lib/developer_portal/lib/liquid/tags/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class Container < Base

example "Using container tag in liquid", %{
<html>
<head></head>
<head>
{% essential_assets %}
</head>
<body>
{% container main %}
<p class="notice">If a CMS page uses this layout you will have a container at your disposal to add content to.</p>
Expand Down
17 changes: 11 additions & 6 deletions lib/developer_portal/lib/liquid/tags/essential_assets.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# frozen_string_literal: true

module Liquid
module Tags
class EssentialAssets < Liquid::Tags::Base
deprecated 'This is outdated and should not be use anymore.'
include Liquid::Tags::ContentFor::ContentFor
nodoc!

# this makes versioning harder, delete it

# This exists for backwards compatibility. Some very old dev portals may still be using tag
# {% essential_assets %} and thus loading old libraries and overriding our updates.
def render(context); end
def render(context)
[
stylesheets.render(context),
render_erb(context, "shared/essential_assets"),
javascripts.render(context)
].join.html_safe
end
end
end
end
Loading

0 comments on commit d0686f3

Please sign in to comment.