Application_Form/app/views/seminars/add_file.html.erb

110 lines
4.2 KiB
Plaintext
Raw Normal View History

2016-06-29 06:57:45 +00:00
<% # encoding: utf-8 %>
2019-11-13 04:07:16 +00:00
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
2019-12-30 07:49:59 +00:00
<%= stylesheet_link_tag "seminar" %>
2019-11-13 04:07:16 +00:00
<%= javascript_include_tag 'basic.js' %>
2019-10-29 15:14:38 +00:00
<% @@session = session %>
<%= yield %>
2016-06-29 06:57:45 +00:00
<%
data = action_data
@con = data["con"]
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@form_index = 0
2016-06-29 06:57:45 +00:00
%>
<% 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 %>
2016-06-29 06:57:45 +00:00
<div class="form-group">
<label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
2016-06-29 06:57:45 +00:00
<div class="col-sm-10">
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
2016-06-29 06:57:45 +00:00
</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>
2016-06-29 06:57:45 +00:00
<div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
2016-06-29 06:57:45 +00:00
</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;">
2020-01-12 06:39:32 +00:00
*<%= name3 %>
</label>
<br>
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
</span>
2016-06-29 06:57:45 +00:00
<div class="col-sm-10">
2020-01-12 06:39:32 +00:00
<%= f.file_field :file, :required => true %>
2016-06-29 06:57:45 +00:00
</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) %>
2016-06-29 06:57:45 +00:00
</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>
2016-06-29 06:57:45 +00:00
<% end %>
<% else %>
上傳檔案數已滿
<% end %>
<% else %>
請先登入
<br />
<a href="<%= page_for_seminar_url %>">回列表頁</a>
<% end %>