hps_learning/app/views/admin/hps_learnings/_form.html.erb

115 lines
4.1 KiB
Plaintext
Raw Normal View History

2017-07-04 16:58:50 +00:00
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/fileupload" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<%= javascript_include_tag "file-upload/jquery.fileupload" %>
<% end %>
<!-- Input Area -->
<div class="input-area">
<!-- Module Tabs -->
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#tag" data-toggle="tab"><%= t(:tags) %></a></li>
</ul>
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<div class="control-group" for="upload">
<%= f.label :course_pic, t("hps_learning.course_pic"), :class => "control-label muted" %>
<div class="controls">
<div class="fileupload fileupload-new clearfix <%= 'fileupload-edit' if @hpsclass.course_pic.file %>" >
<div class="fileupload-new thumbnail pull-left">
<% if @hpsclass.course_pic.file %>
<%= image_tag @hpsclass.course_pic, :id => "showcase_image" %>
<% else %>
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" id="showcase_image" />
<% end %>
</div>
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
<span class="btn btn-file">
<span class="fileupload-new"><%= t(:select_image) %></span>
<span class="fileupload-exists"><%= t(:change) %></span>
<%= f.file_field :course_pic %>
</span>
</div>
</div>
</div>
<!-- <div class="control-group">
<label for="" class="control-label muted"><%#= t("hps_learning.runtime") %></label>
<div class="controls">
<%#= f.number_field :runtime_hours, :min => 0, :max => 59 %> <%#= f.label :runtime_hours, t("hps_learning.runtime_hours") %>
<%#= f.number_field :runtime_mins, :min => 0, :max => 59 %> <%#= f.label :runtime_mins, t("hps_learning.runtime_mins") %>
</div>
</div> -->
</div>
<!-- Tag Module -->
<div class="tab-pane fade" id="tag">
<div class="control-group">
<label class="control-label muted"><%= t(:tags) %></label>
<%= select_tags(f, @module_app) %>
</div>
</div>
</div>
<!-- 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 %>
</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" : '' %>">
<!-- Title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t(:title) %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t(:title), value: (@hpsclass.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
</div>
<script type="text/javascript">
$("#hps_class_course_pic").on("change",function(){
$("#showcase_image").attr("src",URL.createObjectURL(this.files[0]));
})
</script>