F5 Test changes

This commit is contained in:
2015-10-05 18:05:57 +02:00
parent 2bb597419d
commit c93d6bec8a
16 changed files with 132 additions and 47 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations' # require 'capistrano/rails/migrations'
require 'capistrano/puma' require 'capistrano/puma'
require 'capistrano/puma/monit' require 'capistrano/puma/monit'
#require "airbrussh/capistrano" require "airbrussh/capistrano"
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
+3 -3
View File
@@ -1,6 +1,6 @@
GIT GIT
remote: git://github.com/bterkuile/cmtool.git remote: git://github.com/bterkuile/cmtool.git
revision: 6b6a7405bab49a798e38af5e74d52a38de519039 revision: 7dc12ca3e8c240261740dd7a59c1e381ffc1c1b0
specs: specs:
cmtool (2.0.0) cmtool (2.0.0)
ace-rails-ap ace-rails-ap
@@ -113,7 +113,7 @@ GEM
bcrypt (3.1.10) bcrypt (3.1.10)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bourbon (4.2.4) bourbon (4.2.5)
sass (~> 3.4) sass (~> 3.4)
thor (~> 0.19) thor (~> 0.19)
builder (3.2.2) builder (3.2.2)
@@ -274,7 +274,7 @@ GEM
mimemagic (0.3.0) mimemagic (0.3.0)
mini_magick (4.3.3) mini_magick (4.3.3)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.8.0) minitest (5.8.1)
multi_json (1.11.2) multi_json (1.11.2)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
@@ -6,6 +6,7 @@
#= require ace/ace #= require ace/ace
#= require ace/theme-monokai #= require ace/theme-monokai
#= require ace/mode-coffee #= require ace/mode-coffee
#= require ace/mode-xml
#= require_tree . #= require_tree .
#= require_self #= require_self
#$ -> #$ ->
@@ -0,0 +1,33 @@
window.formatXml = (xml) ->
formatted = ''
reg = /(>)(<)(\/*)/g
xml = xml.replace(reg, '$1\r\n$2$3')
pad = 0
jQuery.each xml.split('\r\n'), (index, node) ->
indent = 0
if node.match(/.+<\/\w[^>]*>$/)
indent = 0
else if node.match(/^<\/\w/)
if pad != 0
pad -= 1
else if node.match(/^<\w[^>]*[^\/]>.*$/)
indent = 1
else
indent = 0
padding = ''
i = 0
while i < pad
padding += ' '
i++
formatted += padding + node + '\r\n'
pad += indent
return
formatted
window.squashXml = (xml)->
result = xml
.trim()
.replace(/^\s+/g, '')
.replace(/\s+$/g, '')
.replace(/>(?:\r\n|\r|\n)/g, '')
.replace(/(?:\r\n|\r|\n)/g, ' ')
result
@@ -1,43 +1,76 @@
class SvgElementClass class SvgElementClass
setup: (container)-> setup: (context=$(document))->
if container #@setupSnapCode(context)
@text_field = container.find('.snap-code-editor') @svg_source = context.find('#svg_element_svg')
else @preview_target = context.find('#svg-preview').css('border', '1px solid black')
@text_field = $('.snap-code-editor') @original_svg = @svg_source.val()
@text_field.change => @compileSource()
target = @text_field.data('target')
@target = target
container = @ container = @
ace_div = $('<div></div>').attr('id', 'ace-div').html @text_field.val() @input_type_select = context.find('#svg_element_input_type').change ->
switch $(@).val()
when 'snap_code'
container.setupSnapCode(context)
else
container.setupSvgEdit(context)
.change()
setupSvgEdit: (context)->
@svg_source.val @original_svg #reset svg value
$('#snap-code-ace-div').remove()
container = @
ace_div = $('<div></div>').attr('id', 'raw-svg-ace-div')
ace_div.css ace_div.css
width: '100%' width: '100%'
height: '500px' height: '500px'
@text_field.after(ace_div) @svg_source.after(ace_div)
@editor = ace.edit('raw-svg-ace-div')
@editor.setTheme 'ace/theme/monokai'
@editor.getSession().setMode 'ace/mode/xml'
@editor.setValue formatXml(@svg_source.val())
@editor.getSession().on 'change', (e)=>
result = @editor.getValue()
@preview_target.html result
@svg_source.val squashXml(result)
# @svg_source.val(@editor.getValue()).change()
#@svg_source.hide()
window.editor = @editor
setupSnapCode: (context)->
@snap_code_source = context.find('.snap-code-editor')
@snap_code_source.change => @compileSource()
#preview_target = @snap_code_source.data('previewTarget')
#@preview_target = preview_target
container = @
ace_div = $('<div></div>').attr('id', 'snap-code-ace-div').html @snap_code_source.val()
ace_div.css
width: '100%'
height: '500px'
@snap_code_source.after(ace_div)
#ACE #ACE
@editor = ace.edit('ace-div') @editor = ace.edit('snap-code-ace-div')
@editor.setTheme 'ace/theme/monokai' @editor.setTheme 'ace/theme/monokai'
@editor.getSession().setMode 'ace/mode/coffee' @editor.getSession().setMode 'ace/mode/coffee'
@editor.getSession().on 'change', (e)=> @editor.getSession().on 'change', (e)=>
@text_field.val(@editor.getValue()).change() @snap_code_source.val(@editor.getValue()).change()
@text_field.hide() @snap_code_source.hide()
@svg_code_field = $('#svg_element_svg') @svg_code_field = $('#svg_element_svg')
$(target).on "DOMSubtreeModified", => @preview_target.on "DOMSubtreeModified", => # In image editing in debug mode????
@svg_code_field.val $(target).html() @svg_code_field.val @preview_target.html()
@box_width = $('#svg_element_box_width') @box_width = $('#svg_element_box_width')
@box_height = $('#svg_element_box_height') @box_height = $('#svg_element_box_height')
@dpm = $('#svg_element_dpm') @dpm = $('#svg_element_dpm')
@box_width.change(-> @box_width.change ->
$(target).attr 'width', $(@).val() container.preview_target.attr 'width', $(@).val()
container.compileSource() container.compileSource()
).change() .change()
@box_height.change(->
$(target).attr 'height', $(@).val() @box_height.change ->
container.preview_target.attr 'height', $(@).val()
container.compileSource() container.compileSource()
).change() .change()
@dpm.change(-> @dpm.change(->
return unless dpm = $(@).val() return unless dpm = $(@).val()
if pheight = container.box_height.val() if pheight = container.box_height.val()
@@ -49,11 +82,11 @@ class SvgElementClass
$('.box_width .attribute-info').html "#{width}&nbsp;<i>m</i>" $('.box_width .attribute-info').html "#{width}&nbsp;<i>m</i>"
).change() ).change()
$(target).css('border', '1px solid black')
@compileSource() @compileSource()
compileSource: -> compileSource: ->
return unless source = @text_field.val() return unless source = @snap_code_source.val()
results = $(@text_field.data('preview')) #results = $(@snap_code_source.data('preview'))
results = @preview_target
window.compiledJS = '' window.compiledJS = ''
try try
window.compiledJS = CoffeeScript.compile source, bare: on window.compiledJS = CoffeeScript.compile source, bare: on
@@ -63,11 +96,11 @@ class SvgElementClass
else else
results.text(window.compiledJS) results.text(window.compiledJS)
results.removeClass 'error' results.removeClass 'error'
window.evaluator = new SnapDsl(window.compiledJS, target: @target, width: @box_width.val(), height: @box_height.val()) window.evaluator = new SnapDsl(window.compiledJS, target: @preview_target, width: @box_width.val(), height: @box_height.val())
evaluator.result() evaluator.result()
$('.minibutton.run').removeClass 'error' $('.minibutton.run').removeClass 'error'
catch {location, message} catch {location, message}
if location? if location
message = "Error on line #{location.first_line + 1}: #{message}" message = "Error on line #{location.first_line + 1}: #{message}"
results.text(message).addClass 'error' results.text(message).addClass 'error'
$('.minibutton.run').addClass 'error' $('.minibutton.run').addClass 'error'
@@ -75,12 +108,12 @@ class SnapDsl
constructor: (code, options = {})-> constructor: (code, options = {})->
@js_code = code @js_code = code
@options = options @options = options
@t = $(options.target) @t = options.target
@width = options.width @width = options.width
@height = options.height @height = options.height
$(options.target).html('') $(options.target).html('')
result: -> result: ->
@snap = Snap(@options.target) @snap = Snap(@t[0])
s = @snap s = @snap
try try
eval @js_code eval @js_code
@@ -5,4 +5,7 @@ App.QrCodesLinkComponent = Ember.Component.extend
attributeBindings: ['href', 'target'] attributeBindings: ['href', 'target']
href: Ember.computed 'section.id', 'table.id', -> href: Ember.computed 'section.id', 'table.id', ->
Routes.qr_codes_suppliers_tables_path(section_id: @get('section.id'), table_id: @get('table.id')) Routes.qr_codes_suppliers_tables_path(section_id: @get('section.id'), table_id: @get('table.id'))
click: ->
# Somehow this is needed for within the actions menu
@$().click()
@@ -3,12 +3,9 @@ App.SectionElementComponent = Ember.Component.extend DragNDrop.Draggable,
classNames: ['section-element-container'] classNames: ['section-element-container']
attributeBindings: ['style'] attributeBindings: ['style']
show_handles: false show_handles: false
classNameBindings: [ spinning: false
'uniqueClass' classNameBindings: ['uniqueClass', 'spinning:spin-rotate']
] uniqueClass: Ember.computed 'section_element.id', -> "section-element-#{@get('section_element.id')}"
uniqueClass: (->
"section-element-#{@get('section_element.id')}"
).property('section_element.id')
draggable: Ember.computed.alias 'section.editmode' draggable: Ember.computed.alias 'section.editmode'
offsetX: (-> offsetX: (->
(@get('dpm') || 0) * (@get('section_element.position_x') || 0) (@get('dpm') || 0) * (@get('section_element.position_x') || 0)
@@ -30,7 +27,12 @@ App.SectionElementComponent = Ember.Component.extend DragNDrop.Draggable,
@get('section_element').setProperties @get('section_element').setProperties
position_x: position.left / dpm position_x: position.left / dpm
position_y: position.top / dpm position_y: position.top / dpm
click: -> @toggleProperty('show_handles') if @get('section.editmode') click: ->
if @get('section.editmode')
@toggleProperty('show_handles')
else
@set 'spinning', true
Ember.run.later (=> @set('spinning', false)), 2000
showHandles: Ember.computed.and 'show_handles', 'section.editmode' showHandles: Ember.computed.and 'show_handles', 'section.editmode'
actions: actions:
rotateLeft: -> rotateLeft: ->
@@ -1257,4 +1257,3 @@ $button-edit-color: #ffa
$button-destroy-color: #faa $button-destroy-color: #faa
$button-submit-color: $primary-color $button-submit-color: $primary-color
$button-cancel-color: $secondary-color $button-cancel-color: $secondary-color
@@ -0,0 +1,7 @@
.spin-rotate
+animation(spinRotate 2s)
+keyframes(spinRotate)
from
transform: rotate(0deg)
to
transform: rotate(360deg)
+1
View File
@@ -4,6 +4,7 @@ class SvgElement
include SvgElementDefaults include SvgElementDefaults
property :snap_code property :snap_code
property :active, type: :boolean, default: true property :active, type: :boolean, default: true
property :input_type # %w[raw snap_code]
has_many :section_elements has_many :section_elements
def self.active def self.active
+4 -1
View File
@@ -8,6 +8,9 @@
= f.row :active = f.row :active
.form-label= f.label :active .form-label= f.label :active
.form-field= f.check_box :active .form-field= f.check_box :active
= f.row :input_type
.form-label= f.label :input_type
.form-field= f.select :input_type, %w[raw snap_code]
= f.row :dpm = f.row :dpm
.small-3.columns= f.label :dpm .small-3.columns= f.label :dpm
.small-3.columns= f.number_field :dpm, step: :any .small-3.columns= f.number_field :dpm, step: :any
@@ -25,7 +28,7 @@
.form-field.full= f.text_area :svg .form-field.full= f.text_area :svg
= f.row :snap_code = f.row :snap_code
.form-label= f.label :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'} .row: .small-12.columns= f.text_area :snap_code, rows: 20, class: ['snap-code-editor'], data: {preview_target: '#svg-preview', preview: '#javascript-preview'}
.row: .small-12.columns: pre#javascript-preview.hide .row: .small-12.columns: pre#javascript-preview.hide
.form-actions .form-actions
= f.submit nil, class: 'form-submit-button' = f.submit nil, class: 'form-submit-button'
@@ -1,3 +1,6 @@
- model_class = SvgElement - model_class = SvgElement
- title :edit, model_class - title :edit, model_class
= render 'form' = render 'form'
- content_for :page_links do
ul
li= link_to link_to_destroy_content(@svg_element), [:admin, @svg_element], method: :delete, confirm: are_you_sure(@svg_element), class: 'record-destroy-button'
+2 -5
View File
@@ -9,11 +9,8 @@
tbody tbody
- @svg_elements.each do |svg_element| - @svg_elements.each do |svg_element|
tr tr
td= link_to svg_element.name, [:admin, svg_element] td= link_to svg_element.name, [:edit, :admin, svg_element]
td = edit_td [:admin, svg_element]
= link_to t('helpers.links.edit'), [:edit, :admin, svg_element], class: 'table-edit-button'
'
= link_to t("helpers.links.destroy"), [:admin, svg_element], method: :delete, data: {confirm: are_you_sure? }, class: 'table-destroy-button'
- else - else
= no_content_given model_class = no_content_given model_class
/= link_to t("helpers.links.new"), new_admin_svg_element_path, class: 'record-new-button' /= link_to t("helpers.links.new"), new_admin_svg_element_path, class: 'record-new-button'
+2 -1
View File
@@ -16,6 +16,7 @@ set :deploy_via, :remote_cache
set :branch, :master set :branch, :master
set :user, 'root' set :user, 'root'
set :deploy_to, '/var/www/mozo.bar' set :deploy_to, '/var/www/mozo.bar'
set :bundle_without, %w[development test assets].join(' ')
# Default value for :scm is :git # Default value for :scm is :git
# set :scm, :git # set :scm, :git
@@ -105,7 +106,7 @@ namespace :deploy do
#end #end
#end #end
rsync_host = host rsync_host = host
run_locally { execute "rsync -av --delete ./public/assets/ #{fetch(:user)}@#{rsync_host}:#{shared_path}/public/assets/" } run_locally { execute "rsync -av --delete --ignore-times ./public/assets/ #{fetch(:user)}@#{rsync_host}:#{shared_path}/public/assets/" }
#run_locally { execute "rsync -av ./public/assets/ #{fetch(:user)}@#{rsync_host}:#{shared_path}/public/assets/" } #run_locally { execute "rsync -av ./public/assets/ #{fetch(:user)}@#{rsync_host}:#{shared_path}/public/assets/" }
execute :chown, "-R www-data:www-data", shared_path.join('public/assets/') execute :chown, "-R www-data:www-data", shared_path.join('public/assets/')
+1
View File
@@ -107,6 +107,7 @@ en:
reload_application: Reload application reload_application: Reload application
about: about:
title: About Mozo title: About Mozo
version: Version
body: | body: |
Mozo is an app that allows you to simply order products using your phone.<br> Mozo is an app that allows you to simply order products using your phone.<br>
The process is as follows: The process is as follows:
+1
View File
@@ -107,6 +107,7 @@ nl:
reload_application: Applicatie herstarten reload_application: Applicatie herstarten
about: about:
title: Over Mozo title: Over Mozo
version: Versie
body: | body: |
Mozo is een app waarme je producten kan bestellen met je telefoon.<br> Mozo is een app waarme je producten kan bestellen met je telefoon.<br>
Het proces is als volgt: Het proces is als volgt: