-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from hpi-swt2/Add_styling_search_for_users
Add styling and additional logic to search for users
- Loading branch information
Showing
5 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,23 @@ | ||
// Place all the styles related to the Users controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: https://sass-lang.com/ | ||
|
||
.form-tag { | ||
display: flex; | ||
width: 100%; | ||
} | ||
.text-field { | ||
flex: 5; | ||
margin: 3px; | ||
} | ||
.submit-button { | ||
flex: 1; | ||
margin: 3px; | ||
} | ||
.stack { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
.stack > * + * { | ||
margin-top: .5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ | |
</a></li> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,18 @@ | ||
<div class="jumbotron"> | ||
<h2><%= I18n.t('user.lists') %></h2> | ||
<%= stylesheet_link_tag 'users', media: 'all', 'data-turbolinks-track': 'reload' %> | ||
|
||
<%# https://getbootstrap.com/docs/5.0/layout/grid/#auto-layout-columns %> | ||
<div class="stack"> | ||
<%= form_tag(search_users_path, method: "get", class: "form-tag justify-content-between") do %> | ||
<%= text_field_tag :search, params[:search] , placeholder: I18n.t('user.search.placeholder'), class: "text-field form-control my-2 my-sm-0"%> | ||
<%= submit_tag I18n.t('user.search.index') , class: "submit-button btn btn-outline-secondary my-2 my-sm-0"%> | ||
<% end %> | ||
|
||
<% @users.each do |user| %> | ||
<%= render partial: 'users/card', locals: { user: user, mode: :overview } %> | ||
<% end %> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<%= form_tag(search_users_path, method: "get") do %> | ||
<%= label_tag(:search, I18n.t('user.search.for') ) %> | ||
<%= text_field_tag :search, params[:search] %> | ||
<%= submit_tag I18n.t('user.search.index') %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% @users_to_add.each do |user| %> | ||
<%= render partial: 'users/card', locals: { user: user, mode: :add } %> | ||
<% end %> | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th><%= I18n.t('user.attributes.username') %></th> | ||
<th><%= I18n.t('user.attributes.firstname')%></th> | ||
<th><%= I18n.t('user.attributes.lastname')%></th> | ||
<th><%= I18n.t('user.attributes.email')%></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
<% @users.each do |user| %> | ||
<tr> | ||
<td><%= user.username%></td> | ||
<td><%= user.firstname%></td> | ||
<td><%= user.lastname%></td> | ||
<td><%= user.email %></td> | ||
<% if @users_to_add.include? user %> | ||
<td><%= button_to '+', user_contact_requests_path(user), method: :post, id: user.id %></td> | ||
<% end %> | ||
</tr> | ||
<% end %> | ||
|
||
</tbody> | ||
</table> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters