Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
jsort does the javascript/jquery stuff for drag&drop sortable lists in your rails applications.
Model
Your model should have a 'position'-column of type integer.
Controller
def sort
params[:ordered_items].each_with_index do |id,idx|
m = MyModel.find(id)
m.position = idx
m.save
end
render :nothing => true
end
View (HAML; obviously, will work with html.erb too)
- jsort(@my_items,'ordered_items', sort_my_controller_path) do |item|
= item.name
= link_to "[Edit]", edit_my_item_path(item)
Parameters
jsort ITEMS, NAME, PATH, [OPTIONS]
params[:NAME]
passed to the controller.:text => 'MOVE
- Will use this text as a drag-n-drop-handle instead of the image:image => 'yourimage.jpg'
- use your own image (place it in assets/images path of your application:handle_only => true
- Only the handle (image or text) can be used to drag&move. Default is 'false' which allows you to pick up by clicking anywhere on the line.:register => false
- no call to registerSortableList($('#list-id')
will be implemented and you have to call the register-function in your own code (eg. coffee-script). Use this strategie if you're using Twitter-Bootstrap and loading the application.js at the end of your layout-file:sortable_id => :id
- default's to :id.This will display an ordered list which is sortable by drag and drop.
The block passed to jsort will be used to format each line/item. If no block is
given item.to_s
will be used to display the items.
gem "jsort", "~> 0.0.1"
to your Gemfile//= require jsort_sortable
Copyright (c) 2011 Andi Altendorfer. See LICENSE.txt for further details.
FAQs
Unknown package
We found that jsort demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.