-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6b660a
commit 0c6d9de
Showing
15 changed files
with
1,016 additions
and
2,700 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 |
---|---|---|
|
@@ -13,6 +13,3 @@ | |
*= require_tree . | ||
*= require_self | ||
*/ | ||
.hidden { | ||
display: none !important; | ||
} |
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,6 +1,6 @@ | ||
class PollsController < ApplicationController | ||
def new | ||
authorize! Poll, to: :create? | ||
@poll = current_user.own_polls.new | ||
@poll = Poll.new | ||
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,4 +1,4 @@ | ||
class PollMembership < ApplicationRecord | ||
belongs_to :user, foreign_key: 'user_id' | ||
belongs_to :poll, foreign_key: 'poll_id' | ||
belongs_to :user | ||
belongs_to :poll | ||
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
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,43 +1,47 @@ | ||
<%= form_with model: @poll, url: poll_new_path, method: :post, class: "border rounded p-4 mt-5" do |poll| %> | ||
<%= form_for :poll, url: new_poll_path, method: :post, class: "border rounded p-4 mt-5" do |f| %> | ||
<div class="mb-3"> | ||
<%= poll.text_field :title, placeholder: "Title", class: "form-control" %> | ||
<%= f.text_field :title, placeholder: "Title", class: "form-control" %> | ||
</div> | ||
<div class="mb-3"> | ||
<%= poll.text_area :description, placeholder: "Description", class: "form-control" %> | ||
<%= f.text_area :description, placeholder: "Description", class: "form-control" %> | ||
</div> | ||
<div class="row"> | ||
<div class="col-6 mb-3 d-flex flex-column"> | ||
<%= poll.label :start_date, class: "form-label"%> | ||
<%= poll.date_field :start_date, placeholder: "Start date", class: "form-control"%> | ||
<%= f.label :start_date, class: "form-label"%> | ||
<%= f.date_field :start_date, placeholder: "Start date", class: "form-control"%> | ||
</div> | ||
<div class="col-6 mb-3 d-flex flex-column"> | ||
<%= poll.label :end_date, class: "form-label"%> | ||
<%= poll.date_field :end_date, placeholder: "End date", class: "form-control"%> | ||
<%= f.label :end_date, class: "form-label"%> | ||
<%= f.date_field :end_date, placeholder: "End date", class: "form-control"%> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-4 mb-3"> | ||
<%= poll.text_field :option_1, placeholder: "Option", class: "form-control"%> | ||
<%= f.text_field :option_1, placeholder: "Option", class: "form-control"%> | ||
</div> | ||
<div class="col-4 mb-3"> | ||
<%= poll.text_field :option_2, placeholder: "Option", class: "form-control"%> | ||
<%= f.text_field :option_2, placeholder: "Option", class: "form-control"%> | ||
</div> | ||
<div class="col-4 mb-3"> | ||
<%= poll.text_field :option_3, placeholder: "Option", class: "form-control hidden"%> | ||
<%= f.text_field :option_3, placeholder: "Option", class: "form-control d-none"%> | ||
</div> | ||
<div class="col-4 mb-3"> | ||
<%= poll.text_field :option_4, placeholder: "Option", class: "form-control hidden"%> | ||
<%= f.text_field :option_4, placeholder: "Option", class: "form-control d-none"%> | ||
</div> | ||
<div class="col-4 mb-3"> | ||
<%= poll.text_field :option_5, placeholder: "Option", class: "form-control hidden"%> | ||
<%= f.text_field :option_5, placeholder: "Option", class: "form-control d-none"%> | ||
</div> | ||
</div> | ||
<div class="row d-flex justify-content-between"> | ||
<div class="col-3"> | ||
<%= poll.submit "Add poll", method: :post, class: "btn btn-primary" %> | ||
<% if f.object.persisted?%> | ||
<%= f.submit "Edit poll", method: :post, class: "btn btn-primary" %> | ||
<% else %> | ||
<%= f.submit "Add poll", method: :post, class: "btn btn-primary" %> | ||
<% end %> | ||
</div> | ||
<div class="col-5"> | ||
<%= poll.button "Add option", class: "btn btn-success", style: "width: 100%;" %> | ||
<%= f.button "Add option", class: "btn btn-success", style: "width: 100%;" %> | ||
</div> | ||
</div> | ||
<% 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
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,5 +1,5 @@ | ||
{ | ||
"result": { | ||
"line": 98.91 | ||
"line": 97.75 | ||
} | ||
} |
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
Oops, something went wrong.