tybo 0.0.14 → 0.0.16

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: f3e1659738fc5081c5c1f749ee9f5319bda7d3a6c14e00057f6bda6c637080fc
4
- data.tar.gz: b1c45b98c8a241ee91fa5b3a8a6d8b0be15d5f7fae59c7678b7f2f42480af442
3
+ metadata.gz: b169af454db8bbab7d10fc089d07ffed7c583758a604b5c477be16443b27634c
4
+ data.tar.gz: 32b3dcea7ecdd03445221e2db79c18515c7356d0c937afb562821634ceeeae2c
5
5
  SHA512:
6
- metadata.gz: 40755097ff8fc2b01d7f49e189645c548cea5c3d32bc12df6e3d4f6b498649e0a541f4a4dcbc0dd54e748539b1acb013fab0aa6cfe2b24471ae53f5a28637739
7
- data.tar.gz: 62597ee9ddf4815d0029e5be88ec1c515c4d8de5959b51e3f7392acfc35d49c8c3203422fbe6e9a5ee1326d53ab212a6b8ab0b96fc688624bf0617b4be3c28fa
6
+ metadata.gz: 30786f597f50c4c8a84f668d100332555104b8fbb05db4dc32107d430db529596f543ba00a43000a10d110f1411ec0bfbd5652c3fa00ad1ce38ee5f5e41b8bef
7
+ data.tar.gz: 1f659fa755ca430ec34f26ec6372d0424afe3ce36437917e7958589a904278116d5d3b047de59d6e71e6f9ec97304f9848e8d9be53e21c1e8da8ead3aa27c6fb
data/README.md CHANGED
@@ -48,7 +48,12 @@ add your policy logic in ApplicationController eg:
48
48
 
49
49
  ## Customize
50
50
 
51
- **Update images**: change `logo_url` and `cover_url` in `config/initializer/tybo.rb`
51
+ **Update images**: change image url in `config/initializer/tybo.rb`
52
+ ```
53
+ config.logo_url = 'your_logo.png'
54
+ config.nav_logo_url = 'your_nav_logo.png'
55
+ config.cover_url = 'your_cover.png'
56
+ ```
52
57
 
53
58
  **Customize colors**: Change the `tybo` colors class in `tailwind.config.js`,
54
59
  you can use https://uicolors.app/create to generate complete palette
@@ -2,7 +2,7 @@
2
2
  <div class="flex-1 flex flex-col min-h-0 bg-tybo">
3
3
  <div class="flex-1 flex flex-col pt-5 pb-4 overflow-y-auto">
4
4
  <div class="flex items-center flex-shrink-0 px-4">
5
- <%= image_tag(Tybo.configuration.logo_url, alt: "logo", class: 'mx-auto h-15 w-auto') %>
5
+ <%= image_tag(Tybo.configuration.nav_logo_url, alt: "logo", class: 'mx-auto h-15 w-auto') %>
6
6
  </div>
7
7
 
8
8
  <nav class="mt-5 flex-1 px-2 space-y-1" aria-label="Sidebar">
@@ -70,7 +70,7 @@ class BoGenerator < Rails::Generators::NamedBase
70
70
  def permited_params
71
71
  params = {}
72
72
  action_text_columns = has_one_assoc&.select { |a| a.options[:class_name] == 'ActionText::RichText' }
73
- model_columns&.map do |col|
73
+ permited_columns&.map do |col|
74
74
  params["#{col}".to_sym] = nil
75
75
  end
76
76
  action_text_columns&.map do |col|
@@ -68,7 +68,10 @@ module <%= options[:namespace].camelize %>
68
68
  private
69
69
 
70
70
  def set_<%= class_name.underscore %>
71
- @<%= class_name.underscore %> = <%= class_name %>.find(params[:id])
71
+ @<%= class_name.underscore %> = authorized_scope(
72
+ <%= class_name %>.all,
73
+ with: Bo::<%= options[:namespace].camelize %>::<%= class_name %>Policy
74
+ ).find(params[:id])
72
75
  end
73
76
 
74
77
  def <%= class_name.underscore %>_params
@@ -82,9 +85,5 @@ module <%= options[:namespace].camelize %>
82
85
  <%- end -%>
83
86
  )
84
87
  end
85
-
86
- def namespace
87
- @namespace ||= Bo::<%= options[:namespace].camelize %>
88
- end
89
88
  end
90
89
  end
@@ -2,11 +2,11 @@
2
2
  <%%
3
3
  current_page = if <%= class_name.underscore
4
4
  %>.persisted?
5
- { label: "Détails", path: <%= "#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%> }
5
+ { label: I18n.t('bo.show'), path: <%= "#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%> }
6
6
  else
7
- { label: "Nouvelle <%= class_name.underscore %>", path: <%= "new_#{options[:namespace]}_#{class_name.underscore}_path" %> }
7
+ { label: I18n.t('bo.<%= class_name.underscore %>.new').capitalize, path: <%= "new_#{options[:namespace]}_#{class_name.underscore}_path" %> }
8
8
  end
9
- form.with_title(<%= class_name.underscore %>.persisted? ? <%= class_name.underscore %>.<%=bo_model_title(bo_model)%> : 'Nouvelle <%= class_name.underscore %>')
9
+ form.with_title(<%= class_name.underscore %>.persisted? ? <%= class_name.underscore %>.<%=bo_model_title(bo_model)%> : I18n.t('bo.<%= class_name.underscore %>.new').capitalize)
10
10
  form.with_breadcrumb([
11
11
  { label: I18n.t('bo.<%= class_name.underscore %>.others').capitalize, path: <%= "#{options[:namespace]}_#{class_name.pluralize.underscore}_path"%> },
12
12
  current_page
@@ -5,4 +5,10 @@ class <%= class_name %>Controller < ApplicationController
5
5
  layout '<%= class_name.underscore %>'
6
6
  before_action :authenticate_<%= class_name.underscore %>!
7
7
  authorize :user, through: :current_<%= class_name.underscore %>
8
+
9
+ private
10
+
11
+ def namespace
12
+ @namespace ||= Bo::<%= class_name %>
13
+ end
8
14
  end
@@ -3,6 +3,7 @@
3
3
  Tybo.configure do |config|
4
4
  # customise logo and cover url
5
5
  # should be an external url or image should be present in (app/assets/images)
6
- # config.logo_url =
7
- # config.cover_url =
6
+ # config.logo_url = 'logo.png'
7
+ # config.nav_logo_url = 'nav_logo.png'
8
+ # config.cover_url = 'cover.png'
8
9
  end
@@ -1,5 +1,5 @@
1
1
  module Tybo
2
2
  class Configuration
3
- attr_accessor :logo_url, :cover_url
3
+ attr_accessor :logo_url, :cover_url, :nav_logo_url
4
4
  end
5
5
  end
data/lib/tybo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tybo
2
- VERSION = '0.0.14'
2
+ VERSION = '0.0.16'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tybo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michel Delpierre