Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Changes for Challenges #450

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/stylesheets/layouts/challenge_admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

textarea {
width: 50%;
/*width: 50%;*/
height: 5em;
}

Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/layouts/team_page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

/* Custom, iPhone Retina */
@media only screen and (min-device-width: 320px) and (min-width: 320px) {
.team_page {
.team_page:has(> .side_menu){
display: flex;
}
.team_page {

> section > section {
padding: 0.25em 1.5em;
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/regions/challenges_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def check_for_privileges
def challenge_params
params.require(:challenge).permit(
:name, :short_desc, :long_desc, :eligibility, :video_url, :approved,
:banner_image, :image, :pdf, :pdf_preview, :nation_wide,
:banner_image, :image, :pdf, :pdf_preview, :nation_wide, :teaser,
:outcome_expectations, :sponsor_values
)
end
end
1 change: 1 addition & 0 deletions app/models/challenge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# name :string
# nation_wide :boolean
# short_desc :text
# teaser :text
# video_url :string
# created_at :datetime not null
# updated_at :datetime not null
Expand Down
79 changes: 59 additions & 20 deletions app/views/admin/regions/challenges/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,40 +1,79 @@
<%= form_for [:admin, @region, @challenge] do |form| %>
<div class="form-group">
<%= form.label :name %>
<%= form.text_field :name %>
<%= form_for [:admin, @region, @challenge], html: { class: 'form-horizontal' } do |form| %>

<div class="form-group row mb-1">
<%= form.label :name, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_field :name, class: 'form-control' %>
</div>
</div>

<div class="form-group row mb-1">
<%= form.label "Teaser (hashtags)", class: 'col-sm-1 col-form-label' %>
<div class="col-10">
<%= form.text_area :teaser, class: 'form-control' , :cols => 20, :maxlength => 200 %>
</div>
</div>
<div class="form-group">
<%= form.label :short_desc %>
<%= form.text_area :short_desc %>

<div class="form-group row mb-1">
<%= form.label :problem_statement, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_area :short_desc, class: 'form-control', rows: 3 %>
</div>
</div>
<div class="form-group">
<%= form.label :long_desc %>
<%= form.text_area :long_desc %>

<div class="form-group row mb-1">
<%= form.label :long_description, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_area :long_desc, class: 'form-control', rows: 3 %>
</div>
</div>
<div class="form-group">
<%= form.label :eligibility %>
<%= form.text_area :eligibility %>

<div class="form-group row mb-1">
<%= form.label :outcome_expectations, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_area :outcome_expectations, class: 'form-control', rows: 3 %>
</div>
</div>
<div class="form-group">
<%= form.label :video_url %>
<%= form.url_field :video_url %>

<div class="form-group row mb-1">
<%= form.label :sponsor_values, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_area :sponsor_values, class: 'form-control', rows: 3 %>
</div>
</div>

<div class="form-group row mb-1">
<%= form.label :eligibility, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.text_area :eligibility, class: 'form-control', rows: 3 %>
</div>
</div>

<div class="form-group row mb-1">
<%= form.label :video_url, class: 'col-sm-1 col-form-label' %>
<div class="col-sm-10">
<%= form.url_field :video_url, class: 'form-control' %>
</div>
</div>

<% if current_user.admin_privileges?(@region.competition) %>
<div class="form-group">
<%= form.label :approved %>
<%= form.check_box :approved, { checked: @challenge.approved } %>
<%= form.label :approved, class: 'col-sm-1 col-form-label' %>
<%= form.check_box :approved, { checked: @challenge.approved }, class: 'form-check-input' %>
</div>

<% if @challenge.type == REGIONAL %>
<p>
<p class="form-text text-muted">
Nation wide: This option makes this Regional Challenge available
to any team in <%= @region.parent.name %>.
</p>
<div class="form-group">
<%= form.label :nation_wide %>
<%= form.check_box :nation_wide, { checked: @challenge.nation_wide } %>
<%= form.check_box :nation_wide, { checked: @challenge.nation_wide }%>
</div>
<% end %>
<% end %>

<div class="actions">
<%= form.submit %>
</div>
Expand Down
1 change: 1 addition & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
t.integer "region_id"
t.string "name"
t.text "short_desc"
t.text "teaser"
t.text "long_desc"
t.text "eligibility"
t.string "video_url"
Expand Down
Loading