Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Lécuelle committed Oct 12, 2016
2 parents 96888fd + 9a7d132 commit 1bfc883
Show file tree
Hide file tree
Showing 680 changed files with 34,627 additions and 5,055 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ Procfile.*
*.sw?

.byebug_history
.gitconfig
194 changes: 161 additions & 33 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ gem 'deep_cloneable', '~> 2.2.1'
gem 'devise'
gem 'devise_invitable'
gem 'devise-i18n-views'
gem 'omniauth'
gem 'omniauth-oauth2'

# Attachments
gem 'paperclip'
Expand Down Expand Up @@ -137,6 +139,7 @@ gem 'rubyzip'
gem 'roo'
gem 'sepa_king'
# gem 'sepa_king', path: '/home/jonathan/Workspace/sepa_king'
gem 'rodf'

# Demo data
gem 'ffaker', '>= 2.0.0'
Expand Down
22 changes: 22 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ GEM
builder (>= 2.1.2)
haml (4.0.7)
tilt
hashie (3.4.6)
hpricot (0.8.6)
http-cookie (1.0.3)
domain_name (~> 0.5)
Expand Down Expand Up @@ -220,6 +221,7 @@ GEM
jquery-ui-rails (5.0.5)
railties (>= 3.2.16)
json (1.8.3)
jwt (1.5.6)
kaminari (0.17.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -256,6 +258,7 @@ GEM
minitest (>= 5.0)
ruby-progressbar
multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
Expand All @@ -264,6 +267,18 @@ GEM
mini_portile2 (~> 2.1.0)
nori (2.6.0)
ntlm-http (0.1.1)
oauth2 (1.2.0)
faraday (>= 0.8, < 0.10)
jwt (~> 1.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
omniauth (1.3.1)
hashie (>= 1.2, < 4)
rack (>= 1.0, < 3)
omniauth-oauth2 (1.4.0)
oauth2 (~> 1.0)
omniauth (~> 1.2)
orm_adapter (0.5.0)
paperclip (5.1.0)
activemodel (>= 4.2.0)
Expand Down Expand Up @@ -361,6 +376,10 @@ GEM
rjb-loader (0.0.2)
rails (>= 3.2)
rjb (>= 1.4.8)
rodf (0.3.7)
activesupport (>= 3.0, < 6.0)
builder (~> 3.0)
rubyzip (~> 1.0)
roo (2.5.1)
nokogiri (~> 1)
rubyzip (~> 1.1, < 2.0.0)
Expand Down Expand Up @@ -546,6 +565,8 @@ DEPENDENCIES
minitest-reporters
nokogiri (~> 1.6.0)
ofx-parser!
omniauth
omniauth-oauth2
paperclip
paperclip-document (> 0.0.8)
pg
Expand All @@ -560,6 +581,7 @@ DEPENDENCIES
rest-client
rgeo-geojson
rgeo-shapefile
rodf
roo
rubocop
rubyntlm (>= 0.3.2)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.3
2.11.4
Binary file added app/assets/images/map/marker/sensor-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/map/marker/sensor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions app/assets/images/map/marker/sensor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
//= require active_list.jquery
//= require knockout
//= require_self
//= require i18n
//= require i18n/translations
//= require i18n/locale
//= require i18n/ext
//= require ekylibre
//= require formize/behave
//= require form/dialog
Expand All @@ -42,7 +46,6 @@
//= require ui
//= require jstz
//= require heatmap
//= require i18n/translations
//= require geographiclib
//= require leaflet.js.erb
//= require leaflet/draw
Expand All @@ -53,6 +56,9 @@
//= require leaflet/easy-button
//= require leaflet/modal
//= require leaflet/label
//= require d3
//= require d3/tip
//= require timeline-chart.js
//= require rbush
//= require autosize
//= require plugins
Expand Down
151 changes: 148 additions & 3 deletions app/assets/javascripts/backend/interventions.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
console.warn "Cannot find ##{prefix}quantity_handler <select>" unless select.length > 0
option = select.find("option[value='#{name}']")
console.warn "Cannot find option #{name} of ##{prefix}quantity_handler <select>" unless option.length > 0
if value && !option.is(':visible')
if value
option.show()
else if !value && option.is(':visible')
else
option.hide()

unserializeRecord: (form, attributes, prefix = '', updater_id = null) ->
Expand Down Expand Up @@ -85,7 +85,8 @@
update = true
update = false if value is null and element.val() is ""
if valueType == "number"
update = false if value == element.numericalValue()
# When element doesn't have any value, element.numericalValue() == 0
update = false if value == element.numericalValue() && element.numericalValue() != 0
else
update = false if value == element.val()
if update
Expand Down Expand Up @@ -176,5 +177,149 @@
$(this).each ->
E.interventions.updateAvailabilityInstant($(this).val())

$(document).ready ->

if $('.taskboard').length > 0

taskboard = new InterventionsTaskboard
taskboard.initTaskboard()


class InterventionsTaskboard

constructor: ->
@taskboard = new ekylibre.taskboard('#interventions', true)
@taskboardModal = new ekylibre.modal('#taskboard-modal')

initTaskboard: ->
this.addHeaderActionsEvent()
this.addEditIconClickEvent()
this.addDeleteIconClickEvent()
this.addTaskClickEvent()

getTaskboard: ->
return @taskboard

getTaskboardModal: ->
return @taskboardModal

addHeaderActionsEvent: ->

instance = this

@taskboard.addSelectTaskEvent((event) ->

selectedField = $(event.target)
columnIndex = instance.getTaskboard().getColumnIndex(selectedField)
header = instance.getTaskboard().getHeaderByIndex(columnIndex)
checkedFieldsCount = instance.getTaskboard().getCheckedSelectFieldsCount(selectedField)

if (checkedFieldsCount == 0)

instance.getTaskboard().hiddenHeaderIcons(header)
else
instance.getTaskboard().displayHeaderIcons(header)
)

addEditIconClickEvent: ->

instance = this

@taskboard.getHeaderActions().find('.edit-tasks').on('click', (event) ->

interventionsIds = instance._getSelectedInterventionsIds(event.target)

$.ajax
url: "/backend/interventions/modal",
data: {interventions_ids: interventionsIds}
success: (data, status, request) ->

instance._displayModalWithContent(data)
)


addDeleteIconClickEvent: ->

instance = this

$(document).on('confirm:complete', (event, answer) ->

if ($(event.target).find('.delete-tasks').length == 0 || !answer)
return


columnSelector = event.target
interventionsIds = instance._getSelectedInterventionsIds(columnSelector)

$.ajax
method: 'POST'
url: "/backend/interventions/change_state",
data: {
'intervention': {
interventions_ids: JSON.stringify(interventionsIds),
state: 'rejected'
}
}
success: (data, status, request) ->

selectedTasks = instance.getTaskboard().getSelectedTasksByColumnSelector(columnSelector)
selectedTasks.remove()

)


_getSelectedInterventionsIds: (columnSelector) ->

selectedTasks = @taskboard.getSelectedTasksByColumnSelector(columnSelector)

interventionsIds = [];
selectedTasks.each( ->

interventionDatas = JSON.parse($(this).attr('data-intervention'))
interventionsIds.push(interventionDatas.id);
);

return interventionsIds


addTaskClickEvent: ->

instance = this

@taskboard.addTaskClickEvent((event) ->

element = $(event.target)

if (element.is(':input[type="checkbox"]'))
return

task = element.closest('.task')

intervention = JSON.parse(task.attr('data-intervention'))

$.ajax
url: "/backend/interventions/modal",
data: {intervention_id: intervention.id}
success: (data, status, request) ->

instance._displayModalWithContent(data)
instance.getTaskboardModal().getModal().find('.dropup a').on('click', (event) ->

dropdown = $(this).closest('.dropup')
dropdown.removeClass('open')

dropdownButton = dropdown.find('.dropdown-toggle')
dropdownButton.text(dropdownButton.attr('data-disable-with'))
dropdownButton.attr('disabled', 'disabled')
)
)


_displayModalWithContent: (data) ->

@taskboardModal.removeModalContent()
@taskboardModal.getModalContent().append(data)
@taskboardModal.getModal().modal 'show'

true
) ekylibre, jQuery
Loading

0 comments on commit 1bfc883

Please sign in to comment.