jeremyevans / scaffolding_extensions

Provides a powerful and simple to use administrative interface to perform common actions on models. It supports multiple web frameworks, multiple object-relational mappers, and multiple javascript libraries.

This URL has Read+Write access

scaffolding_extensions / scaffolds / habtm.rhtml
100644 25 lines (19 sloc) 0.983 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<% @scaffold_title = "Update #{sn = h(@scaffold_object.scaffold_name)}'s #{mpn = (so = @scaffold_options )[:aplch_name]}" %>
 
<%= scaffold_form(scaffold_url("update#{@scaffold_suffix}", :id=>(soid=@scaffold_object.scaffold_id))) %>
 
<% if @scaffold_class.scaffold_association_use_auto_complete(assoc = so[:association]) %>
  <h4>Add this <%= so[:aslhc_name] %></h4>
  <%= scaffold_text_field_tag_with_auto_complete('add', so[:singular_name], assoc) %>
<% elsif @items_to_add.length > 0 %>
  <h4>Add these <%= mpn %></h4>
  <%= scaffold_select_tag('add', @items_to_add, true) %>
<% end %>
 
<% if @items_to_remove.length > 0 %>
  <h4>Remove these <%= mpn %></h4>
  <%= scaffold_select_tag('remove', @items_to_remove, true) %>
<% end %>
 
<br /><br />
<input type='submit' value="Update <%= sn %>'s <%= mpn %>" />
</form>
 
<% if '' != (edit_link = scaffold_check_link("Edit #{sn}", true, "edit_#{@scaffold_options[:singular_name]}", :id=>soid)) %>
  <h2><%= edit_link %></h2>
<% end %>