All the little details

This commit is contained in:
2015-02-20 23:03:38 +01:00
parent 9eb4f8ee9a
commit 006d840c4e
18 changed files with 87 additions and 28 deletions
@@ -1,19 +1,3 @@
App.EmployeesIndexController = Ember.ArrayController.extend
needs: ['application']
employees: (-> @get('model').sortBy('name')).property('model.@each.name')
actions:
newEmployee: ->
employee = @store.createRecord('employee')
@modal 'employee_edit',
model: employee
title_path: 'employee.modal.new_title'
close: -> employee.deleteRecord()
editEmployee: (employee)->
@modal 'employee_edit',
model: employee
title_path: 'employee.modal.edit_title'
close: -> employee.rollback()
destroyEmployee: (employee)->
@modal 'confirm',
title: t('employee.destroy.modal.title', employee.serialize())
ok: -> employee.destroyRecord()
@@ -1,2 +1,23 @@
App.EmployeesRoute = Ember.Route.extend
model: -> @store.all 'employee'
actions:
newEmployee: ->
employee = @store.createRecord('employee')
@get('controller').modal 'employee_edit',
model: employee
title_path: 'employee.modal.new_title'
close: -> employee.deleteRecord()
editEmployee: (employee)->
@get('controller').modal 'employee_edit',
model: employee
title_path: 'employee.modal.edit_title'
close: -> employee.rollback()
destroyEmployee: (employee)->
ac = @controllerFor('application')
if ac.get('employee.id') isnt employee.id
ac.modal 'confirm',
title: t('employee.destroy.modal.title', employee.serialize())
ok: -> employee.destroyRecord()
else
ac.modal 'alert',
title: 'You cannot remove yourself'
@@ -0,0 +1,19 @@
.row: .small-12.columns
h2=t 'models.employee'
.display-row
.display-label=t 'attributes.employee.name'
.display-field= model.name
.display-row
.display-label=t 'attributes.employee.manager'
.display-field= boolean model.manager
.display-row
.display-label=t 'attributes.employee.active'
.display-field= boolean model.active
.display-row
.display-label=t 'attributes.employee.color'
.display-field: span.current-color= colorbox model.color
.page-actions
.small-12.columns
link-to 'employees' class="button"
span=t 'models.plural.employee'
a.edit-button{ action 'editEmployee' model}= t 'helpers.links.edit'
@@ -0,0 +1,3 @@
p=body
hr
button.modal-close{action "close"}= t 'confirm.cancel'
@@ -4,7 +4,7 @@ p=t 'employee_shift.modal.body_header'
.form-field= model.employee.name
.form-row.description
.form-label=t 'attributes.employee_shift.description'
.form-field
.form-field.full
= input valueBinding="model.description"
= errors model.errors.description
hr
@@ -3,7 +3,7 @@ App.ScheduleView = Ember.View.extend
didInsertElement: ->
placeholder = @$('#schedule-placeholder')
controller = @get('controller')
events = controller.get('model').map (employee_shift)->employee_shift.get('calendar_event')
events = controller.get('model').filter((employee_shift) -> employee_shift.get('employee.active') ).map( (employee_shift)->employee_shift.get('calendar_event') )
placeholder.fullCalendar
header:
left: 'prev,next,today'
@@ -10,6 +10,13 @@ td.boolean
.boolean-true
@extend .fa
@extend .fa-money
.display-field
.boolean-true
@extend .fa, .fa-lg, .fa-check
.boolean-false
@extend .fa, .fa-lg, .fa-minus
td.colorbox
+table-fit
.list-orders-container
@@ -16,7 +16,7 @@ $side-spacing: 0px
cursor: move !important
.text-alert
color: $alert-color
.text-danger
.text-warning
color: $warning-color
input.dimension
width: 52px
@@ -3,7 +3,7 @@
display: inline-block
span
display: inline-block
.form-field
.form-field, .display-field
.current-color
.colorbox-container
padding: 4px
@@ -0,0 +1,7 @@
.page-actions
+grid-row
$button-margin: 8px
margin-top: 15px
.edit-button
+button($bg: $warning-color)
margin-left: $button-margin