Skip to content
Snippets Groups Projects
Unverified Commit 11ffe1bd authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

Merge branch 'master' of github.com:noesya/osuny

parents f1032e4a 35fa45b4
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,6 @@ class Admin::UsersController < Admin::ApplicationController
end
def user_params
params.require(:user).permit(:first_name, :last_name, :role, :language_id, :mobile_phone)
params.require(:user).permit(:first_name, :last_name, :role, :language_id, :picture, :picture_delete, :mobile_phone)
end
end
......@@ -60,9 +60,10 @@ class User < ApplicationRecord
belongs_to :university
belongs_to :language
has_one :researcher, class_name: 'Research::Researcher'
has_one_attached :picture
def to_s
first_name || last_name ? "#{first_name} #{last_name}"
(first_name.present? || last_name.present?) ? "#{first_name} #{last_name}"
: "#{email}"
end
end
......@@ -6,9 +6,10 @@
</div>
<div class="col-md-4">
<%= f.input :first_name %>
<%= f.input :last_name %>
</div>
<div class="col-md-4">
<%= f.input :last_name %>
<%= f.input :picture %>
</div>
<div class="col-md-4">
<%= f.association :language, include_blank: false %>
......
......@@ -31,6 +31,13 @@
</p>
<% end %>
<% if @user.picture.attached? && @user.picture.variable? %>
<p>
<strong>Picture:</strong>
<%= image_tag @user.picture.variant(resize: '200x') %>
</p>
<% end %>
<% content_for :buttons do %>
<%= edit_link @user %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment