diff options
| author | Teddy Wing | 2017-06-15 18:45:57 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-06-15 19:03:27 +0200 | 
| commit | 5a54186ab087484334d6ff15976d7198ee79371a (patch) | |
| tree | 2677faeaf4fc4326954ca0d49fbaff62ffe9dee9 /app/helpers | |
| parent | 8be607f4a481099a5c29b4eb8de3026bf1e83900 (diff) | |
| download | chouette-core-5a54186ab087484334d6ff15976d7198ee79371a.tar.bz2 | |
Add `MultipleSelectionToolboxHelper`
Port the `select_toolbox` from `NewapplicationHelper`. For now the code
is the same. Just the name and method comment have changed.
Refs #3479
Diffstat (limited to 'app/helpers')
| -rw-r--r-- | app/helpers/multiple_selection_toolbox_helper.rb | 27 | 
1 files changed, 27 insertions, 0 deletions
diff --git a/app/helpers/multiple_selection_toolbox_helper.rb b/app/helpers/multiple_selection_toolbox_helper.rb new file mode 100644 index 000000000..f8f19fda6 --- /dev/null +++ b/app/helpers/multiple_selection_toolbox_helper.rb @@ -0,0 +1,27 @@ +module MultipleSelectionToolboxHelper +  # Box of links that floats at the bottom right of the page +  def multiple_selection_toolbox(actions) +    tools = content_tag :ul do +      dPath = nil +      dPath = referentials_workbench_path if params[:controller] = 'workbenches' + +      actions.collect do |action| +        if action == :edit +          actitem = link_to('#', title: t("actions.#{action}")) do +            content_tag :span, '', class: 'fa fa-pencil' +          end +        elsif action == :delete +          actitem = link_to('#', method: :delete, data: { path: dPath, 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 + +        content_tag :li, actitem, class: 'st_action' +      end.join.html_safe + +    end +    content_tag :div, '', class: 'select_toolbox noselect' do +      tools.concat(content_tag(:span, ("<span>0</span> élément(s) sélectionné(s)").html_safe, class: 'info-msg')) +    end +  end +end  | 
