From ee95def580165b425ffb8ed828d72e4033a34da1 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Thu, 28 Jul 2011 15:33:52 -0700 Subject: [PATCH] removed js from the view. added grabbing hand while moving aspects --- app/views/aspects/_aspect_listings.haml | 13 ------------- config/assets.yml | 1 + public/javascripts/aspect-sorting.js | 18 ++++++++++++++++++ public/stylesheets/sass/application.sass | 8 ++++++++ 4 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 public/javascripts/aspect-sorting.js diff --git a/app/views/aspects/_aspect_listings.haml b/app/views/aspects/_aspect_listings.haml index bad7ad9cb..76b8dada7 100644 --- a/app/views/aspects/_aspect_listings.haml +++ b/app/views/aspects/_aspect_listings.haml @@ -36,16 +36,3 @@ = only_sharing_count = t('contacts.index.only_sharing_with_me') - :javascript - $(document).ready(function() { - jQuery('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({ - items: 'li[id]', - update: function(event, ui) { - var order = jQuery(this).sortable('toArray'); - var obj = { 'reorder_aspects': order, 'authenticity_token': '#{form_authenticity_token}', '_method': 'put' }; - jQuery.ajax('/user', { type: 'post', dataType: 'script', data: obj }); - }, - helper: 'clone' - }); - }); - diff --git a/config/assets.yml b/config/assets.yml index 67240f263..6aa1cc48d 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -44,6 +44,7 @@ javascripts: - public/javascripts/search.js - public/javascripts/contact-edit.js - public/javascripts/contact-list.js + - public/javascripts/aspect-sorting.js login: - public/javascripts/login.js mobile: diff --git a/public/javascripts/aspect-sorting.js b/public/javascripts/aspect-sorting.js new file mode 100644 index 000000000..68df5c6c2 --- /dev/null +++ b/public/javascripts/aspect-sorting.js @@ -0,0 +1,18 @@ +/* Copyright (c) 2010, Diaspora Inc. This file is +* licensed under the Affero General Public License version 3 or later. See +* the COPYRIGHT file. +*/ + +$(document).ready(function() { + $('#aspect_nav.left_nav .all_aspects .sub_nav').sortable({ + items: 'li[id]', + update: function(event, ui) { + var order = $(this).sortable('toArray'), + obj = { 'reorder_aspects': order, '_method': 'put' }; + $.ajax('/user', { type: 'post', dataType: 'script', data: obj }); + }, + revert: true, + helper: 'clone' + }); +}); + diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 4859b17ec..04539c543 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -2868,6 +2868,14 @@ ul.left_nav :position relative :width 100% + a.aspect_selector, + a.home_selector, + a.tag_selector + &:active + :cursor -webkit-grabbing + :cursor -moz-grabbing + :cursor grabbing + a.aspect_selector, a.home_selector, a.tag_selector,