Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created August 10, 2008 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jackdempsey/4713 to your computer and use it in GitHub Desktop.
Save jackdempsey/4713 to your computer and use it in GitHub Desktop.
<%
#locals
blog ||= @blog
post_type = blog.post_type || params[:post_type] || 'text'
channels = blog.department ? blog.department.channels.map {|channel| [channel.name, channel.id]} : {}
%>
<div id="blog">
<% less_form_for [@profile, blog], :html => {:multipart=>true} do |f| %>
<input type="hidden" name="blog[post_type]" value="<%= post_type %>" />
<%= f.text_field :title %>
<% if post_type == 'text' or post_type == nil %>
<%= f.text_area :body %>
<% else %>
<%= f.text_field :url %>
<%= f.wrap(:label => 'Current file') { File.basename(blog.file) } if blog.file %>
<%= '<div>' + f.wrap(:label => 'File'){ file_column_field("blog", "file", :size => 15)} + '</div>' %>
<% end %>
<%= f.select :department_id, @departments %>
<%= f.select :channel_id, channels %>
<div class='row clear'><label>Groups</label>
<table>
</table>
</div>
<%= f.select :visibility, [['Public','public'], ['Private','private']] %>
<div class="row button">
<%= f.submit 'Save', :class=>'button' %>
</div>
<% end %>
</div>
<script type="text/javascript" charset="utf-8">
//<![CDATA[
jQuery(function($){
$("#blog_department_id").change( function(e) { alert($(this).val()) } );
});
//]]>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment