osem-fcy/app/views/proposal/_form.html.haml
2013-01-07 09:04:09 +01:00

142 lines
6.2 KiB
Text

.tabbable
%ul.nav.nav-tabs
%li.active
= link_to "Proposal", "#proposal-content", "data-toggle"=>"tab"
%li
= link_to "Attachments", "#attachment-content", "data-toggle"=>"tab"
.tab-content
#proposal-content.tab-pane.active
.span12
= semantic_form_for(@event, :url => @url) do |f|
%section#basic
= f.inputs :name => "Basic Information" do
= f.input :title, :required => true
= f.input :subtitle
= f.input :abstract, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'abstract-count')"}, :required => true
You have used
%span#abstract-count #{@event.abstract_word_count}
words. Abstracts are limited to 250 words.
%br
%br
= f.input :description, :input_html => {:rows => 5}, :hint => "This will only be shown to organizers, not to attendees."
%section#details
= f.inputs :name => "Event Details" do
= f.input :event_type_id,:as => :select, :collection => @event_types, :include_blank => false
%section#information
= f.inputs :name => "Your Information" do
= semantic_fields_for @person do |p|
= p.input :public_name, :required => true
= p.input :company, :label => "Affiliation", :hint => "This could be a company, a user group, or nothing at all."
= p.input :biography, :required => true, :input_html => {:rows => 5, "onkeyup" => "word_count(this, 'biography-count')"}
You have used
%span#biography-count #{@person.biography_word_count}
words. Biographies are limited to 150 words.
%br
%br
%section#speakers
= f.inputs :name => "Additional Speakers" do
Will there be any additional speakers? If so, please enter their full names, email address, and a short
biography for each.
= f.input :proposal_additional_speakers, :input_html => {:rows => 5}, :label => false
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
#attachment-content.tab-pane
.span12
= form_for EventAttachment.new, :url => conference_proposal_event_attachment_index_path(@conference.short_title, @event),
:html => { :multipart => true, :id => "fileupload" } do |f|
%table.table.table-striped
%thead
%th
%th
%b Filename
%th
%b Title
%th
%b Size
%th
%b Public
%th
%tbody.files
.row-fluid.fileupload-buttonbar
.btn.btn-success.fileinput-button
%i.icon-plus.icon-white
Add files...
= f.file_field :attachment
= f.hidden_field :event_id, :value => @event.id
:javascript
$(document).ready( function() {
$('#fileupload').fileupload();
$('#fileupload').bind('fileuploadsubmit', function (e, data) {
var inputs = data.context.find(':input');
if (inputs.filter('[required][value=""]').first().focus().length) {
return false;
}
data.formData = inputs.serializeArray();
});
} );
:plain
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="name"><input type="text" name="title[]" value="{%=file.name%}"/></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td class="name"><input checked type="checkbox" name="public">Public</input></td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
<div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button class="btn btn-primary">
<i class="icon-upload icon-white"></i>
<span>{%=locale.fileupload.start%}</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button class="btn btn-warning">
<i class="icon-ban-circle icon-white"></i>
<span>{%=locale.fileupload.cancel%}</span>
</button>
{% } %}</td>
</tr>
{% } %}
</script>
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-download fade">
{% if (file.error) { %}
<td>{%=file.title%}</td>
<td class="name">{%=file.name%}</td>
<td class="size">{%=o.formatFileSize(file.size)%}</td>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else { %}
<td class="preview">{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
{% } %}</td>
<td class="name">
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
</td>
<td>{%=file.title%}</td>
<td class="size">{%=o.formatFileSize(file.size)%}</td>
<td>{%=file.public%}</td>
<td colspan="2"></td>
{% } %}
<td class="delete">
<button class="btn btn-danger pull-right" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
<i class="icon-trash icon-white"></i>
<span>{%=locale.fileupload.destroy%}</span>
</button>
</td>
</tr>
{% } %}
</script>