Skip to content

Commit

Permalink
feature: kanban boards (preparation) (#3088)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Aug 2, 2024
1 parent 87fe58a commit 3e2743d
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize(field:, resource:)
end

def classes
base_classes = "py-4 rounded-xl max-w-full"
base_classes = "py-4 rounded-2xl max-w-full"

view_type_classes = if view_type == :list
"flex flex-col space-y-2"
Expand Down
2 changes: 1 addition & 1 deletion app/components/avo/paginator_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="flex flex-col sm:flex-row items-center justify-between aborder-t aborder-slate-200 rounded-xl space-y-2 sm:space-y-0">
<div class="flex flex-col sm:flex-row items-center justify-between aborder-t aborder-slate-200 rounded-2xl space-y-2 sm:space-y-0">
<div class="flex-2 sm:flex sm:items-center sm:justify-between">
<div>
<div class="text-sm leading-5 text-slate-600 flex items-center">
Expand Down
10 changes: 6 additions & 4 deletions app/components/avo/panel_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<%= content_tag :div, data: data_attributes, class: classes do %>
<%= content_tag :div, class: classes, data: data_attributes do %>
<%= render Avo::CoverPhotoComponent.new cover_photo: @cover_photo %>
<% if render_header? %>
<div data-target="panel-header" class="flex flex-col flex-1 w-full mb-4">
<div data-target="panel-header" class="flex flex-col w-full mb-4">
<div class="flex justify-center sm:justify-start flex-col sm:flex-row w-full flex-1 has-cover-photo:mt-0">
<%= render Avo::ProfilePhotoComponent.new profile_photo: @profile_photo %>
<div class="flex flex-col flex-1 w-full">
Expand Down Expand Up @@ -55,9 +55,11 @@
</div>
<% end %>
<% if bare_content? %>
<div data-target="panel-bare-content" class="relative <% if sidebar? %> has-sidebar <% end %>">
<%= content_tag :div, class: class_names("relative flex flex-1", "has-sidebar": sidebar?), data: {
target: :"panel-bare-content"
} do %>
<%= bare_content %>
</div>
<% end %>
<% end %>
<% if footer_tools? %>
<div
Expand Down
3 changes: 2 additions & 1 deletion app/views/avo/actions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
size: :sm,
data: {
target: :submit_action,
}, autofocus: @fields.reject { |field| field.is_a?(Avo::Fields::HiddenField) }.empty? do %>
},
autofocus: @fields.reject { |field| field.is_a?(Avo::Fields::HiddenField) }.empty? do %>
<%= @action.confirm_button_label %>
<% end %>
<% end %>
Expand Down
3 changes: 1 addition & 2 deletions app/views/layouts/avo/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
<%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
<% else %>
<%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
<% if Rails.env.development? %>
<% if Rails.env.development? && defined?(Hotwire::Livereload) %>
<%= javascript_include_tag "hotwire-livereload", defer: true %>
<% end %>
<% end %>
<%= render Avo::AssetManager::JavascriptComponent.new asset_manager: Avo.asset_manager %>
<%= render partial: "avo/partials/head" %>
<%= turbo_refreshes_with method: :replace, scroll: :reset %>
<%= content_for :head %>
</head>
<body class="bg-application os-mac">
Expand Down
1 change: 1 addition & 0 deletions lib/avo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def mount_engines
mount Avo::DynamicFilters::Engine, at: "/avo-dynamic_filters" if defined?(Avo::DynamicFilters::Engine)
mount Avo::Dashboards::Engine, at: "/dashboards" if defined?(Avo::Dashboards::Engine)
mount Avo::Pro::Engine, at: "/avo-pro" if defined?(Avo::Pro::Engine)
mount Avo::Kanban::Engine, at: "/boards" if defined?(Avo::Kanban::Engine)
}
end

Expand Down
6 changes: 3 additions & 3 deletions lib/generators/avo/templates/initializer/avo.tt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Avo.configure do |config|
end

## == Authentication ==
# config.current_user_method = {}
# config.is_admin_method = :is_admin
# config.is_developer_method = :is_developer
# config.current_user_method = :current_user
# config.authenticate_with do
# end

## == Authorization ==
# config.is_admin_method = :is_admin
# config.is_developer_method = :is_developer
# config.authorization_methods = {
# index: 'index?',
# show: 'show?',
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/avo_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ task "avo:sym_link" do
`touch #{packages_path}/.keep`
end

["avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu"].each do |gem|
["avo-advanced", "avo-pro", "avo-dynamic_filters", "avo-dashboards", "avo-menu", "avo-kanban"].each do |gem|
path = `bundle show #{gem} 2> /dev/null`.chomp

# If path is emty we check if package is defined outside of root (on release process it is)
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def permissions
create: true,
update: false,
read: true,
delete: true
delete: true,
}
end
end
110 changes: 55 additions & 55 deletions spec/dummy/config/initializers/avo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,61 +78,61 @@
config.search_results_count = 8

## == Menus ==
config.main_menu = -> do
section "Resources", icon: "heroicons/solid/building-storefront", collapsable: true, collapsed: false do
group "Company", collapsable: true do
resource :projects
resource :team
resource :team_membership
resource :reviews
end

group "People", collapsable: true do
resource "User"
resource :people
resource :spouses
end

group "Education", collapsable: true do
resource :course
resource :course_link
end

group "Blog", collapsable: true do
# resource :z_posts
resource :posts
resource :comments
resource :photo_comments
end

section "Store", icon: "heroicons/outline/currency-dollar" do
resource :products
resource :stores
end

group "Other", collapsable: true, collapsed: true do
resource :fish, label: "Fishies"
resource :events
end
end

section "Geography", icon: "heroicons/outline/globe", collapsable: true, collapsed: true do
resource :city
end

section "Tools", icon: "heroicons/outline/finger-print", collapsable: true, collapsed: true do
all_tools
end

group do
link "Avo", "https://avohq.io"
link_to "Google", "https://google.com", target: :_blank
end
end
config.profile_menu = -> do
link "Profile", path: "/profile", icon: "heroicons/outline/user-circle"
# link_to "Sign out", path: main_app.destroy_user_session_path, icon: "user-circle", method: :post, params: {hehe: :hoho}
end
# config.main_menu = -> do
# section "Resources", icon: "heroicons/solid/building-storefront", collapsable: true, collapsed: false do
# group "Company", collapsable: true do
# resource :projects
# resource :team
# resource :team_membership
# resource :reviews
# end

# group "People", collapsable: true do
# resource "User"
# resource :people
# resource :spouses
# end

# group "Education", collapsable: true do
# resource :course
# resource :course_link
# end

# group "Blog", collapsable: true do
# # resource :z_posts
# resource :posts
# resource :comments
# resource :photo_comments
# end

# section "Store", icon: "heroicons/outline/currency-dollar" do
# resource :products
# resource :stores
# end

# group "Other", collapsable: true, collapsed: true do
# resource :fish, label: "Fishies"
# resource :events
# end
# end

# section "Geography", icon: "heroicons/outline/globe", collapsable: true, collapsed: true do
# resource :city
# end

# section "Tools", icon: "heroicons/outline/finger-print", collapsable: true, collapsed: true do
# all_tools
# end

# group do
# link "Avo", "https://avohq.io"
# link_to "Google", "https://google.com", target: :_blank
# end
# end
# config.profile_menu = -> do
# link "Profile", path: "/profile", icon: "heroicons/outline/user-circle"
# # link_to "Sign out", path: main_app.destroy_user_session_path, icon: "user-circle", method: :post, params: {hehe: :hoho}
# end

# config.pagination = -> do
# {
Expand Down
5 changes: 2 additions & 3 deletions tailwind.preset.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function contentPaths(basePath) {
module.exports = {
content: [
...contentPaths('./tmp/avo/packages/*'),
...contentPaths('./../avo-kanban/*'),
...contentPaths(avoPath),
],
theme: {
Expand Down Expand Up @@ -50,9 +51,6 @@ module.exports = {
'1/2': '50%',
full: '100%',
},
borderRadius: {
xl: '1rem',
},
boxShadow: {
row: '0 0 15px -5px rgba(0, 0, 0, 0.25)',
context: '0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 0 25px -5px rgba(0, 0, 0, 0.1)',
Expand Down Expand Up @@ -161,6 +159,7 @@ module.exports = {
addVariant('has-cover-photo', '.has-cover-photo & ')
addVariant('index-grid-view', '.index-grid-view & ')
addVariant('index-table-view', '.index-table-view & ')
addVariant('kanban-dragging', '.kanban-dragging & ')
}),
],
}

0 comments on commit 3e2743d

Please sign in to comment.