add :edit view

This commit is contained in:
EricTYL 2020-02-05 15:12:50 +08:00
parent 07d757f3c5
commit 2bbd136570
2 changed files with 153 additions and 0 deletions

View File

@ -0,0 +1,148 @@
<% # encoding: utf-8 %>
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<%= stylesheet_link_tag "lib/main-form-col2" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %>
<%= javascript_include_tag "lib/bootstrap-typeahead.js" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
<li class="pull-right">
<%= copy_to_all_language_button(".language-nav", ".language-area") %>
</li>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- activity_name -->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_activity.activity_name") %></label>
<div class="controls">
<%= f.fields_for :activity_name_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_activity.activity_name"), value: (@activity.activity_name_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- activity_organizer -->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_activity.activity_organizer") %></label>
<div class="controls">
<%= f.fields_for :activity_organizer_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_activity.activity_organizer"), value: (@activity.activity_organizer_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- activity_area -->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_activity.activity_area") %></label>
<div class="controls">
<%= f.fields_for :activity_area_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_activity.activity_area"), value: (@activity.activity_area_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li></li>
<li class="active">
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
</li>
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- year -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_activity.year") %></label>
<div class="controls">
<%= select_year((@activity.year ? @activity.year.to_i : DateTime.now.year), {:start_year => (DateTime.now.year+5), :end_year => 1930}, {:name => 'activity[year]',:class => 'span1'} ) %>
</div>
</div>
<!-- activity_start_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_activity.activity_start_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @activity.activity_end_date, :new_record => @activity.new_record? %>
</div>
</div>
<!-- activity_end_date -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_activity.activity_end_date") %></label>
<div class="controls">
<%= f.datetime_picker :publication_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @activity.activity_end_date, :new_record => @activity.new_record? %>
</div>
</div>
<!-- note -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_activity.note") %></label>
<div class="controls">
<%= f.text_area :note, rows: 2, class: "ckeditor input-block-level" %>
</div>
</div>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="status">
<!-- Status -->
<div class="control-group">
<label class="control-label muted"><%= t(:status) %></label>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn <%= 'active' if @activity.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<input type="hidden" name="referer_url" value="<%= request.referer %>">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>

View File

@ -0,0 +1,5 @@
<%= form_for @activity, url: admin_book_path(@activity), html: { class: "form-horizontal main-forms previewable" } do |f| %>
<fieldset>
<%= render partial: 'form', locals: {f: f} %>
</fieldset>
<% end %>