forked from spen/seminar
110 lines
4.2 KiB
Plaintext
110 lines
4.2 KiB
Plaintext
<% # encoding: utf-8 %>
|
|
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
|
|
<%= stylesheet_link_tag "seminar" %>
|
|
<%= javascript_include_tag 'basic.js' %>
|
|
<% @@session = session %>
|
|
<%= yield %>
|
|
<%
|
|
data = action_data
|
|
@con = data["con"]
|
|
@seminar = data["seminar"]
|
|
@seminar_signup = data["seminar_signup"]
|
|
@form_index = 0
|
|
%>
|
|
<% if !session[:seminar_signup_id].blank? %>
|
|
|
|
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
|
|
|
|
<%= form_for @con, url: add_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %>
|
|
<fieldset>
|
|
<% if @seminar.seminar_submission_field_sets.count != 0
|
|
data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0]
|
|
data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]
|
|
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
|
|
show1 = !(data1.disabled)
|
|
show2 = !(data2.disabled)
|
|
show3 = !(data3.disabled)
|
|
name1 = data1['name'][I18n.locale]
|
|
name2 = data2['name'][I18n.locale]
|
|
name3 = data3['name'][I18n.locale]
|
|
plc1 = data1['placeholder'][I18n.locale]
|
|
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
|
|
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
|
|
else
|
|
show1 = true
|
|
show2 = true
|
|
show3 = true
|
|
name1 = t('seminar_signup.title')
|
|
name2 = t('seminar_signup.description')
|
|
name3 = t('seminar_signup.file')
|
|
plc1 = t('seminar_signup.title')
|
|
plc2 = ''
|
|
plc3 = ''
|
|
end
|
|
%>
|
|
<% if show1 %>
|
|
<div class="form-group">
|
|
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
|
|
<div class="col-sm-10">
|
|
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% if show2 %>
|
|
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
|
<span style="margin-right: 0.5em;">
|
|
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
|
<%= name2 %>
|
|
</label>
|
|
<br>
|
|
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
|
|
</span>
|
|
<div class="col-sm-10">
|
|
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% if show3 %>
|
|
<div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
|
|
<span style="margin-right: 0.5em;">
|
|
<label for="note" class="col-sm-2 control-label" style="display: contents;">
|
|
<%= name3 %>
|
|
</label>
|
|
<br>
|
|
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
|
|
</span>
|
|
<div class="col-sm-10">
|
|
<%= f.file_field :file %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
|
|
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
|
|
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
|
|
</div>
|
|
<% @form_index = @form_index +1 %>
|
|
<% end %>
|
|
<div class="form-group">
|
|
<div class="col-sm-offset-2 col-sm-10">
|
|
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
|
<input type="hidden" name="seminar_signup_contribute[seminar_signup_id]" value="<%= session[:seminar_signup_id] %>">
|
|
<%= f.submit t('submit'), class: 'btn btn-primary', :id => 'button-mail' %>
|
|
<%= f.button t('cancel'), type: 'reset', class: 'btn' %>
|
|
</div>
|
|
</div>
|
|
</fieldset>
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
上傳檔案數已滿
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
請先登入
|
|
<br />
|
|
<a href="<%= page_for_seminar_url %>">回列表頁</a>
|
|
|
|
<% end %> |