finish the first version of predict tool.and finish the backend control panel of this tool.
This commit is contained in:
parent
24d14e2b3b
commit
190752a275
|
@ -1,4 +1,9 @@
|
|||
$(document).ready(function(){
|
||||
var head_images = $.post("/cancerpredictResult",{"header":1})
|
||||
head_images.done(function(){
|
||||
$('.header-nav').html(head_images.responseJSON['head_images']);
|
||||
$('.navbar-brand').html(head_images.responseJSON['title'])
|
||||
});
|
||||
Array.prototype.remove_item_from_array = function(){
|
||||
var result_array = this;
|
||||
for(var i=0;i<arguments.length;i++){
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
#cancer_table *[data-key]{
|
||||
padding: 0.375em 0;
|
||||
}
|
||||
.head_logo{
|
||||
float:left;
|
||||
height: 6em;
|
||||
}
|
||||
.header-nav{
|
||||
top:0 !important;
|
||||
}
|
||||
.title_texts{
|
||||
color:rgb(210, 106, 2);
|
||||
}
|
||||
.cencer_table_name{
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
|
|
|
@ -15,8 +15,16 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@categories = @module_app.categories.enabled
|
||||
@filter_fields = filter_fields(@categories, @tags)
|
||||
@table_fields = [:status, :category, :title, :start_date, :end_date, :last_modified]
|
||||
@head_images_id = @form_to_show.head_images_id
|
||||
@title_images_id = @form_to_show.title_images_id
|
||||
@head_images = []
|
||||
@title_images = []
|
||||
@head_images_id.each{|image_id| @head_images.push Headimages.find_by(:id=>image_id.to_s)} rescue nil
|
||||
@title_images_id.each{|image_id| @title_images.push Headimages.find_by(:id=>image_id.to_s)} rescue nil
|
||||
@head_new_image = Headimages.new(:cancerpredictfields_id => @form_to_show.id)
|
||||
end
|
||||
def edit
|
||||
if !(params["cancerpredictfields"].nil?)
|
||||
params["cancerpredictfields"]["form_show"].each do |num,property|
|
||||
property.each do |key,value|
|
||||
if value != "0" && value != "1"
|
||||
|
@ -85,36 +93,86 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@size.each{|size| @form_to_show[size] = params["cancerpredictfields"][size]}
|
||||
@file_path = Rails.root.to_s + '/app/assets/images/predict_tool'
|
||||
if !Dir.exist? @file_path
|
||||
#FileUtils.mkdir_p @file_path
|
||||
FileUtils.mkdir_p @file_path
|
||||
end
|
||||
# if @file.nil? != true
|
||||
# @file_name = @file.original_filename
|
||||
# @file_content = @file.read
|
||||
# FileUtils.cp(@file , @file_path)
|
||||
# @file_content.force_encoding('UTF-8')
|
||||
# Dir.chdir(@file_path)
|
||||
# @filetowrite
|
||||
# if !File.file?(@file_name)
|
||||
# @filetowrite = File.new(@file_name,"w")
|
||||
# else
|
||||
# @filetowrite = File.open(@file_name,"w")
|
||||
# end
|
||||
# @filetowrite.write(@file_content)
|
||||
# @filetowrite.close
|
||||
# Dir.chdir(Rails.root.to_s)
|
||||
# else
|
||||
# @file_name = @font_settings.font_file_name
|
||||
# end
|
||||
@field_name = {"font_file_name" => @file_name,"font_dir" => @file_path}
|
||||
@field_name.each do |name,value|
|
||||
@font_settings["old_" + name.to_s] = @font_settings[name.to_s]
|
||||
@font_settings[name.to_s] = value.to_s
|
||||
@images = params["cancerpredictfields"]['head_images']
|
||||
@head_images_id = @form_to_show.head_images_id
|
||||
@delete_index = []
|
||||
if !@images.nil?
|
||||
@images.each do |num,image|
|
||||
if num.to_i < @head_images_id.length && @head_images_id.length != 0
|
||||
if image['remove_image'] == "1"
|
||||
@delete_index.push num.to_i
|
||||
else
|
||||
@image_id = @head_images_id[num.to_i]
|
||||
@image = Headimages.find_by(:id=>@image_id.to_s)
|
||||
if !image['sort_number'].nil?
|
||||
@image.sort_number = image['sort_number'].to_i
|
||||
@image.save
|
||||
end
|
||||
next if image['temp_file'] == nil
|
||||
@file_name = image['temp_file'].original_filename.gsub('(','_').gsub(')','_').gsub(' ','_') rescue next
|
||||
@image.sort_number = image['sort_number'].to_i
|
||||
@image.temp_file = image['temp_file']
|
||||
@image.save
|
||||
end
|
||||
else
|
||||
@file_name = image['temp_file'].original_filename.gsub('(','_').gsub(')','_').gsub(' ','_') rescue next
|
||||
@headimages = Headimages.new(:cancerpredictfields_id => @form_to_show.id,:title => @app_title)
|
||||
@headimages.temp_file = image['temp_file']
|
||||
@headimages.sort_number = image['sort_number'].to_i if !image['sort_number'].nil?
|
||||
@headimages.save
|
||||
@form_to_show.head_images_id.push @headimages.id
|
||||
end
|
||||
end
|
||||
end
|
||||
@delete_index.reverse!
|
||||
@delete_index.each do |i|
|
||||
@image_id = @head_images_id[i.to_i]
|
||||
Headimages.find_by(:id => @image_id ).destroy rescue next
|
||||
@form_to_show.head_images_id.delete(@image_id)
|
||||
end
|
||||
@images = params["cancerpredictfields"]['title_images']
|
||||
@title_images_id = @form_to_show.title_images_id
|
||||
@delete_index = []
|
||||
if !@images.nil?
|
||||
@images.each do |num,image|
|
||||
if num.to_i < @title_images_id.length && @title_images_id.length != 0
|
||||
if image['remove_image'] == "1"
|
||||
@delete_index.push num.to_i
|
||||
else
|
||||
@image_id = @title_images_id[num.to_i]
|
||||
@image = Headimages.find_by(:id=>@image_id.to_s)
|
||||
if !image['sort_number'].nil?
|
||||
@image.sort_number = image['sort_number'].to_i
|
||||
@image.save
|
||||
end
|
||||
next if image['temp_file'] == nil
|
||||
@file_name = image['temp_file'].original_filename.gsub('(','_').gsub(')','_').gsub(' ','_') rescue next
|
||||
@image.sort_number = image['sort_number'].to_i
|
||||
@image.temp_file = image['temp_file']
|
||||
@image.save
|
||||
end
|
||||
else
|
||||
@file_name = image['temp_file'].original_filename.gsub('(','_').gsub(')','_').gsub(' ','_') rescue next
|
||||
@headimages = Headimages.new(:cancerpredictfields_id => @form_to_show.id,:title => @app_title)
|
||||
@headimages.temp_file = image['temp_file']
|
||||
@headimages.sort_number = image['sort_number'].to_i if !image['sort_number'].nil?
|
||||
@headimages.save
|
||||
@form_to_show.title_images_id.push @headimages.id
|
||||
end
|
||||
end
|
||||
end
|
||||
@delete_index.reverse!
|
||||
@delete_index.each do |i|
|
||||
@image_id = @title_images_id[i.to_i]
|
||||
Headimages.find_by(:id => @image_id ).destroy rescue next
|
||||
@form_to_show.title_images_id.delete(@image_id)
|
||||
end
|
||||
@form_to_show.title_texts = params['cancerpredictfields']['title_texts']
|
||||
@form_to_show.save
|
||||
#params.cancerpredictfields
|
||||
#render :html => params["cancerpredictfields"]["form_result_is_right"].to_s
|
||||
render :html => params["cancerpredictfields"].to_s
|
||||
#redirect_to admin_cancerpredicts_path
|
||||
end
|
||||
redirect_to admin_cancerpredicts_path
|
||||
end
|
||||
def showSubmit
|
||||
@results = Cancerpredictrecord.where("title"=>@app_title).take_while{true}
|
||||
|
@ -146,7 +204,6 @@ class Admin::CancerpredictsController < OrbitAdminController
|
|||
@choicenames.push @form_to_show.form_show[index.to_s]["choice_fields"][I18n.locale.to_s]
|
||||
end
|
||||
end
|
||||
#render :html => @result_names.to_s
|
||||
end
|
||||
def create_first_field
|
||||
if Cancerpredictfields.where("title"=>(@app_title + "_back")).take_while{true}.count == 0
|
||||
|
|
|
@ -10,6 +10,27 @@ class CancerpredictsController < ApplicationController
|
|||
tags = OrbitHelper.widget_tags
|
||||
categories = OrbitHelper.widget_categories || []
|
||||
create_first_field
|
||||
#begin
|
||||
if params['header'].to_i == 1
|
||||
result = {}
|
||||
@head_images = {}
|
||||
@form_to_show.head_images_id.each do |image_id|
|
||||
next if image_id.to_s == ""
|
||||
@image = Headimages.find_by(:id=>image_id.to_s)
|
||||
@url = @image.temp_file.to_s
|
||||
@head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s+'" src="'+@url+'\"/>')
|
||||
end
|
||||
result['head_images'] = Hash[@head_images.sort].values.join('')
|
||||
@head_images = {}
|
||||
@form_to_show.title_images_id.each do |image_id|
|
||||
next if image_id.to_s == ""
|
||||
@image = Headimages.find_by(:id=>image_id.to_s)
|
||||
@url = @image.temp_file.to_s
|
||||
@head_images[@image.sort_number.to_i] = ('<img class="head_logo" alt ="' + Pathname.new(@image.temp_file.file.file).basename.to_s+'" src="'+@url+'\"/>')
|
||||
end
|
||||
|
||||
result['title'] = ((@form_to_show.title_texts == "") ? "" : '<a class="title_texts">'+@form_to_show.title_texts+'</a>')+Hash[@head_images.sort].values.join('')
|
||||
else
|
||||
@record = Cancerpredictrecord.new
|
||||
@record.title = @app_title
|
||||
params['data'].each do |rec_key,rec_value|
|
||||
|
@ -98,8 +119,12 @@ class CancerpredictsController < ApplicationController
|
|||
result['texts'] += '<a class="addition">'+',此外</a><div class="extra-text" style="display:none;"><div class="texts_show" style="clear:both;"></div>'
|
||||
result['texts'] += '</div>'
|
||||
result['servive_ratio'] = @servive_ratio
|
||||
end
|
||||
result = result.merge(params)
|
||||
render :json=> result
|
||||
# rescue
|
||||
# render :json=> params
|
||||
#end
|
||||
end
|
||||
def index
|
||||
uid = OrbitHelper.params[:uid] rescue ""
|
||||
|
|
|
@ -6,7 +6,6 @@ class Cancerpredictfields
|
|||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
mount_uploader :temp_file, AssetUploader
|
||||
field :title ,type:String ,default:""
|
||||
field :form_show , :type=> Hash ,default:{0=>{:variable=>"age",:name=>{"zh_tw"=>"年齡<br/>(age)","en"=>"age"},:is_num=>1, :hint=>{'zh_tw'=>'從 18 歲(含)開始至 93 歲','en'=>''} , :comment_text=>{'zh_tw'=>'年齡為該婦女於確診罹患乳癌時之年齡','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[18,93],:right=>0,:is_float=>0},
|
||||
1=>{:variable=>"size",:name=>{"zh_tw"=>"腫瘤大小<br/>(tumor size)","en"=>"tumor size"},:is_num=>1,:hint=>{'zh_tw'=>'','en'=>''}, :comment_text=>{'zh_tw'=>'若有多個原發腫瘤,請輸入最大尺寸之原發腫瘤','en'=>''}, :choice_fields=> {"zh_tw"=>[],"en"=>[]},:range=>[1,300],:right=>0,:is_float=>0},
|
||||
|
@ -29,7 +28,11 @@ class Cancerpredictfields
|
|||
field :small ,type:String ,default:"0.825em"
|
||||
field :medium ,type:String ,default:"1em"
|
||||
field :large ,type:String ,default:"1.25em"
|
||||
field :head_images ,type:Array , default: []
|
||||
field :image_path ,type:String ,default:"1.25em"
|
||||
field :head_images_id ,type:Array , default: []
|
||||
field :title_images_id ,type:Array , default: []
|
||||
field :title_texts ,type:String ,default:""
|
||||
#field :image_uploader ,type:Object
|
||||
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc],[:postdate, :desc])}
|
||||
scope :is_approved, ->{where(:approved => true)}
|
||||
#before_create :set_expire
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# encoding: utf-8
|
||||
require 'carrierwave/processing/mime_types'
|
||||
|
||||
class HeadImagesUploader < CarrierWave::Uploader::Base
|
||||
|
||||
include CarrierWave::MimeTypes
|
||||
|
||||
process :set_content_type
|
||||
|
||||
# Include RMagick or ImageScience support:
|
||||
# include CarrierWave::RMagick
|
||||
# include CarrierWave::ImageScience
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
# storage :file
|
||||
# storage :s3
|
||||
|
||||
# Override the directory where uploaded files will be stored.
|
||||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
return "uploads/#{model.class.to_s.underscore}/predict_tool"
|
||||
end
|
||||
|
||||
# override
|
||||
def filename
|
||||
@original_filename
|
||||
end
|
||||
|
||||
def cache_dir
|
||||
"#{Rails.root}/tmp/uploads"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class Headimages
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include OrbitModel::Status
|
||||
include OrbitModel::Impression
|
||||
# encoding: utf-8
|
||||
include OrbitTag::Taggable
|
||||
include OrbitCategory::Categorizable
|
||||
mount_uploader :temp_file, HeadImagesUploader
|
||||
field :cancerpredictfields_id ,type:String ,default:""
|
||||
field :title ,type:String ,default:""
|
||||
field :sort_number ,type:Integer ,default: 0
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<!-- if this page editing please add class "fileupload-edit" -->
|
||||
<div class="fileupload fileupload-new clearfix" data-provides="fileupload">
|
||||
<span class="show_span"><%= t('cancerpredict.sort_num')+': ' %></span>
|
||||
<%= f.text_field 'sort_number',{:class=>'sort_num',:value=>((image_form['sort_number'] == nil) ? i+1 : image_form['sort_number'] ),:style=>'float: left;width: 3em;'} %>
|
||||
<span class="show_span"><%= t('cancerpredict.logo')+': ' %></span>
|
||||
<div class="fileupload-new thumbnail pull-left">
|
||||
<% if image_form.temp_file.file.present? %>
|
||||
<%= image_tag( image_form.temp_file, :size=>"120x120") rescue ''%>
|
||||
<% else %>
|
||||
<%= image_tag "/assets/site-logo.png", :class => "pull-left upload-picture"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||
<% if image_form.temp_file.file.present?%>
|
||||
<span class="btn btn-file">
|
||||
<%= f.file_field :temp_file, {:id => "input-upload", :class => 'fileupload-new', :accept=> 'image/png,image/gif,image/jpeg'} %><%= t('preferences.change') %>
|
||||
</span>
|
||||
<%= f.check_box :remove_image,{:checked=>false} %>
|
||||
<%= t(:remove) %> <%= (I18n.locale.to_s == 'en') ? ' this logo' : '該logo' %>
|
||||
<%else%>
|
||||
<span class="btn btn-file">
|
||||
<%= f.file_field :temp_file,{ :id => "input-upload", :class => 'fileupload-new', :accept=> 'image/png,image/gif,image/jpeg'} %><%= t('preferences.select_image') %>
|
||||
</span>
|
||||
<%end%>
|
||||
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload"><%= t(:cancel) %></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,6 +1,138 @@
|
|||
<%= stylesheet_link_tag "lib/fileupload"%>
|
||||
<%= javascript_include_tag 'lib/bootstrap-fileupload' %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=form_for @form_to_show ,:url=>{:controller=>"cancerpredicts" ,:action=>"edit"} do |form|%>
|
||||
<%= form.file_field :temp_file, accept: 'image/png,image/gif,image/jpeg'%>
|
||||
<span class="show_span"><%= t('cancerpredict.title') %></span>
|
||||
<div style="clear:both;"></div>
|
||||
<label class="label_left" for="title_text"><%= t('cancerpredict.title_text')+':' %></label> <%=form.text_field :title_texts ,{:value => @form_to_show.title_texts,:id=>"title_text"} %>
|
||||
<% if @title_images.length != 0%>
|
||||
<% @title_images.each_with_index do |temp_image,i| %>
|
||||
<%= form.fields_for "title_images" do |image_fields| %>
|
||||
<div class="image_field title_images" value="<%=(i+1).to_s%>">
|
||||
<%= image_fields.fields_for i.to_s do |image_field| %>
|
||||
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
||||
<% if i.to_i == @title_images.length - 1%>
|
||||
<script>
|
||||
$(document).on('click', '#add_file.title_images', function(){
|
||||
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
||||
if( old_id == undefined)
|
||||
old_id = 0;
|
||||
else
|
||||
old_id = Number(old_id);
|
||||
var new_id = old_id + 1;
|
||||
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
||||
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
||||
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
||||
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
||||
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
||||
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
||||
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||
formTip();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= form.fields_for "title_images" do |image_fields| %>
|
||||
<%= image_fields.fields_for "0" do |image_field| %>
|
||||
<script>
|
||||
$(document).on('click', '#add_file.title_images', function(){
|
||||
var old_id = $('.image_field.title_images').eq(-1).attr('value');
|
||||
if( old_id == undefined)
|
||||
old_id = 0;
|
||||
else
|
||||
old_id = Number(old_id);
|
||||
var new_id = old_id + 1;
|
||||
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
||||
$(this).parent().siblings('.add-target.title_images').before(('<div class="image_field title_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||
var name = $('.image_field.title_images').eq(-1).find('[type="file"]').attr('name');
|
||||
$('.image_field.title_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
||||
name = $('.image_field.title_images').eq(-1).find('input.sort_num').attr('name');
|
||||
$('.image_field.title_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
||||
new_id = $('.image_field.title_images').eq(-2).find('input.sort_num').val();
|
||||
if(new_id != undefined)
|
||||
$('.image_field.title_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||
else
|
||||
$('.image_field.title_images').eq(-1).find('input.sort_num').val(1);
|
||||
formTip();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="add-target title_images"></div>
|
||||
<p class="add-btn">
|
||||
<%= hidden_field_tag 'title_images_count', @title_images.count %>
|
||||
<a id="add_file" class="title_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
||||
</p>
|
||||
<span class="show_span"><%= t('cancerpredict.tool_head_pictures') %></span>
|
||||
<div style="clear:both;"></div>
|
||||
<% if @head_images.length != 0%>
|
||||
<% @head_images.each_with_index do |temp_image,i| %>
|
||||
<%= form.fields_for "head_images" do |image_fields| %>
|
||||
<div class="head_images image_field" value="<%=(i+1).to_s%>">
|
||||
<%= image_fields.fields_for i.to_s do |image_field| %>
|
||||
<%= render :partial => 'image_form', :object => temp_image, :locals => {:f => image_field, :i => i} %>
|
||||
<% if i.to_i == @head_images.length - 1%>
|
||||
<script>
|
||||
$(document).on('click', '#add_file.head_images', function(){
|
||||
var old_id = $('.image_field').eq(-1).attr('value');
|
||||
if( old_id == undefined)
|
||||
old_id = 0;
|
||||
else
|
||||
old_id = Number(old_id);
|
||||
var new_id = old_id + 1;
|
||||
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => i}).gsub("\"","\'").html_safe %>"
|
||||
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||
var name = $('.image_field').eq(-1).find('[type="file"]').attr('name');
|
||||
$('.image_field').eq(-1).find('[type="file"]').attr('name',name.replace("<%=i%>",new_id-1));
|
||||
name = $('.image_field').eq(-1).find('input.sort_num').attr('name');
|
||||
$('.image_field').eq(-1).find('input.sort_num').attr('name',name.replace("<%=i%>",new_id-1));
|
||||
new_id = $('.image_field').eq(-2).find('input.sort_num').val();
|
||||
$('.image_field').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||
formTip();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= form.fields_for "head_images" do |image_fields| %>
|
||||
<%= image_fields.fields_for "0" do |image_field| %>
|
||||
<script>
|
||||
$(document).on('click', '#add_file.head_images', function(){
|
||||
var old_id = $('.image_field.head_images').eq(-1).attr('value');
|
||||
if( old_id == undefined)
|
||||
old_id = 0;
|
||||
else
|
||||
old_id = Number(old_id);
|
||||
var new_id = old_id + 1;
|
||||
var html = "<%= escape_javascript(render :partial => 'image_form', :object => @head_new_image, :locals => {:f => image_field, :i => 0}).gsub("\"","\'").html_safe %>"
|
||||
$(this).parent().siblings('.add-target.head_images').before(('<div class="image_field head_images" value="'+new_id+'">'+html.replace(old_id, new_id)+'</div>'));
|
||||
var name = $('.image_field.head_images').eq(-1).find('[type="file"]').attr('name');
|
||||
$('.image_field.head_images').eq(-1).find('[type="file"]').attr('name',name.replace("0",new_id-1));
|
||||
name = $('.image_field.head_images').eq(-1).find('input.sort_num').attr('name');
|
||||
$('.image_field.head_images').eq(-1).find('input.sort_num').attr('name',name.replace("0",new_id-1));
|
||||
new_id = $('.image_field.head_images').eq(-2).find('input.sort_num').val();
|
||||
if(new_id != undefined)
|
||||
$('.image_field.head_images').eq(-1).find('input.sort_num').val(Number(new_id)+1);
|
||||
else
|
||||
$('.image_field.head_images').eq(-1).find('input.sort_num').val(1);
|
||||
formTip();
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="add-target head_images"></div>
|
||||
<p class="add-btn">
|
||||
<%= hidden_field_tag 'head_images_count', @head_images.count %>
|
||||
<a id="add_file" class="head_images trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t('cancerpredict.add_image') %></a>
|
||||
</p>
|
||||
<span class="show_span"><%= t('cancerpredict.text_descibe') %></span>
|
||||
<div style="clear:both;"></div>
|
||||
<%= form.text_field 'text_descibe',{:value=> @form_to_show.text_descibe[I18n.locale.to_s],:style=>'width:100%;'} %>
|
||||
|
|
|
@ -9,6 +9,12 @@ en:
|
|||
medium: medium
|
||||
large: large
|
||||
Input_fields: User input fields' contents
|
||||
tool_head_pictures: All the logos in the page of predict tool
|
||||
sort_num: sort num
|
||||
logo: logo image
|
||||
title: title of the page of predict tool
|
||||
title_text: title texts
|
||||
add_image: add image
|
||||
table:
|
||||
welcome: Welcome to The after breast cancer healing system of Taiwanprepare!\nTo start, please enter the relevant information below.
|
||||
Reset: Reset
|
||||
|
|
|
@ -9,6 +9,12 @@ zh_tw:
|
|||
medium: 中
|
||||
large: 大
|
||||
Input_fields: 使用者輸入欄位內容
|
||||
tool_head_pictures: 預測工具頁面最上方的所有logo
|
||||
sort_num: 順序號碼
|
||||
logo: logo圖片
|
||||
title: 預測工具頁面標題
|
||||
title_text: 標題文字
|
||||
add_image: 新增圖片
|
||||
table:
|
||||
welcome: 歡迎使用台灣準備乳癌癒後系統!\n若要開始 請在下方輸入相關資訊
|
||||
Reset: 重置
|
||||
|
|
Loading…
Reference in New Issue