From 936e5fa5a3870a921c35f032e23e12bc64f83e5d Mon Sep 17 00:00:00 2001 From: ger619 Date: Wed, 17 Apr 2024 14:59:58 +0300 Subject: [PATCH] add team edit --- app/assets/stylesheets/application.css | 4 +++ app/views/news/show.html.erb | 2 +- app/views/team/edit.html.erb | 44 ++++++++++++++++++++++++++ app/views/team/new.html.erb | 1 - app/views/team/show.html.erb | 8 ++++- 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 app/views/team/edit.html.erb diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 288b9ab71..c5e90e008 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -13,3 +13,7 @@ *= require_tree . *= require_self */ + +p { + font-family: "Adelle Sans", serif; +} \ No newline at end of file diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index d15782534..47fbffc36 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -1,6 +1,6 @@
-

NEWS | <%= @news.header_news %>

+

NEWS | <%= @news.header_news %>

diff --git a/app/views/team/edit.html.erb b/app/views/team/edit.html.erb new file mode 100644 index 000000000..c37ad7fda --- /dev/null +++ b/app/views/team/edit.html.erb @@ -0,0 +1,44 @@ +<%= form_with(model: @team, url: team_path(@team), method: :patch, class: "bg-white rounded shadow-md p-6") do |f| %> + +
+
+ EDIT TEAM MEMBERS +
+
+

+ This is a platform where you can add edit team members +

+
+ +
+ +
+ + <%= 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%> + +
+
+ + <%= 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%> + +
+ + <%= 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" %> +
+ +
+ + + +<% end %> diff --git a/app/views/team/new.html.erb b/app/views/team/new.html.erb index f5ea3916e..aa0037043 100644 --- a/app/views/team/new.html.erb +++ b/app/views/team/new.html.erb @@ -1,6 +1,5 @@ <%= form_with model: @team, url: team_index_path, method: :post, data: { turbo: false }, local: true do |f| %> -
ADD NEWS TEAM MEMBERS diff --git a/app/views/team/show.html.erb b/app/views/team/show.html.erb index a2303d6c2..3b3debf86 100644 --- a/app/views/team/show.html.erb +++ b/app/views/team/show.html.erb @@ -23,7 +23,13 @@

<%= raw @team.about %>

- <%= button_to 'Destroy', @team, method: :delete, data: { confirm: 'Are you sure?' }, class: "bg-[#FAE115] p-3 rounded-lg mt-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 %> +