Progress commit

This commit is contained in:
2015-03-01 16:04:57 +01:00
parent 9cba5a11ff
commit d172b28850
16 changed files with 106 additions and 24 deletions
@@ -63,7 +63,7 @@ class SvgElementClass
else
results.text(window.compiledJS)
results.removeClass 'error'
window.evaluator = new SnapDsl(window.compiledJS, target: @target)
window.evaluator = new SnapDsl(window.compiledJS, target: @target, width: @box_width.val(), height: @box_height.val())
evaluator.result()
$('.minibutton.run').removeClass 'error'
catch {location, message}
@@ -76,8 +76,8 @@ class SnapDsl
@js_code = code
@options = options
@t = $(options.target)
@width = @t.width()
@height = @t.height()
@width = options.width
@height = options.height
$(options.target).html('')
result: ->
@snap = Snap(@options.target)
@@ -8,7 +8,7 @@ App.SectionController = Ember.ObjectController.extend
@get('model').save()
@get('model.section_elements').forEach (section_element) -> section_element.save()
rollbackEditable: ->
@get('model').rollback().then =>
@get('model').rollback()
@get('model.section_elements').forEach (section_element) ->
if section_element.get('id')
section_element.rollback()
@@ -36,6 +36,7 @@ App.SectionController = Ember.ObjectController.extend
@modal 'add_section_element',
model: @get('model')
ok: => @send 'makeEditable'
removeSectionElement: (section_element)-> section_element.destroy()
textures: ['wood1', 'wood2']
sections: (-> @get('controllers.sections.model')).property('controllers.sections.model')
@@ -1,4 +1,5 @@
Ember.Handlebars.helper 'svg', (content, options)->
width = options.hash.width8 || '100%'
height = options.hash.height8 || '100%'
"<svg width='#{width}' height='#{height}' viewBox='0 0 155 310'><g transform=''>#{content}</g></svg>".htmlSafe()
#"<svg width='#{width}' height='#{height}'>#{content}</svg>".htmlSafe()
"<svg width='#{width}' height='#{height}' viewBox='0 0 #{options.hash.width} #{options.hash.height}'><g transform=''>#{content}</g></svg>".htmlSafe()
@@ -94,6 +94,14 @@ App.ApplicationRoute = Ember.Route.extend
markSupplierOpen: ->
return unless supplier = @controllerFor('application').get('supplier')
supplier.open_the_place()
rotateLeft: (record)->
new_rotation = -90 + record.get('rotation')
new_rotation += 360 if new_rotation < 0
record.set 'rotation', new_rotation
rotateRight: (record)->
new_rotation = 90 + record.get('rotation')
new_rotation -= 360 if new_rotation >= 360
record.set 'rotation', new_rotation
events:
list_needs_help: (data) ->
if list = @store.getById('list', data.id)
@@ -20,7 +20,7 @@
li: a{action "addTables"}: span.section-add-tables-icon=t 'section.add_tables.button_label'
li: a{action "arrangeTables"}: span.section-arrange-tables-icon=t 'section.arrange_tables.modal.title'
li: a href="{{route 'qr_codes_suppliers_tables_path' section_id=id}}" target="_blank": span.qr-icon=t 'table.print_qr_codes'
li: a{action "addSectionElement"}: span.section-add-section-element-icon= t 'section_element.add_butoon'
li: a{action "addSectionElement"}: span.section-add-section-element-icon= t 'section_element.add_button'
li: a.section-destroy{action "destroySection"}: span.section-remove-icon=t 'helpers.links.destroy'
a.section-edit-mode-button{ action "makeEditable" }: span
= view "section-tables" contentBinding="tables"
@@ -1 +1,6 @@
= svg view.content.svg width=view.content.box_width height=view.content.box_height
if view.showHandles
.section-element-handles
a.rotate-left{action "rotateLeft" view.content bubbles=false}: span.icon
a.rotate-right{action "rotateRight" view.content bubbles=false}: span.icon
a.remove-section-element{action "removeSectionElement" view.content bubbles=false}: span.icon
@@ -2,6 +2,7 @@ App.SectionElementView = Ember.View.extend DragNDrop.Draggable,
templateName: 'section/section-element'
classNames: ['section-element']
attributeBindings: ['style']
show_handles: false
classNameBindings: [
'uniqueClass'
]
@@ -32,8 +33,5 @@ App.SectionElementView = Ember.View.extend DragNDrop.Draggable,
@get('content').setProperties
position_x: Math.round(10 * position.left / dpm ) / 10
position_y: Math.round(10 * position.top / dpm ) / 10
click: ->
return unless @get('controller.editmode')
new_rotation = 90 + @get('content.rotation')
new_rotation -= 360 if new_rotation >= 360
@set 'content.rotation', new_rotation
click: -> @toggleProperty('show_handles')
showHandles: Ember.computed.and 'show_handles', 'controller.editmode'
@@ -25,6 +25,7 @@ String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() +
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
window.countries = <%= IsoCountryCodes.all.map{|cc| {name: cc.name}}.to_json.html_safe %>;
var path_mapping = {
user_root: '/user',
join_occupied_table: '/user/join_occupied_table',
@@ -25,7 +25,6 @@
# <span data-t="models.table">Tafel</span>
@tspan = (path, vars={}) -> "<span data-t='#{path}' data-t-attributes='#{JSON.stringify(vars)}'>#{t(path, vars)}</span>"
@t = (path, vars={}) ->
#result = undefined
#m = undefined
@@ -52,17 +52,21 @@
span.section-add-tables-icon
@extend .fa
@extend .fa-plus-square
margin-right: $icon-right-margin
span
padding-left: 7px
span.section-arrange-tables-icon
@extend .fa
@extend .fa-th
margin-right: $icon-right-margin
span
padding-left: 7px
span.section-remove-icon
@extend .fa, .fa-trash-o
margin-right: $icon-right-margin
span
padding-left: 7px
span.section-add-section-element-icon
@extend .fa, .fa-image
margin-right: $icon-right-margin
span
padding-left: 7px
input
height: auto
padding-top: 4px
@@ -9,3 +9,26 @@
border: 2px outset #aaa
&:hover
border-color: $active-color
.section-element-handles
width: 80px
height: 22px
position: absolute
top: -22px
.rotate-left
+button($bg: $secondary-color, $padding: $button-tny)
+button-icon-only
margin-right: 4px
span
@extend .fa, .fa-lg, .fa-rotate-left
.rotate-right
+button($bg: $secondary-color, $padding: $button-tny)
+button-icon-only
margin-right: 4px
span
@extend .fa, .fa-lg, .fa-rotate-right
.remove-section-element
+button($bg: $alert-color, $padding: $button-tny)
+button-icon-only
span
@extend .fa, .fa-lg, .fa-times
+1 -1
View File
@@ -19,7 +19,7 @@
.small-6.columns.attribute-info
= f.row :svg
.form-label= f.label :svg
.form-field= f.text_area :svg
.form-field.full= f.text_area :svg
= f.row :snap_code
.form-label= f.label :snap_code
.row: .small-12.columns= f.text_area :snap_code, rows: 20, class: ['snap-code-editor'], data: {target: '#svg-preview', preview: '#javascript-preview'}
+17
View File
@@ -14,6 +14,7 @@ en:
user_feedback: User feedback
employee: Employee
employee_shift: Shift
section_element: Section element
svg_element: Svg element
plural:
user: Users
@@ -29,6 +30,7 @@ en:
user_feedback: User feedbacks
employee: Employees
employee_shift: Shifts
section_element: Section elements
svg_element: Svg elements
attributes:
product_category:
@@ -98,3 +100,18 @@ en:
female: "Ms."
svg_element:
name: Name
svg: SVG
dpm: Dots per meter
box_width: Box width
box_height: Box height
snap_code: Snap code
section_element:
name: Name
svg: SVG
dpm: Dots per meter
box_width: Box width
box_height: Box height
snap_code: Snap code
position_x: X
position_y: Y
rotation: Angle
+21
View File
@@ -13,6 +13,8 @@ nl:
join_request: Deelname verzoek
employee: Werknemer
employee_shift: Shift
section_element: Ruimte element
svg_element: Svg element
plural:
user: Gebruikers
supplier: Restaurants
@@ -26,6 +28,8 @@ nl:
join_request: Deelname verzoeken
employee: Werknemers
employee_shift: Shifts
section_element: Ruimte elementen
svg_element: Svg element
attributes:
product_category:
name: Naam
@@ -93,3 +97,20 @@ nl:
email: "E-mail:*"
male: "Dhr."
female: "Mvr."
svg_element:
name: Name
svg: SVG
dpm: Dots per meter
box_width: Box width
box_height: Box height
snap_code: Snap code
section_element:
name: Name
svg: SVG
dpm: Dots per meter
box_width: Box width
box_height: Box height
snap_code: Snap code
position_x: X
position_y: Y
rotation: Angle
+4
View File
@@ -213,3 +213,7 @@ nl:
destroy_confirmation: 'Weet je zeker dat je de ${models.employee_shift} wilt verwijderen?'
suppliers_switcher:
switch_to_button: Switch to %{name}
section_element:
add_button: ${models.section_element} toevoegen
modal:
title: ${models.section_element} toevoegen
+2 -2
View File
@@ -4,8 +4,8 @@ Release
Supplier
--------
- Fix employee creation
- Fix add manager functionality
- Fix section element positioning
- Add active toggle to svg elements
- Link employee to orders
- Employee personal schedule
- english emails