add suppliers/lists ui styling and security fixes

This commit is contained in:
2012-09-07 15:19:02 +02:00
parent 2be6c0ee03
commit 76424f972f
33 changed files with 773 additions and 22 deletions
+22
View File
@@ -0,0 +1,22 @@
= form_for [:suppliers, @list], html: {class: 'form-horizontal' } do |f|
= render 'error_messages', target: @list
.control-group class=(@list.errors[:state].any? ? 'error' : nil)
= f.label :state, class: 'control-label'
.controls
= f.text_field :state, class: 'text_field', disabled: true
.control-group class=(@list.errors[:needs_help].any? ? 'error' : nil)
= f.label :needs_help, class: 'control-label'
.controls
= f.check_box :needs_help, class: 'check_box'
.control-group class=(@list.errors[:needs_payment].any? ? 'error' : nil)
= f.label :needs_payment, class: 'control-label'
.controls
= f.check_box :needs_payment, class: 'check_box'
.control-group class=(@list.errors[:table_id].any? ? 'error' : nil)
= f.label :table_id, Table.model_name.human, class: 'control-label'
.controls
= f.collection_select :table_id, @tables, :id, :number, include_blank: nil
.form-actions
= f.submit nil, class: 'btn btn-primary'
'
= link_to t("helpers.links.cancel"), suppliers_lists_path, class: 'btn'
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :edit, model_class
= render 'form'
+41
View File
@@ -0,0 +1,41 @@
- model_class = List
div.page-header= title :index, model_class
form action='' method="get"
input#lists-date type="text" name="date" value=@date.to_s('%Y-%m-%d')
.well
- if @lists.any?
table.table
thead
tr
th= model_class.human_attribute_name(:state)
th= model_class.human_attribute_name(:needs_help)
th= model_class.human_attribute_name(:needs_payment)
th= model_class.human_attribute_name(:closed_at)
th= Table.model_name.human
th.currency= model_class.human_attribute_name(:price)
th.timestamp= model_class.human_attribute_name(:created_at)
th.actions=t 'helpers.actions'
tbody
- @lists.each do |list|
tr
td= link_to list.state, [:suppliers, list]
td=show_boolean list.needs_help
td=show_boolean list.needs_payment
td=l list.closed_at, format: :short
td= link_to_if list.table.present?, list.table.try(:number), [:suppliers, list.table]
td.currency= list.price.present? ? currency(list.price) : '...'
td.timestamp=l list.created_at, format: :short
td.actions
= link_to t('helpers.links.edit'), [:edit, :suppliers, list], class: 'btn btn-mini'
'
= link_to t("helpers.links.destroy"), [:suppliers, list], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
= no_content_given model_class
- content_for :footer do
javascript:
$('#lists-date').datepicker({
dateFormat: 'yy-mm-dd',
onSelect: function(dateText, inst){
$(this).parents('form').submit();
}
})
+4
View File
@@ -0,0 +1,4 @@
- model_class = List
.page-header
= title :new, model_class
= render 'form'
+19
View File
@@ -0,0 +1,19 @@
.page-header= title t('supplier.lists.show.title', list: List.model_name.human)
dl.dl-horizontal
dt= List.human_attribute_name(:created_at)
dd= l @list.created_at, format: :short
.well
table#list-table.table
thead
tr
th= Order.model_name.human
th.currency= Product.human_attribute_name(:price)
tbody
tr
td colspan=2 = slider_image
tfoot
- content_for :footer do
javascript:
jQuery(function(){
Qsupplier.load_list('#{@list.id}');
})
+1 -1
View File
@@ -7,7 +7,7 @@ dl.dl-horizontal.show-list
dt= model_class.human_attribute_name(:code)
dd= @product.code
dt= model_class.human_attribute_name(:price)
dd= @product.price
dd=currency @product.price
- if @product.product_category.present?
dt= ProductCategory.model_name.human
dd= link_to @product.product_category.name, @product.product_category