aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2017-03-01 17:16:15 +0100
committerjpl2017-03-01 17:16:28 +0100
commit49a472835bf5bfe57c711dfd20b8e1a44afd6264 (patch)
tree28dfa684f901160a37781ecd4f952e4218a5b4a9
parenta31a230a8e019fdf0d3fe948803eff73cccfd333 (diff)
downloadchouette-core-49a472835bf5bfe57c711dfd20b8e1a44afd6264.tar.bz2
Refs #2623: updating selectable_table component, with js params injection to url
-rw-r--r--app/assets/javascripts/selectable_table.coffee15
-rw-r--r--app/helpers/newapplication_helper.rb9
-rw-r--r--db/schema.rb18
3 files changed, 38 insertions, 4 deletions
diff --git a/app/assets/javascripts/selectable_table.coffee b/app/assets/javascripts/selectable_table.coffee
index 1b4b95c0b..84475857e 100644
--- a/app/assets/javascripts/selectable_table.coffee
+++ b/app/assets/javascripts/selectable_table.coffee
@@ -28,11 +28,26 @@
elm = selection.indexOf(e.currentTarget.id)
selection.splice(elm, 1)
+ # console.log(selection)
+
# Updating toolbox, according to selection
if selection.length > 0
toolbox
.removeClass 'noselect'
.children('.info-msg').children('span').text(selection.length)
+
+ # Injecting selection into action urls
+ toolbox.find('.st_action').each ->
+ actionURL = $(this).children('a').attr('data-path')
+
+ newSelection = []
+ i = 0
+ while i < selection.length
+ newSelection[i] = 'referentials[]=' + selection[i] + ''
+ i++
+
+ $(this).children('a').attr('href', actionURL + '?' + newSelection.join('&'))
+
else
toolbox
.addClass 'noselect'
diff --git a/app/helpers/newapplication_helper.rb b/app/helpers/newapplication_helper.rb
index 49b717beb..fcb5d26a3 100644
--- a/app/helpers/newapplication_helper.rb
+++ b/app/helpers/newapplication_helper.rb
@@ -175,11 +175,12 @@ module NewapplicationHelper
def select_toolbox(actions)
tools = content_tag :ul do
actions.collect do |action|
-
- actitem = link_to '#', title: t("actions.#{action}") do
- if action == :edit
+ if action == :edit
+ actitem = link_to('#', title: t("actions.#{action}")) do
content_tag :span, '', class: 'fa fa-pencil'
- elsif action == :delete
+ end
+ elsif action == :delete
+ actitem = link_to('#', method: :delete, data: { path: referentials_workbench_path, confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?' }, title: t("actions.#{action}")) do
content_tag :span, '', class: 'fa fa-trash'
end
end
diff --git a/db/schema.rb b/db/schema.rb
index 5ef4dbd20..02ede8b1b 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -165,6 +165,22 @@ ActiveRecord::Schema.define(version: 20170301145604) do
add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true
+ create_table "delayed_jobs", force: true do |t|
+ t.integer "priority", default: 0
+ t.integer "attempts", default: 0
+ t.text "handler"
+ t.text "last_error"
+ t.datetime "run_at"
+ t.datetime "locked_at"
+ t.datetime "failed_at"
+ t.string "locked_by"
+ t.string "queue"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
+
create_table "exports", force: true do |t|
t.integer "referential_id", limit: 8
t.string "status"
@@ -828,6 +844,8 @@ ActiveRecord::Schema.define(version: 20170301145604) do
add_index "workbenches", ["stop_area_referential_id"], :name => "index_workbenches_on_stop_area_referential_id"
Foreigner.load
+ add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey", dependent: :delete
+
add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete
add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", dependent: :nullify