plutonium 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cd810654b7f478348594edd4972ff72e3f0528adbc35feedf4c6da74b29964b
4
- data.tar.gz: e1e734d466dafd92710104ef714ff6b7f225a9813b3c5315d3ea8bbf9b47edb2
3
+ metadata.gz: 13471e736d83c0f9cb32571c6a65d3c88d0085c2281386bf831736bf7bb12daa
4
+ data.tar.gz: 880a7edcc4fe4abc6507d6f701997c9d9e5a4e5f090bfb76f518bcdf6dd11652
5
5
  SHA512:
6
- metadata.gz: 94ee927e45efaa80f88d32e94ccfe6225b815bb6674b59a217f5a4f87b4a40a64efc7599968f894a7dc059bbd28672260f40d32db93a6f0d7cc4115313458db1
7
- data.tar.gz: 648290295c54d176fbad95ee7c495e091d9d3f6704c55c00f06dd4ac2b37fd9a14d87b64075bb175292648c2c3bceba37151f1f58c03410beb5b8cd2ca78b9bc
6
+ metadata.gz: a44f71032bc167846977f7f1a784e3671fc3e06c7a2db8c6fe4e1caa1517f55bea93fa7f5bff81d396b0ccbc92e86fb2e73c87989f5be55f5c2adfb18b6da99c
7
+ data.tar.gz: ff20cdacd085bb0dcdfe9151ec6643cba9a961f5b63562402d23c3be295345a2c881c8faeff4cdf4c36af38db3cacc63b212aa297961315b2a2874140fd37ccb
@@ -1,8 +1,6 @@
1
- <%= render_component :resource_header, brand_name: nil do |header| %>
2
- <% header.with_brand_logo do %>
3
- <%= logo_tag classname: "mr-3 h-10" %>
4
- <% end %>
1
+ <%# locals: (sidebar_toggle:) %>
5
2
 
3
+ <%= render_component :resource_header, sidebar_toggle: do |header| %>
6
4
  <% header.with_action do %>
7
5
  <%=
8
6
  render_component :nav_grid_menu, label: "Apps" do |menu|
@@ -1,36 +1,38 @@
1
1
  <nav <%= attributes_html %>>
2
2
  <div class="flex flex-wrap justify-between items-center">
3
3
  <div class="flex justify-start items-center">
4
- <button
5
- data-drawer-target="drawer-navigation"
6
- data-drawer-toggle="drawer-navigation"
7
- aria-controls="drawer-navigation"
8
- class="p-2 mr-2 text-gray-600 rounded-lg cursor-pointer lg:hidden hover:text-gray-900 hover:bg-gray-100 focus:bg-gray-100 dark:focus:bg-gray-700 focus:ring-2 focus:ring-gray-100 dark:focus:ring-gray-700 dark:text-gray-200 dark:hover:bg-gray-700 dark:hover:text-white">
9
- <svg
10
- aria-hidden="true"
11
- class="w-6 h-6"
12
- fill="currentColor"
13
- viewBox="0 0 20 20"
14
- xmlns="http://www.w3.org/2000/svg">
15
- <path
16
- fill-rule="evenodd"
17
- d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h6a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
18
- clip-rule="evenodd"
19
- ></path>
20
- </svg>
21
- <svg
22
- aria-hidden="true"
23
- class="hidden w-6 h-6"
24
- fill="currentColor"
25
- viewBox="0 0 20 20"
26
- xmlns="http://www.w3.org/2000/svg">
27
- <path
28
- fill-rule="evenodd"
29
- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
30
- clip-rule="evenodd"></path>
31
- </svg>
32
- <span class="sr-only">Toggle sidebar</span>
33
- </button>
4
+ <% if sidebar_toggle %>
5
+ <button
6
+ data-drawer-target="drawer-navigation"
7
+ data-drawer-toggle="drawer-navigation"
8
+ aria-controls="drawer-navigation"
9
+ class="p-2 mr-2 text-gray-600 rounded-lg cursor-pointer lg:hidden hover:text-gray-900 hover:bg-gray-100 focus:bg-gray-100 dark:focus:bg-gray-700 focus:ring-2 focus:ring-gray-100 dark:focus:ring-gray-700 dark:text-gray-200 dark:hover:bg-gray-700 dark:hover:text-white">
10
+ <svg
11
+ aria-hidden="true"
12
+ class="w-6 h-6"
13
+ fill="currentColor"
14
+ viewBox="0 0 20 20"
15
+ xmlns="http://www.w3.org/2000/svg">
16
+ <path
17
+ fill-rule="evenodd"
18
+ d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h6a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
19
+ clip-rule="evenodd"
20
+ ></path>
21
+ </svg>
22
+ <svg
23
+ aria-hidden="true"
24
+ class="hidden w-6 h-6"
25
+ fill="currentColor"
26
+ viewBox="0 0 20 20"
27
+ xmlns="http://www.w3.org/2000/svg">
28
+ <path
29
+ fill-rule="evenodd"
30
+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
31
+ clip-rule="evenodd"></path>
32
+ </svg>
33
+ <span class="sr-only">Toggle sidebar</span>
34
+ </button>
35
+ <% end %>
34
36
  <% if brand_name.present? || brand_logo.present? %>
35
37
  <a href="<%= root_path %>" class="flex items-center justify-between md:min-w-60">
36
38
  <%= brand_logo if brand_logo.present? %>
@@ -3,7 +3,9 @@ module PlutoniumUi
3
3
  renders_one :brand_logo
4
4
  renders_many :actions
5
5
 
6
- option :brand_name
6
+ option :brand_name, optional: true
7
+ option :default_brand_logo, default: -> { true }
8
+ option :sidebar_toggle, default: -> { false }
7
9
 
8
10
  private
9
11
 
@@ -14,6 +16,14 @@ module PlutoniumUi
14
16
  controller: "resource-header"
15
17
  }
16
18
  end
19
+
20
+ def before_render
21
+ return if brand_logo.present? || !default_brand_logo
22
+
23
+ with_brand_logo do
24
+ resource_logo_tag classname: "mr-3 h-10"
25
+ end
26
+ end
17
27
  end
18
28
  end
19
29
 
@@ -7,11 +7,28 @@
7
7
  <%= csrf_meta_tags %>
8
8
  <%= csp_meta_tag %>
9
9
 
10
+ <% if default_turbo_tag %>
11
+ <meta name="turbo-cache-control" content="no-cache">
12
+ <meta name="turbo-refresh-method" content="morph">
13
+ <meta name="turbo-refresh-scroll" content="preserve">
14
+ <% end %>
15
+
10
16
  <%= meta %>
11
17
  <%= favicon %>
12
- <%= fonts %>
18
+
19
+ <% if default_fonts_tag %>
20
+ <link rel="preconnect" href="https://fonts.googleapis.com">
21
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
22
+ <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap" rel="stylesheet">
23
+ <% end %>
24
+
25
+ <% if default_assets_tag %>
26
+ <%= resource_stylesheet_tag %>
27
+ <%= resource_script_tag %>
28
+ <% end %>
29
+
13
30
  <%= assets %>
14
- <%= after_head %>
31
+ <%= head %>
15
32
  <%# <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.snow.min.css" integrity="sha512-/FHUK/LsH78K9XTqsR9hbzr21J8B8RwHR/r8Jv9fzry6NVAOVIGFKQCNINsbhK7a1xubVu2r5QZcz2T9cKpubw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
16
33
  <script src="https://cdnjs.cloudflare.com/ajax/libs/quill/1.3.7/quill.min.js" integrity="sha512-P2W2rr8ikUPfa31PLBo5bcBQrsa+TNj8jiKadtaIrHQGMo6hQM6RdPjQYxlNguwHz8AwSQ28VkBK6kHBLgd/8g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
17
34
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/2.6.0/slimselect.min.css" integrity="sha512-GvqWM4KWH8mbgWIyvwdH8HgjUbyZTXrCq0sjGij9fDNiXz3vJoy3jCcAaWNekH2rJe4hXVWCJKN+bEW8V7AAEQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
@@ -2,9 +2,8 @@ module PlutoniumUi
2
2
  class ResourceLayoutComponent < PlutoniumUi::Base
3
3
  renders_one :meta
4
4
  renders_one :favicon
5
- renders_one :fonts
6
5
  renders_one :assets
7
- renders_one :after_head
6
+ renders_one :head
8
7
  renders_one :header
9
8
  renders_one :sidebar
10
9
 
@@ -14,6 +13,9 @@ module PlutoniumUi
14
13
  option :main_classname, default: -> { "p-4 h-auto" }
15
14
  option :header_adjustment, default: -> { "pt-20" }
16
15
  option :sidebar_adjustment, default: -> { "lg:ml-64" }
16
+ option :default_turbo_tag, default: -> { true }
17
+ option :default_fonts_tag, default: -> { true }
18
+ option :default_assets_tag, default: -> { true }
17
19
 
18
20
  private
19
21
 
@@ -1,28 +1,11 @@
1
- <%= render_component :resource_layout, page_title: make_page_title(@page_title), lang: "en" do |layout| %>
2
-
3
- <% layout.with_meta do %>
4
- <meta name="turbo-cache-control" content="no-cache">
5
- <meta name="turbo-refresh-method" content="morph">
6
- <meta name="turbo-refresh-scroll" content="preserve">
7
- <% end %>
8
-
1
+ <%= render_component :resource_layout, lang: "en",
2
+ page_title: make_page_title(@page_title) do |layout| %>
9
3
  <% layout.with_favicon do %>
10
- <%= favicon_link_tag "plutonium.ico" %>
11
- <% end %>
12
-
13
- <% layout.with_fonts do %>
14
- <link rel="preconnect" href="https://fonts.googleapis.com">
15
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
16
- <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap" rel="stylesheet">
17
- <% end %>
18
-
19
- <% layout.with_assets do %>
20
- <%= plutonium_stylesheet_tag %>
21
- <%= plutonium_script_tag %>
4
+ <%= resource_favicon_tag %>
22
5
  <% end %>
23
6
 
24
7
  <% layout.with_header do %>
25
- <%= render("resource_header") %>
8
+ <%= render("resource_header", sidebar_toggle: true) %>
26
9
  <% end %>
27
10
 
28
11
  <% layout.with_sidebar do %>
@@ -1,30 +1,12 @@
1
1
  <%= render_component :resource_layout, page_title: @page_title,
2
2
  lang: "en",
3
3
  main_classname: "flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0" do |layout| %>
4
-
5
- <% layout.with_meta do %>
6
- <meta name="turbo-cache-control" content="no-cache">
7
- <meta name="turbo-refresh-method" content="morph">
8
- <meta name="turbo-refresh-scroll" content="preserve">
9
- <% end %>
10
-
11
4
  <% layout.with_favicon do %>
12
- <%= favicon_link_tag "plutonium.ico" %>
13
- <% end %>
14
-
15
- <% layout.with_fonts do %>
16
- <link rel="preconnect" href="https://fonts.googleapis.com">
17
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
18
- <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap" rel="stylesheet">
19
- <% end %>
20
-
21
- <% layout.with_assets do %>
22
- <%= plutonium_stylesheet_tag %>
23
- <%= plutonium_script_tag %>
5
+ <%= resource_favicon_tag %>
24
6
  <% end %>
25
7
 
26
8
  <p class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
27
- <%= logo_tag classname: "w-24 h-24 mr-2" %>
9
+ <%= resource_logo_tag classname: "w-24 h-24 mr-2" %>
28
10
  </p>
29
11
  <div class="w-full max-w-md bg-white rounded-lg shadow dark:border md:mt-0 xl:p-0 dark:bg-gray-800 dark:border-gray-700">
30
12
  <div class="w-full p-6 space-y-4 md:space-y-6 sm:p-8">
@@ -32,7 +14,7 @@
32
14
  </div>
33
15
  </div>
34
16
  <div class="mt-4 flex items-center font-medium text-blue-600 dark:text-blue-500 hover:underline">
35
- <%= Plutonium::Icons.render "outline/home" %>
17
+ <%= render_icon "outline/home" %>
36
18
  <%= link_to "Home", root_path, class: "font-medium text-blue-600 dark:text-blue-500" %>
37
19
  </div>
38
20
  <% end %>
@@ -35,6 +35,9 @@ module Pu
35
35
  import { registerControllers } from "@radioactive-labs/plutonium"
36
36
  registerControllers(application)
37
37
  EOT
38
+
39
+ environment "config.plutonium.assets.stylesheet = \"application\""
40
+ environment "config.plutonium.assets.script = \"application\""
38
41
  end
39
42
  end
40
43
  end
@@ -29,8 +29,11 @@ module Pu
29
29
  end
30
30
 
31
31
  def setup_app
32
- directory "config"
32
+ # directory "config"
33
33
  directory "app"
34
+
35
+ environment "# config.plutonium.assets.favicon = \"favicon.ico\""
36
+ environment "# config.plutonium.assets.logo = \"logo.png\""
34
37
  end
35
38
 
36
39
  def install_required_gems
@@ -1,4 +1 @@
1
1
  # Configure plutonium
2
-
3
- # # set a custom global logo
4
- # Plutonium::Config.logo = "custom-logo.png"
@@ -1,33 +1,41 @@
1
1
  module Plutonium
2
2
  module Helpers
3
3
  module AssetsHelper
4
- def plutonium_stylesheet_tag
4
+ def resource_stylesheet_tag
5
5
  url = if Plutonium.development?
6
- file = JSON.parse(File.read(Plutonium.root.join("src", "build", "css.manifest")))["plutonium.css"]
7
- "/build/#{file}"
6
+ filename = JSON.parse(File.read(Plutonium.root.join("src", "build", "css.manifest")))["plutonium.css"]
7
+ "/build/#{filename}"
8
8
  else
9
- "plutonium.css"
9
+ resource_stylesheet_asset
10
10
  end
11
11
  stylesheet_link_tag url, "data-turbo-track": "reload"
12
12
  end
13
13
 
14
- def plutonium_script_tag
14
+ def resource_script_tag
15
15
  url = if Plutonium.development?
16
- file = JSON.parse(File.read(Plutonium.root.join("src", "build", "js.manifest")))["plutonium.js"]
17
- "/build/#{file}"
16
+ filename = JSON.parse(File.read(Plutonium.root.join("src", "build", "js.manifest")))["plutonium.js"]
17
+ "/build/#{filename}"
18
18
  else
19
- "plutonium.min.js"
19
+ resource_script_asset
20
20
  end
21
21
  javascript_include_tag url, "data-turbo-track": "reload", type: "module"
22
22
  end
23
23
 
24
- def logo_tag(classname:)
25
- image_tag logo, class: classname
24
+ def resource_favicon_tag
25
+ favicon_link_tag resource_favicon_asset
26
26
  end
27
27
 
28
- def logo
29
- Plutonium::Config.logo || "plutonium-logo.png"
28
+ def resource_logo_tag(classname:)
29
+ image_tag resource_logo_asset, class: classname
30
30
  end
31
+
32
+ def resource_logo_asset = Rails.application.config.plutonium.assets.logo
33
+
34
+ def resource_stylesheet_asset = Rails.application.config.plutonium.assets.stylesheet
35
+
36
+ def resource_script_asset = Rails.application.config.plutonium.assets.script
37
+
38
+ def resource_favicon_asset = Rails.application.config.plutonium.assets.favicon
31
39
  end
32
40
  end
33
41
  end
@@ -6,6 +6,12 @@ module Plutonium
6
6
  config.plutonium.cache_discovery = defined?(Rails.env) && !Rails.env.development?
7
7
  config.plutonium.enable_hotreload = defined?(Rails.env) && Rails.env.development?
8
8
 
9
+ config.plutonium.assets = ActiveSupport::OrderedOptions.new
10
+ config.plutonium.assets.logo = "plutonium.png"
11
+ config.plutonium.assets.favicon = "plutonium.ico"
12
+ config.plutonium.assets.stylesheet = "plutonium.css"
13
+ config.plutonium.assets.script = "plutonium.min.js"
14
+
9
15
  # If you don't want to precompile Plutonium's assets (eg. because you're using webpack),
10
16
  # you can do this in an intiailzer:
11
17
  #
@@ -1,3 +1,3 @@
1
1
  module Plutonium
2
- VERSION = "0.11.0"
2
+ VERSION = "0.11.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plutonium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Froelich
@@ -708,15 +708,15 @@ files:
708
708
  - app/assets/icons/solid/youtube.svg
709
709
  - app/assets/icons/solid/zoom-in.svg
710
710
  - app/assets/icons/solid/zoom-out.svg
711
- - app/assets/plutonium-logo-original.png
712
- - app/assets/plutonium-logo-white.png
713
- - app/assets/plutonium-logo.png
711
+ - app/assets/plutonium-original.png
712
+ - app/assets/plutonium-white.png
714
713
  - app/assets/plutonium.css
715
714
  - app/assets/plutonium.ico
716
715
  - app/assets/plutonium.js
717
716
  - app/assets/plutonium.js.map
718
717
  - app/assets/plutonium.min.js
719
718
  - app/assets/plutonium.min.js.map
719
+ - app/assets/plutonium.png
720
720
  - app/views/application/_flash.html.erb
721
721
  - app/views/application/_flash_alerts.html.erb
722
722
  - app/views/application/_flash_toasts.html.erb
File without changes