view.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. App.View = (function(lng, App, undefined) {
  2. lng.View.Template.create('pending-tmp',
  3. '<li id="{{id}}">\
  4. <a href="#">\
  5. <span class="icon check"></span>\
  6. <strong>{{name}}</strong>\
  7. <small>{{description}}</small>\
  8. </a>\
  9. </li>'
  10. );
  11. lng.View.Template.create('list-tmp',
  12. '<li id="{{id}}">\
  13. <a href="#">\
  14. <span class="icon folder"></span>\
  15. <strong>{{name}}</strong>\
  16. <small>{{description}}</small>\
  17. </a>\
  18. </li>'
  19. );
  20. var todo = function(id) {
  21. lng.Data.Sql.select('todo', {id:id}, function(result){
  22. if (result.length > 0) {
  23. var data = result[0];
  24. lng.Data.Cache.set('current_todo', data);
  25. $('#txtEditName').val(data.name);
  26. $('#txtEditDescription').val(data.description);
  27. $('#txtEditName').val(data.name);
  28. lng.Router.section('view');
  29. }
  30. });
  31. };
  32. var returnToMain = function(message, icon) {
  33. lng.Sugar.Growl.show(message, icon, true);
  34. App.Data.refresh();
  35. setTimeout(function() {
  36. lng.Router.back();
  37. lng.Sugar.Growl.hide();
  38. }, 500);
  39. };
  40. return{
  41. todo: todo,
  42. returnToMain: returnToMain
  43. }
  44. })(LUNGO, App);