patch_file/app/views/admin/patchfiles/editckeditor.html.erb

77 lines
3.2 KiB
Plaintext
Raw Normal View History

2019-09-28 11:48:59 +00:00
<h3 title="CKEDITOR現有字形">CKEDITOR現有字形</h3>
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>
<button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button>
<div style="clear:both;"></div>
2019-09-28 11:48:59 +00:00
<%=form_for @field,:url=>{:controller=>"patchfiles" ,:action=>"newfont"} do |f|%>
<div style="padding-left:1em" class="allcheckbox">
<%= f.fields_for :font_array do |fontfield|%>
<% @arr = @field.font_array.keys %>
<% for @i in @arr %>
<div style="float:left;">
<% if @field.font_array[@i.to_s] == true%>
<%=fontfield.check_box @i.to_s,{:checked=>true,:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
<% else %>
<%=fontfield.check_box @i.to_s,{:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
<% end %>
<%=fontfield.label @i.to_s ,{:for=>"checkbox"+@i.to_s,:style=>"float:right;"}%>
</div>
<%end%>
2019-09-28 11:48:59 +00:00
<%end%>
</div>
<div style="clear:both;"></div>
<div style="padding-left:1em"><label for="newfont" style="float:left;"><%=t(:newfont)%>:</label><%=f.text_field :new_add_font,{:id=>"newfont",:placeholder=>t(:newfont)}%></div>
<%=f.submit "#{t(:updatefont)}",{:id=>"submitbtn"}%>
<button id="initialbtn"><%= (I18n.locale.to_s == "zh_tw") ? "點擊來恢復初始狀態" : "click to recovery initial state" %></button>
<%=f.text_field :initial_btn, {:id=>"hidden-initial",:type => "hidden",:value=>"false"} %>
<button id="deletebtn"><%= (I18n.locale.to_s == "zh_tw") ? "點擊來刪除所選字形" : "click to delete selected font" %></button>
<%=f.text_field :delete_btn, {:id=>"hidden-delete",:type => "hidden",:value=>"false"} %>
2019-09-28 11:48:59 +00:00
<%end%>
<li id ="ckeditorFont" class="show_li">
<a title="CKEDITOR現有字形">CKEDITOR現有字形</a>
<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %>
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
<ul>
<% @field.font_array.each do |font,istrue|%>
<% @inform = (I18n.locale.to_s == "en") ? "click me to edit" : "點擊我來編輯" %>
<li><a title="<%= @inform+' '+font %>" href="<%= admin_patchfiles_path %>/editfontfile?font=<%= font %>"><%= font %></a></li>
<%end%>
</ul>
</li>
2019-09-28 11:48:59 +00:00
<style type="text/css">
.show_li,.show_li *{
list-style:none;
color:black;
}
.show_li ul{
display:none;
}
#clicktosee{
color:blue;
cursor:pointer;
}
</style>
<script>
$("#initialbtn").off("click").on("click",function(){
$("#hidden-initial").val("true");
$("#submitbtn").click();
});
$("#deletebtn").off("click").on("click",function(){
$("#hidden-delete").val("true");
$("#submitbtn").click();
});
$("#clickall").off("click").on("click",function(){
for(var i =0;i<$(".allcheckbox input").length ; i++){
if($(".allcheckbox input").eq(i).is(":checked") == false)
$(".allcheckbox input").eq(i).click();
}
});
$("#unclickall").off("click").on("click",function(){
for(var i =0;i<$(".allcheckbox input").length ; i++){
if($(".allcheckbox input").eq(i).is(":checked") == true)
$(".allcheckbox input").eq(i).click();
}
});
$('.Toggleclass').off("click").on("click",function(){
$(this).parent().find(">ul").slideToggle();
});
</script>