First Commit

This commit is contained in:
Xavier J 2015-08-10 11:05:06 +02:00
commit b5b83e939a
213 changed files with 8688 additions and 0 deletions

17
.gitignore vendored Normal file
View file

@ -0,0 +1,17 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp

1
.idea/.name Normal file
View file

@ -0,0 +1 @@
admi_facile

37
.idea/admi_facile.iml Normal file
View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="JRUBY" name="JRuby">
<configuration>
<JRUBY_FACET_CONFIG_ID NAME="JRUBY_SDK_NAME" VALUE="" />
<LOAD_PATH number="0" />
<I18N_FOLDERS number="0" />
</configuration>
<facet type="JRailsFacetType" name="JRuby on Rails">
<configuration>
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
</configuration>
</facet>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$APPLICATION_HOME_DIR$/bin" />
<output-test url="file://$APPLICATION_HOME_DIR$/bin" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/components" />
<excludeFolder url="file://$MODULE_DIR$/public/system" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/config/locales" />
</component>
</module>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>

22
.idea/compiler.xml Normal file
View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View file

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

30
.idea/misc.xml Normal file
View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
</expanded-state>
<selected-state>
<State>
<id>Android</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="rbenv: 2.1.5" project-jdk-type="RUBY_SDK" />
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/admi_facile.iml" filepath="$PROJECT_DIR$/.idea/admi_facile.iml" />
</modules>
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

1594
.idea/workspace.xml Normal file

File diff suppressed because it is too large Load diff

2
.rspec Normal file
View file

@ -0,0 +1,2 @@
--color
--require spec_helper

85
Gemfile Normal file
View file

@ -0,0 +1,85 @@
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
#haml
gem 'haml-rails'
#bootstrap saas
gem 'bootstrap-sass', '~> 3.3.5'
# Decorators
gem 'draper'
#Gestion des comptes utilisateurs
gem 'devise'
gem 'rest-client'
gem 'carrierwave'
gem 'pg'
gem 'rgeo-geojson'
gem 'leaflet-rails'
gem 'leaflet-markercluster-rails', '~> 0.7.0'
gem 'leaflet-draw-rails'
gem 'bootstrap-datepicker-rails'
gem 'chartkick'
group :test do
gem 'capybara'
gem 'factory_girl'
gem 'database_cleaner'
gem 'selenium-webdriver'
gem 'webmock'
gem 'database_cleaner'
gem 'shoulda-matchers', require: false
gem 'simplecov', require: false
gem 'poltergeist'
end
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'rspec-rails', '~> 3.0'
end

313
Gemfile.lock Normal file
View file

@ -0,0 +1,313 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
arel (6.0.2)
autoprefixer-rails (5.2.1)
execjs
json
bcrypt (3.1.10)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-datepicker-rails (1.4.0)
railties (>= 3.0)
bootstrap-sass (3.3.5)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
builder (3.2.2)
byebug (5.0.0)
columnize (= 0.9.0)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
mime-types (>= 1.16)
chartkick (1.3.2)
childprocess (0.5.5)
ffi (~> 1.0, >= 1.0.11)
cliver (0.3.2)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
columnize (0.9.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
database_cleaner (1.4.1)
debug_inspector (0.0.2)
devise (3.4.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
draper (2.1.0)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
request_store (~> 1.0)
erubis (2.7.0)
execjs (2.5.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
ffi (1.9.6)
globalid (0.3.5)
activesupport (>= 4.1.0)
haml (4.0.6)
tilt
haml-rails (0.9.0)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
jbuilder (2.3.1)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
jquery-rails (4.0.4)
rails-dom-testing (~> 1.0)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
leaflet-draw-rails (0.1.0)
leaflet-markercluster-rails (0.7.0)
railties (>= 3.1)
leaflet-rails (0.7.4)
loofah (2.0.2)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.6.1)
mini_portile (0.6.2)
minitest (5.7.0)
multi_json (1.11.2)
netrc (0.10.3)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
orm_adapter (0.5.0)
pg (0.18.2)
poltergeist (1.6.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
json (~> 1.4)
request_store (1.1.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rgeo (0.3.20)
rgeo-geojson (0.3.1)
rgeo (~> 0.3)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-rails (3.2.1)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
ruby_parser (3.7.0)
sexp_processor (~> 4.1)
rubyzip (1.1.7)
safe_yaml (1.0.4)
sass (3.4.16)
sass-rails (5.0.3)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1)
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
selenium-webdriver (2.44.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
sexp_processor (4.6.0)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
simplecov (0.9.1)
docile (~> 1.1.0)
multi_json (~> 1.0)
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
spring (1.3.6)
sprockets (3.2.0)
rack (~> 1.0)
sprockets-rails (2.3.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
warden (1.2.3)
rack (>= 1.0)
web-console (2.2.1)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (1.21.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
websocket (1.2.1)
websocket-driver (0.5.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bootstrap-datepicker-rails
bootstrap-sass (~> 3.3.5)
byebug
capybara
carrierwave
chartkick
coffee-rails (~> 4.1.0)
database_cleaner
devise
draper
factory_girl
haml-rails
jbuilder (~> 2.0)
jquery-rails
leaflet-draw-rails
leaflet-markercluster-rails (~> 0.7.0)
leaflet-rails
pg
poltergeist
rails (= 4.2.0)
rest-client
rgeo-geojson
rspec-rails (~> 3.0)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
selenium-webdriver
shoulda-matchers
simplecov
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)
webmock
BUNDLED WITH
1.10.4

28
README.rdoc Normal file
View file

@ -0,0 +1,28 @@
== README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
Please feel free to use a different markup language if you do not plan to run
<tt>rake doc:app</tt>.

6
Rakefile Normal file
View file

@ -0,0 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks

0
app/assets/images/.keep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

View file

@ -0,0 +1,101 @@
(function () {
OSM = L.tileLayer("http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", {
attribution: '&copy; Openstreetmap France | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
mapId = "map_qp";
position = get_position();
map = L.map(mapId, {
center: new L.LatLng(position.lat, position.lon),
zoom: 13,
layers: [OSM]
});
window.map = map;
baseMap = {
"OpenStreetMap": OSM
};
L.control.layers(baseMap).addTo(map);
function loaddraw(data) {
var qpLayer = L.geoJson(data).addTo(map);
map.fitBounds(qpLayer.getBounds());
recup_qp_dessin(data)
};
getdraw(ref_dossier);
function getdraw (ref) {
$.ajax({
headers: {'AUTHORIZATION': ''},
url: 'http://apicarto.coremaps.com/api/v1/data/' + ref + '/geojson',
datatype: 'json',
jsonCallback: 'getJson',
success: loaddraw
});
};
function loadGeoJson(data) {
map.spin(false);
var qpLayer = L.geoJson(data, {onEachFeature: onEachFeature, style: style()}).addTo(map);
};
function onEachFeature(feature, layer) {
var anchor = $(location).attr('hash').substring(1);
if (anchor != "") {
var qp_select = JSON.parse(anchor);
if (qp_select.qp.indexOf(feature.properties.code_qp) > -1) {
window.geom_inter.index.push(feature.properties.code_qp);
window.featureCollection.features.push(feature);
layer.setStyle(select_style());
map.fitBounds(layer.getBounds());
}
}
};
function style(feature) {
return {
fillColor: '#FC4E2A',
weight: 1,
opacity: 1,
color: 'white',
dashArray: '0',
fillOpacity: 0.6
};
}
function recup_qp_dessin(geom){
/**/
$.ajax({
url: 'http://apicarto.coremaps.com/zoneville/api/v1/qp',
datatype: 'json',
method: 'POST',
data: {geom: geom},
jsonCallback: 'getJson',
success: function (data) {
var qp_supp = "";
feature = geom
feature.properties = data;
for (i = 0; i < data.length; i++) {
$.ajax({
url: 'http://apicarto.coremaps.com/zoneville/api/beta/qp/mapservice',
datatype: 'json',
method: 'GET',
data: {code: data[i].code_qp},
jsonCallback: 'getJson',
success: function (data) {
loadGeoJson(data);
}
});
}
}
});
/**/
}
}).call(this);

View file

@ -0,0 +1,58 @@
L.Control.EasyButtons = L.Control.extend({
options: {
position: 'topleft',
title: '',
intendedIcon: 'fa-circle-o'
},
onAdd: function () {
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
this.link = L.DomUtil.create('a', 'leaflet-bar-part', container);
this._addImage()
this.link.href = '#';
L.DomEvent.on(this.link, 'click', this._click, this);
this.link.title = this.options.title;
return container;
},
intendedFunction: function(){ alert('no function selected');},
_click: function (e) {
L.DomEvent.stopPropagation(e);
L.DomEvent.preventDefault(e);
this.intendedFunction();
this.link.blur();
},
_addImage: function () {
var extraClasses = this.options.intendedIcon.lastIndexOf('fa', 0) === 0 ? ' fa fa-lg' : ' glyphicon';
var icon = L.DomUtil.create('i', this.options.intendedIcon + extraClasses, this.link);
icon.id = this.options.id;
}
});
L.easyButton = function( btnIcon , btnFunction , btnTitle , btnMap , btnId) {
var newControl = new L.Control.EasyButtons();
if (btnIcon) newControl.options.intendedIcon = btnIcon;
if (btnId) newControl.options.id = btnId;
if ( typeof btnFunction === 'function'){
newControl.intendedFunction = btnFunction;
}
if (btnTitle) newControl.options.title = btnTitle;
if ( btnMap === '' ){
// skip auto addition
} else if ( btnMap ) {
btnMap.addControl(newControl);
} else {
map.addControl(newControl);
}
return newControl;
};

View file

@ -0,0 +1,39 @@
ul.photon-autocomplete {
position: absolute;
background-color: white;
z-index: 1000;
box-shadow: 0 4px 9px #999999;
display: none;
}
.photon-autocomplete li {
min-height: 40px;
line-height: 1em;
padding: 5px 10px;
overflow: hidden;
white-space: nowrap;
font-size: 1em;
}
.photon-autocomplete li strong {
display: block;
}
.photon-autocomplete li.on {
background-color: #2980b9;
cursor: pointer;
}
.photon-autocomplete li.photon-no-result {
text-align: center;
color: #666;
font-size: 0.9em;
line-height: 40px;
}
.photon-autocomplete .photon-feedback {
display: block;
text-align: right;
font-size: 0.8em;
padding: 3px;
color: #999;
border-top: 1px solid #eee;
}
.photon-input:focus {
width: 400px;
}

View file

@ -0,0 +1,444 @@
L.PhotonBase = L.Class.extend({
forEach: function (els, callback) {
Array.prototype.forEach.call(els, callback);
},
ajax: function (callback, thisobj) {
if (typeof this.xhr === 'object') {
this.xhr.abort();
}
this.xhr = new XMLHttpRequest();
var self = this;
this.xhr.open('GET', this.options.url + this.buildQueryString(this.getParams()), true);
this.xhr.onload = function(e) {
self.fire('ajax:return');
if (this.status === 200) {
if (callback) {
var raw = this.response;
raw = JSON.parse(raw);
callback.call(thisobj || this, raw);
}
}
delete this.xhr;
};
this.fire('ajax:send');
this.xhr.send();
},
buildQueryString: function (params) {
var queryString = [];
for (var key in params) {
if (params[key]) {
queryString.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key]));
}
}
return queryString.join('&');
},
featureToPopupContent: function (feature) {
var container = L.DomUtil.create('div', 'leaflet-photon-popup'),
title = L.DomUtil.create('h3', '', container);
title.innerHTML = feature.properties.label;
return container;
}
});
L.PhotonSearch = L.PhotonBase.extend({
includes: L.Mixin.Events,
options: {
url: 'http://photon.komoot.de/api/?',
placeholder: 'Start typing...',
minChar: 3,
limit: 5,
submitDelay: 300,
includePosition: true,
noResultLabel: 'No result',
feedbackEmail: 'photon@komoot.de', // Set to null to remove feedback box
feedbackLabel: 'Feedback'
},
CACHE: '',
RESULTS: [],
KEYS: {
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
TAB: 9,
RETURN: 13,
ESC: 27,
APPLE: 91,
SHIFT: 16,
ALT: 17,
CTRL: 18
},
initialize: function (map, input, options) {
this.map = map;
this.input = input;
L.setOptions(this, options);
var CURRENT = null;
try {
Object.defineProperty(this, 'CURRENT', {
get: function () {
return CURRENT;
},
set: function (index) {
if (typeof index === 'object') {
index = this.resultToIndex(index);
}
CURRENT = index;
}
});
} catch (e) {
// Hello IE8
}
this.input.type = 'search';
this.input.placeholder = this.options.placeholder;
this.input.autocomplete = 'off';
this.input.autocorrect = 'off';
L.DomEvent.disableClickPropagation(this.input);
L.DomEvent.on(this.input, 'keydown', this.onKeyDown, this);
L.DomEvent.on(this.input, 'input', this.onInput, this);
L.DomEvent.on(this.input, 'blur', this.onBlur, this);
L.DomEvent.on(this.input, 'focus', this.onFocus, this);
this.createResultsContainer();
},
createResultsContainer: function () {
this.resultsContainer = L.DomUtil.create('ul', 'photon-autocomplete', document.querySelector('body'));
},
resizeContainer: function()
{
var l = this.getLeft(this.input);
var t = this.getTop(this.input) + this.input.offsetHeight;
this.resultsContainer.style.left = l + 'px';
this.resultsContainer.style.top = t + 'px';
var width = this.options.width ? this.options.width : this.input.offsetWidth - 2;
this.resultsContainer.style.width = width + 'px';
},
onKeyDown: function (e) {
switch (e.keyCode) {
case this.KEYS.TAB:
if(this.CURRENT !== null)
{
this.setChoice();
}
L.DomEvent.stop(e);
break;
case this.KEYS.RETURN:
L.DomEvent.stop(e);
this.setChoice();
break;
case this.KEYS.ESC:
L.DomEvent.stop(e);
this.hide();
this.input.blur();
break;
case this.KEYS.DOWN:
if(this.RESULTS.length > 0) {
if(this.CURRENT !== null && this.CURRENT < this.RESULTS.length - 1) { // what if one resutl?
this.CURRENT++;
this.highlight();
}
else if(this.CURRENT === null) {
this.CURRENT = 0;
this.highlight();
}
}
break;
case this.KEYS.UP:
if(this.CURRENT !== null) {
L.DomEvent.stop(e);
}
if(this.RESULTS.length > 0) {
if(this.CURRENT > 0) {
this.CURRENT--;
this.highlight();
}
else if(this.CURRENT === 0) {
this.CURRENT = null;
this.highlight();
}
}
break;
}
},
onInput: function (e) {
if (typeof this.submitDelay === 'number') {
window.clearTimeout(this.submitDelay);
delete this.submitDelay;
}
this.submitDelay = window.setTimeout(L.Util.bind(this.search, this), this.options.submitDelay);
},
onBlur: function (e) {
this.fire('blur');
var self = this;
setTimeout(function () {
self.hide();
}, 100);
},
onFocus: function (e) {
this.fire('focus');
this.input.select();
this.search(); // In case we have a value from a previous search.
},
clear: function () {
this.RESULTS = [];
this.CURRENT = null;
this.CACHE = '';
this.resultsContainer.innerHTML = '';
},
hide: function() {
this.fire('hide');
this.clear();
this.resultsContainer.style.display = 'none';
},
setChoice: function (choice) {
choice = choice || this.RESULTS[this.CURRENT];
if (choice) {
this.hide();
this.fire('selected', {choice: choice.feature});
this.onSelected(choice.feature);
this.input.value = '';
}
},
search: function() {
var val = this.input.value;
var minChar = typeof this.options.minChar === 'function' ? this.options.minChar(val) : val.length >= this.options.minChar;
if (!val || !minChar) return this.clear();
if(val + '' === this.CACHE + '') return;
else this.CACHE = val;
this._doSearch();
},
_doSearch: function () {
this.ajax(this.handleResults, this);
},
_onSelected: function (feature) {
this.map.setView([feature.geometry.coordinates[1], feature.geometry.coordinates[0]], 16);
},
onSelected: function (choice) {
return (this.options.onSelected || this._onSelected).call(this, choice);
},
_formatResult: function (feature, el) {
var title = L.DomUtil.create('strong', '', el),
detailsContainer = L.DomUtil.create('small', '', el),
details = [],
type = this.formatType(feature);
title.innerHTML = feature.properties.name;
if (type) details.push(type);
if (feature.properties.city && feature.properties.city !== feature.properties.name) {
details.push(feature.properties.city);
}
if (feature.properties.country) details.push(feature.properties.country);
detailsContainer.innerHTML = details.join(', ');
},
formatResult: function (feature, el) {
return (this.options.formatResult || this._formatResult).call(this, feature, el);
},
formatType: function (feature) {
return (this.options.formatType || this._formatType).call(this, feature);
},
_formatType: function (feature) {
return feature.properties.osm_value;
},
createResult: function (feature) {
var el = L.DomUtil.create('li', '', this.resultsContainer);
this.formatResult(feature, el);
var result = {
feature: feature,
el: el
};
// Touch handling needed
L.DomEvent.on(el, 'mouseover', function (e) {
this.CURRENT = result;
this.highlight();
}, this);
L.DomEvent.on(el, 'mousedown', function (e) {
this.setChoice();
}, this);
return result;
},
resultToIndex: function (result) {
var out = null;
this.forEach(this.RESULTS, function (item, index) {
if (item === result) {
out = index;
return;
}
});
return out;
},
handleResults: function(geojson) {
var self = this;
this.clear();
this.resultsContainer.style.display = 'block';
this.resizeContainer();
this.forEach(geojson.features, function (feature) {
self.RESULTS.push(self.createResult(feature));
});
if (geojson.features.length === 0) {
var noresult = L.DomUtil.create('li', 'photon-no-result', this.resultsContainer);
noresult.innerHTML = this.options.noResultLabel;
}
if (this.options.feedbackEmail) {
var feedback = L.DomUtil.create('a', 'photon-feedback', this.resultsContainer);
feedback.href = 'mailto:' + this.options.feedbackEmail;
feedback.innerHTML = this.options.feedbackLabel;
}
this.CURRENT = 0;
this.highlight();
if (this.options.resultsHandler) {
this.options.resultsHandler(geojson);
}
},
highlight: function () {
var self = this;
this.forEach(this.RESULTS, function (item, index) {
if (index === self.CURRENT) {
L.DomUtil.addClass(item.el, 'on');
}
else {
L.DomUtil.removeClass(item.el, 'on');
}
});
},
getLeft: function (el) {
var tmp = el.offsetLeft;
el = el.offsetParent;
while(el) {
tmp += el.offsetLeft;
el = el.offsetParent;
}
return tmp;
},
getTop: function (el) {
var tmp = el.offsetTop;
el = el.offsetParent;
while(el) {
tmp += el.offsetTop;
el = el.offsetParent;
}
return tmp;
},
getParams: function () {
return {
q: this.CACHE,
lang: this.options.lang,
limit: this.options.limit,
lat: this.options.includePosition ? this.map.getCenter().lat : null,
lon: this.options.includePosition ? this.map.getCenter().lng : null
};
}
});
L.Control.Photon = L.Control.extend({
includes: L.Mixin.Events,
onAdd: function (map, options) {
this.map = map;
this.container = L.DomUtil.create('div', 'leaflet-photon');
this.options = L.Util.extend(this.options, options);
this.input = L.DomUtil.create('input', 'photon-input', this.container);
this.search = new L.PhotonSearch(map, this.input, this.options);
this.search.on('blur', this.forwardEvent, this);
this.search.on('focus', this.forwardEvent, this);
this.search.on('hide', this.forwardEvent, this);
this.search.on('selected', this.forwardEvent, this);
this.search.on('ajax:send', this.forwardEvent, this);
this.search.on('ajax:return', this.forwardEvent, this);
return this.container;
},
forwardEvent: function (e) {
this.fire(e.type, e);
}
});
L.Map.addInitHook(function () {
if (this.options.photonControl) {
this.photonControl = new L.Control.Photon(this.options.photonControlOptions || {});
this.addControl(this.photonControl);
}
});
L.PhotonReverse = L.PhotonBase.extend({
includes: L.Mixin.Events,
options: {
url: 'http://photon.komoot.de/reverse/?',
limit: 1,
handleResults: null
},
initialize: function (options) {
L.setOptions(this, options);
},
doReverse: function (latlng) {
latlng = L.latLng(latlng);
this.fire('reverse', {latlng: latlng});
this.latlng = latlng;
this.ajax(this.handleResults, this);
},
_handleResults: function (data) {
/*eslint-disable no-console */
console.log(data);
/*eslint-enable no-alert */
},
handleResults: function (data) {
return (this.options.handleResults || this._handleResults).call(this, data);
},
getParams: function () {
return {
lang: this.options.lang,
limit: this.options.limit,
lat: this.latlng.lat,
lon: this.latlng.lng
};
}
});

View file

@ -0,0 +1,41 @@
L.SpinMapMixin = {
spin: function (state, options) {
if (!!state) {
// start spinning !
if (!this._spinner) {
this._spinner = new Spinner(options).spin(this._container);
this._spinning = 0;
}
this._spinning++;
}
else {
this._spinning--;
if (this._spinning <= 0) {
// end spinning !
if (this._spinner) {
this._spinner.stop();
this._spinner = null;
}
}
}
}
};
L.Map.include(L.SpinMapMixin);
L.Map.addInitHook(function () {
this.on('layeradd', function (e) {
// If added layer is currently loading, spin !
if (e.layer.loading) this.spin(true);
if (typeof e.layer.on != 'function') return;
e.layer.on('data:loading', function () { this.spin(true); }, this);
e.layer.on('data:loaded', function () { this.spin(false); }, this);
}, this);
this.on('layerremove', function (e) {
// Clean-up
if (e.layer.loading) this.spin(false);
if (typeof e.layer.on != 'function') return;
e.layer.off('data:loaded');
e.layer.off('data:loading');
}, this);
});

View file

@ -0,0 +1,117 @@
/* Variables and Mixins */
/* Generic L.Toolbar */
.leaflet-toolbar-0 {
list-style: none;
padding-left: 0;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
}
.leaflet-toolbar-0 > li {
position: relative;
}
.leaflet-toolbar-0 > li > .leaflet-toolbar-icon {
display: block;
width: 26px;
height: 26px;
line-height: 26px;
margin-right: 0;
padding-right: 0;
border-right: 0;
text-align: center;
text-decoration: none;
background-color: #ffffff;
}
.leaflet-toolbar-0 > li > .leaflet-toolbar-icon:hover {
background-color: #f4f4f4;
}
.leaflet-toolbar-0 .leaflet-toolbar-1 {
display: none;
list-style: none;
}
.leaflet-toolbar-tip-container {
margin: 0 auto;
height: 12px;
position: relative;
overflow: hidden;
}
.leaflet-toolbar-tip {
width: 12px;
height: 12px;
margin: -6px auto 0;
background-color: #ffffff;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
/* L.Toolbar.Control */
.leaflet-control-toolbar {
/* Secondary Toolbar */
}
.leaflet-control-toolbar > li > .leaflet-toolbar-icon {
border-bottom: 1px solid #ccc;
}
.leaflet-control-toolbar > li:first-child > .leaflet-toolbar-icon {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.leaflet-control-toolbar > li:last-child > .leaflet-toolbar-icon {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-width: 0;
}
.leaflet-control-toolbar .leaflet-toolbar-1 {
margin: 0;
padding: 0;
position: absolute;
left: 26px;
/* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */
top: 0;
white-space: nowrap;
height: 26px;
}
.leaflet-control-toolbar .leaflet-toolbar-1 > li {
display: inline-block;
}
.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon {
display: block;
background-color: #919187;
border-left: 1px solid #aaa;
color: #fff;
font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif;
line-height: 26px;
text-decoration: none;
padding-left: 10px;
padding-right: 10px;
height: 26px;
}
.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon:hover {
background-color: #a0a098;
}
/* L.Toolbar.Popup */
.leaflet-popup-toolbar {
position: relative;
}
.leaflet-popup-toolbar > li {
float: left;
}
.leaflet-popup-toolbar > li:first-child > .leaflet-toolbar-icon {
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.leaflet-popup-toolbar > li:last-child > .leaflet-toolbar-icon {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
border-bottom-width: 0;
}
.leaflet-popup-toolbar .leaflet-toolbar-1 {
position: absolute;
top: 26px;
left: 0;
padding-left: 0;
}
.leaflet-popup-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon {
position: relative;
float: left;
width: 26px;
height: 26px;
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,259 @@
(function () {
API_URL = '//api-adresse.data.gouv.fr';
var showSearchPoints = function (geojson) {
console.log(geojson);
};
var SHORT_CITY_NAMES = ['y', 'ay', 'bu', 'by', 'eu', 'fa', 'gy', 'oo', 'oz', 'py', 'ri', 'ry', 'sy', 'ur', 'us', 'uz'];
var photonControlOptions = {
resultsHandler: showSearchPoints,
position: 'topleft',
url: API_URL + '/search/?',
placeholder: 'Entrer une adresse',
minChar: function (val) {
return SHORT_CITY_NAMES.indexOf(val) !== -1 || val.length >= 3;
},
submitDelay: 200
};
var LeafIcon, OSM, baseMap, cad, cadWmtsUrl, drawControl, drawnItems, greenIcon, ignApiKey, layers, map, mapId, onEachFeature, onMapClick, onZoom, ortho, overlayMaps, scan25, scan25url, scanWmtsUrl;
L.drawLocal.draw.toolbar.buttons.polygon = 'Dessiner un polygone';
L.drawLocal.draw.toolbar.actions.title = "Annule le dessin en cours";
L.drawLocal.draw.toolbar.actions.text = "Annuler";
L.drawLocal.draw.toolbar.undo.text = "Supprimer le dernier point";
L.drawLocal.draw.toolbar.undo.title = "Supprime le dernier point dessiné";
L.drawLocal.draw.handlers.polygon.tooltip.start = "Cliquer pour commencer le dessin";
L.drawLocal.draw.handlers.polygon.tooltip.cont = "Cliquer pour continuer le dessin";
L.drawLocal.draw.handlers.polygon.tooltip.end = "Cliquer sur le premier point pour finaliser votre dessin";
L.drawLocal.edit.toolbar.actions.save.title = "Valide les modifications";
L.drawLocal.edit.toolbar.actions.save.text = "Valider les modifications";
L.drawLocal.edit.toolbar.actions.cancel.title = "Annule les modifications";
L.drawLocal.edit.toolbar.actions.cancel.text = "Annuler les modifications";
L.drawLocal.edit.handlers.edit.tooltip.text = "Déplacer les points pour éditer le dessin";
L.drawLocal.edit.handlers.edit.tooltip.subtext = "Cliquer sur 'annuler' pour annuler les changements";
L.drawLocal.edit.toolbar.buttons.edit = "Édition du dessin";
L.drawLocal.edit.toolbar.buttons.editDisabled = "Aucun dessin à éditer";
L.drawLocal.edit.toolbar.buttons.removeDisabled = "Aucun dessin à supprimer";
L.drawLocal.edit.toolbar.buttons.remove = "Supprimer le dessin";
L.drawLocal.edit.handlers.remove.tooltip.text = "Cliquer sur le dessin pour le supprimer";
L.drawLocal.edit.handlers.remove.tooltip.subtext = "Cliquer sur 'annuler' pour annuler la suppression";
mapId = "map_qp";
layers = new Array;
window.featureCollection = new Object()
window.featureCollection.type = 'FeatureCollection';
window.featureCollection.features = new Array();
OSM = L.tileLayer("http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png", {
attribution: '&copy; Openstreetmap France | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
position = get_position();
map = L.map(mapId, {
center: new L.LatLng(position.lat, position.lon),
zoom: 13,
layers: [OSM],
photonControl: true,
photonControlOptions: photonControlOptions,
photonReverseControl: true
});
var info = L.control();
// method that we will use to update the control based on feature properties passed
info.update = function (props) {
this._div.innerHTML = '<h4>Quartier prioritaire</h4>' + (props ?
'<b>' + props.nom_qp + '</b><br />' + props.commune_qp
: 'survolez un quartier prioritaire');
};
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
this.update();
return this._div;
};
info.addTo(map);
window.map = map;
baseMap = {
"OpenStreetMap": OSM
};
//L.control.layers(baseMap).addTo(map);
LeafIcon = L.Icon.extend({
options: {
shadowUrl: "http://leafletjs.com/docs/images/leaf-shadow.png",
iconSize: [38, 95],
shadowSize: [50, 64],
iconAnchor: [22, 94],
shadowAnchor: [4, 62],
popupAnchor: [-3, -76]
}
});
greenIcon = new LeafIcon({
iconUrl: "http://leafletjs.com/docs/images/leaf-green.png"
});
drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
drawControl = new L.Control.Draw({
position: "topright",
draw: {
polygon: {
shapeOptions: {
color: "purple"
},
allowIntersection: false,
drawError: {
color: "orange",
timeout: 1000
},
showArea: false,
metric: true,
repeatMode: false
},
marker: false,
polyline: false,
rectangle: false,
circle: false
},
edit: {
featureGroup: drawnItems
}
});
map.addControl(drawControl);
L.control.scale({
imperial: false
}).addTo(map);
map.on("draw:created", function (e) {
var layer;
layer = e.layer;
drawnItems.addLayer(layer);
console.log(layer);
window.featureCollection.features.push(layer.toGeoJSON());
get_ref_dossier ();
/**
$.ajax({
url: 'http://apicarto.coremaps.com//zoneville/api/v1/qp',
datatype: 'json',
method: 'POST',
data: {geom:layer.toGeoJSON()},
jsonCallback: 'getJson',
success: function (data){
var qp_supp = "";
feature = layer.toGeoJSON()
feature.properties = data;
for (i = 0; i < data.length; i++){
qp_supp += "<br><span>Quartier(s) prioritaire(s) : " + data[i].code_qp+ " - " +data[i].nom_qp;
}
$("#selection_qp").append("<span>Dessin personnalisé</span><br>"+qp_supp +'<br>');
}
});**/
});
map.spin(true);
$.ajax({
url: 'http://apicarto.coremaps.com/zoneville/api/beta/qp/mapservice',
datatype: 'json',
jsonCallback: 'getJson',
success: loadGeoJson
});
window.geom_inter = {index: []};
function style(feature) {
return {
fillColor: '#FC4E2A',
weight: 1,
opacity: 1,
color: 'white',
dashArray: '0',
fillOpacity: 0.6
};
}
function select_style(feature) {
return {
fillColor: '#1E4E2E',
weight: 1,
opacity: 1,
color: 'white',
dashArray: '0',
fillOpacity: 0.6
};
}
function onEachFeature(feature, layer) {
var anchor = $(location).attr('hash').substring(1);
if (anchor != "") {
var qp_select = JSON.parse(anchor);
if (qp_select.qp.indexOf(feature.properties.code_qp) > -1) {
window.geom_inter.index.push(feature.properties.code_qp);
window.featureCollection.features.push(feature);
layer.setStyle(select_style());
map.fitBounds(layer.getBounds());
}
}
layer.on("mouseover", function (e) {
info.update({nom_qp: feature.properties.nom_qp, commune_qp: feature.properties.commune_qp})
});
layer.on("mouseout", function (e) {
info.update()
});
//layer.on("click", function (e) {
// var feature = e.target.feature;
// console.log(select_style());
// if (window.geom_inter.index.indexOf(feature.properties.code_qp) == -1) {
// window.geom_inter.index.push(feature.properties.code_qp);
// window.featureCollection.features.push(feature);
// layer.setStyle(select_style());
// $("#selection_qp").append("<span>Quartier sélectionné : " + feature.properties.code_qp + "</span><br>");
// }
//});
};
function loadGeoJson(data) {
map.spin(false);
// var store = new Terraformer.GeoStore({
// store: new Terraformer.GeoStore.Memory(),
// index: new Terraformer.RTree()
// });
// store.add(data);
// window.store = store;
// var anchor = $(location).attr('hash').substring(1);
// var qp_select = JSON.parse(anchor);
// for (i = 0; i < qp_select.qp.length; i++){
// store.get(id, function (err, res) {
// if (typeof res == != 'undefined'){
// window.geom_inter.index.push(res.properties.code_qp);
// window.featureCollection.features.push(res);
// }
// });
//}
var qpLayer = L.geoJson(data, {onEachFeature: onEachFeature, style: style()}).addTo(map);
};
function store() {
return $.ajax("http://apicarto.coremaps.com/store/api/v2/datastore/draw", {
method: 'POST',
crossDomain: true,
contentType: 'application/x-www-form-urlencoded',
headers: {'AUTHORIZATION': ''},
data: {geojson: JSON.stringify(window.featureCollection)}
}).done(function (data) {
$('#info').append('<span>Références pour récupérer le fichier : ' + data.reference + '</span>');
});
};
L.easyButton('fa-floppy-o', store, 'Enregistrer votre sélection').addTo(map);
function listener(event) {
console.log(event);
console.log("received: " + event.data);
}
if (window.addEventListener) {
addEventListener("message", listener, false)
} else {
attachEvent("onmessage", listener)
}
}).call(this);

View file

@ -0,0 +1,21 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery
//= require bootstrap-sprockets
//= require bootstrap-datepicker
//= require bootstrap-datepicker/core
//= require bootstrap-datepicker/locales/bootstrap-datepicker.fr.js

View file

@ -0,0 +1,34 @@
//récupération de la position de l'entreprise
function get_position(){
var position;
$.ajax({
url: '/dossiers/'+dossier_id+'/carte/position',
dataType: 'json',
async: false
}).done(function (data) {
position = data
});
return position;
}
function get_ref_dossier (){
$.post("http://apicarto.coremaps.com/api/v1/datastore", {
contentType: "application/json",
dataType: 'json',
geom: JSON.stringify(window.featureCollection.features[0]),
ascyn: false
}).done(function (data) {
$("#ref_dossier").val(data.reference);
});
}
function submit_check_draw(e) {
if (window.featureCollection.features.length == 0) {
$("#flash_message").html('<div class="alert alert-danger">Un dessin est obligatoire.</div>');
e.preventDefault();
return false;
}
}

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,4 @@
function show_dossier_id_input (){
$("#btn_show_dossier_id_input").hide()
$("#pro_dossier_id").show()
}

View file

@ -0,0 +1,3 @@
// Place all the styles related to the admin controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,53 @@
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*= require bootstrap-datepicker3
*/
@import "bootstrap-sprockets";
@import "bootstrap";
body {
background-color:rgb(255,255,255)
}
.logo {
margin-left: 10px;
padding-top: 5px;
padding-bottom: 5px;
max-height: 100%;
}
.alert.alert-success,
.alert.alert-danger {
margin-top:-20px
}
.navbar {
height: 35px;
background-color: rgb(235, 235, 235)
}
.btn {
box-shadow: none !important;
}
.description {
border-color: rgba(200, 200, 200, 0.6);
border-style: solid;
border-radius: 5px;
border-width: 1px;
padding: 10px;
background-color: rgb(245, 245, 245);
margin-top: 10px;
}

View file

@ -0,0 +1,19 @@
// Place all the styles related to the carte controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
table {
font-size: 13;
}
.info {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.8);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
}
.info h4 {
margin: 0 0 5px;
color: #777;
}

View file

@ -0,0 +1,3 @@
// Place all the styles related to the commentaires controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,3 @@
// Place all the styles related to the demandes controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,3 @@
// Place all the styles related to the description controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,7 @@
// Place all the styles related to the dossiers controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
h5 span {
font-weight: normal
}

View file

@ -0,0 +1,3 @@
// Place all the styles related to the recapitulatif controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -0,0 +1,7 @@
// Place all the styles related to the start controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.mask {
display: none;
}

View file

@ -0,0 +1,31 @@
class Admin::DossierController < ApplicationController
before_action :authenticate_user!
def show
@dossier = Dossier.find(params[:dossier_id])
@entreprise = @dossier.entreprise.decorate
@etablissement = @dossier.etablissement.decorate
@dossier_pdf = @dossier.dossier_pdf
@commentaires = @dossier.commentaires.order(created_at: :desc)
@commentaires = @commentaires.all.decorate
@commentaire_email = current_user.email
@dossier = @dossier.decorate
rescue
redirect_start
end
def index
@dossier = Dossier.find(params[:dossier_id])
redirect_to url_for({controller: 'admin/dossier', action: :show, :dossier_id => @dossier.id})
rescue
redirect_start
end
private
def redirect_start
redirect_to url_for({controller: '/start', action: :error_dossier})
end
end

View file

@ -0,0 +1,22 @@
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :store_location
def store_location
unless params[:controller] == "devise/sessions"
url = "/admin/dossier/#{params[:dossier_id]}"
session[:user_return_to] = url
end
end
def stored_location_for(resource_or_scope)
session[:user_return_to] || super
end
def after_sign_in_path_for(resource)
stored_location_for(resource) || root_path
end
end

View file

@ -0,0 +1,40 @@
class CarteController < ApplicationController
def show
@dossier = Dossier.find(params[:dossier_id])
rescue
redirect_to url_for({controller: :start, action: :error_dossier})
end
def save_ref_api_carto
@dossier = Dossier.find(params[:dossier_id])
@dossier.ref_dossier = params[:ref_dossier]
@dossier.save
if params[:back_url] == 'recapitulatif'
@commentaire = Commentaire.create
@commentaire.email = 'Modification localisation'
@commentaire.body = 'La localisation de la demande a été modifiée. Merci de le prendre en compte.'
@commentaire.dossier = @dossier
@commentaire.save
redirect_to url_for({controller: :recapitulatif, action: :show, :dossier_id => params[:dossier_id]})
else
redirect_to url_for({controller: :description, action: :show, :dossier_id => params[:dossier_id]})
end
end
def get_position
@dossier = Dossier.find(params[:dossier_id])
if @dossier.position_lat == nil
tmp_position = Carto::Geocodeur.convert_adresse_to_point(@dossier.etablissement.adresse.gsub("\r\n", ' '))
@dossier.position_lat = tmp_position.point.y
@dossier.position_lon = tmp_position.point.x
@dossier.save
end
render json: { lon: @dossier.position_lon, lat: @dossier.position_lat, dossier_id: params[:dossier_id] }
end
end

View file

@ -0,0 +1,17 @@
class CommentairesController < ApplicationController
def create
@commentaire = Commentaire.create
@commentaire.email = params['email_commentaire']
@commentaire.body = params['texte_commentaire']
@commentaire.dossier = Dossier.find(params['dossier_id'])
@commentaire.save
if request.referer.include?'/recapitulatif'
redirect_to url_for({controller: :recapitulatif, action: :show, :dossier_id => params['dossier_id']})
else
redirect_to url_for({controller: 'admin/dossier', action: :show, :dossier_id => params['dossier_id']})
end
end
end

View file

View file

@ -0,0 +1,14 @@
class DemandesController < ApplicationController
def show
@dossier = Dossier.find(params[:dossier_id])
@evenement_vie = EvenementVie.where(use_admi_facile: true)
end
def choice
@dossier = Dossier.find(params[:dossier_id])
@dossier.ref_formulaire = params[:ref_formulaire]
@dossier.save
redirect_to url_for({controller: :carte, action: :show, :dossier_id => params[:dossier_id]})
end
end

View file

@ -0,0 +1,59 @@
class DescriptionController < ApplicationController
def show
@dossier = Dossier.find(params[:dossier_id])
@dossier = @dossier.decorate
rescue
redirect_to url_for({controller: :start, action: :error_dossier})
end
def error
show
flash.now.alert = 'Un ou plusieurs attributs obligatoires sont manquants ou incorrects.'
render 'show'
end
def create
@dossier = Dossier.find(params[:dossier_id])
@dossier.nom_projet = params[:nom_projet]
@dossier.description = params[:description]
@dossier.montant_projet = params[:montant_projet]
@dossier.montant_aide_demande = params[:montant_aide_demande]
@dossier.date_previsionnelle = params[:date_previsionnelle]
@dossier.lien_plus_infos = params[:lien_plus_infos]
@dossier.mail_contact = params[:mail_contact]
@dossier.save
#upload dossier pdf
@dossier_pdf = DossierPdf.new
@dossier_pdf.ref_dossier_pdf = params[:dossier_pdf]
@dossier_pdf.dossier = @dossier
@dossier_pdf.save!
if check_missing_attributes(params)||check_format_email(@dossier.mail_contact) == nil
redirect_to url_for({controller: :description, action: :error})
else
if params[:back_url] == 'recapitulatif'
@commentaire = Commentaire.create
@commentaire.email = 'Modification détails'
@commentaire.body = 'Les informations détaillées de la demande ont été modifiées. Merci de le prendre en compte.'
@commentaire.dossier = @dossier
@commentaire.save
end
redirect_to url_for({controller: :recapitulatif, action: :show, dossier_id: @dossier.id})
end
end
private
def check_missing_attributes params
params[:nom_projet].strip == '' || params[:description].strip == '' || params[:montant_projet].strip == '' || params[:montant_aide_demande].strip == '' || params[:date_previsionnelle].strip == '' || params[:mail_contact].strip == ''
end
def check_format_email email
/\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/.match(email)
end
end

View file

@ -0,0 +1,66 @@
class DossiersController < ApplicationController
def show
@dossier = Dossier.find(params[:id])
@etablissement = @dossier.etablissement.decorate
@entreprise = @dossier.entreprise.decorate
rescue
redirect_to url_for({controller: :start, action: :error_dossier})
end
def create
@rescue_redirect = 'error_siret'
@etablissement = Etablissement.new(SIADE::EtablissementAdapter.new(params[:siret]).to_params)
@entreprise = Entreprise.new(SIADE::EntrepriseAdapter.new(params[:siret][0..-6]).to_params)
@dossier_id = params[:pro_dossier_id].strip
if @dossier_id != ""
@rescue_redirect = 'error_dossier'
@dossier = Dossier.find(@dossier_id)
@etablissement = @dossier.etablissement
if @etablissement.siret == params[:siret]
redirect_to url_for({controller: :recapitulatif, action: :show, dossier_id: @dossier_id})
else
raise 'Combinaison Dossier_ID / SIRET non valide'
end
else
@dossier = Dossier.create
@entreprise.dossier = @dossier
@entreprise.save
@etablissement.dossier = @dossier
@etablissement.entreprise = @entreprise
@etablissement.save
redirect_to url_for({controller: :dossiers, action: :show, id: @dossier.id})
end
rescue
redirect_to url_for({controller: :start, action: @rescue_redirect})
end
def update
@dossier = Dossier.find(params[:id])
@dossier.autorisation_donnees = (params[:autorisation_donnees] == 'on')
@dossier.save
if @dossier.autorisation_donnees
redirect_to url_for({controller: :demandes, action: :show, dossier_id: @dossier.id})
else
@etablissement = @dossier.etablissement.decorate
@entreprise = @dossier.entreprise.decorate
self.error
end
end
def error
show
flash.now.alert = 'Les conditions sont obligatoires.'
render 'show'
end
end

View file

@ -0,0 +1,25 @@
class Pros::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
#GET /resource/sign_in
def new
super
end
#POST /resource/sign_in
def create
super
end
# DELETE /resource/sign_out
# def destroy
# super
# end
# protected
# You can put the params you want to permit in the empty array.
# def configure_sign_in_params
# devise_parameter_sanitizer.for(:sign_in) << :attribute
# end
end

View file

@ -0,0 +1,12 @@
class RecapitulatifController < ApplicationController
def show
@dossier = Dossier.find(params[:dossier_id])
@dossier = @dossier.decorate
@commentaires = @dossier.commentaires.order(created_at: :desc)
@commentaires = @commentaires.all.decorate
@commentaire_email = @dossier.mail_contact
rescue
redirect_to url_for({controller: :start, action: :error_dossier})
end
end

View file

@ -0,0 +1,17 @@
class StartController < ApplicationController
def index
end
def error_siret
flash.now.alert = 'Ce SIRET n\'est pas valide'
render 'index'
end
def error_login
flash.now.alert = 'Ce compte n\'existe pas'
render 'index'
end
def error_dossier
flash.now.alert = 'Ce dossier n\'existe pas'
render 'index'
end
end

View file

@ -0,0 +1,14 @@
class User::CustomFailure < Devise::FailureApp
def redirect_url
url_for({controller: '/start', action: :index})
end
# You need to override respond to eliminate recall
def respond
if http_auth?
http_auth
else
redirect
end
end
end

View file

@ -0,0 +1,25 @@
class User::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
def new
redirect_to url_for({controller: '/start', action: :error_login})
end
# POST /resource/sign_in
def create
super
end
# DELETE /resource/sign_out
def destroy
super
end
# protected
# You can put the params you want to permit in the empty array.
# def configure_sign_in_params
# devise_parameter_sanitizer.for(:sign_in) << :attribute
# end
end

View file

@ -0,0 +1,13 @@
class AdminDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,13 @@
class CarteDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,10 @@
class CommentaireDecorator < Draper::Decorator
delegate_all
def created_at_fr
created_at.to_datetime.strftime("%d/%m/%Y - %H:%M")
rescue
'dd/mm/YYYY - HH:MM'
end
end

View file

@ -0,0 +1,13 @@
class DemandeDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,13 @@
class DescriptionDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,13 @@
class DossierDecorator < Draper::Decorator
delegate_all
def date_fr
date_previsionnelle.to_date.strftime("%d/%m/%Y")
rescue
'dd/mm/YYYY'
end
def date_en
date_previsionnelle.to_date.strftime("%Y-%m-%d")
end
end

View file

@ -0,0 +1,47 @@
class EntrepriseDecorator < Draper::Decorator
delegate_all
def raison_sociale_or_name
raison_sociale.nil? ? nom + '' + prenom : raison_sociale
end
def siege_social_true_false
siege_social? ? 'Cet établissement est le siège social' : 'Cet établissement n\'est pas le siège social'
end
def code_effectif_entreprise_libelle
case code_effectif_entreprise.to_s
when '00'
'0 salarié'
when '01'
'1 ou 2 salariés'
when '02'
'3 à 5 salariés'
when '03'
'6 à 9 salariés'
when '11'
'10 à 19 salariés'
when '12'
'20 à 49 salariés'
when '21'
'50 à 99 salariés'
when '22'
'100 à 199 salariés'
when '31'
'200 à 249 salariés'
when '32'
'250 à 499 salariés'
when '41'
'500 à 999 salariés'
when '42'
'1 000 à 1 999 salariés'
when '51'
'2 000 à 4 999 salariés'
when '52'
'5 000 à 9 999 salariés'
when '53'
'10 000 salariés et plus'
end
end
end

View file

@ -0,0 +1,7 @@
class EtablissementDecorator < Draper::Decorator
delegate_all
def siege_social_true_false
siege_social? ? 'Cet établissement est le siège social' : 'Cet établissement n\'est pas le siège social'
end
end

View file

@ -0,0 +1,13 @@
class RecapitulatifDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,13 @@
class StartDecorator < Draper::Decorator
delegate_all
# Define presentation-specific methods here. Helpers are accessed through
# `helpers` (aka `h`). You can override attributes, for example:
#
# def created_at
# helpers.content_tag :span, class: 'time' do
# object.created_at.strftime("%a %m/%d/%y")
# end
# end
end

View file

@ -0,0 +1,2 @@
module Admin::DossierHelper
end

View file

@ -0,0 +1,2 @@
module ApplicationHelper
end

View file

@ -0,0 +1,2 @@
module CarteHelper
end

View file

@ -0,0 +1,2 @@
module CommentairesHelper
end

View file

@ -0,0 +1,2 @@
module DemandesHelper
end

View file

@ -0,0 +1,2 @@
module DescriptionHelper
end

View file

@ -0,0 +1,2 @@
module DossiersHelper
end

View file

@ -0,0 +1,2 @@
module RecapitulatifHelper
end

View file

@ -0,0 +1,2 @@
module StartHelper
end

0
app/mailers/.keep Normal file
View file

0
app/models/.keep Normal file
View file

View file

@ -0,0 +1,3 @@
class Commentaire < ActiveRecord::Base
belongs_to :dossier
end

View file

6
app/models/dossier.rb Normal file
View file

@ -0,0 +1,6 @@
class Dossier < ActiveRecord::Base
has_one :etablissement
has_one :entreprise
has_one :dossier_pdf
has_many :commentaires
end

View file

@ -0,0 +1,5 @@
class DossierPdf < ActiveRecord::Base
belongs_to :dossier
mount_uploader :ref_dossier_pdf, DossierPdfUploader
end

4
app/models/entreprise.rb Normal file
View file

@ -0,0 +1,4 @@
class Entreprise < ActiveRecord::Base
belongs_to :dossier
has_one :etablissement
end

View file

@ -0,0 +1,4 @@
class Etablissement < ActiveRecord::Base
belongs_to :dossier
belongs_to :entreprise
end

View file

@ -0,0 +1,2 @@
class EvenementVie < ActiveRecord::Base
end

6
app/models/pro.rb Normal file
View file

@ -0,0 +1,6 @@
class Pro < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end

View file

@ -0,0 +1,2 @@
class RefFormulaire < ActiveRecord::Base
end

View file

@ -0,0 +1,2 @@
class RefPiecesJointe < ActiveRecord::Base
end

6
app/models/user.rb Normal file
View file

@ -0,0 +1,6 @@
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end

View file

@ -0,0 +1,51 @@
# encoding: utf-8
class DossierPdfUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
# include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# # For Rails 3.1+ asset pipeline compatibility:
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
#
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
#
# def scale(width, height)
# # do something
# end
# Create different versions of your uploaded files:
# version :thumb do
# process :resize_to_fit => [50, 50]
# end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(pdf)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View file

@ -0,0 +1,25 @@
%h1#dossier_id{:class => 'text-info', :style => 'text-align:right'}
= "Dossier n°#{@dossier.id}"
%script{type: 'text/javascript'}
="url_carte = '#{@dossier.id}/'"
="ref_dossier = '#{@dossier.ref_dossier}'"
= render partial: '/dossiers/infos_entreprise'
%br
= render partial: '/dossiers/infos_dossier'
%br
%br
.content{class: 'row'}
#map_qp{style: 'height:500px', class: 'col-lg-6 col-md-6'}
%object{ data: "#{@dossier_pdf.ref_dossier_pdf.url}", type: "application/pdf", title:"Dossier PDF", class: 'col-lg-6 col-md-6', style: 'height:500px'}
= render partial: '/carte/carte_sources_CSS'
= render partial: '/carte/carte_sources_JS_backend'
%br
= render partial: '/recapitulatif/commentaires_flux'
%br
%br

View file

@ -0,0 +1,6 @@
%div#sources_CSS_api_carto
%link{:href => "http://leaflet.github.io/Leaflet.draw/leaflet.draw.css", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "/assets/api_carto/lib/leaflet.photon.css", :rel => "stylesheet", :type => "text/css"}/
%link{:href => "http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css", :rel => "stylesheet"}/
%link{:href => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/dd04bbf160aa33c44aa63e8a744b3632c162c340/src/easy-button.css", :rel => "stylesheet"}/

View file

@ -0,0 +1,14 @@
%script{type: 'text/javascript'}
="var dossier_id =#{@dossier.id}"
%div#sources_JS_api_carto
%script{:src => "http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"}
%script{:src => "http://leaflet.github.io/Leaflet.draw/leaflet.draw.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.0.1/spin.min.js"}
%script{:src => "/assets/api_carto/lib/leaflet.spin.js"}
%script{:src => "/assets/api_carto/lib//leaflet.photon.js"}
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.bar.js"}
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.button.js"}
%script{:src => "/assets/api_carto/qp.js"}

View file

@ -0,0 +1,15 @@
%script{type: 'text/javascript'}
="var dossier_id =#{@dossier.id}"
="var ref_dossier=#{@dossier.ref_dossier}"
%div#sources_JS_api_carto_backend
%script{:src => "http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"}
%script{:src => "http://leaflet.github.io/Leaflet.draw/leaflet.draw.js"}
%script{:src => "https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.0.1/spin.min.js"}
%script{:src => "/assets/api_carto/lib/leaflet.spin.js"}
%script{:src => "/assets/api_carto/lib//leaflet.photon.js"}
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.bar.js"}
%script{:src => "https://cdn.rawgit.com/CliffCloud/Leaflet.EasyButton/14332b70b18bdec80f4cce86c643372883bf90aa/src/easy-button.button.js"}
%script{:src => "/assets/api_carto/backend.js"}

View file

@ -0,0 +1,20 @@
%h2
='Localisation de votre demande'
%br
=render partial: 'carte_sources_CSS'
.content
#map_qp{style: 'height:600px; width: 100%;'}
= form_tag(url_for({controller: :carte, action: :save_ref_api_carto}), class: 'form-inline', method: 'POST') do
%br
%input{type: 'hidden', value: '', name: 'ref_dossier', id: 'ref_dossier'}
%input{type: 'hidden', value: request.parameters[:back_url], name: 'back_url', id: 'back_url'}
-if request.parameters[:back_url] == 'recapitulatif'
=render partial: '/layouts/modifications_terminees'
-else
=render partial: '/layouts/etape_suivante'
=render partial: 'carte_sources_JS'

View file

@ -0,0 +1,16 @@
%h2
='Type de demande'
%br
= form_tag(url_for({controller: :demandes, action: :choice}), class: 'form-inline', method: 'POST') do
%div{style:'text-align:center'}
%select{name:'ref_formulaire', id: 'ref_formulaire', class:'form-control'}
-@evenement_vie.each do |ev|
%optgroup{:label => ev.nom}
-RefFormulaire.where(evenement_vie: ev.id, use_admi_facile: true).each do |form|
%option{value: form.id}
&nbsp;&nbsp;
=form.nom
%br
=render partial: 'layouts/etape_suivante'

View file

@ -0,0 +1,71 @@
%h2 Description de votre projet
%br
= form_tag(url_for({controller: :description, action: :create, dossier_id: @dossier.id}), class: 'form-inline', method: 'POST', multipart: true) do
%input{type: 'hidden', value: request.parameters[:back_url], name: 'back_url', id: 'back_url'}
%div{style:'margin-left:3%;'}
%h4 Nom de votre projet*
%div{style:'margin-top:1.5rem; margin-left:2%; margin-right:2%;'}
%input{class: 'form-control', style: 'width:100%', type: 'text', id: 'nom_projet', name: 'nom_projet', placeholder: 'Nom du projet', value: @dossier.nom_projet}
%br
%h4 Description de votre projet*
%div{style:'text-align:center; margin-left:2%; margin-right:2%'}
%textarea{id:'description', name:'description', class:'form-control', rows: '6', style:'width: 100%', placeholder: 'Description du projet'}
=@dossier.description
%br
%div{class:'row'}
%div{class:'col-lg-6 col-md-6'}
%h4 Montant du projet*
%div{style:'margin-left:4%; margin-top:1.5rem'}
%input{class: 'form-control', type: 'number', id: 'montant_projet', name: 'montant_projet', placeholder: 'Montant du projet', value: @dossier.montant_projet}
!='&euro;'
%div{class:'col-lg-6 col-md-6'}
%h4 Montant des aides que vous sollicitez*
%div{style:'margin-left:4%; margin-top:1.5rem'}
%input{class: 'form-control', type: 'number', id: 'montant_aide_demande', name: 'montant_aide_demande', placeholder: 'Montant des aides', value: @dossier.montant_aide_demande}
!='&euro;'
%br
%div{class:'row'}
%div{class:'col-lg-6 col-md-6'}
%h4 Date prévisionnelle du début de votre projet*
%div{style:'margin-left:4%; margin-top:1.5rem'}
%input{class: 'form-control', type: 'text', id: 'date_previsionnelle', name: 'date_previsionnelle', placeholder: 'Date prévisionnelle', value: @dossier.date_previsionnelle, 'data-provide' => 'datepicker', 'data-date-format' => 'dd/mm/yyyy'}
%div{class:'col-lg-6 col-md-6'}
%h4 Mail de contact*
%div{style:'margin-left:4%; margin-top:1.5rem'}
%input{class: 'form-control', style:'width:60%', type: 'email', id: 'mail_contact', name: 'mail_contact', placeholder: 'Mail de contact', value: @dossier.mail_contact}
%br
%h3 Documents administratifs
%br
%table{class:'table', style:'width:50%; margin-left:5%'}
%tr
%th{class:'col-lg-4'} Charger votre dossier (.pdf)
%td{class:'col-lg-6'}
%input{type: 'file',name:'dossier_pdf', id:'dossier_pdf', accept: ".pdf"}
%br
%p
='Afin de facilité votre démarche, nous avons récupéré pour vous :'
%ul
%li
='Votre déclaration sociale'
%li
='Votre déclaration fiscale'
%div{style: 'text-align:right'}
%h6 Tous les champs portant un * sont obligatoires.
-if request.parameters[:back_url] == 'recapitulatif'
=render partial: '/layouts/modifications_terminees'
-else
= submit_tag 'Terminer la procédure', id: 'suivant', class: %w(btn btn btn-success), style: 'float:right', data: { disable_with: 'Terminé la procédure', submit: true}
%br
%br

View file

@ -0,0 +1,47 @@
=javascript_include_tag "http://code.highcharts.com/highcharts.js", "chartkick"
.row{id: 'infos_dossier'}
.col-md-6
%h4.text-info= @dossier.nom_projet
%div{style: 'margin-left:10px; padding-top:5px'}
.description
- begin
- @dossier.description.split(/(?:\n\r?|\r\n?')/).each do |line|
= line
%br
- rescue
=''
%br
.col-lg-6.col-md-6
%h4
='Montant total '
%div{style: 'margin-left:10px'}
=number_to_currency(@dossier.montant_projet.to_f, :unit => " ", :separator => ",", :delimiter => " ")
!='&euro;'
.col-lg-6.col-md-6
%h4
= 'Début du projet souhaité '
%div{style: 'margin-left:10px'}
=@dossier.date_fr
.col-lg-6.col-md-6
%br
%h4
='Contact'
%a{href: "mailto:#{@dossier.mail_contact}", style: 'margin-left:10px'}
=@dossier.mail_contact
-if !request.url.include?('admin')
.col-lg-6.col-md-6
%br
%br
%a#modif_carte{href: "/dossiers/#{@dossier.id}/carte?back_url=recapitulatif"} Modifier la localisation
%br
%a#modif_description{href: "/dossiers/#{@dossier.id}/description?back_url=recapitulatif"} Modifier la description
.col-md-6
= pie_chart({"Montant à charge #{(100 - @dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => (@dossier.montant_projet.to_f - @dossier.montant_aide_demande.to_f), "Montant souhaité #{(@dossier.montant_aide_demande.to_f/@dossier.montant_projet.to_f*100).round(2)}%" => @dossier.montant_aide_demande})

View file

@ -0,0 +1,38 @@
%h4
=@entreprise.raison_sociale_or_name
%div{class:'row', id: 'infos_entreprise'}
%div{class:'col-lg-6 col-md-6', style:'margin-left:2%'}
%h5
='SIRET : '
%span.text-success
=@etablissement.siret
%h5
=@entreprise.forme_juridique
%h5
=@etablissement.libelle_naf
%h5
='Date création : '
%span
=Time.at(@entreprise.date_creation).strftime "%d-%m-%Y"
%br
%h5
='Code effectif entreprise : '
%span
=@entreprise.code_effectif_entreprise_libelle
%h5
='Capital social : '
%span
=number_to_currency(@entreprise.capital_social, delimiter: ' ', unit: '€', format: "%n %u")
%div.col-lg-6.col-md-6{style:'margin-left:-2%'}
%h5
='Adresse : '
%div{style:'margin-left:2%'}
=@etablissement.adresse.gsub(/[\n]/, '<br>').html_safe

View file

@ -0,0 +1,16 @@
%h2{style:'margin-bottom:16px'}
='Récapitulatif de vos informations'
%div{class:'row', style:'margin-left:5%'}
= render partial: 'infos_entreprise'
= form_tag(url_for({controller: :dossiers, action: :update}), class: 'form-inline', method: 'PUT') do
%br
%div
%label{ style:'font-weight:normal' }
%input{type:'checkbox', name: 'autorisation_donnees', id: 'autorisation_donnees'}
='Jautorise les organismes publics à vérifier les informations de mon entreprise auprès des administrations concernées. Ces informations resteront strictement confidentielles.'
%br
%br
= render partial: 'layouts/etape_suivante'

Some files were not shown because too many files have changed in this diff Show more