app/views/cytoplasm/fonts/_li.html.erb in cytoplasm-0.2.6 vs app/views/cytoplasm/fonts/_li.html.erb in cytoplasm-0.2.7

- old
+ new

@@ -1,35 +1,66 @@ -<% f["variants"] = f["familyinfo"] if dir == "fontsquirrel" %> -<li data-family="<%=fam%>" data-directory="<%=dir%>" data-uid="<%=uid = Cytoplasm.generate_uid()%>" style="padding:0px;list-style:none;margin:0px;"> - <table class="cytoTable"> - <tr><td colspan=2><h6><%=link_to(fam,cytoplasm_show_font_url(dir,fam))%></h6></td></tr> +<% +f["variants"] = f["familyinfo"] if dir == "fontsquirrel" +enabled = Cytoplasm::FontsController.is_enabled?(dir,fam) +%> +<li data-family="<%=fam%>" data-directory="<%=dir%>" data-uid="<%=uid = Cytoplasm.generate_uid()%>" style="padding:0px;list-style:none;margin:0px 0px 15px;"> + <table class="cytoTable" style="margin:0px;"> + <tr><td data-type="header" data-tag="h2"><%=link_to(fam,cytoplasm_show_font_url(dir,fam))%></td></tr> <% unless f["variants"].nil? or f["variants"].empty? %><% f["variants"].each do |v| %> <tr> <% if dir=="fontsquirrel" %> <td class="labelcell"><%=v["style_name"]%>:</td> <td style="background:white;text-align:center;"><%=image_tag(v["listing_image"])%></td> <% elsif dir=="googlewebfonts" %> <td class="labelcell"><%=v%>:</td> <td style="background:white;text-align:center;"><span class="gwf-preview" style="font-family:'<%=fam%>';font-size:48px;font-weight:<%=v%>;">AaBbCcDdEeFfGgHhIiJjKk</span></td> <% end %> + <td class="iconcell"><%=image_tag("cytoplasm/actions-circle-"+((!enabled)?"add":"remove")+"-1.png")%></td> + <td class="iconcell"><%=image_tag("cytoplasm/artwork-paintroll.png")%></td> + <td class="iconcell"><%=image_tag("cytoplasm/edition-delete-1.png")%></td> </tr> <% end end %> <tr> - <td colspan=2> + <td data-type="info"> <%=link_to("Details",((dir=="fontsquirrel")?"http://www.fontsquirrel.com/fonts/":"http://www.google.com/webfonts/specimen/")+fam,:class => "font_details",:target => "_blank")%> | - <%=link_to("Preview","#",:class => "font_preview")%> | - <%=link_to((Cytoplasm::FontsController.is_enabled?(dir,fam))?"Disable":"Enable","#",:class => "font_enable_disable")%> | + <% if enabled %> + <%=link_to("Preview","#",:class => "font_preview")%> | + <%=link_to("Set as...","#",:class => "font_set")%> | + <% end %> + <%=link_to((enabled)?"Disable":"Enable","#",:class => "font_enable_disable")%> | <%=link_to("Uninstall","#",:class => "font_uninstall")%> </td> </tr> </table> </li> <script type="text/javascript"> (function($){ $.Cytoplasm("ready",function(){ + $('[data-uid="<%=uid%>"] .font_preview').click(function(e){ + e.preventDefault(); + + }); + + $('[data-uid="<%=uid%>"] .font_set').click(function(e){ + e.preventDefault(); + var opts = {}; + <% Cytoplasm.vars()[:fonts][:faces].each do |style,currentFace| %> + $ + opts["<%=style.capitalize%> (<%=currentFace%>)"] = function(e){ + alert("<%=style%>"); + /*$.post("<%=cytoplasm_update_url%>",{style:"<%=style%>"},function(data){ + $.cytoAjaxResponse(""); + });*/ + }; + <% end %> + $(this).CytoMenu({ + options:opts + }); + }); + $('[data-uid="<%=uid%>"] .font_enable_disable').click(function(e){ e.preventDefault(); var $this = $(this); var li = $this.parents("li"); var fam = li.data('family'); @@ -46,10 +77,10 @@ $this.html("Enable"); }); } else return false; }); - $('.font_uninstall').click(function(e){ + $('[data-uid="<%=uid%>"] .font_uninstall').click(function(e){ e.preventDefault(); var $this = $(this); var li = $this.parents("li"); var fam = li.data('family'); var dir = li.data('directory'); \ No newline at end of file