view.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. App.View.popup = function(content)
  2. {
  3. var tpl = App.Templates.get('popup', 'general');
  4. if ('undefined' != typeof App.Templates.html.popup[content]) {
  5. var content = App.Templates.get(content, 'popup').finalize();
  6. }
  7. tpl.set(':content', content);
  8. $('#popup-bg, #popup').remove();
  9. $(document.body).append(tpl.finalize());
  10. }
  11. App.View.closePopup = function()
  12. {
  13. $('.black_overlay').remove();
  14. $('.popup_content').remove();
  15. }
  16. App.View.updateInitialInfo = function(key, object)
  17. {
  18. var expr = '.'+key;
  19. var object = parseInt(object, 10);
  20. var html = object + ' ' + App.Messages.get(key, (object > 1));
  21. $(expr).html(html);
  22. }
  23. App.View.listItems = function(reply){
  24. var acc = [];
  25. var build_method = App.Env.getWorldName() + '_entry';
  26. var data = reply.data;
  27. // TODO: fix it data.data
  28. $.each(data, function(key)
  29. {
  30. var o = data[key];
  31. fb.warn(key);
  32. acc[acc.length++] = App.HTML.Build[build_method](o, key);
  33. });
  34. var html = acc.done().wrapperize('ENTRIES_WRAPPER', App.Env.getWorldName());
  35. App.Ref.CONTENT.html(html);
  36. App.Helpers.updateScreen();
  37. }