venue_management/app/views/venue_managements/edit_file.html.erb

99 lines
4.3 KiB
Plaintext
Raw Normal View History

2020-05-07 15:26:34 +00:00
<% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= stylesheet_link_tag "venue_management" %>
<%= javascript_include_tag 'basic.js' %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@con = data["con"]
@venue_management = data["venue_management"]
@venue_management_signup = data["venue_management_signup"]
@form_index = 0
%>
<% if !session[:venue_management_signup_id].blank? %>
<%= form_for @con, url: edit_file_proc_venue_managements_path, html: {class: "content form-horizontal" , :id=>"new-venue_management-signup-contribute"} do |f| %>
<fieldset>
<% if @venue_management.venue_management_submission_field_sets.count != 0
data1 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @venue_management.venue_management_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @venue_management.venue_management_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('venue_management_signup.description') ? '' : data2['placeholder'][I18n.locale]
plc3 = data3['placeholder'][I18n.locale]==t('venue_management_signup.file') ? '' : data3['placeholder'][I18n.locale]
else
show1 = true
show2 = true
show3 = true
name1 = t('venue_management_signup.title')
name2 = t('venue_management_signup.description')
name3 = t('venue_management_signup.file')
plc1 = t('venue_management_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 %>
<% @venue_management.venue_management_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(@venue_management,@form_index,false,"venue_management_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="venue_management_signup_contribute[id]" value="<%= @con[:_id] %>">
<input type="hidden" name="venue_management_signup_contribute[venue_management_signup_id]" value="<%= session[:venue_management_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 %>