fix bug about recovery font and delete font and add edit all font
This commit is contained in:
1 parent
7eb02f0d1c
commit
44188cb614
5 files changed
+103
-54
No files matched your search
@@ -1,16 +1,19 @@
|
||||
<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>
|
||||
<%=form_for @field,:url=>{:controller=>"patchfiles" ,:action=>"newfont"} do |f|%>
|
||||
<div style="padding-left:1em">
|
||||
<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].values.first == true%>
|
||||
<%=fontfield.check_box @field.font_array[@i.to_s].keys.first,{:checked=>true,:id=>"checkbox"+@i.to_s,: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 @field.font_array[@i.to_s].keys.first,{:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
|
||||
<%=fontfield.check_box @i.to_s,{:id=>"checkbox"+@i.to_s,:style=>"float:left;"} %>
|
||||
<% end %>
|
||||
<%=fontfield.label @field.font_array[@i.to_s].keys.first,{:for=>"checkbox"+@i.to_s,:style=>"float:right;"}%>
|
||||
<%=fontfield.label @i.to_s ,{:for=>"checkbox"+@i.to_s,:style=>"float:right;"}%>
|
||||
</div>
|
||||
<%end%>
|
||||
<%end%>
|
||||
@@ -20,8 +23,20 @@
|
||||
<%=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"} %>
|
||||
<%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>
|
||||
<style type="text/css">
|
||||
.show_li,.show_li *{
|
||||
list-style:none;
|
||||
@@ -40,5 +55,23 @@
|
||||
$("#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>
|
||||
@@ -4,7 +4,8 @@
|
||||
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
|
||||
<ul>
|
||||
<% @font_array.each do |font|%>
|
||||
<li><a title="<%= font %>" href="<%= admin_patchfiles_path %>/editfontfile?font=<%= font %>"><%= font %></a></li>
|
||||
<% @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>
|
||||
|
||||
Reference in new issue
Block a user