Finish a lot.

This commit is contained in:
BoHung Chiu 2021-02-28 17:19:14 +08:00
parent 62a8e98ced
commit d0641cd677
99 changed files with 263 additions and 210 deletions

View File

@ -1,3 +1,3 @@
= PersonalCourse
= PersonalPluginGenerator
This project rocks and uses MIT-LICENSE.

View File

@ -39,7 +39,7 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
redirect_to params[:referer_url]
end
def generate_plugin
template_dir_path = File.expand_path("../../../views/admin/personal_plugin_fields/template_generator/", __FILE__) + "/"
template_dir_path = File.expand_path("../../../../template_generator/", __FILE__) + "/"
cp_template_dir_path = "#{Rails.root}/tmp/#{@personal_plugin_field.module_name}/"
FileUtils.rm_rf(cp_template_dir_path)
FileUtils.cp_r(template_dir_path,cp_template_dir_path)
@ -78,51 +78,159 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
blank_text = yml_text.split(/(\r\n|\n)/).select{|t| t.include?"col_name_translate_yaml"}.first.split('col_name_translate_yaml').first rescue ""
col_name_translate_yaml = col_name_translate_yaml.gsub("\n","\n#{blank_text}")
yml_text = yml_text.gsub("col_name_translate_yaml",col_name_translate_yaml)
yml_text = yml_text.gsub("personal_plugin_template_translate",@personal_plugin_field.title_translations[locale])
File.open(yml_file,'w+') do |f|
f.write(yml_text)
end
end
plugin_template_related_files_fields = @personal_plugin_field.primary_modal_fields.select{|field_value| field_value[:field_type] == "file" rescue false}.map{|v| v[:field_name]}
plugin_template_related_files_fields = plugin_template_related_files_fields.map{|field_name|
"has_many :#{field_name.pluralize}, :dependent => :destroy, :autosave => true\n" +
"accepts_nested_attributes_for :#{field_name.pluralize}, :allow_destroy => true\n"
}.join("\n")
@blank_text = " "
slug_title = @personal_plugin_field.primary_modal_fields.select{|field_value| field_value[:slug_title] == "1" rescue false}.first[:field_name].to_s rescue ""
plugin_template_related_files = @personal_plugin_field.primary_modal_fields.select{|field_value| field_value[:field_type] == "file" rescue false}.map{|v| v[:field_name]}
plugin_template_related_files_text = plugin_template_related_files.to_s
plugin_template_related_files_fields = plugin_template_related_files.map{|field_name|
"has_many :#{field_name.pluralize}, :dependent => :destroy, :autosave => true\r\n" +
"#{@blank_text}accepts_nested_attributes_for :#{field_name.pluralize}, :allow_destroy => true"
}.join("\r\n#{@blank_text}")
plugin_template = @personal_plugin_field.primary_modal_name
backend_index_fields = @personal_plugin_field.backend_fields["index"] rescue []
backend_index_fields_contents = backend_index_fields.map do |field_name|
if field_name == slug_title
"<%= link_to #{plugin_template}.#{field_name}, page_for_#{plugin_template}(#{plugin_template}), target: \"blank\" %>\r\n " +
"<div class=\"quick-edit\">
<ul class=\"nav nav-pills hide\">
<li><%= link_to t('edit'), edit_admin_#{plugin_template}_path(course,:page => params[:page]) %></li>
<li><%= link_to t(:delete_), admin_#{plugin_template}_path(id: course.id, :page => params[:page]), method: :delete, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>\r\n "
else
"<%= #{plugin_template}.#{field_name} %>"
end
end
col_name_to_show = @personal_plugin_field.frontend_fields["member_show"] rescue []
col_name_to_show_in_show_page = @personal_plugin_field.frontend_fields["show"] rescue []
col_name_to_show_in_index_page = @personal_plugin_field.frontend_fields["index"] rescue []
extra_translate_title = col_name_to_show_in_index_page.map{|field_name| #在個人外掛前台index頁面的欄位翻譯名稱hash
["th-#{field_name}","I18n.locale(\"#{@personal_plugin_field.module_name}.#{field_name}\")"]
}.to_h
col_fields = ""
col_fields = @personal_plugin_field.primary_modal_fields.map do |field_value|
type = "String" if field_value[:field_type]
field_text = "field :#{field_value[:field_name]}, :type => #{type}, :default => {}"
field_text += ", :localize => true" if field_value[:localize]
}
col_fields = get_fields_text(@personal_plugin_field.primary_modal_fields)
col_related_fields = @personal_plugin_field.related_modal_fields.map{|field_values| get_fields_text(field_values)}
locale_fields = []
none_locale_fields = []
locale_fields_input_fields = []
none_locale_fields_input_fields = []
plugin_template_related = @personal_plugin_field.related_modal_name.select{|n| n.present?}
plugin_template_related_main_field = @personal_plugin_field.related_modal_fields.map{|field_values| field_values.map{|field_value| field_value[:field_name]}.select{|t| t.present?}.first }
@personal_plugin_field.primary_modal_fields.each do |field_value|
field_name = field_value[:field_name]
field_type = field_value[:field_type]
next if field_name.blank?
next if field_type == "file"
if (field_value[:localize] == "1" rescue false)
locale_fields << field_name
input_field = generate_input_field(field_type,field_name,true)
locale_fields_input_fields << input_field
else
none_locale_fields << field_name
input_field = generate_input_field(field_type,field_name)
none_locale_fields_input_fields << input_field
end
end
col_fields = col_fields.join("\r\n ")
col_related_fields = ""
@match_pattern = {"personal_plugin_template" => @personal_plugin_field.module_name,
"plugin_template" => @personal_plugin_field.primary_modal_name,
"plugin_template_related" => @personal_plugin_field.related_modal_name.select{|n| n.present?},
"plugin_template" => plugin_template,
"plugin_template_related" => plugin_template_related,
"plugin_template_related_files_fields" => plugin_template_related_files_fields,
"col_name_to_show" => col_name_to_show.to_s, #在會員前台頁面的顯示欄位
"col_name_to_show_in_show_page" => col_name_to_show_in_show_page.to_s, #在個人外掛前台show頁面的顯示欄位
"col_name_to_show_in_index_page" => col_name_to_show_in_index_page.to_s, #在個人外掛前台index頁面的顯示欄位
"extra_translate_title" => extra_translate_title.to_s,
"col_fields" => col_fields
"extra_translate_title" => extra_translate_title.map{|k,v| "\"#{k}\" => #{v}"}.join(", ").prepend("{").concat("}"),
"col_fields" => col_fields,
"col_related_fields" => col_related_fields,
"plugin_template_file" => plugin_template_related_files,
"plugin_template_sort_hash" => "nil",
"col_name_to_show_in_index_page_arr" => col_name_to_show_in_index_page,
"backend_index_fields" => backend_index_fields,
"slug_title" => slug_title,
"backend_index_fields_contents" => backend_index_fields_contents,
"plugin_template_related_files_text" => plugin_template_related_files_text,
"locale_fields" => locale_fields,
"none_locale_fields" => none_locale_fields,
"none_locale_fields_input_fields" => none_locale_fields_input_fields,
"locale_fields_input_fields" => locale_fields_input_fields,
"plugin_template_related_main_field" => plugin_template_related_main_field
}
@match_pattern = @match_pattern.sort_by{|k,v| -k.length}.sort_by{|k,v| (v.class != Array) ? 1 : 0}
max_length = @match_pattern.keys.map{|k| k.length}.max
@match_pattern = @match_pattern.sort_by{|k,v| (v.class != Array) ? (max_length - k.length) : -k.length}
@logs = []
replace_files(files)
#Thread.new do
dirs.each do |dir|
replace_dir(dir)
end
#end
render :html => @match_pattern
render :html => @logs.join("<br>").html_safe#@match_pattern
end
def generate_input_field(field_type,field_name,localize = false)
personal_plugin_template = @personal_plugin_field.module_name
plugin_template = @personal_plugin_field.primary_modal_name
input_field = ""
field_value_text = "@#{plugin_template}.#{field_name}"
field_name_text = ":#{field_name}"
field_name_text = "locale" if localize
if localize
field_value_text = "@#{plugin_template}.#{field_name}_translations[locale]"
end
case field_type
when "year"
input_field = "<%= select_year((#{field_value_text} ? #{field_value_text}.to_i : DateTime.now.year), {:start_year => DateTime.now.year + 5, :end_year => 1930}, {:name => '#{plugin_template}[#{field_name}]',:class => 'span1'} ) %>"
when "date"
when "time"
when "date_time"
input_field = "<%= f.text_area #{field_name_text}, class: \"input-block-level ckeditor\", placeholder: t(\"#{personal_plugin_template}.#{field_name}\"), value: (#{field_value_text} rescue nil) %>"
when "text_editor"
else #text_field
input_field = "<%= f.text_field #{field_name_text}, class: \"input-block-level\", placeholder: t(\"#{personal_plugin_template}.#{field_name}\"), value: (#{field_value_text} rescue nil) %>"
end
if localize
input_field.prepend("<%= f.fields_for :#{field_name}_translations do |f| %>\r\n ").concat("<% end %>\r\n ")
end
input_field
end
def get_fields_text(field_values)
fields_text = field_values.map do |field_value|
next if field_value[:field_type] == "file" || field_value[:field_name].blank?
type = "String"
default = "\"\""
case field_value[:field_type]
when "date"
type = "Date"
default = "Date.parse(DateTime.now.to_s)"
when "time"
type = "Time"
default = "Time.now"
when "date_time"
type = "DateTime"
default = "DateTime.now"
end
no_localize_types = ["date","time","date_time"]
field_text = "field :#{field_value[:field_name]}, :type => #{type}, :default => #{default}"
field_text += ", :localize => true" if field_value[:localize] && !no_localize_types.include?(field_value[:field_type])
field_text += ", as: :slug_title" if field_value[:slug_title]
end
fields_text.join("\r\n#{@blank_text}")
end
def replace_dirs(dirs)
dirs.each do |dir|
replace_dir(dir)
end
end
def replace_dir(dir)
dir = replace_file(dir)
return true if dir.blank?
return true if dir.select{|d| d.present?}.blank?
if dir.count > 1
replace_dirs(dir)
else
dir = dir[0]
end
sub_dirs = Dir.glob("#{dir}/*/")
files = Dir.glob("#{dir}/*").select { |fn| File.file?(fn) }
replace_files(files)
@ -147,49 +255,81 @@ class Admin::PersonalPluginFieldsController < OrbitAdminController
if new_filename.blank?
FileUtils.rm_rf("#{path}/#{file_name}")
elsif file_name != new_filename
FileUtils.mv("#{path}/#{file_name}", "#{path}/#{new_filename}")
if new_filename.class == Array
new_filename.each do |f|
FileUtils.cp_r("#{path}/#{file_name}", "#{path}/#{f}")
end
FileUtils.rm_rf("#{path}/#{file_name}")
else
FileUtils.mv("#{path}/#{file_name}", "#{path}/#{new_filename}")
end
end
if new_filename.blank?
return ""
return [""]
else
is_array = new_filename.class == Array
new_filename = Array(new_filename)
if isfile
file_text = File.read("#{path}/#{new_filename}")
file_text = replace_text_with_pattern(file_text)
File.open("#{path}/#{new_filename}",'w+'){|f| f.write(file_text)}
new_filename.each_with_index do |sub_file,i|
next if File.extname(sub_file).match(/(png|jpg)/i)
file_text = File.read("#{path}/#{sub_file}")
if is_array
file_text = replace_text_with_pattern(file_text,false,i)
else
file_text = replace_text_with_pattern(file_text)
end
File.open("#{path}/#{sub_file}",'w+'){|f| f.write(file_text)}
end
end
return "#{path}/#{new_filename}"
return new_filename.map{|sub_file| "#{path}/#{sub_file}" if sub_file.present?}
end
end
def replace_text_with_pattern(text,is_file=false,i = nil)
new_text = text
@match_pattern.each do |k,v|
next if !include_key(new_text,k)
vv = v
vv = vv[i] if i
vv = vv[i] if i && vv.class == Array
if vv.class == String
if i && vv == ""
if i && vv == "" && is_file
new_text = ""
puts k
else
new_text = gsub_text_by_key_value(new_text,k,vv)
end
elsif vv.class == Array
if is_file && v.count == 0 && (new_text.include?(k) || new_text.include?(k.classify))
new_text = ""
break
if is_file
if v.count == 0
new_text = ""
break
else
new_text = vv.map{|sub_v| gsub_text_by_key_value(new_text,k,sub_v)}
break
end
end
new_text = new_text.gsub(/<%[ ]*parse_again_start[ ]*%>((?:(?!<%[ ]*parse_again_start[ ]*%>).)+)<%[ ]*parse_again_end[ ]*%>/m) do |ff|
puts ff
ff = ff.strip
result = (0...vv.count).map {|i| replace_text_with_pattern(ff,false,i) }.join("\r\n")
new_text = new_text.gsub(/<% parse_again_start %>((?:(?!<% parse_again_start %>).)+)<% parse_again_end %>/m) do |ff|
parse_content = $1 #last match
result = ff
if include_key($1,k)
start_index = 0
end_index = parse_content.length
start_index = 2 if parse_content[0..1] == "\r\n"
end_index = end_index - 2 if parse_content[(end_index - 2)..(end_index - 1)] == "\r\n"
parse_content = parse_content.slice(start_index,end_index)
result = (0...vv.count).map {|i| replace_text_with_pattern(parse_content,false,i) }.join("")
end
result
end
end
end
return new_text
end
def include_key(text,key)
return text.include?(key) || text.include?(key.classify)
end
def gsub_text_by_key_value(text,k,v)
text = text.gsub(k + "s",v.pluralize)
text = text.gsub(k ,v )
text = text.gsub(k.classify + "s",v.pluralize.classify)
text = text.gsub(k.classify + "s",v.classify.pluralize)
text = text.gsub(k.classify,v.classify)
end
private

View File

@ -1,8 +0,0 @@
<tr id="<%= dom_id course_category %>" data-type-id="<%= course_category.id.to_s %>">
<td><%= course_category.title %></td>
<td class="span2">
<a href="<%= edit_admin_course_category_path(course_category) %>#course_category_modal" data-toggle="modal" data-remote="true" class="action"><%= t(:edit) %></a>
<%= link_to t(:delete_), admin_course_category_path(course_category), "data-confirm" => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle action" %>
</td>
</tr>

View File

@ -1,17 +0,0 @@
<% @courses.each do |course| %>
<tr id="<%= dom_id course %>" class="with_action">
<td class="span1"><%= course.year %></td>
<td class="span1">
<%= link_to course.title, page_for_course(course), target: "blank"%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_course_path(course,:page => params[:page]) %></li>
<li><%= link_to t(:delete_), admin_course_path(id: course.id, :page => params[:page]), method: :delete, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
</td>
<td><%= link_to course.course_assignments.count,course_assignments_admin_courses_path(:id=> course.id) %></td>
<td><%= course.member_profile.name rescue "" %></td>
<td><%= course.display_students rescue "" %></td>
</tr>
<% end %>

View File

@ -1,82 +0,0 @@
<h4><%=t("personal_course.assignment_management")%>-<%=@course.title rescue "" %></h4>
<% student_assignment = (StudentAssignment rescue nil) %>
<table class="table main-list">
<thead>
<tr>
<th class="span2"><%= t("personal_course.name") %></th>
<th class="span2"><%= t("personal_course.detail") %></th>
<th class="span2"><%= t("personal_course.course_attachment") %></th>
<th class="span2">
<%= t("personal_course.assign_date") %>
<button tabindex="0" class="help_btn" data-target="#show_assign_date_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_assign_date_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
<div id="show_assign_date_modal" class="modal fade" style="color: #333;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" aria-hidden="true" class="close" data-target="show_assign_date_modal">×</button>
<h4 class="modal-title"><%= t("personal_course.assign_date") %></h4>
</div>
<div class="modal-body"><%= t("personal_course.assign_date_hint") %></div>
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_assign_date_modal">Close</button></div>
</div>
</div>
</div>
</th>
<th class="span2">
<%= t("personal_course.deadline") %>
<button tabindex="0" class="help_btn" data-target="#show_deadline_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_deadline_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
<div id="show_deadline_modal" class="modal fade" style="color: #333;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" aria-hidden="true" class="close" data-target="show_deadline_modal">×</button>
<h4 class="modal-title"><%= t("personal_course.deadline") %></h4>
</div>
<div class="modal-body"><%= t("personal_course.deadline_hint") %></div>
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_deadline_modal">Close</button></div>
</div>
</div>
</div>
</th>
<% if !student_assignment.nil? %>
<th class="span2"><%=t("personal_course.already_deliver")%></th>
<% end %>
</tr>
</thead>
<tbody id="tbody_writing_journals" class="sort-holder">
<% @course_assignments.each do |course_assignment| %>
<tr>
<td>
<%= course_assignment.name %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_assignment_admin_courses_path(:uid=>course_assignment.uid,:name=>course_assignment.name,:page => params[:page]) %></li>
<li><%= link_to t(:delete_), destroy_assignment_admin_courses_path(id: course_assignment.id, :page => params[:page]), method: :delete, data: { confirm: t('personal_course.delete_assignment_message') } %></li>
</ul>
</div>
</td>
<td><%= course_assignment.detail.html_safe %></td>
<td><%= course_assignment.display_attachments %></td>
<td><%= course_assignment.display_assign_date %></td>
<td><%= course_assignment.display_deadline %></td>
<% if !student_assignment.nil? %>
<td><%= link_to course_assignment.deliver_count, show_assignments_admin_courses_path(:name=>course_assignment.name, :uid => course_assignment.uid ) %></td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<div class="bottomnav clearfix">
<div class="action pull-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_assignment_admin_courses_path(:id=>params[:id]), :class => 'btn btn-primary' %>
</div>
<div class="pagination pagination-centered">
<%= content_tag :div, paginate(@course_assignments), class: "pagination pagination-centered" %>
</div>
</div>
<script type="text/javascript">
$('.modal .close').click(function(){
$("#"+$(this).attr("data-target")).modal('hide');
})
</script>

View File

@ -1,3 +0,0 @@
module PersonalCourse
VERSION = "0.0.1"
end

View File

@ -40,51 +40,34 @@
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<!-- course code -->
<% parse_again_start %>
<!-- locale_fields -->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_course.course_code") %></label>
<label class="control-label muted"><%= t("personal_plugin_template.locale_fields") %></label>
<div class="controls">
<%= f.text_field :course_code, class: "input-block-level", placeholder: t("personal_course.course_code"), value: (@course.course_code rescue nil) %>
</div>
</div>
<!-- course title-->
<div class="control-group input-title">
<label class="control-label muted"><%= t("personal_course.title") %></label>
<div class="controls">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_course.title"), value: (@course.title_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<!-- course objective -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_course.objective") %></label>
<div class="controls">
<%= f.fields_for :objective_translations do |f| %>
<%= f.text_area locale, class: "input-block-level ckeditor", placeholder: t("personal_course.objective"), value: (@course.objective_translations[locale] rescue nil) %>
<% end %>
locale_fields_input_fields
</div>
</div>
<% parse_again_end %>
</div>
<% end %>
<!-- File -->
<%
files_hash = {}
["course_syllabus_file", "course_progress_file", "course_activity_file", "course_multimedia_file", "course_material_file", "course_supplement_file", "course_evaluation_file"].each do |file|
plugin_template_related_files_text.each do |file|
hash = {}
hash["html"] = add_attribute("form_file", f, file.pluralize.to_sym)
hash["count"] = @course.send(file.pluralize).count rescue 0
hash["count"] = @plugin_template.send(file.pluralize).count rescue 0
files_hash[file] = hash
%>
<div class="control-group">
<label class="control-label muted"><%= t("personal_course.#{file}") %></label>
<label class="control-label muted"><%= t("personal_plugin_template.#{file}") %></label>
<div class="controls">
<!-- Exist -->
<% if !@course.new_record? && hash["count"] > 0 %>
<% if !@plugin_template.new_record? && hash["count"] > 0 %>
<div class="exist">
<% @course.send(file.pluralize).each_with_index do |obj, i| %>
<% @plugin_template.send(file.pluralize).each_with_index do |obj, i| %>
<% if !obj.new_record? %>
<%= f.fields_for file.pluralize.to_sym, obj do |f| %>
<%= render :partial => "form_file", :object => obj, :locals => {:f => f, :i => i} %>
@ -115,9 +98,6 @@
<li>
<a href="#status" data-toggle="tab"><%= t(:status) %></a>
</li>
<li>
<a href="#students" data-toggle="tab"><%= t("personal_course.students") %></a>
</li>
</ul>
<!-- Module -->
@ -141,58 +121,42 @@
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_plugins.author") %></label>
<div class="controls">
<% members = !@course.member_profile.nil? ? @course.member_profile.to_a : [] %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'course[member_profile_id]', email_members: members,index:'0',select_name:'member_profile_id'} %>
<% members = !@plugin_template.member_profile.nil? ? @plugin_template.member_profile.to_a : [] %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'plugin_template[member_profile_id]', email_members: members,index:'0',select_name:'member_profile_id'} %>
</div>
</div>
<% end %>
<!-- year -->
<% parse_again_start %>
<!-- none_locale_fields -->
<div class="control-group">
<label class="control-label muted"><%= t("personal_course.year") %></label>
<label class="control-label muted"><%= t("personal_plugin_template.none_locale_fields") %></label>
<div class="controls">
<%= select_year((@course.year ? @course.year.to_i : DateTime.now.year), {:start_year => DateTime.now.year + 5, :end_year => 1930}, {:name => 'course[year]',:class => 'span1'} ) %>
none_locale_fields_input_fields
</div>
</div>
<!-- course_category -->
<% parse_again_end %>
<% parse_again_start %>
<!-- plugin_template_related -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_course.course_category") %></label>
<label class="control-label muted"><%= t("personal_plugin_template.plugin_template_related") %></label>
<div class="controls">
<%= f.select :course_category_id, CourseCategory.all.collect {|t| [ t.title, t.id ]} %>
<%= f.select :plugin_template_related_id, plugin_template_related.all.collect {|t| [ t.plugin_template_related_main_field, t.id ]} %>
</div>
</div>
<!-- course_semester -->
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_course.course_semester") %></label>
<div class="controls">
<%= f.select :course_semester_id, CourseSemester.all.collect {|t| [ t.title, t.id ]} %>
</div>
</div>
<% parse_again_end %>
</div>
<!-- Status Module -->
<div class="tab-pane fade" id="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 @course.is_hidden? %>">
<label class="checkbox inline btn <%= 'active' if @plugin_template.is_hidden? %>">
<%= f.check_box :is_hidden %> <%= t(:hide) %>
</label>
</div>
</div>
</div>
<div class="tab-pane fade" id="students">
<div class="control-group">
<label class="control-label muted"><%= t("personal_course.students") %></label>
<div class="controls" data-toggle="buttons-checkbox">
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'course[student_ids][]', email_members: @course.students,index:'1',select_name:'student_ids'} %>
</div>
</div>
</div>
</div>
</div>
<!-- Form Actions -->

View File

@ -0,0 +1,7 @@
<% @plugin_templates.each do |plugin_template| %>
<tr id="<%= dom_id course %>" class="with_action">
<% parse_again_start %>
<td> backend_index_fields_contents </td>
<% parse_again_end %>
</tr>
<% end %>

View File

@ -1,11 +1,13 @@
<table class="table main-list">
<thead>
<tr>
<th><%= t('personal_plugin_template.year') %></th>
<% parse_again_start %>
<th><%= t('personal_plugin_template.backend_index_fields') %></th>
<% parse_again_end %>
</tr>
</thead>
<tbody id="tbody_writing_journals" class="sort-holder">
<%= render 'personal_plugin_templates' %>
<%= render 'plugin_templates' %>
</tbody>
</table>

View File

@ -0,0 +1,3 @@
module PersonalPluginTemplate
VERSION = "0.0.1"
end

View File

@ -0,0 +1,27 @@
<table class="table table-hover table-striped projects-index plugin_templates-index dt-responsive nowrap">
<caption><h3>{{widget-title}}</h3></caption>
<thead>
<tr>
<% parse_again_start %>
<th class="col-md-1">{{th_col_name_to_show_in_index_page_arr}}</th>
<% parse_again_end %>
</tr>
</thead>
<tbody data-level="0" data-list="plugin_templates">
<tr>
<% parse_again_start %>
<td>{{col_name_to_show_in_index_page_arr}}</td>
<% parse_again_end %>
</tr>
</tbody>
</table>
{{pagination_goes_here}}
<script>
$('table.plugin_templates-index').DataTable({
searching: false,
paging: false,
ordering: false,
info: false
});
</script>

View File

@ -0,0 +1,12 @@
{
"frontend": [
{
"filename" : "index",
"name" : {
"zh_tw" : "1. 列表",
"en" : "1. List"
},
"thumbnail" : "thumb.png"
}
]
}

View File

@ -0,0 +1,8 @@
<table class="table table-striped plugin-show-table">
<tbody data-list="plugin_datas" data-level="0">
<tr>
<th class="{{title_class}}">{{title}}</th>
<td class="{{value_class}}">{{value}}</td>
</tr>
</tbody>
</table>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB