-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better winning project publishing form (#426)
Setting a project as a winner now happens in a separate form that requires that the user set a specific funding date and encourages her to fill out a funded project description and image in order to make the overall public-facing winner page more appealing.
- Loading branch information
Showing
19 changed files
with
237 additions
and
76 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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.center-form__cancel { | ||
text-align: center; | ||
} | ||
|
||
.center-form__cancel-link { | ||
color: $lighter-base-font-color !important; | ||
font-size: .85em; | ||
|
||
text-decoration: none !important; | ||
|
||
&:hover { | ||
text-decoration: underline !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
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class FundedProject < Project | ||
validates :funded_on, presence: true | ||
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<div class="funded_on"> | ||
<%= form.input :funded_on, as: :string, input_html: { class: "datepicker", autocomplete: "off" }, required: local_assigns[:required], hint: local_assigns[:hint] %> | ||
</div> | ||
|
||
<% content_for :javascript do %> | ||
<%= javascript_tag do %> | ||
$(window).load(function(){ | ||
$('.datepicker').datepicker({ | ||
dateFormat: 'yy-mm-dd', | ||
onClose: function(){ $('.datepicker').blur() } | ||
}); | ||
}); | ||
<% 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
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<div class="image-upload"> | ||
<% if form.object.photos.present? %> | ||
<section class="current-images"> | ||
<label><%= t "simple_form.labels.project.current_photos-html" %></label> | ||
<ul class="old-photos"> | ||
<%= form.input :photo_order, as: :hidden %> | ||
<% form.object.photos.each do |photo| %> | ||
<li data-id="<%= photo.id %>"> | ||
<span><%= photo.image_file_name %></span> | ||
<a href="#" class="remove-image" data-remove="true">remove</a> | ||
</li> | ||
<% end %> | ||
</ul> | ||
</section> | ||
<% end %> | ||
|
||
<% if s3_uploader_available? %> | ||
<%= render partial: "projects/image_form", locals: { form: form, upload_mechanism: :s3, image_notes: local_assigns[:image_notes] } %> | ||
<% else %> | ||
<%= render partial: "projects/image_form", locals: { form: form, upload_mechanism: :classic, image_notes: local_assigns[:image_notes] } %> | ||
<% end %> | ||
|
||
</div> | ||
|
||
<% content_for :javascript do %> | ||
<%= javascript_tag do %> | ||
window.awesomeEnvironment.remainingUploads = 0; | ||
|
||
function reorderPhotos(){ | ||
var photo_order = $('.old-photos li[data-id]').map(function(x, el){ | ||
return $(el).attr('data-id') | ||
}); | ||
$('#project_photo_order').val($.makeArray(photo_order).join(" ")); | ||
} | ||
|
||
$(".old-photos *[data-remove='true']").on("click", function(){ | ||
var val = $('#project_photo_order').val(); | ||
val = val.replace($(this.parentNode).attr('data-id'), ''); | ||
$('#project_photo_order').val(val); | ||
|
||
el = document.createElement('input'); | ||
el.type = 'hidden'; | ||
el.name = 'project[photo_ids_to_delete][]'; | ||
el.value = $(this.parentNode).attr('data-id'); | ||
|
||
$('#project_photo_order').after(el); | ||
}); | ||
|
||
$(window).load(function(){ | ||
$(".old-photos").sortable({ | ||
update: reorderPhotos | ||
})}); | ||
<% 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
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<%= hidden_field_tag :return_to, params[:return_to] %> | ||
<div class="chapter-select"> | ||
<%= form.input :chapter_id, collection: winnable_chapters_for(form.object), label: t(".chapter_id"), include_blank: false, disabled: !(form.object.in_any_chapter? || current_user.admin?), hint: t(".hints.chapter_id") %> | ||
</div> | ||
<div class="personal-info"> | ||
<%= render partial: "projects/funded_date", locals: { form: form, required: true, hint: t(".hints.funded_on") } %> | ||
<%= form.input :title, maxlength: 50 %> | ||
<%= form.input :name, label: t(".name") %> | ||
<%= form.input :url %> | ||
<%= form.input :rss_feed_url %> | ||
</div> | ||
<div class="project-info"> | ||
<%= form.input :funded_description, required: true %> | ||
</div> | ||
|
||
<%= render partial: "projects/image_upload", locals: { form: form, image_notes: t(".image-notes") } %> | ||
|
Oops, something went wrong.