Skip to content

Commit

Permalink
allow to change the profile picture + change the wording of the top b…
Browse files Browse the repository at this point in the history
…anner + minor bug/fixes and UX/UI improvements
  • Loading branch information
did committed Jul 25, 2024
1 parent 5c55680 commit 15c9c7b
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 39 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ gem 'maglevcms', github: 'maglevhq/maglev-core', branch: 'master', require: fals

source 'https://packages.nocoffee.fr/private' do
# MaglevCMS PRO: multi-sites, multi-themes
gem 'maglevcms-pro', '~> 0.3.1', require: 'maglev/pro'
gem 'maglevcms-pro', '~> 0.4.0', require: 'maglev/pro'

# NoCoffee UIKit to build sleek and consistent UI
gem 'ncuikit', '~> 0.1.1'
gem 'ncuikit', '~> 0.2.0'
end

gem "redcarpet", "~> 3.6"
Expand Down
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/maglevhq/maglev-core.git
revision: 302e7f63267379c5a2bf8ff18716ab38244ec5d0
revision: da606a424d1781a59ed27fcadca8c610019fa074
branch: master
specs:
maglevcms (1.6.0)
maglevcms (1.6.1)
jbuilder (~> 2.11.2)
kaminari (~> 1.2.1)
maglev-injectable (~> 2.1.1)
Expand All @@ -14,15 +14,15 @@ GIT
GEM
remote: https://packages.nocoffee.fr/private/
specs:
maglevcms-pro (0.3.2)
maglevcms-pro (0.4.0)
concurrent-ruby
faraday
haikunator (= 1.1.0)
jbuilder (~> 2.11.2)
kaminari
liquid (~> 5.4)
rails (>= 6.1.6)
ncuikit (0.1.1)
ncuikit (0.2.0)
importmap-rails (~> 2.0, >= 2.0.1)
rails (>= 7.1.3.2)
stimulus-rails (~> 1.2)
Expand Down Expand Up @@ -134,7 +134,7 @@ GEM
dry-cli (1.0.0)
error_highlight (0.6.0)
erubi (1.12.0)
faraday (2.9.1)
faraday (2.9.2)
faraday-net_http (>= 2.0, < 3.2)
faraday-net_http (3.1.0)
net-http
Expand Down Expand Up @@ -317,7 +317,7 @@ GEM
vite_rails (3.0.17)
railties (>= 5.1, < 8)
vite_ruby (~> 3.0, >= 3.2.2)
vite_ruby (3.5.0)
vite_ruby (3.6.0)
dry-cli (>= 0.7, < 2)
rack-proxy (~> 0.6, >= 0.6.1)
zeitwerk (~> 2.2)
Expand Down Expand Up @@ -354,8 +354,8 @@ DEPENDENCIES
importmap-rails
jbuilder
maglevcms!
maglevcms-pro (~> 0.3.1)!
ncuikit (~> 0.1.1)!
maglevcms-pro (~> 0.4.0)!
ncuikit (~> 0.2.0)!
pg (~> 1.1)
puma (>= 5.0)
rails (~> 7.1.2)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/config/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
//= link_tree ../../javascript .js
//= link_tree ../../../vendor/javascript .js
//= link_tree ../builds
//= link ncuikit_manifest.js
//= link ncuikit_manifest.js
4 changes: 2 additions & 2 deletions app/controllers/current_user_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def destroy
private
# Use callbacks to share common setup or constraints between actions.
def set_user
@user = current_user
@user = User.find(current_user.id)
end

# Only allow a list of trusted parameters through.
def user_params
params.require(:user).permit(:email, :password, :password_confirmation)
params.require(:user).permit(:avatar, :email, :password, :password_confirmation)
end
end
2 changes: 2 additions & 0 deletions app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Application } from "@hotwired/stimulus"

const application = Application.start()

ActiveStorage.start()

// Configure Stimulus development experience
application.debug = false
window.Stimulus = application
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ eagerLoadControllersFrom("controllers", application)

// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
// lazyLoadControllersFrom("controllers", application)
// lazyLoadControllersFrom("controllers", application)
3 changes: 3 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ class User < ApplicationRecord
## validations ##
validates :email, presence: true, uniqueness: true

## Attachments ##
has_one_attached :avatar

end
5 changes: 4 additions & 1 deletion app/views/current_user/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<%= form_with(model: @user, url: current_user_path) do |form| %>
<div class="grid grid-cols-1 gap-x-6 gap-y-6 sm:grid-cols-6">
<div class="sm:col-span-3">
<%= render_ncuikit_form :avatar_field, form: form, attribute: :avatar %>
</div>
<div class="sm:col-start-1 sm:col-span-3">
<%= render_ncuikit_form :email_field, form: form, attribute: :email %>
</div>

Expand All @@ -16,7 +19,7 @@
</div>

<div class="mt-12 text-right border-t border-gray-900/10 pt-6">
<%= render_ncuikit_button :primary_submit, label: 'Update' %>
<%= render_ncuikit_button :primary_submit, label: 'Update', size: 'lg' %>
</div>
<% end %>
<% end %>
13 changes: 0 additions & 13 deletions app/views/layouts/_authenticated_user.html.erb

This file was deleted.

3 changes: 2 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

<link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css" rel="stylesheet" />

<%= javascript_importmap_tags %>
<%= javascript_include_tag "activestorage" %>

<%= javascript_importmap_tags %>
<%= javascript_import_module_tag "ncuikit/application" %>

<style>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_demo_banner.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="flex items-center justify-center gap-x-6 bg-gray-900 px-6 py-2.5 sm:px-3.5">
<p class="text-sm leading-6 text-white">
<strong class="font-semibold">Welcome to our demo application powered by MaglevPRO, the ultimate page builder in Rails</strong>
<strong class="font-semibold">This is a demo platform powered by <%= link_to 'Maglev', 'https://www.maglev.dev', class: 'underline', target: '_blank' %>, our site builder in Rails</strong>
<svg viewBox="0 0 2 2" class="mx-2 inline h-0.5 w-0.5 fill-current" aria-hidden="true"><circle cx="1" cy="1" r="1" /></svg>
<a href="https://github.com/maglevhq/site-builder-demo" target="_blank">
Check out the source code <i class="ri-github-fill"></i> &nbsp;<span aria-hidden="true">&rarr;</span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_profile_dropdown.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render_ncuikit :menu_dropdown, orientation: 'right', content_class: 'w-48', arrow: true do |c| %>
<% c.with_label do %>
<%= render_ncuikit :avatar, full_name: nil, size: 'sm' %>
<%= render_ncuikit :avatar, url: current_user.avatar, full_name: nil, size: 'sm' %>
<% end %>

<% c.with_menu_header do %>
Expand Down
8 changes: 5 additions & 3 deletions app/views/sites/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
<%= render_ncuikit_form :text_field, form: form, attribute: :name %>
</div>

<div class="sm:col-span-6">
<%= render_ncuikit_form :text_field, form: form, attribute: :domain, options: { hint: domain_hint } %>
</div>
<% if form.object.persisted? %>
<div class="sm:col-start-1 sm:col-span-3">
<%= render_ncuikit_form :text_field, form: form, attribute: :domain, options: { hint: domain_hint } %>
</div>
<% end %>

<div class="sm:col-span-6">
<%= render_ncuikit_form :card_radio_buttons, form: form, attribute: :theme_id, options: { grids: 2 } do |c| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/sites/_site.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<% end %>
<% c.menu_separator %>
<% c.menu_item do %>
<%= button_to site_path(site), method: :delete, class: c.menu_item_css, data: { turbo_confirm: 'Are you sure?' } do %>
<%= button_to site_path(site), method: :delete, class: [c.menu_item_css, 'text-red-600'], data: { turbo_confirm: 'Are you sure?' } do %>
<i class="ri-delete-bin-line mr-1"></i> Delete
<% end %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/sites/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%= render_ncuikit :page_layout, title: 'Editing site' do |page| %>
<% page.with_actions do %>
<%= render_ncuikit_button :primary_link, label: 'Back to sites', url: sites_path, icon: 'ri-arrow-left-line' %>
<%= render_ncuikit_button :secondary_link, label: 'Back to sites', url: sites_path, icon: 'ri-arrow-left-line' %>
<% end %>

<%= form_with(model: @site) do |form| %>
<%= render 'form', form: %>

<div class="mt-12 text-right border-t border-gray-900/10 pt-6">
<%= render_ncuikit_button :primary_submit, label: 'Update' %>
<%= render_ncuikit_button :primary_submit, size: 'lg', label: 'Update' %>
</div>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/sites/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<%= render_ncuikit :page_layout, title: 'New site' do |page| %>
<% page.with_actions do %>
<%= render_ncuikit_button :primary_link, label: 'Back to sites', url: sites_path, icon: 'ri-arrow-left-line' %>
<%= render_ncuikit_button :secondary_link, label: 'Back to sites', url: sites_path, icon: 'ri-arrow-left-line' %>
<% end %>

<%= form_with(model: @site) do |form| %>
<%= render 'form', form: %>

<div class="mt-12 text-right border-t border-gray-900/10 pt-6">
<%= render_ncuikit_button :primary_submit, label: 'Create' %>
<%= render_ncuikit_button :primary_submit, size: 'lg', label: 'Create' %>
</div>
<% end %>
<% end %>
5 changes: 5 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@

en:
hello: "Hello world"

activerecord:
attributes:
site:
domain: "Custom domain"

0 comments on commit 15c9c7b

Please sign in to comment.