diff --git a/app/assets/javascripts/admin/svg_element/svg_element.js.coffee b/app/assets/javascripts/admin/svg_element/svg_element.js.coffee
index ccb975ef..e7ec46c0 100644
--- a/app/assets/javascripts/admin/svg_element/svg_element.js.coffee
+++ b/app/assets/javascripts/admin/svg_element/svg_element.js.coffee
@@ -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)
diff --git a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee
index 632e5f4e..d721d305 100644
--- a/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee
+++ b/app/assets/javascripts/supplier/app/controllers/section_controller.js.coffee
@@ -8,12 +8,12 @@ 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.section_elements').forEach (section_element) ->
- if section_element.get('id')
- section_element.rollback()
- else
- section_element.deleteRecord()
+ @get('model').rollback()
+ @get('model.section_elements').forEach (section_element) ->
+ if section_element.get('id')
+ section_element.rollback()
+ else
+ section_element.deleteRecord()
@set('editmode', false)
addSection: -> @modal 'add_section', model: @get('model')
addTables: -> @modal 'section_add_tables', model: @get('model')
@@ -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')
diff --git a/app/assets/javascripts/supplier/app/helpers/svg.js.coffee b/app/assets/javascripts/supplier/app/helpers/svg.js.coffee
index 05d30334..3d8f98b8 100644
--- a/app/assets/javascripts/supplier/app/helpers/svg.js.coffee
+++ b/app/assets/javascripts/supplier/app/helpers/svg.js.coffee
@@ -1,4 +1,5 @@
Ember.Handlebars.helper 'svg', (content, options)->
width = options.hash.width8 || '100%'
height = options.hash.height8 || '100%'
- "".htmlSafe()
+ #"".htmlSafe()
+ "".htmlSafe()
diff --git a/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
index 01704e30..0b70f04f 100644
--- a/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
+++ b/app/assets/javascripts/supplier/app/routes/application_route.js.coffee.erb
@@ -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)
diff --git a/app/assets/javascripts/supplier/app/templates/section.emblem b/app/assets/javascripts/supplier/app/templates/section.emblem
index efbddf83..7a7ba985 100644
--- a/app/assets/javascripts/supplier/app/templates/section.emblem
+++ b/app/assets/javascripts/supplier/app/templates/section.emblem
@@ -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"
diff --git a/app/assets/javascripts/supplier/app/templates/section/section-element.emblem b/app/assets/javascripts/supplier/app/templates/section/section-element.emblem
index bf8f25aa..b59dc818 100644
--- a/app/assets/javascripts/supplier/app/templates/section/section-element.emblem
+++ b/app/assets/javascripts/supplier/app/templates/section/section-element.emblem
@@ -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
diff --git a/app/assets/javascripts/supplier/app/views/section/section-element.js.coffee b/app/assets/javascripts/supplier/app/views/section/section-element.js.coffee
index adbf1c5f..42b64841 100644
--- a/app/assets/javascripts/supplier/app/views/section/section-element.js.coffee
+++ b/app/assets/javascripts/supplier/app/views/section/section-element.js.coffee
@@ -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'
diff --git a/app/assets/javascripts/supplier/foundation1/application.js.erb b/app/assets/javascripts/supplier/foundation1/application.js.erb
index ae08e194..b3121e8b 100644
--- a/app/assets/javascripts/supplier/foundation1/application.js.erb
+++ b/app/assets/javascripts/supplier/foundation1/application.js.erb
@@ -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',
diff --git a/app/assets/javascripts/translations.js.coffee.erb b/app/assets/javascripts/translations.js.coffee.erb
index ac476344..9bcd79de 100644
--- a/app/assets/javascripts/translations.js.coffee.erb
+++ b/app/assets/javascripts/translations.js.coffee.erb
@@ -25,7 +25,6 @@
# Tafel
@tspan = (path, vars={}) -> "#{t(path, vars)}"
-
@t = (path, vars={}) ->
#result = undefined
#m = undefined
diff --git a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass
index 9bb75e1b..1b146cb1 100644
--- a/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass
+++ b/app/assets/stylesheets/supplier/foundation1/_qsections.css.sass
@@ -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
diff --git a/app/assets/stylesheets/supplier/foundation1/components/_section_elements.css.sass b/app/assets/stylesheets/supplier/foundation1/components/_section_elements.css.sass
index 361d4189..e409378d 100644
--- a/app/assets/stylesheets/supplier/foundation1/components/_section_elements.css.sass
+++ b/app/assets/stylesheets/supplier/foundation1/components/_section_elements.css.sass
@@ -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
+
diff --git a/app/views/admin/svg_elements/_form.html.slim b/app/views/admin/svg_elements/_form.html.slim
index 91634d09..e54de103 100644
--- a/app/views/admin/svg_elements/_form.html.slim
+++ b/app/views/admin/svg_elements/_form.html.slim
@@ -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'}
diff --git a/config/locales/models.en.yml b/config/locales/models.en.yml
index 7a70dc5a..03260213 100644
--- a/config/locales/models.en.yml
+++ b/config/locales/models.en.yml
@@ -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
diff --git a/config/locales/models.nl.yml b/config/locales/models.nl.yml
index ce6aac3a..5a51f081 100644
--- a/config/locales/models.nl.yml
+++ b/config/locales/models.nl.yml
@@ -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
diff --git a/config/locales/supplier.nl.yml b/config/locales/supplier.nl.yml
index 1d67fbc9..60e99bc7 100644
--- a/config/locales/supplier.nl.yml
+++ b/config/locales/supplier.nl.yml
@@ -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
diff --git a/wip.md b/wip.md
index 9faa304b..fd44202f 100644
--- a/wip.md
+++ b/wip.md
@@ -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