Skip to content

Commit

Permalink
add team edit
Browse files Browse the repository at this point in the history
  • Loading branch information
ger619 committed Apr 17, 2024
1 parent d3d4100 commit 936e5fa
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 3 deletions.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
*= require_tree .
*= require_self
*/

p {
font-family: "Adelle Sans", serif;
}
2 changes: 1 addition & 1 deletion app/views/news/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="shadow-md">
<div class="p-6 bg-[#FAE115] font-bold uppercase lg:text-3xl md:text-3xl text-2xl flex justify-between ">
<p class="md:w-full w-[90%] truncate ...">NEWS | <%= @news.header_news %></p>
<h1 class="md:w-full w-[90%] truncate ...">NEWS | <%= @news.header_news %></h1>
</div>


Expand Down
44 changes: 44 additions & 0 deletions app/views/team/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<%= form_with(model: @team, url: team_path(@team), method: :patch, class: "bg-white rounded shadow-md p-6") do |f| %>

<div class="md:p-0">
<div class="p-6 bg-[#FAE115] font-bold uppercase lg:text-5xl md:text-4xl text-3xl flex justify-between">
EDIT TEAM MEMBERS
</div>
<div class="md:w-[800px] lg:w-[1024px] flex flex-col gap-4 md:my-24 md:mx-auto bg-[#F7F3ED] md:p-8">
<p class="text-xl font-light mt-5">
This is a platform where you can add edit team members
</p>
<div>
<label htmlFor="header text">
Edit Players
<span class="text-red-500">*</span>
</label>
</div>

<div class="flex justify-between pr-10">

<%= f.text_field :first_name, class: "h-[50px] w-[30%] p-2 border-b border-black bg-[#F7F3ED] focus:outline-none" ,placeholder: "first name", :required => :true %>
<%= f.text_field :second_name, class: "h-[50px] w-[30%] p-2 border-b border-black bg-[#F7F3ED] focus:outline-none" ,placeholder: "second name", :required => :true%>
<%= f.text_field :last_name, class: "h-[50px] w-[30%] p-2 border-b border-black bg-[#F7F3ED] focus:outline-none" ,placeholder: "last name", :required => :true%>

</div>
<div class="flex justify-between pr-10">

<%= f.select :position, %w[Striker Midfielder Defender Goalkeeper Coach], prompt: 'Role/Position', required: true, class: 'h-[50px] w-[45%] p-2 border-b border-black bg-[#F7F3ED] focus:outline-none' %>
<%= f.number_field :jersey_number, class: "h-[50px] w-[30%] p-2 border-b border-black bg-[#F7F3ED] focus:outline-none" ,placeholder: "Jersey Number", :required => :true %>
<%= image_tag f.object.image, :class => 'w-[200px]' if f.object.image.present? %>
<%= f.file_field :image, class: "h-[50px] w-[30%] p-2 focus:outline-none" ,placeholder: "Passport Photo of Player", :required => :true%>

</div>

<%= f.text_area :about, class: "tinymce appearance-none border rounded w-full py-2 px-3 leading-tight focus:outline-none focus:shadow-outline" %>
<%= tinymce %>
<%= f.submit "Submit", class: "w-[300px] mt-10 mb-10 md:mb-10 md:mt-16 mx-auto p-4 bg-[#F4E721] text-3xl text-black uppercase" %>
</div>

</div>



<% end %>
1 change: 0 additions & 1 deletion app/views/team/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<%= form_with model: @team, url: team_index_path, method: :post, data: { turbo: false }, local: true do |f| %>


<div class="md:p-0">
<div class="p-6 bg-[#FAE115] font-bold uppercase lg:text-5xl md:text-4xl text-3xl flex justify-between">
ADD NEWS TEAM MEMBERS
Expand Down
8 changes: 7 additions & 1 deletion app/views/team/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
</h2>

<h3 class="text-base font-light"><%= raw @team.about %></h3>
<%= button_to 'Destroy', @team, method: :delete, data: { confirm: 'Are you sure?' }, class: "bg-[#FAE115] p-3 rounded-lg mt-2" %>
<div class="flex inline-flex gap-2">
<% if current_user && current_user.role === 'moderator' %>
<%= link_to "Edit", edit_team_path(@team.id), class: "bg-[#FAE115] p-3 rounded-lg mt-2 uppercase" %>
<%= button_to 'Destroy', @team, method: :delete, data: { confirm: 'Are you sure?' }, class: "bg-[#FAE115] p-3 rounded-lg mt-2 uppercase" %>
<% end %>
</div>
</div>
</div>

Expand Down

0 comments on commit 936e5fa

Please sign in to comment.