Spec fixes

This commit is contained in:
2014-12-01 17:54:55 +01:00
parent 9ef3d4b725
commit 60e6b2a648
21 changed files with 74 additions and 86 deletions
@@ -1,11 +1,15 @@
App.TablesIndexController = Ember.ArrayController.extend
tables: (-> @get('model').sortBy('casted_number')).property('model.@each.number')
actions:
newTable: ->
table = @store.createRecord('table')
@modal 'table_edit',
model: table
close: -> table.deleteRecord()
editTable: (table)->
@modal 'table_edit',
model: table
close: ->
table.rollback()
close: -> table.rollback()
destroyTable: (table)->
@modal 'confirm',
title: t('table.destroy.modal.title', number: table.get('number'))
@@ -1,8 +1,8 @@
attr = DS.attr
App.Table = DS.Model.extend
number: attr 'number'
width: attr 'number'
height: attr 'number'
number: attr 'number', defaultValue: 0
width: attr 'number', defaultValue: 1
height: attr 'number', defaultValue: 1
position_x: attr 'number'
position_y: attr 'number'
# occupied: attr 'boolean'
@@ -16,15 +16,16 @@ header.top-menu
.extra-info
.supplier-info-row
.counter.supplier-orders-placed-count
= supplier.orders_placed_count
span.supplier-orders-placed-count-number= supplier.orders_placed_count
span.orders-placed-count-icon
.supplier-info-row
.counter.supplier-orders-in-process-count
= supplier.orders_in_process_count
span.supplier-orders-in-process-count-number= supplier.orders_in_process_count
span.orders-in-process-count-icon
aside.side-menu
ul
li.title: h3 Menu
li.supplier-name= supplier.name
if supplier.open
li: a.supplier-close-shop{action "markSupplierClosed"}= t 'supplier.close_for_orders'
else
@@ -1,12 +1,10 @@
p=t 'table.edit.modal.body_header'
.form-row
.form-row.number
.form-label=t 'attributes.table.number'
.form-field= input type="number" valueBinding="model.number"
.form-row
.form-row.section
.form-label=t 'models.section'
.form-field
= view "select" content=sections selectionBinding="model.section" optionLabelPath="content.title" optionValuePath="content.id"
= model.section.title
.form-field= view "select" content=sections selectionBinding="model.section" optionLabelPath="content.title" optionValuePath="content.id"
hr
button.modal-close{action "close"}=t 'section.add_tables.modal.close_button'
button.modal-confirm.right{action "save"}=t 'section.add_tables.modal.add_button'
@@ -20,3 +20,4 @@
td.actions
a.table-edit{ action 'editTable' table }: span
a.table-destroy{ action 'destroyTable' table }: span
a.button.new-table-button{action "newTable"}= t 'table.new_button'
@@ -1,5 +1,4 @@
$side-spacing: 0px
@import constants
html
body
padding-top: 42px
@@ -9,6 +9,7 @@ aside.side-menu
opacity: 0.9
border-right: 2px solid black
z-index: 8050
color: white
h3
color: white
margin-bottom: 3px
@@ -1,4 +1,3 @@
@import constants
@import bourbon
@import ./qconstants
@import ./foundation_and_overrides
@@ -49,10 +49,10 @@ module Suppliers
respond_to do |format|
if @table.save
format.html { redirect_to [:suppliers, @table.section || @table], notice: t('action.create.successfull', model: Table.model_name.human) }
format.json { render json: @table, status: :created, location: @table }
format.json { render json: @table, status: :created }
else
format.html { render action: "new" }
format.json { render json: @table.errors, status: :unprocessable_entity }
format.json { render json: {errors: @table.errors}, status: :unprocessable_entity }
end
end
end
@@ -65,12 +65,10 @@ module Suppliers
respond_to do |format|
if @table.update_attributes(table_params)
format.html { redirect_to [:suppliers, @table.section || @table], notice: t('action.update.successfull', model: Table.model_name.human) }
format.json { head :no_content }
format.js { head :no_content }
format.json { render json: @table }
else
format.html { render action: "edit" }
format.json { render json: @table.errors, status: :unprocessable_entity }
format.js { head :no_content }
format.json { render json: {errors: @table.errors}, status: :unprocessable_entity }
end
end
end