gabrielshufelt / Real-Ratings-SOEN-341_Project_F24

0 stars 1 forks source link

Implement Team View, Edit, and Create Logic (Students) #63

Open Luqman1008 opened 2 weeks ago

Luqman1008 commented 2 weeks ago

Description:

Develop both the view and back-end logic for students to view their team, edit team details (name, description), and create a new team if not part of one.

Key Elements:

  1. Conditional Rendering for Teams:

    • Check if the student belongs to a team.
    • Display the current team’s name, description, and members with "Edit Team Details" and "Leave Team" buttons.
    • If the student doesn’t belong to a team, display a "Create a New Team" button and list other available teams with "Join Team" buttons.
  2. Create and Edit Team Form:

    • Create a form to allow students to input Team Name and Team Description.
    • Pre-fill the form with the current team’s details if the student is editing.
    • Validate input fields (team name presence, character limits).
    • Include error handling and ensure proper display of validation errors on the form.
  3. Controller Logic for Team Management:

    • Implement edit, update, new, and create actions in the controller:
      • Edit: Pre-load the current team data.
      • Update: Save updated team details.
      • New: Display the form for creating a new team.
      • Create: Handle form submission and save the new team, associating the student with it.
  4. Error Handling and Validation:

    • Validate team name for presence and apply character limits on name and description.
    • Display errors if the form contains invalid data, and ensure the form is not saved until all issues are resolved.
  5. Routing:

    • Set up routes for team creation and editing:
      resources :teams, only: [:edit, :update, :new, :create]