Skip to content

Commit

Permalink
final-hamlized up through admin/taxonomies
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Grzesiak and Nick Karpenske authored and bendyworks-admin committed Jan 28, 2010
1 parent 8e6400e commit 9ed01de
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 106 deletions.
2 changes: 1 addition & 1 deletion app/views/admin/tax_categories/_form.html.haml
Expand Up @@ -5,4 +5,4 @@
%p
= f.label :description, t("description")
%br/
= f.text_field :description
= f.text_field :description
7 changes: 3 additions & 4 deletions app/views/admin/tax_categories/edit.html.haml
@@ -1,7 +1,6 @@
= render :partial => 'admin/shared/configuration_menu'
%h1= t("editing_tax_category")
= error_messages_for :tax_category
- form_for(:tax_category, :url => object_url, :html => { :method => :put }) do |f|
= render :partial => "form", :locals => { :f => f }
%p.form-buttons
= button t("update")
- form_for(:tax_category, :url => object_url, :html => {:method => :put}) do |f|
= render :partial => "form", :locals => {:f => f}
%p.form-buttons= button t("update")
20 changes: 9 additions & 11 deletions app/views/admin/tax_categories/index.html.haml
Expand Up @@ -13,15 +13,13 @@
%th
%tbody
- @tax_categories.each do |tax_category|
%tr{:id => dom_id tax_category}
%td= tax_category.name
%td= tax_category.description
%td.actions
= link_to_edit tax_category
\ 
\#{link_to_delete tax_category}
</haml:block>
%tr{:id => dom_id(tax_category)}
%td= tax_category.name
%td= tax_category.description
%td.actions
= link_to_edit tax_category
\&nbsp;
= link_to_delete tax_category
- if @tax_categories.empty?
%tr
%td{:colspan => "3"} None.
</haml:block>
%tr
%td{:colspan => "3"} #{t('none')}.
5 changes: 2 additions & 3 deletions app/views/admin/tax_categories/new.html.haml
Expand Up @@ -2,6 +2,5 @@
%h1= t("new_tax_category")
= error_messages_for :tax_category
- form_for(:tax_category, :url => collection_url) do |f|
= render :partial => "form", :locals => { :f => f }
%p.form-buttons
= button t("create")
= render :partial => "form", :locals => {:f => f}
%p.form-buttons= button t("create")
2 changes: 1 addition & 1 deletion app/views/admin/tax_categories/show.html.haml
@@ -1 +1 @@
= render :partial => 'admin/shared/configuration_menu'
= render :partial => 'admin/shared/configuration_menu'
14 changes: 4 additions & 10 deletions app/views/admin/tax_rates/_form.html.haml
@@ -1,17 +1,11 @@
%table
%tr
%td
= t("zone")
\:
%td #{t("zone")}:
%td= f.collection_select(:zone_id, @available_zones, :id, :name)
%tr
%td
= t("tax_category")
\:
%td #{t("tax_category")}:
%td= f.collection_select(:tax_category_id, @available_categories,:id, :name)
%tr
%td
= t("rate")
\:
%td #{t("rate")}:
%td= f.text_field :amount
= render "admin/shared/calculator_fields", :f => f
= render "admin/shared/calculator_fields", :f => f
7 changes: 3 additions & 4 deletions app/views/admin/tax_rates/edit.html.haml
@@ -1,6 +1,5 @@
%h1= t("editing_tax_rate")
= error_messages_for :tax_rate
- form_for(@tax_rate, :url => object_url, :html => { :method => :put }) do |f|
= render :partial => "form", :locals => { :f => f }
%p
= submit_tag t("update")
- form_for(@tax_rate, :url => object_url, :html => {:method => :put}) do |f|
= render :partial => "form", :locals => {:f => f}
%p= submit_tag t("update")
22 changes: 10 additions & 12 deletions app/views/admin/tax_rates/index.html.haml
@@ -1,7 +1,6 @@
.toolbar
%ul.actions
%li
= button_link_to t("new_tax_rate"), new_object_url, :icon => 'add'
%li= button_link_to t("new_tax_rate"), new_object_url, :icon => 'add'
%br.clear/
%h1= t("tax_rates")
%table.index
Expand All @@ -13,13 +12,12 @@
%th= t("action")
%tbody
- @tax_rates.each do |tax_rate|
%tr{:id => dom_id tax_rate}
%td= tax_rate.zone.name
%td= tax_rate.tax_category.name
%td= tax_rate.amount
%td= tax_rate.calculator.to_s
%td
= link_to_edit tax_rate
\&nbsp;
\#{link_to_delete tax_rate}
</haml:block>
%tr{:id => dom_id(tax_rate)}
%td= tax_rate.zone.name
%td= tax_rate.tax_category.name
%td= tax_rate.amount
%td= tax_rate.calculator.to_s
%td
= link_to_edit tax_rate
\&nbsp;
= link_to_delete tax_rate
5 changes: 2 additions & 3 deletions app/views/admin/tax_rates/new.html.haml
@@ -1,6 +1,5 @@
%h1= t("new_tax_rate")
= error_messages_for :tax_rate
- form_for(:tax_rate, :url => collection_url) do |f|
= render :partial => "form", :locals => { :f => f }
%p
= submit_tag t("create")
= render :partial => "form", :locals => {:f => f}
%p= submit_tag t("create")
2 changes: 1 addition & 1 deletion app/views/admin/tax_settings/edit.html.haml
Expand Up @@ -8,4 +8,4 @@
%p.form-buttons
= button t('update')
= t("or")
= link_to t("cancel"), admin_tax_settings_url
= link_to t("cancel"), admin_tax_settings_url
6 changes: 2 additions & 4 deletions app/views/admin/tax_settings/show.html.haml
Expand Up @@ -2,8 +2,6 @@
%h1= t("tax_settings")
%table
%tr
%th{:scope => "row"}
= t("show_price_inc_vat")
\:
%th{:scope => "row"} #{t("show_price_inc_vat")}:
%td= Spree::Config[:show_price_inc_vat]
%p= link_to_with_icon 'edit', t("edit"), edit_admin_tax_settings_path
%p= link_to_with_icon 'edit', t("edit"), edit_admin_tax_settings_path
2 changes: 1 addition & 1 deletion app/views/admin/taxonomies/_form.html.haml
Expand Up @@ -3,4 +3,4 @@
= f.label :name, t("name")
%br/
= error_message_on :taxonomy, :name
= text_field :taxonomy, :name
= text_field :taxonomy, :name
13 changes: 7 additions & 6 deletions app/views/admin/taxonomies/_js_head.html.haml
@@ -1,9 +1,10 @@
- content_for :head do
= javascript_tag "var taxonomy_id = #{@taxonomy.id}; |
var loading = '#{escape_javascript t('loading')}'; |
var new_taxon = '#{escape_javascript t('new_taxon')}'; |
var server_error = '#{escape_javascript t('server_error')}'; |
var taxonomy_tree_error = '#{escape_javascript t('taxonomy_tree_error')}';" |
:javascript
var taxonomy_id = #{@taxonomy.id};
var loading = '#{escape_javascript t('loading')}';
var new_taxon = '#{escape_javascript t('new_taxon')}';
var server_error = '#{escape_javascript t('server_error')}';
var taxonomy_tree_error = '#{escape_javascript t('taxonomy_tree_error')}';
= javascript_include_tag 'taxonomy'
%script{:src => "/javascripts/jsTree/jquery.tree.js", :type => "text/javascript"}
%script{:src => "/javascripts/jsTree/plugins/jquery.tree.contextmenu.js", :type => "text/javascript"}
%script{:src => "/javascripts/jsTree/plugins/jquery.tree.contextmenu.js", :type => "text/javascript"}
15 changes: 7 additions & 8 deletions app/views/admin/taxonomies/_list.html.haml
Expand Up @@ -2,11 +2,10 @@
%tr
%th= t("name")
%th
- for taxonomy in @taxonomies
%tr{:id => dom_id taxonomy}
%td
= taxonomy.name
%td.actions
= link_to_edit taxonomy.id
\&nbsp; #{link_to_delete taxonomy}
</haml:block>
- @taxonomies.each do |taxonomy|
%tr{:id => dom_id(taxonomy)}
%td= taxonomy.name
%td.actions
= link_to_edit taxonomy.id
\&nbsp;
= link_to_delete taxonomy
24 changes: 24 additions & 0 deletions app/views/admin/taxonomies/_manage_products.html.haml
@@ -0,0 +1,24 @@
%h3 Manage Products for [#{@taxon.presentation}]
= save_button('Save', 'manage-products', @taxon.id)
|
= reload_button('Reset', 'manage-products', 'manage_products', @taxon.id)
|
= cancel_button('Cancel', 'manage-products')
%table.two-col
%tr
%td.two-col-left
%h4 Current Products
%h5 Click to remove
%ul#add-product-target.plain
- @taxon.products.each do |p|
%li
%span.product-action.product-action-remove{:id => "product-#{p.id}"}= p.name
%td.two-col-right
%h4 All Products
%h5 Click to add
%ul#remove-product-target.plain
- Product.find(:all).each do |p|
%li
%span.product-action.product-action-add{:id => "product-#{p.id}"}= p.name
:javascript
spree.taxon.pm.onload(#{@taxon.id});
10 changes: 4 additions & 6 deletions app/views/admin/taxonomies/_taxon.html.haml
@@ -1,9 +1,7 @@
- if taxon.children.length != 0
%ul
- taxon.children.each do |child|
%li{:id => child.id, :rel => "taxon"}
%a{:href => "#"}= child.name
- if child.children.length > 0
= render :partial => "taxon", :locals => {:taxon => child}
</ul>
</haml:block>
%li{:id => child.id, :rel => "taxon"}
%a{:href => "#"}= child.name
- if child.children.length > 0
= render :partial => "taxon", :locals => {:taxon => child}
32 changes: 10 additions & 22 deletions app/views/admin/taxonomies/edit.html.haml
Expand Up @@ -10,8 +10,7 @@
#taxonomy_tree.tree
%p#progress{:style => "display:none;"}
%img{:alt => "Spinner", :src => "/images/spinner.gif?1234540747", :style => "vertical-align:bottom;"}/
= t('updating')
\..
#{t('updating')}..
%p
%br/
%small= t("taxonomy_tree_instruction")
Expand All @@ -20,23 +19,12 @@
= t("or")
= link_to t("cancel"), admin_taxonomies_path
- content_for :head do
:javascript
var initial = [
{ attributes :
{ "id" : "#{@taxonomy.root.id}" },
data : "#{@taxonomy.root.name}",
state : "open",
children : [
<haml:silent> @taxonomy.root.children.each_with_index do |taxon,i|
</haml:silent><haml:block> {
attributes :
{ id : "#{taxon.id}"},
data : "#{taxon.name}"
<haml:silent> unless taxon.children.empty?
</haml:silent><haml:block> ,state : "closed"
</haml:block> }#{"," if i < (@taxonomy.root.children.size - 1)}
</haml:block> ]
}
];


%script{:type => 'text/javascript'}
var initial =
[{
attributes : { "id" : "#{@taxonomy.root.id}" }, data : "#{@taxonomy.root.name}", state : "open",
children : [
- is_closed = lambda {|t| t.children.empty? ? '' : ',state : "closed"'}
= @taxonomy.root.children.map {|t| "{attributes : { id : \"#{t.id}\"}, data : \"#{t.name}\"#{is_closed(t)}}"}.join(',')
]
}];
2 changes: 1 addition & 1 deletion app/views/admin/taxonomies/get_children.json.haml
Expand Up @@ -6,4 +6,4 @@
- unless t.children.empty?
,state : "closed"
}#{"," if i < (@taxons.size - 1)}
]
]
7 changes: 2 additions & 5 deletions app/views/admin/taxonomies/index.html.haml
@@ -1,10 +1,7 @@
= render :partial => 'admin/shared/configuration_menu'
.toolbar
%ul.actions
%li
= button_link_to t("new_taxonomy"), new_admin_taxonomy_url, :icon => 'add'
</p>
%li= button_link_to t("new_taxonomy"), new_admin_taxonomy_url, :icon => 'add'
%br.clear/
%h1= t("taxonomies")
#list-taxonomies
= render :partial => 'list'
#list-taxonomies= render :partial => 'list'
5 changes: 2 additions & 3 deletions app/views/admin/taxonomies/new.html.haml
@@ -1,6 +1,5 @@
= render :partial => 'admin/shared/configuration_menu'
%h1= t("new_taxonomy")
- form_for(:taxon, :url => collection_url) do |f|
= render :partial => "form", :locals => { :f => f }
%p.form-buttons
= button t("create")
= render :partial => "form", :locals => {:f => f}
%p.form-buttons= button t("create")

0 comments on commit 9ed01de

Please sign in to comment.