catalog.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. $(document).ready(function()
  2. {
  3. /* Sort up. */
  4. $(document).on('click', '.icon-arrow-up', function()
  5. {
  6. $(this).parents('tr').prev().before($(this).parents('tr'));
  7. $('tr .order').each(function(index,obj){$(this).val(index + 1);});
  8. });
  9. /* Sort down. */
  10. $(document).on('click', '.icon-arrow-down', function()
  11. {
  12. var hasNext = $(this).parents('tr').next().find('.icon-arrow-down').size() > 0;
  13. if(hasNext)
  14. {
  15. $(this).parents('tr').next().after($(this).parents('tr'));
  16. $('tr .order').each(function(index,obj){$(this).val(index + 1);});
  17. }
  18. });
  19. $('tr .order').each(function(index,obj){$(this).val(index + 1);});
  20. var setCatalogKey = function()
  21. {
  22. maxID = v.maxID
  23. $('[value=new]').each(function()
  24. {
  25. maxID ++;
  26. $(this).parents('.node').find('[id*=type]').attr('name', 'type[' + maxID + ']');
  27. $(this).parents('.node').find('[id*=title]').attr('name', 'title[' + maxID + ']');
  28. $(this).parents('.node').find('[id*=keywords]').attr('name', 'keywords[' + maxID + ']');
  29. $(this).parents('.node').find('[id*=order]').attr('name', 'order[' + maxID + ']');
  30. $(this).attr('name', 'mode[' + maxID + ']');
  31. })
  32. }
  33. setCatalogKey();
  34. });