PageRenderTime 72ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 1ms

/public/js/hackdashApp.js

https://github.com/14mmm/hackdash
JavaScript | 4843 lines | 3263 code | 972 blank | 608 comment | 509 complexity | c66b06278711345e4df8055e3fd84ce7 MD5 | raw file
  1. /*!
  2. * Hackdash - v0.5.1
  3. * Copyright (c) 2014 Hackdash
  4. *
  5. */
  6. (function (modules) {
  7. var resolve, getRequire, require, notFoundError, findFile
  8. , extensions = {".js":[],".json":[],".css":[],".html":[]};
  9. notFoundError = function (path) {
  10. var error = new Error("Could not find module '" + path + "'");
  11. error.code = 'MODULE_NOT_FOUND';
  12. return error;
  13. };
  14. findFile = function (scope, name, extName) {
  15. var i, ext;
  16. if (typeof scope[name + extName] === 'function') return name + extName;
  17. for (i = 0; (ext = extensions[extName][i]); ++i) {
  18. if (typeof scope[name + ext] === 'function') return name + ext;
  19. }
  20. return null;
  21. };
  22. resolve = function (scope, tree, path, fullpath, state) {
  23. var name, dir, exports, module, fn, found, i, ext;
  24. path = path.split('/');
  25. name = path.pop();
  26. if ((name === '.') || (name === '..')) {
  27. path.push(name);
  28. name = '';
  29. }
  30. while ((dir = path.shift()) != null) {
  31. if (!dir || (dir === '.')) continue;
  32. if (dir === '..') {
  33. scope = tree.pop();
  34. } else {
  35. tree.push(scope);
  36. scope = scope[dir];
  37. }
  38. if (!scope) throw notFoundError(fullpath);
  39. }
  40. if (name && (typeof scope[name] !== 'function')) {
  41. found = findFile(scope, name, '.js');
  42. if (!found) found = findFile(scope, name, '.json');
  43. if (!found) found = findFile(scope, name, '.css');
  44. if (!found) found = findFile(scope, name, '.html');
  45. if (found) {
  46. name = found;
  47. } else if ((state !== 2) && (typeof scope[name] === 'object')) {
  48. tree.push(scope);
  49. scope = scope[name];
  50. name = '';
  51. }
  52. }
  53. if (!name) {
  54. if ((state !== 1) && scope[':mainpath:']) {
  55. return resolve(scope, tree, scope[':mainpath:'], fullpath, 1);
  56. }
  57. return resolve(scope, tree, 'index', fullpath, 2);
  58. }
  59. fn = scope[name];
  60. if (!fn) throw notFoundError(fullpath);
  61. if (fn.hasOwnProperty('module')) return fn.module.exports;
  62. exports = {};
  63. fn.module = module = { exports: exports };
  64. fn.call(exports, exports, module, getRequire(scope, tree));
  65. return module.exports;
  66. };
  67. require = function (scope, tree, fullpath) {
  68. var name, path = fullpath, t = fullpath.charAt(0), state = 0;
  69. if (t === '/') {
  70. path = path.slice(1);
  71. scope = modules['/'];
  72. tree = [];
  73. } else if (t !== '.') {
  74. name = path.split('/', 1)[0];
  75. scope = modules[name];
  76. if (!scope) throw notFoundError(fullpath);
  77. tree = [];
  78. path = path.slice(name.length + 1);
  79. if (!path) {
  80. path = scope[':mainpath:'];
  81. if (path) {
  82. state = 1;
  83. } else {
  84. path = 'index';
  85. state = 2;
  86. }
  87. }
  88. }
  89. return resolve(scope, tree, path, fullpath, state);
  90. };
  91. getRequire = function (scope, tree) {
  92. return function (path) { return require(scope, [].concat(tree), path); };
  93. };
  94. return getRequire(modules, []);
  95. })({
  96. "client": {
  97. "app": {
  98. "HackdashApp.js": function (exports, module, require) {
  99. /**
  100. * Landing Application
  101. *
  102. */
  103. var HackdashRouter = require('./HackdashRouter')
  104. , ModalRegion = require('./views/ModalRegion');
  105. module.exports = function(){
  106. var app = module.exports = new Backbone.Marionette.Application();
  107. function initRegions(){
  108. app.addRegions({
  109. header: "header",
  110. main: "#main",
  111. footer: "footer",
  112. modals: ModalRegion
  113. });
  114. }
  115. function initRouter(){
  116. app.router = new HackdashRouter();
  117. Backbone.history.start({ pushState: true });
  118. }
  119. app.addInitializer(initRegions);
  120. app.addInitializer(initRouter);
  121. window.hackdash.app = app;
  122. window.hackdash.app.start();
  123. // Add navigation for BackboneRouter to all links
  124. // unless they have attribute "data-bypass"
  125. $(window.document).on("click", "a:not([data-bypass])", function(evt) {
  126. var href = { prop: $(this).prop("href"), attr: $(this).attr("href") };
  127. var root = window.location.protocol + "//" + window.location.host + (app.root || "");
  128. if (href.prop && href.prop.slice(0, root.length) === root) {
  129. evt.preventDefault();
  130. Backbone.history.navigate(href.attr, { trigger: true });
  131. }
  132. });
  133. };
  134. },
  135. "HackdashRouter.js": function (exports, module, require) {
  136. /*
  137. * Hackdash Router
  138. */
  139. var Dashboard = require("./models/Dashboard")
  140. , Project = require("./models/Project")
  141. , Projects = require("./models/Projects")
  142. , Dashboards = require("./models/Dashboards")
  143. , Collection = require("./models/Collection")
  144. , Collections = require("./models/Collections")
  145. , Profile = require("./models/Profile")
  146. , Header = require("./views/Header")
  147. , Footer = require("./views/Footer")
  148. , HomeLayout = require("./views/Home")
  149. , LoginView = require("./views/Login")
  150. , ProfileView = require("./views/Profile")
  151. , ProjectFullView = require("./views/Project/Full")
  152. , ProjectEditView = require("./views/Project/Edit")
  153. , ProjectsView = require("./views/Project/Layout")
  154. , DashboardsView = require("./views/Dashboard/Collection")
  155. , CollectionsView = require("./views/Collection/Collection");
  156. module.exports = Backbone.Marionette.AppRouter.extend({
  157. routes : {
  158. "" : "index"
  159. , "login" : "showLogin"
  160. , "projects" : "showProjects"
  161. , "projects/create" : "showProjectCreate"
  162. , "projects/:pid/edit" : "showProjectEdit"
  163. , "projects/:pid" : "showProjectFull"
  164. , "dashboards" : "showDashboards"
  165. , "collections" : "showCollections"
  166. , "collections/:cid" : "showCollection"
  167. , "users/profile": "showProfile"
  168. , "users/:user_id" : "showProfile"
  169. },
  170. index: function(){
  171. if (hackdash.subdomain){
  172. this.showDashboard();
  173. }
  174. else {
  175. this.showHome();
  176. }
  177. },
  178. removeHomeLayout: function(){
  179. $('body').removeClass("homepage");
  180. $('header').add('footer').show();
  181. $('#page').addClass('container');
  182. },
  183. showHome: function(){
  184. $('body').addClass("homepage");
  185. $('header').add('footer').hide();
  186. $('#page').removeClass('container');
  187. var app = window.hackdash.app;
  188. app.main.show(new HomeLayout());
  189. },
  190. getSearchQuery: function(){
  191. var query = hackdash.getQueryVariable("q");
  192. var fetchData = {};
  193. if (query && query.length > 0){
  194. fetchData = { data: $.param({ q: query }) };
  195. }
  196. return fetchData;
  197. },
  198. showLogin: function(){
  199. var providers = window.hackdash.providers;
  200. var app = window.hackdash.app;
  201. app.modals.show(new LoginView({
  202. model: new Backbone.Model({ providers: providers.split(',') })
  203. }));
  204. },
  205. showDashboard: function() {
  206. this.removeHomeLayout();
  207. var app = window.hackdash.app;
  208. app.type = "dashboard";
  209. app.dashboard = new Dashboard();
  210. app.projects = new Projects();
  211. app.header.show(new Header({
  212. model: app.dashboard,
  213. collection: app.projects
  214. }));
  215. app.main.show(new ProjectsView({
  216. model: app.dashboard,
  217. collection: app.projects
  218. }));
  219. app.footer.show(new Footer({
  220. model: app.dashboard
  221. }));
  222. var self = this;
  223. app.dashboard.fetch()
  224. .done(function(){
  225. app.projects.fetch(self.getSearchQuery(), { parse: true })
  226. .done(function(){
  227. app.projects.buildShowcase(app.dashboard.get("showcase"));
  228. });
  229. });
  230. },
  231. showProjects: function() {
  232. this.removeHomeLayout();
  233. var app = window.hackdash.app;
  234. app.type = "isearch";
  235. app.projects = new Projects();
  236. app.header.show(new Header({
  237. collection: app.projects
  238. }));
  239. app.main.show(new ProjectsView({
  240. collection: app.projects
  241. }));
  242. app.projects.fetch(this.getSearchQuery());
  243. },
  244. showProjectCreate: function(){
  245. this.removeHomeLayout();
  246. var app = window.hackdash.app;
  247. app.type = "project";
  248. app.dashboard = new Dashboard();
  249. app.project = new Project();
  250. app.header.show(new Header({
  251. model: app.dashboard
  252. }));
  253. app.main.show(new ProjectEditView({
  254. model: app.project
  255. }));
  256. app.dashboard.fetch();
  257. },
  258. showProjectEdit: function(pid){
  259. this.removeHomeLayout();
  260. var app = window.hackdash.app;
  261. app.type = "project";
  262. app.dashboard = new Dashboard();
  263. app.project = new Project({ _id: pid });
  264. app.header.show(new Header({
  265. model: app.dashboard
  266. }));
  267. app.main.show(new ProjectEditView({
  268. model: app.project
  269. }));
  270. app.dashboard.fetch();
  271. app.project.fetch();
  272. },
  273. showProjectFull: function(pid){
  274. this.removeHomeLayout();
  275. var app = window.hackdash.app;
  276. app.type = "project";
  277. app.dashboard = new Dashboard();
  278. app.project = new Project({ _id: pid });
  279. app.header.show(new Header({
  280. model: app.dashboard
  281. }));
  282. app.main.show(new ProjectFullView({
  283. model: app.project
  284. }));
  285. app.dashboard.fetch();
  286. app.project.fetch();
  287. },
  288. showCollections: function() {
  289. this.removeHomeLayout();
  290. var app = window.hackdash.app;
  291. app.type = "collections";
  292. app.collections = new Collections();
  293. app.header.show(new Header({
  294. collection: app.collections
  295. }));
  296. app.main.show(new CollectionsView({
  297. collection: app.collections
  298. }));
  299. app.collections.fetch(this.getSearchQuery());
  300. },
  301. showCollection: function(collectionId) {
  302. this.removeHomeLayout();
  303. var app = window.hackdash.app;
  304. app.type = "collection";
  305. app.collection = new Collection({ _id: collectionId });
  306. app.collection
  307. .fetch({ parse: true })
  308. .done(function(){
  309. app.header.show(new Header({
  310. model: app.collection
  311. }));
  312. app.main.show(new DashboardsView({
  313. hideAdd: true,
  314. collection: app.collection.get("dashboards")
  315. }));
  316. });
  317. },
  318. showProfile: function(userId) {
  319. this.removeHomeLayout();
  320. var app = window.hackdash.app;
  321. app.type = "profile";
  322. if (!userId){
  323. if (hackdash.user){
  324. userId = hackdash.user._id;
  325. }
  326. else {
  327. window.location = "/";
  328. }
  329. }
  330. app.profile = new Profile({
  331. _id: userId
  332. });
  333. app.profile.fetch({ parse: true });
  334. app.header.show(new Header());
  335. app.main.show(new ProfileView({
  336. model: app.profile
  337. }));
  338. },
  339. showDashboards: function() {
  340. this.removeHomeLayout();
  341. var app = window.hackdash.app;
  342. app.type = "dashboards";
  343. app.dashboards = new Dashboards();
  344. app.collections = new Collections();
  345. app.header.show(new Header({
  346. collection: app.dashboards
  347. }));
  348. app.main.show(new DashboardsView({
  349. collection: app.dashboards
  350. }));
  351. app.collections.getMines();
  352. app.dashboards.fetch(this.getSearchQuery());
  353. }
  354. });
  355. },
  356. "Initializer.js": function (exports, module, require) {
  357. module.exports = function(){
  358. window.hackdash = window.hackdash || {};
  359. window.hackdash.getQueryVariable = function(variable){
  360. var query = window.location.search.substring(1);
  361. var vars = query.split("&");
  362. for (var i=0;i<vars.length;i++) {
  363. var pair = vars[i].split("=");
  364. if(pair[0] === variable){return decodeURI(pair[1]);}
  365. }
  366. return(false);
  367. };
  368. if ($.fn.editable){
  369. // Set global mode for InlineEditor (X-Editable)
  370. $.fn.editable.defaults.mode = 'inline';
  371. }
  372. // Init Helpers
  373. require('./helpers/handlebars');
  374. require('./helpers/backboneOverrides');
  375. Placeholders.init({ live: true, hideOnFocus: true });
  376. window.hackdash.apiURL = "/api/v2";
  377. window.hackdash.startApp = require('./HackdashApp');
  378. };
  379. },
  380. "helpers": {
  381. "backboneOverrides.js": function (exports, module, require) {
  382. /*
  383. * Backbone Global Overrides
  384. *
  385. */
  386. // Override Backbone.sync to use the PUT HTTP method for PATCH requests
  387. // when doing Model#save({...}, { patch: true });
  388. var originalSync = Backbone.sync;
  389. Backbone.sync = function(method, model, options) {
  390. if (method === 'patch') {
  391. options.type = 'PUT';
  392. }
  393. return originalSync(method, model, options);
  394. };
  395. },
  396. "handlebars.js": function (exports, module, require) {
  397. /**
  398. * HELPER: Handlebars Template Helpers
  399. *
  400. */
  401. Handlebars.registerHelper('embedCode', function() {
  402. var embedUrl = window.location.protocol + "//" + window.location.host;
  403. var template = _.template('<iframe src="<%= embedUrl %>" width="100%" height="500" frameborder="0" allowtransparency="true" title="Hackdash"></iframe>');
  404. return template({
  405. embedUrl: embedUrl
  406. });
  407. });
  408. Handlebars.registerHelper('firstUpper', function(text) {
  409. return text.charAt(0).toUpperCase() + text.slice(1);
  410. });
  411. Handlebars.registerHelper('markdown', function(md) {
  412. return markdown.toHTML(md);
  413. });
  414. Handlebars.registerHelper('disqus_shortname', function() {
  415. return window.hackdash.disqus_shortname;
  416. });
  417. Handlebars.registerHelper('user', function(prop) {
  418. if (window.hackdash.user){
  419. return window.hackdash.user[prop];
  420. }
  421. });
  422. Handlebars.registerHelper('isLoggedIn', function(options) {
  423. if (window.hackdash.user){
  424. return options.fn(this);
  425. } else {
  426. return options.inverse(this);
  427. }
  428. });
  429. Handlebars.registerHelper('isDashboardView', function(options) {
  430. if (window.hackdash.app.type === "dashboard"){
  431. return options.fn(this);
  432. } else {
  433. return options.inverse(this);
  434. }
  435. });
  436. Handlebars.registerHelper('isSearchView', function(options) {
  437. if (window.hackdash.app.type === "isearch"){
  438. return options.fn(this);
  439. } else {
  440. return options.inverse(this);
  441. }
  442. });
  443. Handlebars.registerHelper('timeAgo', function(date) {
  444. if (date && moment(date).isValid()) {
  445. return moment(date).fromNow();
  446. }
  447. return "-";
  448. });
  449. Handlebars.registerHelper('formatDate', function(date) {
  450. if (date && moment(date).isValid()) {
  451. return moment(date).format("DD/MM/YYYY HH:mm");
  452. }
  453. return "-";
  454. });
  455. Handlebars.registerHelper('formatDateText', function(date) {
  456. if (date && moment(date).isValid()) {
  457. return moment(date).format("DD MMM YYYY, HH:mm");
  458. }
  459. return "";
  460. });
  461. Handlebars.registerHelper('formatDateTime', function(date) {
  462. if (date && moment(date).isValid()) {
  463. return moment(date).format("HH:mm");
  464. }
  465. return "";
  466. });
  467. Handlebars.registerHelper('timeFromSeconds', function(seconds) {
  468. function format(val){
  469. return (val < 10) ? "0" + val : val;
  470. }
  471. if (seconds && seconds > 0){
  472. var t = moment.duration(seconds * 1000),
  473. h = format(t.hours()),
  474. m = format(t.minutes()),
  475. s = format(t.seconds());
  476. return h + ":" + m + ":" + s;
  477. }
  478. return "-";
  479. });
  480. }
  481. },
  482. "index.js": function (exports, module, require) {
  483. jQuery(function() {
  484. require('./Initializer')();
  485. });
  486. },
  487. "models": {
  488. "Admins.js": function (exports, module, require) {
  489. /**
  490. * Collection: Administrators of a Dashboard
  491. *
  492. */
  493. var
  494. Users = require('./Users'),
  495. User = require('./User');
  496. module.exports = Users.extend({
  497. model: User,
  498. idAttribute: "_id",
  499. url: function(){
  500. return hackdash.apiURL + '/admins';
  501. },
  502. addAdmin: function(userId){
  503. $.ajax({
  504. url: this.url() + '/' + userId,
  505. type: "POST",
  506. context: this
  507. }).done(function(user){
  508. this.add(user);
  509. });
  510. },
  511. });
  512. },
  513. "Collection.js": function (exports, module, require) {
  514. /**
  515. * MODEL: Collection (a group of Dashboards)
  516. *
  517. */
  518. var Dashboards = require('./Dashboards');
  519. module.exports = Backbone.Model.extend({
  520. idAttribute: "_id",
  521. urlRoot: function(){
  522. return hackdash.apiURL + '/collections';
  523. },
  524. parse: function(response){
  525. response.dashboards = new Dashboards(response.dashboards || []);
  526. return response;
  527. },
  528. addDashboard: function(dashId){
  529. $.ajax({
  530. url: this.url() + '/dashboards/' + dashId,
  531. type: "POST",
  532. context: this
  533. });
  534. this.get("dashboards").add({ _id: dashId });
  535. },
  536. removeDashboard: function(dashId){
  537. $.ajax({
  538. url: this.url() + '/dashboards/' + dashId,
  539. type: "DELETE",
  540. context: this
  541. });
  542. var result = this.get("dashboards").where({ _id: dashId});
  543. if (result.length > 0){
  544. this.get("dashboards").remove(result[0]);
  545. }
  546. },
  547. });
  548. },
  549. "Collections.js": function (exports, module, require) {
  550. /**
  551. * Collection: Collections (group of Dashboards)
  552. *
  553. */
  554. var
  555. Collection = require('./Collection');
  556. module.exports = Backbone.Collection.extend({
  557. model: Collection,
  558. idAttribute: "_id",
  559. url: function(){
  560. return hackdash.apiURL + '/collections';
  561. },
  562. getMines: function(){
  563. $.ajax({
  564. url: this.url() + '/own',
  565. context: this
  566. }).done(function(collections){
  567. this.reset(collections, { parse: true });
  568. });
  569. }
  570. });
  571. },
  572. "Dashboard.js": function (exports, module, require) {
  573. /**
  574. * MODEL: Project
  575. *
  576. */
  577. var Admins = require("./Admins");
  578. module.exports = Backbone.Model.extend({
  579. defaults: {
  580. admins: null
  581. },
  582. url: function(){
  583. return hackdash.apiURL + "/";
  584. },
  585. idAttribute: "_id",
  586. initialize: function(){
  587. this.set("admins", new Admins());
  588. },
  589. });
  590. },
  591. "Dashboards.js": function (exports, module, require) {
  592. /**
  593. * MODEL: Dashboards
  594. *
  595. */
  596. module.exports = Backbone.Collection.extend({
  597. url: function(){
  598. return hackdash.apiURL + "/dashboards";
  599. },
  600. idAttribute: "_id",
  601. });
  602. },
  603. "Profile.js": function (exports, module, require) {
  604. /**
  605. * MODEL: User
  606. *
  607. */
  608. var Projects = require("./Projects");
  609. module.exports = Backbone.Model.extend({
  610. idAttribute: "_id",
  611. defaults: {
  612. collections: new Backbone.Collection(),
  613. dashboards: new Backbone.Collection(),
  614. projects: new Projects(),
  615. contributions: new Projects(),
  616. likes: new Projects()
  617. },
  618. urlRoot: function(){
  619. return hackdash.apiURL + '/profiles';
  620. },
  621. parse: function(response){
  622. this.get("collections").reset(response.collections);
  623. this.get("dashboards").reset(
  624. _.map(response.admin_in, function(dash){ return { title: dash }; })
  625. );
  626. this.get("projects").reset(response.projects);
  627. this.get("contributions").reset(response.contributions);
  628. this.get("likes").reset(response.likes);
  629. return response;
  630. }
  631. });
  632. },
  633. "Project.js": function (exports, module, require) {
  634. /**
  635. * MODEL: Project
  636. *
  637. */
  638. module.exports = Backbone.Model.extend({
  639. idAttribute: "_id",
  640. defaults: {
  641. active: true
  642. },
  643. urlRoot: function(){
  644. return hackdash.apiURL + '/projects';
  645. },
  646. doAction: function(type, res, done){
  647. $.ajax({
  648. url: this.url() + '/' + res,
  649. type: type,
  650. context: this
  651. }).done(done);
  652. },
  653. updateList: function(type, add){
  654. var list = this.get(type);
  655. var uid = hackdash.user._id;
  656. function exists(){
  657. return _.find(list, function(usr){
  658. return (usr._id === uid);
  659. }) ? true : false;
  660. }
  661. if (add && !exists()){
  662. list.push(hackdash.user);
  663. }
  664. else if (!add && exists()){
  665. var idx = 0;
  666. _.each(list, function(usr, i){
  667. if (usr._id === uid) {
  668. idx = i;
  669. }
  670. });
  671. list.splice(idx, 1);
  672. }
  673. this.set(type, list);
  674. this.trigger("change");
  675. },
  676. join: function(){
  677. this.doAction("POST", "contributors", function(){
  678. this.updateList("contributors", true);
  679. });
  680. },
  681. leave: function(){
  682. this.doAction("DELETE", "contributors", function(){
  683. this.updateList("contributors", false);
  684. });
  685. },
  686. follow: function(){
  687. this.doAction("POST", "followers", function(){
  688. this.updateList("followers", true);
  689. });
  690. },
  691. unfollow: function(){
  692. this.doAction("DELETE", "followers", function(){
  693. this.updateList("followers", false);
  694. });
  695. },
  696. });
  697. },
  698. "Projects.js": function (exports, module, require) {
  699. /**
  700. * Collection: Projectss
  701. *
  702. */
  703. var
  704. Project = require('./Project');
  705. var Projects = module.exports = Backbone.Collection.extend({
  706. model: Project,
  707. idAttribute: "_id",
  708. url: function(){
  709. return hackdash.apiURL + '/projects';
  710. },
  711. parse: function(response){
  712. if (hackdash.app.type !== "dashboard"){
  713. //it is not a dashboard so all projects active
  714. return response;
  715. }
  716. var dashboard = hackdash.app.dashboard;
  717. var showcase = (dashboard && dashboard.get("showcase")) || [];
  718. if (showcase.length === 0){
  719. //no showcase defined: all projects are active
  720. return response;
  721. }
  722. // set active property of a project from showcase mode
  723. // (only projects at showcase array are active ones)
  724. _.each(response, function(project){
  725. if (showcase.indexOf(project._id) >= 0){
  726. project.active = true;
  727. }
  728. else {
  729. project.active = false;
  730. }
  731. });
  732. return response;
  733. },
  734. buildShowcase: function(showcase){
  735. _.each(showcase, function(id, i){
  736. var found = this.where({ _id: id, active: true });
  737. if (found.length > 0){
  738. found[0].set("showcase", i);
  739. }
  740. }, this);
  741. this.trigger("reset");
  742. },
  743. getActives: function(){
  744. return new Projects(
  745. this.filter(function(project){
  746. return project.get("active");
  747. })
  748. );
  749. },
  750. getInactives: function(){
  751. return new Projects(
  752. this.filter(function(project){
  753. return !project.get("active");
  754. })
  755. );
  756. }
  757. });
  758. },
  759. "User.js": function (exports, module, require) {
  760. /**
  761. * MODEL: User
  762. *
  763. */
  764. module.exports = Backbone.Model.extend({
  765. idAttribute: "_id",
  766. });
  767. },
  768. "Users.js": function (exports, module, require) {
  769. /**
  770. * Collection: Users
  771. *
  772. */
  773. var
  774. User = require('./User');
  775. module.exports = Backbone.Collection.extend({
  776. model: User,
  777. idAttribute: "_id",
  778. url: function(){
  779. return hackdash.apiURL + '/users';
  780. },
  781. });
  782. }
  783. },
  784. "views": {
  785. "Collection": {
  786. "Collection.js": function (exports, module, require) {
  787. /**
  788. * VIEW: Collections
  789. *
  790. */
  791. var Collection = require('./index');
  792. module.exports = Backbone.Marionette.CollectionView.extend({
  793. //--------------------------------------
  794. //+ PUBLIC PROPERTIES / CONSTANTS
  795. //--------------------------------------
  796. id: "collections",
  797. className: "row collections",
  798. itemView: Collection,
  799. collectionEvents: {
  800. "remove": "render"
  801. },
  802. //--------------------------------------
  803. //+ INHERITED / OVERRIDES
  804. //--------------------------------------
  805. onRender: function(){
  806. var self = this;
  807. _.defer(function(){
  808. self.updateIsotope();
  809. });
  810. },
  811. //--------------------------------------
  812. //+ PUBLIC METHODS / GETTERS / SETTERS
  813. //--------------------------------------
  814. //--------------------------------------
  815. //+ EVENT HANDLERS
  816. //--------------------------------------
  817. //--------------------------------------
  818. //+ PRIVATE AND PROTECTED METHODS
  819. //--------------------------------------
  820. isotopeInitialized: false,
  821. updateIsotope: function(){
  822. var $collections = this.$el;
  823. if (this.isotopeInitialized){
  824. $collections.isotope("destroy");
  825. }
  826. $collections.isotope({
  827. itemSelector: ".collection"
  828. , animationEngine: "jquery"
  829. , resizable: true
  830. });
  831. this.isotopeInitialized = true;
  832. }
  833. });
  834. },
  835. "List.js": function (exports, module, require) {
  836. /**
  837. * VIEW: User Collections
  838. *
  839. */
  840. var template = require('./templates/list.hbs')
  841. , Collection = require('./ListItem');
  842. module.exports = Backbone.Marionette.CompositeView.extend({
  843. //--------------------------------------
  844. //+ PUBLIC PROPERTIES / CONSTANTS
  845. //--------------------------------------
  846. className: "modal my-collections-modal",
  847. template: template,
  848. itemView: Collection,
  849. itemViewContainer: ".collections",
  850. ui: {
  851. "title": "input[name=title]",
  852. "description": "input[name=description]",
  853. "events": ".events"
  854. },
  855. events: {
  856. "click .close": "close",
  857. "click .btn-add": "add"
  858. },
  859. itemViewOptions: function(){
  860. return {
  861. dashboardId: this.model.get("_id")
  862. };
  863. },
  864. //--------------------------------------
  865. //+ INHERITED / OVERRIDES
  866. //--------------------------------------
  867. //--------------------------------------
  868. //+ PUBLIC METHODS / GETTERS / SETTERS
  869. //--------------------------------------
  870. addedCollection: function(title){
  871. this.showAction("add", title);
  872. },
  873. removedCollection: function(title){
  874. this.showAction("remove", title);
  875. },
  876. //--------------------------------------
  877. //+ EVENT HANDLERS
  878. //--------------------------------------
  879. add: function(){
  880. if (this.ui.title.val()){
  881. this.collection.create({
  882. title: this.ui.title.val(),
  883. description: this.ui.description.val()
  884. }, { wait: true });
  885. this.ui.title.val("");
  886. this.ui.description.val("");
  887. }
  888. },
  889. //--------------------------------------
  890. //+ PRIVATE AND PROTECTED METHODS
  891. //--------------------------------------
  892. timer: null,
  893. showAction: function(type, title){
  894. var msg = (type === 'add' ? ' has been added to ' : ' has been removed from ');
  895. var dash = this.model.get("domain");
  896. this.ui.events.empty();
  897. window.clearTimeout(this.timer);
  898. var li = $('<li><span>' + dash + '</span>' + msg + '<span>' + title + '</span></li>');
  899. li.appendTo(this.ui.events);
  900. var self = this;
  901. this.timer = window.setTimeout(function(){
  902. self.ui.events.empty();
  903. }, 50000);
  904. }
  905. });
  906. },
  907. "ListItem.js": function (exports, module, require) {
  908. /**
  909. * VIEW: A User Collection
  910. *
  911. */
  912. var template = require('./templates/listItem.hbs');
  913. module.exports = Backbone.Marionette.ItemView.extend({
  914. //--------------------------------------
  915. //+ PUBLIC PROPERTIES / CONSTANTS
  916. //--------------------------------------
  917. tagName: "li",
  918. template: template,
  919. //--------------------------------------
  920. //+ INHERITED / OVERRIDES
  921. //--------------------------------------
  922. initialize: function(options){
  923. this.dashboardId = options.dashboardId;
  924. },
  925. onRender: function(){
  926. if (this.hasDashboard()){
  927. this.$el.addClass('active');
  928. }
  929. else {
  930. this.$el.removeClass('active');
  931. }
  932. this.$el.off("click").on("click", this.toggleDashboard.bind(this));
  933. },
  934. serializeData: function(){
  935. return _.extend({
  936. hasDash: this.hasDashboard()
  937. }, this.model.toJSON());
  938. },
  939. //--------------------------------------
  940. //+ PUBLIC METHODS / GETTERS / SETTERS
  941. //--------------------------------------
  942. //--------------------------------------
  943. //+ EVENT HANDLERS
  944. //--------------------------------------
  945. viewCollection: function(){
  946. this.$el.off("click");
  947. hackdash.app.modals.close();
  948. },
  949. toggleDashboard: function(e){
  950. if ($(e.target).hasClass("view-collection")){
  951. this.viewCollection();
  952. return;
  953. }
  954. if (this.hasDashboard()){
  955. this.model.removeDashboard(this.dashboardId);
  956. hackdash.app.modals.currentView.removedCollection(this.model.get("title"));
  957. }
  958. else {
  959. this.model.addDashboard(this.dashboardId);
  960. hackdash.app.modals.currentView.addedCollection(this.model.get("title"));
  961. }
  962. this.render();
  963. },
  964. //--------------------------------------
  965. //+ PRIVATE AND PROTECTED METHODS
  966. //--------------------------------------
  967. hasDashboard: function(){
  968. return this.model.get("dashboards").where({ _id: this.dashboardId}).length > 0;
  969. }
  970. });
  971. },
  972. "index.js": function (exports, module, require) {
  973. /**
  974. * VIEW: Collection
  975. *
  976. */
  977. var template = require('./templates/collection.hbs');
  978. module.exports = Backbone.Marionette.ItemView.extend({
  979. //--------------------------------------
  980. //+ PUBLIC PROPERTIES / CONSTANTS
  981. //--------------------------------------
  982. id: function(){
  983. return this.model.get("_id");
  984. },
  985. className: "collection span4",
  986. template: template,
  987. //--------------------------------------
  988. //+ INHERITED / OVERRIDES
  989. //--------------------------------------
  990. onRender: function(){
  991. var url = "http://" + hackdash.baseURL + "/collections/" + this.model.get("_id");
  992. this.$el.on("click", function(e){
  993. if (!$(e.target).hasClass("add")){
  994. window.location = url;
  995. }
  996. });
  997. },
  998. //--------------------------------------
  999. //+ PUBLIC METHODS / GETTERS / SETTERS
  1000. //--------------------------------------
  1001. //--------------------------------------
  1002. //+ EVENT HANDLERS
  1003. //--------------------------------------
  1004. //--------------------------------------
  1005. //+ PRIVATE AND PROTECTED METHODS
  1006. //--------------------------------------
  1007. });
  1008. },
  1009. "templates": {
  1010. "collection.hbs.js": function (exports, module, require) {
  1011. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1012. this.compilerInfo = [4,'>= 1.0.0'];
  1013. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1014. var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
  1015. buffer += "<div class=\"well\">\n <div class=\"well-content\">\n <h4>";
  1016. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1017. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1018. buffer += escapeExpression(stack1)
  1019. + "</h4>\n ";
  1020. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1021. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1022. buffer += escapeExpression(stack1)
  1023. + "\n </div>\n <div class=\"row-fluid footer-box\">\n <div class=\"aging activity created_at\">\n <i rel=\"tooltip\" title=\"";
  1024. options = {hash:{},data:data};
  1025. buffer += escapeExpression(((stack1 = helpers.timeAgo || depth0.timeAgo),stack1 ? stack1.call(depth0, depth0.created_at, options) : helperMissing.call(depth0, "timeAgo", depth0.created_at, options)))
  1026. + "\" class=\"tooltips icon-time icon-1\"></i>\n </div>\n </div>\n</div>\n";
  1027. return buffer;
  1028. })
  1029. ;
  1030. },
  1031. "list.hbs.js": function (exports, module, require) {
  1032. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1033. this.compilerInfo = [4,'>= 1.0.0'];
  1034. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1035. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  1036. buffer += "<div class=\"modal-header\">\n <button type=\"button\" data-dismiss=\"modal\" aria-hidden=\"true\" class=\"close\">×</button>\n <h3>My Collections: adding ";
  1037. if (stack1 = helpers.domain) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1038. else { stack1 = depth0.domain; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1039. buffer += escapeExpression(stack1)
  1040. + "</h3>\n <ul class=\"events\"></ul>\n</div>\n<div class=\"modal-body\">\n <ul class=\"collections\"></ul>\n</div>\n<div class=\"modal-footer\">\n <div class=\"row-fluid\">\n <div class=\"span12\">\n <div class=\"span10\">\n <input type=\"text\" name=\"title\" placeholder=\"Enter Title\" class=\"input-medium pull-left\" style=\"margin-right: 10px;\">\n <input type=\"text\" name=\"description\" placeholder=\"Enter Description\" class=\"input-medium pull-left\">\n <input type=\"button\" class=\"btn primary btn-success pull-left btn-add\" value=\"Add\">\n </div>\n <div class=\"span2\">\n <input type=\"button\" class=\"btn primary pull-right\" data-dismiss=\"modal\" value=\"Close\">\n </div>\n </div>\n </div>\n</div>";
  1041. return buffer;
  1042. })
  1043. ;
  1044. },
  1045. "listItem.hbs.js": function (exports, module, require) {
  1046. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1047. this.compilerInfo = [4,'>= 1.0.0'];
  1048. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1049. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  1050. buffer += "<label class=\"pull-left\">\n ";
  1051. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1052. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1053. buffer += escapeExpression(stack1)
  1054. + "\n</label>\n\n<a class=\"pull-right view-collection\" href=\"/collections/";
  1055. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1056. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1057. buffer += escapeExpression(stack1)
  1058. + "\">View</a>";
  1059. return buffer;
  1060. })
  1061. ;
  1062. }
  1063. }
  1064. },
  1065. "Dashboard": {
  1066. "Collection.js": function (exports, module, require) {
  1067. /**
  1068. * VIEW: Dashboards
  1069. *
  1070. */
  1071. var Dashboard = require('./index');
  1072. module.exports = Backbone.Marionette.CollectionView.extend({
  1073. //--------------------------------------
  1074. //+ PUBLIC PROPERTIES / CONSTANTS
  1075. //--------------------------------------
  1076. id: "dashboards",
  1077. className: "row dashboards",
  1078. itemView: Dashboard,
  1079. itemViewOptions: function(){
  1080. return {
  1081. hideAdd: this.hideAdd
  1082. };
  1083. },
  1084. //--------------------------------------
  1085. //+ INHERITED / OVERRIDES
  1086. //--------------------------------------
  1087. initialize: function(options){
  1088. this.hideAdd = (options && options.hideAdd) || false;
  1089. },
  1090. onRender: function(){
  1091. var self = this;
  1092. _.defer(function(){
  1093. self.updateIsotope();
  1094. });
  1095. },
  1096. //--------------------------------------
  1097. //+ PUBLIC METHODS / GETTERS / SETTERS
  1098. //--------------------------------------
  1099. //--------------------------------------
  1100. //+ EVENT HANDLERS
  1101. //--------------------------------------
  1102. //--------------------------------------
  1103. //+ PRIVATE AND PROTECTED METHODS
  1104. //--------------------------------------
  1105. isotopeInitialized: false,
  1106. updateIsotope: function(){
  1107. var $dashboards = this.$el;
  1108. if (this.isotopeInitialized){
  1109. $dashboards.isotope("destroy");
  1110. }
  1111. $dashboards.isotope({
  1112. itemSelector: ".dashboard"
  1113. , animationEngine: "jquery"
  1114. , resizable: true
  1115. });
  1116. this.isotopeInitialized = true;
  1117. }
  1118. });
  1119. },
  1120. "index.js": function (exports, module, require) {
  1121. /**
  1122. * VIEW: Dashboard
  1123. *
  1124. */
  1125. var template = require('./templates/dashboard.hbs')
  1126. , UserCollectionsView = require('../Collection/List');
  1127. module.exports = Backbone.Marionette.ItemView.extend({
  1128. //--------------------------------------
  1129. //+ PUBLIC PROPERTIES / CONSTANTS
  1130. //--------------------------------------
  1131. id: function(){
  1132. return this.model.get("_id");
  1133. },
  1134. className: "dashboard span4",
  1135. template: template,
  1136. events: {
  1137. "click .demo a": "stopPropagation",
  1138. "click .add a": "onAddToCollection"
  1139. },
  1140. //--------------------------------------
  1141. //+ INHERITED / OVERRIDES
  1142. //--------------------------------------
  1143. initialize: function(options){
  1144. this.hideAdd = (options && options.hideAdd) || false;
  1145. },
  1146. onRender: function(){
  1147. this.$el
  1148. .attr({
  1149. "title": this.model.get("status")
  1150. , "data-name": this.model.get("domain")
  1151. , "data-date": this.model.get("created_at")
  1152. })
  1153. .tooltip({});
  1154. $('.tooltips', this.$el).tooltip({});
  1155. var url = "http://" + this.model.get("domain") + "." + hackdash.baseURL;
  1156. this.$el.on("click", function(e){
  1157. if (!$(e.target).hasClass("add")){
  1158. window.location = url;
  1159. }
  1160. });
  1161. },
  1162. serializeData: function(){
  1163. return _.extend({
  1164. hideAdd: this.hideAdd
  1165. }, this.model.toJSON());
  1166. },
  1167. //--------------------------------------
  1168. //+ PUBLIC METHODS / GETTERS / SETTERS
  1169. //--------------------------------------
  1170. //--------------------------------------
  1171. //+ EVENT HANDLERS
  1172. //--------------------------------------
  1173. stopPropagation: function(e){
  1174. e.stopPropagation();
  1175. },
  1176. onAddToCollection: function(){
  1177. hackdash.app.modals.show(new UserCollectionsView({
  1178. model: this.model,
  1179. collection: hackdash.app.collections
  1180. }));
  1181. },
  1182. //--------------------------------------
  1183. //+ PRIVATE AND PROTECTED METHODS
  1184. //--------------------------------------
  1185. });
  1186. },
  1187. "templates": {
  1188. "dashboard.hbs.js": function (exports, module, require) {
  1189. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1190. this.compilerInfo = [4,'>= 1.0.0'];
  1191. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1192. var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing, helperMissing=helpers.helperMissing;
  1193. function program1(depth0,data) {
  1194. var buffer = "", stack1;
  1195. buffer += "\n <div class=\"pull-right demo\">\n <a href=\"";
  1196. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1197. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1198. buffer += escapeExpression(stack1)
  1199. + "\" target=\"_blank\" class=\"btn btn-link\">Site</a>\n </div>\n ";
  1200. return buffer;
  1201. }
  1202. function program3(depth0,data) {
  1203. var buffer = "", stack1, options;
  1204. buffer += "\n ";
  1205. options = {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data};
  1206. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  1207. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1208. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  1209. if(stack1 || stack1 === 0) { buffer += stack1; }
  1210. buffer += "\n ";
  1211. return buffer;
  1212. }
  1213. function program4(depth0,data) {
  1214. return "\n <div class=\"pull-right add\">\n <a class=\"btn btn-link add\">Add to Collections</a>\n </div>\n ";
  1215. }
  1216. buffer += "<div class=\"well\">\n <div class=\"well-content\">\n <h4>";
  1217. if (stack1 = helpers.domain) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1218. else { stack1 = depth0.domain; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1219. buffer += escapeExpression(stack1)
  1220. + "</h4>\n <h4>";
  1221. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1222. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1223. buffer += escapeExpression(stack1)
  1224. + "</h4>\n ";
  1225. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1226. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1227. buffer += escapeExpression(stack1)
  1228. + "\n <br/>\n </div>\n <div class=\"row-fluid footer-box\">\n <div class=\"aging activity created_at\">\n <i rel=\"tooltip\" title=\"";
  1229. options = {hash:{},data:data};
  1230. buffer += escapeExpression(((stack1 = helpers.timeAgo || depth0.timeAgo),stack1 ? stack1.call(depth0, depth0.created_at, options) : helperMissing.call(depth0, "timeAgo", depth0.created_at, options)))
  1231. + "\" class=\"tooltips icon-time icon-1\"></i>\n </div>\n\n ";
  1232. stack2 = helpers['if'].call(depth0, depth0.link, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  1233. if(stack2 || stack2 === 0) { buffer += stack2; }
  1234. buffer += "\n\n ";
  1235. stack2 = helpers.unless.call(depth0, depth0.hideAdd, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
  1236. if(stack2 || stack2 === 0) { buffer += stack2; }
  1237. buffer += "\n \n </div>\n</div>\n";
  1238. return buffer;
  1239. })
  1240. ;
  1241. }
  1242. }
  1243. },
  1244. "Footer": {
  1245. "AddAdmin.js": function (exports, module, require) {
  1246. /**
  1247. * VIEW: A User Collection
  1248. *
  1249. */
  1250. var template = require('./templates/addAdmin.hbs')
  1251. , Users = require('../../models/Users');
  1252. module.exports = Backbone.Marionette.ItemView.extend({
  1253. //--------------------------------------
  1254. //+ PUBLIC PROPERTIES / CONSTANTS
  1255. //--------------------------------------
  1256. className: "modal add-admins-modal",
  1257. template: template,
  1258. ui: {
  1259. "txtUser": "#txtUser",
  1260. "addOn": ".add-on"
  1261. },
  1262. events: {
  1263. "click #save": "saveAdmin"
  1264. },
  1265. //--------------------------------------
  1266. //+ INHERITED / OVERRIDES
  1267. //--------------------------------------
  1268. initialize: function(){
  1269. this.users = new Users();
  1270. },
  1271. onRender: function(){
  1272. this.initTypehead();
  1273. },
  1274. //--------------------------------------
  1275. //+ PUBLIC METHODS / GETTERS / SETTERS
  1276. //--------------------------------------
  1277. //--------------------------------------
  1278. //+ EVENT HANDLERS
  1279. //--------------------------------------
  1280. saveAdmin: function(){
  1281. var selected = this.users.find(function(user){
  1282. return user.get('selected');
  1283. });
  1284. if (selected){
  1285. this.collection.addAdmin(selected.get("_id"));
  1286. this.close();
  1287. }
  1288. },
  1289. //--------------------------------------
  1290. //+ PRIVATE AND PROTECTED METHODS
  1291. //--------------------------------------
  1292. initTypehead: function(){
  1293. var users = this.users,
  1294. self = this,
  1295. MIN_CHARS_FOR_SERVER_SEARCH = 3;
  1296. this.ui.txtUser.typeahead({
  1297. source: function(query, process){
  1298. if (query.length >= MIN_CHARS_FOR_SERVER_SEARCH){
  1299. users.fetch({
  1300. data: $.param({ q: query }),
  1301. success: function(){
  1302. var usersIds = users.map(function(user){ return user.get('_id').toString(); });
  1303. process(usersIds);
  1304. }
  1305. });
  1306. }
  1307. else {
  1308. process([]);
  1309. }
  1310. },
  1311. matcher: function(){
  1312. return true;
  1313. },
  1314. highlighter: function(uid){
  1315. var user = users.get(uid),
  1316. template = _.template('<img class="avatar" src="<%= picture %>" /> <%= name %>');
  1317. return template({
  1318. picture: user.get('picture'),
  1319. name: user.get('name')
  1320. });
  1321. },
  1322. updater: function(uid) {
  1323. var selectedUser = users.get(uid);
  1324. selectedUser.set('selected', true);
  1325. self.ui.addOn.empty().append('<img class="avatar" src="' + selectedUser.get("picture") + '" />');
  1326. return selectedUser.get('name');
  1327. }
  1328. });
  1329. }
  1330. });
  1331. },
  1332. "Embed.js": function (exports, module, require) {
  1333. /**
  1334. * VIEW: A Embed code
  1335. *
  1336. */
  1337. var template = require('./templates/embed.hbs');
  1338. module.exports = Backbone.Marionette.ItemView.extend({
  1339. //--------------------------------------
  1340. //+ PUBLIC PROPERTIES / CONSTANTS
  1341. //--------------------------------------
  1342. className: "modal",
  1343. template: template,
  1344. ui: {
  1345. embedCode: "textarea"
  1346. },
  1347. //--------------------------------------
  1348. //+ INHERITED / OVERRIDES
  1349. //--------------------------------------
  1350. onRender: function(){
  1351. var self = this;
  1352. _.defer(function(){
  1353. self.ui.embedCode.select();
  1354. });
  1355. },
  1356. //--------------------------------------
  1357. //+ PUBLIC METHODS / GETTERS / SETTERS
  1358. //--------------------------------------
  1359. //--------------------------------------
  1360. //+ EVENT HANDLERS
  1361. //--------------------------------------
  1362. //--------------------------------------
  1363. //+ PRIVATE AND PROTECTED METHODS
  1364. //--------------------------------------
  1365. });
  1366. },
  1367. "User.js": function (exports, module, require) {
  1368. /**
  1369. * VIEW: User
  1370. *
  1371. */
  1372. var template = require('./templates/user.hbs');
  1373. module.exports = Backbone.Marionette.ItemView.extend({
  1374. //--------------------------------------
  1375. //+ PUBLIC PROPERTIES / CONSTANTS
  1376. //--------------------------------------
  1377. tagName: "li",
  1378. template: template,
  1379. //--------------------------------------
  1380. //+ INHERITED / OVERRIDES
  1381. //--------------------------------------
  1382. onRender: function(){
  1383. $('.tooltips', this.$el).tooltip({});
  1384. }
  1385. //--------------------------------------
  1386. //+ PUBLIC METHODS / GETTERS / SETTERS
  1387. //--------------------------------------
  1388. //--------------------------------------
  1389. //+ EVENT HANDLERS
  1390. //--------------------------------------
  1391. //--------------------------------------
  1392. //+ PRIVATE AND PROTECTED METHODS
  1393. //--------------------------------------
  1394. });
  1395. },
  1396. "Users.js": function (exports, module, require) {
  1397. /**
  1398. * VIEW: Collection of Users
  1399. *
  1400. */
  1401. var template = require('./templates/users.hbs')
  1402. , User = require('./User')
  1403. , AddAdmin = require('./AddAdmin');
  1404. module.exports = Backbone.Marionette.CompositeView.extend({
  1405. //--------------------------------------
  1406. //+ PUBLIC PROPERTIES / CONSTANTS
  1407. //--------------------------------------
  1408. template: template,
  1409. tagName: "div",
  1410. itemViewContainer: "ul",
  1411. itemView: User,
  1412. events: {
  1413. "click a.add-admins": "showAddAdmins"
  1414. },
  1415. templateHelpers: {
  1416. isAdmin: function(){
  1417. var user = hackdash.user;
  1418. return user && user.admin_in.indexOf(this.domain) >= 0 || false;
  1419. }
  1420. },
  1421. //--------------------------------------
  1422. //+ INHERITED / OVERRIDES
  1423. //--------------------------------------
  1424. //--------------------------------------
  1425. //+ PUBLIC METHODS / GETTERS / SETTERS
  1426. //--------------------------------------
  1427. //--------------------------------------
  1428. //+ EVENT HANDLERS
  1429. //--------------------------------------
  1430. showAddAdmins: function(){
  1431. hackdash.app.modals.show(new AddAdmin({
  1432. collection: this.collection
  1433. }));
  1434. }
  1435. //--------------------------------------
  1436. //+ PRIVATE AND PROTECTED METHODS
  1437. //--------------------------------------
  1438. });
  1439. },
  1440. "index.js": function (exports, module, require) {
  1441. var
  1442. template = require('./templates/footer.hbs')
  1443. , Users = require('./Users')
  1444. , Embed = require('./Embed');
  1445. module.exports = Backbone.Marionette.Layout.extend({
  1446. //--------------------------------------
  1447. //+ PUBLIC PROPERTIES / CONSTANTS
  1448. //--------------------------------------
  1449. className: "container",
  1450. template: template,
  1451. regions: {
  1452. "admins": ".admins-ctn"
  1453. },
  1454. ui: {
  1455. "switcher": ".dashboard-btn",
  1456. "showcaseMode": ".btn-showcase-mode",
  1457. "createShowcase": ".btn-new-project",
  1458. "footerToggle": ".footer-toggle-ctn"
  1459. },
  1460. events: {
  1461. "click .dashboard-btn": "onClickSwitcher",
  1462. "click .embed-btn": "showEmbedModal",
  1463. "click .btn-showcase-mode": "changeShowcaseMode"
  1464. },
  1465. templateHelpers: {
  1466. isAdmin: function(){
  1467. var user = hackdash.user;
  1468. return user && user.admin_in.indexOf(this.domain) >= 0 || false;
  1469. }
  1470. },
  1471. modelEvents: {
  1472. "change": "render"
  1473. },
  1474. //--------------------------------------
  1475. //+ INHERITED / OVERRIDES
  1476. //--------------------------------------
  1477. initialize: function(){
  1478. var isDashboard = (hackdash.app.type === "dashboard" ? true : false);
  1479. if (isDashboard){
  1480. this.model.get("admins").fetch();
  1481. }
  1482. },
  1483. onRender: function(){
  1484. var isDashboard = (hackdash.app.type === "dashboard" ? true : false);
  1485. if (isDashboard){
  1486. this.admins.show(new Users({
  1487. model: this.model,
  1488. collection: this.model.get("admins")
  1489. }));
  1490. }
  1491. $('.tooltips', this.$el).tooltip({});
  1492. },
  1493. serializeData: function(){
  1494. var msg = "This Dashboard is open: click to close";
  1495. if (!this.model.get("open")) {
  1496. msg = "This Dashboard is closed: click to reopen";
  1497. }
  1498. return _.extend({
  1499. switcherMsg: msg
  1500. }, this.model.toJSON());
  1501. },
  1502. //--------------------------------------
  1503. //+ PUBLIC METHODS / GETTERS / SETTERS
  1504. //--------------------------------------
  1505. //--------------------------------------
  1506. //+ EVENT HANDLERS
  1507. //--------------------------------------
  1508. onClickSwitcher:function(){
  1509. var open = true;
  1510. if (this.ui.switcher.hasClass("dash-open")){
  1511. open = false;
  1512. }
  1513. $('.tooltips', this.$el).tooltip('hide');
  1514. this.model.set({ "open": open }, { trigger: false });
  1515. this.model.save({ wait: true });
  1516. },
  1517. showEmbedModal: function(){
  1518. hackdash.app.modals.show(new Embed());
  1519. },
  1520. //--------------------------------------
  1521. //+ PRIVATE AND PROTECTED METHODS
  1522. //--------------------------------------
  1523. changeShowcaseMode: function(){
  1524. if (this.ui.showcaseMode.hasClass("on")){
  1525. this.model.trigger("save:showcase");
  1526. this.model.trigger("end:showcase");
  1527. this.model.isShowcaseMode = false;
  1528. this.ui.showcaseMode
  1529. .text("Edit Showcase")
  1530. .removeClass("on");
  1531. this.ui.createShowcase.removeClass("hide");
  1532. this.ui.footerToggle.removeClass("hide");
  1533. }
  1534. else {
  1535. this.model.isShowcaseMode = true;
  1536. this.model.trigger("edit:showcase");
  1537. this.ui.showcaseMode
  1538. .text("Save Showcase")
  1539. .addClass("on");
  1540. this.ui.createShowcase.addClass("hide");
  1541. this.ui.footerToggle.addClass("hide");
  1542. }
  1543. }
  1544. });
  1545. },
  1546. "templates": {
  1547. "addAdmin.hbs.js": function (exports, module, require) {
  1548. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1549. this.compilerInfo = [4,'>= 1.0.0'];
  1550. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1551. return "<div class=\"modal-header\">\n <button type=\"button\" data-dismiss=\"modal\" aria-hidden=\"true\" class=\"close\">×</button>\n <h3>Add Dashboard Admin</h3>\n</div>\n<div class=\"modal-body\">\n <div class=\"input-prepend\">\n <span class=\"add-on\" style=\"padding: 10px;\">\n <i class=\"icon-user\"></i>\n </span>\n <input id=\"txtUser\" type=\"text\" class=\"input-xlarge\" placeholder=\"type name or username\" autocomplete=\"off\" style=\"padding: 10px;\">\n </div>\n</div>\n<div class=\"modal-footer\">\n <input id=\"save\" type=\"button\" class=\"btn primary btn-success pull-right\" style=\"margin-left: 10px;\" value=\"Save\">\n <input type=\"button\" class=\"btn primary pull-right\" data-dismiss=\"modal\" value=\"Cancel\">\n</div>";
  1552. })
  1553. ;
  1554. },
  1555. "embed.hbs.js": function (exports, module, require) {
  1556. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1557. this.compilerInfo = [4,'>= 1.0.0'];
  1558. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1559. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  1560. buffer += "<div class=\"modal-header\">\n <button type=\"button\" data-dismiss=\"modal\" aria-hidden=\"true\" class=\"close\">×</button>\n <h3>Embed code</h3>\n</div>\n<div class=\"modal-body\">\n <textarea rows=\"2\" style=\"width:90%;\">";
  1561. if (stack1 = helpers.embedCode) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1562. else { stack1 = depth0.embedCode; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1563. buffer += escapeExpression(stack1)
  1564. + "</textarea>\n</div>\n<div class=\"modal-footer\">\n <input type=\"button\" class=\"btn primary pull-right\" data-dismiss=\"modal\" value=\"Cancel\">\n</div>";
  1565. return buffer;
  1566. })
  1567. ;
  1568. },
  1569. "footer.hbs.js": function (exports, module, require) {
  1570. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1571. this.compilerInfo = [4,'>= 1.0.0'];
  1572. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1573. var buffer = "", stack1, self=this, functionType="function", escapeExpression=this.escapeExpression;
  1574. function program1(depth0,data) {
  1575. var buffer = "", stack1;
  1576. buffer += "\n<div class=\"footer-toggle-ctn\">\n <a class=\"tooltips btn dashboard-btn ";
  1577. stack1 = helpers['if'].call(depth0, depth0.open, {hash:{},inverse:self.program(4, program4, data),fn:self.program(2, program2, data),data:data});
  1578. if(stack1 || stack1 === 0) { buffer += stack1; }
  1579. buffer += " pull-right\"\n data-placement=\"top\" data-original-title=\"";
  1580. if (stack1 = helpers.switcherMsg) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1581. else { stack1 = depth0.switcherMsg; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1582. buffer += escapeExpression(stack1)
  1583. + "\">\n ";
  1584. stack1 = helpers['if'].call(depth0, depth0.open, {hash:{},inverse:self.program(8, program8, data),fn:self.program(6, program6, data),data:data});
  1585. if(stack1 || stack1 === 0) { buffer += stack1; }
  1586. buffer += "\n </a>\n\n <a class=\"btn pull-right\" href=\"/api/v2/csv\" target=\"_blank\" data-bypass>Export CSV</a>\n <a class=\"btn pull-right embed-btn\">Embed code</a>\n</div>\n<a class=\"btn btn-large pull-right btn-showcase-mode\">Edit Showcase</a>\n";
  1587. return buffer;
  1588. }
  1589. function program2(depth0,data) {
  1590. return "dash-open";
  1591. }
  1592. function program4(depth0,data) {
  1593. return "dash-close";
  1594. }
  1595. function program6(depth0,data) {
  1596. return "Close Dashboard";
  1597. }
  1598. function program8(depth0,data) {
  1599. return "Open Dashboard";
  1600. }
  1601. buffer += "<h4>Admins</h4>\n<div class=\"well-content admins-ctn\"></div>\n\n";
  1602. stack1 = helpers['if'].call(depth0, depth0.isAdmin, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  1603. if(stack1 || stack1 === 0) { buffer += stack1; }
  1604. return buffer;
  1605. })
  1606. ;
  1607. },
  1608. "user.hbs.js": function (exports, module, require) {
  1609. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1610. this.compilerInfo = [4,'>= 1.0.0'];
  1611. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1612. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  1613. buffer += "<a href=\"/users/";
  1614. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1615. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1616. buffer += escapeExpression(stack1)
  1617. + "\">\n <img class=\"avatar tooltips\" rel=\"tooltip\" \n src=\"";
  1618. if (stack1 = helpers.picture) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1619. else { stack1 = depth0.picture; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1620. buffer += escapeExpression(stack1)
  1621. + "\" data-id=\"";
  1622. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1623. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1624. buffer += escapeExpression(stack1)
  1625. + "\" title=\"";
  1626. if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  1627. else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  1628. buffer += escapeExpression(stack1)
  1629. + "\">\n</a>";
  1630. return buffer;
  1631. })
  1632. ;
  1633. },
  1634. "users.hbs.js": function (exports, module, require) {
  1635. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  1636. this.compilerInfo = [4,'>= 1.0.0'];
  1637. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  1638. var buffer = "", stack1, self=this;
  1639. function program1(depth0,data) {
  1640. return "\n<a class=\"add-admins\">\n <i class=\"icon-plus\"></i>\n</a>\n";
  1641. }
  1642. buffer += "<ul></ul>\n";
  1643. stack1 = helpers['if'].call(depth0, depth0.isAdmin, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  1644. if(stack1 || stack1 === 0) { buffer += stack1; }
  1645. return buffer;
  1646. })
  1647. ;
  1648. }
  1649. }
  1650. },
  1651. "Header": {
  1652. "Collection.js": function (exports, module, require) {
  1653. /**
  1654. * VIEW: CollectionHeader Layout
  1655. *
  1656. */
  1657. var
  1658. template = require('./templates/collection.hbs');
  1659. module.exports = Backbone.Marionette.ItemView.extend({
  1660. //--------------------------------------
  1661. //+ PUBLIC PROPERTIES / CONSTANTS
  1662. //--------------------------------------
  1663. template: template,
  1664. ui: {
  1665. "title": "#collection-title",
  1666. "description": "#collection-description"
  1667. },
  1668. templateHelpers: {
  1669. isAdmin: function(){
  1670. var user = hackdash.user;
  1671. return (user && this.owner._id === user._id) || false;
  1672. }
  1673. },
  1674. modelEvents: {
  1675. "change": "render"
  1676. },
  1677. //--------------------------------------
  1678. //+ INHERITED / OVERRIDES
  1679. //--------------------------------------
  1680. onRender: function(){
  1681. var user = hackdash.user;
  1682. if (user){
  1683. var isAdmin = this.model.get("owner")._id === user._id;
  1684. if (isAdmin){
  1685. this.initEditables();
  1686. }
  1687. }
  1688. $('.tooltips', this.$el).tooltip({});
  1689. },
  1690. //--------------------------------------
  1691. //+ PUBLIC METHODS / GETTERS / SETTERS
  1692. //--------------------------------------
  1693. //--------------------------------------
  1694. //+ EVENT HANDLERS
  1695. //--------------------------------------
  1696. //--------------------------------------
  1697. //+ PRIVATE AND PROTECTED METHODS
  1698. //--------------------------------------
  1699. initEditables: function(){
  1700. var self = this;
  1701. this.ui.title.editable({
  1702. type: 'text',
  1703. title: 'Enter title',
  1704. emptytext: "Enter a title",
  1705. inputclass: 'dashboard-edit-title',
  1706. tpl: '<input type="text" maxlength="30">',
  1707. success: function(response, newValue) {
  1708. self.model.set('title', newValue);
  1709. self.model.save();
  1710. }
  1711. });
  1712. this.ui.description.editable({
  1713. type: 'textarea',
  1714. title: 'Enter description',
  1715. emptytext: "Enter a description",
  1716. inputclass: "dashboard-edit-desc",
  1717. tpl: '<textarea maxlength="250" cols="50"></textarea>',
  1718. success: function(response, newValue) {
  1719. self.model.set('description', newValue);
  1720. self.model.save();
  1721. }
  1722. });
  1723. },
  1724. });
  1725. },
  1726. "Collections.js": function (exports, module, require) {
  1727. /**
  1728. * VIEW: CollectionsHeader Layout
  1729. *
  1730. */
  1731. var
  1732. template = require('./templates/collections.hbs');
  1733. module.exports = Backbone.Marionette.ItemView.extend({
  1734. //--------------------------------------
  1735. //+ PUBLIC PROPERTIES / CONSTANTS
  1736. //--------------------------------------
  1737. template: template,
  1738. //--------------------------------------
  1739. //+ INHERITED / OVERRIDES
  1740. //--------------------------------------
  1741. //--------------------------------------
  1742. //+ PUBLIC METHODS / GETTERS / SETTERS
  1743. //--------------------------------------
  1744. //--------------------------------------
  1745. //+ EVENT HANDLERS
  1746. //--------------------------------------
  1747. //--------------------------------------
  1748. //+ PRIVATE AND PROTECTED METHODS
  1749. //--------------------------------------
  1750. });
  1751. },
  1752. "Dashboard.js": function (exports, module, require) {
  1753. /**
  1754. * VIEW: DashboardHeader Layout
  1755. *
  1756. */
  1757. var
  1758. template = require('./templates/dashboard.hbs');
  1759. module.exports = Backbone.Marionette.ItemView.extend({
  1760. //--------------------------------------
  1761. //+ PUBLIC PROPERTIES / CONSTANTS
  1762. //--------------------------------------
  1763. template: template,
  1764. ui: {
  1765. "title": "#dashboard-title",
  1766. "description": "#dashboard-description",
  1767. "link": "#dashboard-link"
  1768. },
  1769. templateHelpers: {
  1770. isAdmin: function(){
  1771. var user = hackdash.user;
  1772. return user && user.admin_in.indexOf(this.domain) >= 0 || false;
  1773. }
  1774. },
  1775. modelEvents: {
  1776. "change": "render"
  1777. },
  1778. //--------------------------------------
  1779. //+ INHERITED / OVERRIDES
  1780. //--------------------------------------
  1781. initialize: function(options){
  1782. this.readOnly = (options && options.readOnly) || false;
  1783. },
  1784. onRender: function(){
  1785. var user = hackdash.user;
  1786. if (user){
  1787. var isAdmin = user.admin_in.indexOf(this.model.get("domain")) >= 0;
  1788. if (isAdmin){
  1789. this.initEditables();
  1790. }
  1791. }
  1792. $('.tooltips', this.$el).tooltip({});
  1793. },
  1794. serializeData: function(){
  1795. return _.extend({
  1796. readOnly: this.readOnly
  1797. }, this.model.toJSON() || {});
  1798. },
  1799. //--------------------------------------
  1800. //+ PUBLIC METHODS / GETTERS / SETTERS
  1801. //--------------------------------------
  1802. //--------------------------------------
  1803. //+ EVENT HANDLERS
  1804. //--------------------------------------
  1805. //--------------------------------------
  1806. //+ PRIVATE AND PROTECTED METHODS
  1807. //--------------------------------------
  1808. initEditables: function(){
  1809. var self = this;
  1810. this.ui.title.editable({
  1811. type: 'text',
  1812. title: 'Enter title',
  1813. emptytext: "Enter a title",
  1814. inputclass: 'dashboard-edit-title',
  1815. tpl: '<input type="text" maxlength="30">',
  1816. success: function(response, newValue) {
  1817. self.model.set('title', newValue);
  1818. self.model.save();
  1819. }
  1820. });
  1821. this.ui.description.editable({
  1822. type: 'textarea',
  1823. title: 'Enter description',
  1824. emptytext: "Enter a description",
  1825. inputclass: "dashboard-edit-desc",
  1826. tpl: '<textarea maxlength="250" cols="50"></textarea>',
  1827. success: function(response, newValue) {
  1828. self.model.set('description', newValue);
  1829. self.model.save();
  1830. }
  1831. });
  1832. this.ui.link.editable({
  1833. type: 'text',
  1834. title: 'Enter a link',
  1835. emptytext: "Enter a link",
  1836. inputclass: "dashboard-edit-link",
  1837. success: function(response, newValue) {
  1838. self.model.set('link', newValue);
  1839. self.model.save();
  1840. }
  1841. });
  1842. },
  1843. });
  1844. },
  1845. "Dashboards.js": function (exports, module, require) {
  1846. /**
  1847. * VIEW: DashboardsHeader Layout
  1848. *
  1849. */
  1850. var
  1851. template = require('./templates/dashboards.hbs');
  1852. module.exports = Backbone.Marionette.ItemView.extend({
  1853. //--------------------------------------
  1854. //+ PUBLIC PROPERTIES / CONSTANTS
  1855. //--------------------------------------
  1856. template: template,
  1857. //--------------------------------------
  1858. //+ INHERITED / OVERRIDES
  1859. //--------------------------------------
  1860. //--------------------------------------
  1861. //+ PUBLIC METHODS / GETTERS / SETTERS
  1862. //--------------------------------------
  1863. //--------------------------------------
  1864. //+ EVENT HANDLERS
  1865. //--------------------------------------
  1866. //--------------------------------------
  1867. //+ PRIVATE AND PROTECTED METHODS
  1868. //--------------------------------------
  1869. });
  1870. },
  1871. "Search.js": function (exports, module, require) {
  1872. var
  1873. template = require('./templates/search.hbs');
  1874. module.exports = Backbone.Marionette.ItemView.extend({
  1875. //--------------------------------------
  1876. //+ PUBLIC PROPERTIES / CONSTANTS
  1877. //--------------------------------------
  1878. tagName: "form",
  1879. className: "formSearch",
  1880. template: template,
  1881. ui: {
  1882. searchbox: "#searchInput"
  1883. },
  1884. events: {
  1885. "keyup #searchInput": "search",
  1886. "click .sort": "sort"
  1887. },
  1888. //--------------------------------------
  1889. //+ INHERITED / OVERRIDES
  1890. //--------------------------------------
  1891. lastSearch: "",
  1892. initialize: function(options){
  1893. this.showSort = (options && options.showSort) || false;
  1894. this.collection = options && options.collection;
  1895. this.placeholder = (options && options.placeholder) || "Type here";
  1896. },
  1897. onRender: function(){
  1898. var query = hackdash.getQueryVariable("q");
  1899. if (query && query.length > 0){
  1900. this.ui.searchbox.val(query);
  1901. this.lastSearch = query;
  1902. }
  1903. },
  1904. serializeData: function(){
  1905. return {
  1906. showSort: this.showSort,
  1907. placeholder: this.placeholder
  1908. };
  1909. },
  1910. //--------------------------------------
  1911. //+ PUBLIC METHODS / GETTERS / SETTERS
  1912. //--------------------------------------
  1913. //--------------------------------------
  1914. //+ EVENT HANDLERS
  1915. //--------------------------------------
  1916. sort: function(e){
  1917. e.preventDefault();
  1918. var val = $(e.currentTarget).data("option-value");
  1919. this.collection.trigger("sort:" + val);
  1920. },
  1921. search: function(){
  1922. var self = this;
  1923. window.clearTimeout(this.timer);
  1924. this.timer = window.setTimeout(function(){
  1925. var keyword = self.ui.searchbox.val();
  1926. var fragment = Backbone.history.fragment.replace(Backbone.history.location.search, "");
  1927. if (keyword !== self.lastSearch) {
  1928. self.lastSearch = keyword;
  1929. var opts = {
  1930. reset: true
  1931. };
  1932. if (keyword.length > 0) {
  1933. opts.data = $.param({ q: keyword });
  1934. hackdash.app.router.navigate(fragment + "?q=" + keyword, { trigger: true });
  1935. self.collection.fetch(opts);
  1936. }
  1937. else {
  1938. if (hackdash.app.type === "isearch"){
  1939. self.collection.reset();
  1940. }
  1941. else {
  1942. self.collection.fetch();
  1943. }
  1944. hackdash.app.router.navigate(fragment, { trigger: true, replace: true });
  1945. }
  1946. }
  1947. }, 300);
  1948. }
  1949. //--------------------------------------
  1950. //+ PRIVATE AND PROTECTED METHODS
  1951. //--------------------------------------
  1952. });
  1953. },
  1954. "index.js": function (exports, module, require) {
  1955. var
  1956. template = require('./templates/header.hbs')
  1957. , Search = require('./Search')
  1958. , DashboardHeader = require('./Dashboard')
  1959. , DashboardsHeader = require('./Dashboards')
  1960. , CollectionsHeader = require('./Collections')
  1961. , CollectionHeader = require('./Collection');
  1962. module.exports = Backbone.Marionette.Layout.extend({
  1963. //--------------------------------------
  1964. //+ PUBLIC PROPERTIES / CONSTANTS
  1965. //--------------------------------------
  1966. className: "container",
  1967. template: template,
  1968. regions: {
  1969. "search": ".search-ctn",
  1970. "page": ".page-ctn"
  1971. },
  1972. ui: {
  1973. pageTitle: ".page-title"
  1974. },
  1975. modelEvents: {
  1976. "change": "render"
  1977. },
  1978. templateHelpers: {
  1979. hackdashURL: function(){
  1980. return "http://" + hackdash.baseURL;
  1981. },
  1982. isDashboardAdmin: function(){
  1983. var isDashboard = (hackdash.app.type === "dashboard" ? true : false);
  1984. var user = hackdash.user;
  1985. return isDashboard && user && user.admin_in.indexOf(this.domain) >= 0 || false;
  1986. }
  1987. },
  1988. //--------------------------------------
  1989. //+ INHERITED / OVERRIDES
  1990. //--------------------------------------
  1991. onRender: function(){
  1992. var type = window.hackdash.app.type;
  1993. var self = this;
  1994. function showSearch(placeholder){
  1995. self.search.show(new Search({
  1996. showSort: type === "dashboard",
  1997. placeholder: placeholder,
  1998. collection: self.collection
  1999. }));
  2000. }
  2001. switch(type){
  2002. case "isearch":
  2003. showSearch("Type here to search projects");
  2004. this.ui.pageTitle.text("Projects");
  2005. break;
  2006. case "dashboards":
  2007. showSearch();
  2008. this.page.show(new DashboardsHeader());
  2009. break;
  2010. case "dashboard":
  2011. showSearch();
  2012. if (this.model.get("_id")){
  2013. this.page.show(new DashboardHeader({
  2014. model: this.model
  2015. }));
  2016. }
  2017. break;
  2018. case "collections":
  2019. showSearch("Type here to search collections");
  2020. this.page.show(new CollectionsHeader());
  2021. break;
  2022. case "collection":
  2023. if (this.model.get("_id")){
  2024. this.page.show(new CollectionHeader({
  2025. model: this.model
  2026. }));
  2027. }
  2028. break;
  2029. case "project":
  2030. if (this.model.get("_id")){
  2031. this.page.show(new DashboardHeader({
  2032. model: this.model,
  2033. readOnly: true
  2034. }));
  2035. }
  2036. break;
  2037. }
  2038. $('.tooltips', this.$el).tooltip({});
  2039. },
  2040. //--------------------------------------
  2041. //+ PUBLIC METHODS / GETTERS / SETTERS
  2042. //--------------------------------------
  2043. //--------------------------------------
  2044. //+ EVENT HANDLERS
  2045. //--------------------------------------
  2046. //--------------------------------------
  2047. //+ PRIVATE AND PROTECTED METHODS
  2048. //--------------------------------------
  2049. });
  2050. },
  2051. "templates": {
  2052. "collection.hbs.js": function (exports, module, require) {
  2053. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2054. this.compilerInfo = [4,'>= 1.0.0'];
  2055. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2056. var stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
  2057. function program1(depth0,data) {
  2058. var buffer = "", stack1;
  2059. buffer += "\n\n <h1>\n <a id=\"collection-title\">";
  2060. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2061. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2062. buffer += escapeExpression(stack1)
  2063. + "</a>\n </h1>\n\n <p class=\"lead collection-lead\">\n <a id=\"collection-description\">";
  2064. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2065. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2066. buffer += escapeExpression(stack1)
  2067. + "</a>\n </p>\n\n";
  2068. return buffer;
  2069. }
  2070. function program3(depth0,data) {
  2071. var buffer = "", stack1;
  2072. buffer += "\n\n ";
  2073. stack1 = helpers['if'].call(depth0, depth0.title, {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
  2074. if(stack1 || stack1 === 0) { buffer += stack1; }
  2075. buffer += "\n\n ";
  2076. stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
  2077. if(stack1 || stack1 === 0) { buffer += stack1; }
  2078. buffer += "\n\n";
  2079. return buffer;
  2080. }
  2081. function program4(depth0,data) {
  2082. var buffer = "", stack1;
  2083. buffer += "\n <h1>\n ";
  2084. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2085. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2086. buffer += escapeExpression(stack1)
  2087. + "\n </h1>\n ";
  2088. return buffer;
  2089. }
  2090. function program6(depth0,data) {
  2091. var buffer = "", stack1;
  2092. buffer += "\n <p class=\"lead\">";
  2093. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2094. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2095. buffer += escapeExpression(stack1)
  2096. + "</p>\n ";
  2097. return buffer;
  2098. }
  2099. stack1 = helpers['if'].call(depth0, depth0.isAdmin, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
  2100. if(stack1 || stack1 === 0) { return stack1; }
  2101. else { return ''; }
  2102. })
  2103. ;
  2104. },
  2105. "collections.hbs.js": function (exports, module, require) {
  2106. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2107. this.compilerInfo = [4,'>= 1.0.0'];
  2108. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2109. var buffer = "", stack1, options, self=this, functionType="function", blockHelperMissing=helpers.blockHelperMissing;
  2110. function program1(depth0,data) {
  2111. return "\n <a class=\"btn btn-large\" href=\"/dashboards\">Create a Collection</a>\n";
  2112. }
  2113. function program3(depth0,data) {
  2114. return "\n <a class=\"btn btn-large\" href=\"/login\">Login to manage collections</a>\n";
  2115. }
  2116. buffer += "<h1>Collections</h1>\n\n";
  2117. options = {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data};
  2118. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  2119. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2120. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2121. if(stack1 || stack1 === 0) { buffer += stack1; }
  2122. buffer += "\n";
  2123. return buffer;
  2124. })
  2125. ;
  2126. },
  2127. "dashboard.hbs.js": function (exports, module, require) {
  2128. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2129. this.compilerInfo = [4,'>= 1.0.0'];
  2130. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2131. var stack1, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
  2132. function program1(depth0,data) {
  2133. var buffer = "", stack1;
  2134. buffer += "\n \n ";
  2135. stack1 = helpers['if'].call(depth0, depth0.title, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
  2136. if(stack1 || stack1 === 0) { buffer += stack1; }
  2137. buffer += "\n\n ";
  2138. stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  2139. if(stack1 || stack1 === 0) { buffer += stack1; }
  2140. buffer += "\n\n";
  2141. return buffer;
  2142. }
  2143. function program2(depth0,data) {
  2144. var buffer = "", stack1;
  2145. buffer += "\n <h1>\n ";
  2146. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2147. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2148. buffer += escapeExpression(stack1)
  2149. + "\n\n ";
  2150. stack1 = helpers['if'].call(depth0, depth0.link, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
  2151. if(stack1 || stack1 === 0) { buffer += stack1; }
  2152. buffer += "\n </h1>\n ";
  2153. return buffer;
  2154. }
  2155. function program3(depth0,data) {
  2156. var buffer = "", stack1;
  2157. buffer += "\n <a class=\"dashboard-link\" href=\"";
  2158. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2159. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2160. buffer += escapeExpression(stack1)
  2161. + "\" target=\"_blank\" data-bypass>site</a>\n ";
  2162. return buffer;
  2163. }
  2164. function program5(depth0,data) {
  2165. var buffer = "", stack1;
  2166. buffer += "\n <p class=\"lead\">";
  2167. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2168. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2169. buffer += escapeExpression(stack1)
  2170. + "</p>\n ";
  2171. return buffer;
  2172. }
  2173. function program7(depth0,data) {
  2174. var buffer = "", stack1, options;
  2175. buffer += "\n\n ";
  2176. stack1 = helpers['if'].call(depth0, depth0.isAdmin, {hash:{},inverse:self.program(10, program10, data),fn:self.program(8, program8, data),data:data});
  2177. if(stack1 || stack1 === 0) { buffer += stack1; }
  2178. buffer += "\n\n ";
  2179. options = {hash:{},inverse:self.program(17, program17, data),fn:self.program(12, program12, data),data:data};
  2180. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  2181. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2182. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2183. if(stack1 || stack1 === 0) { buffer += stack1; }
  2184. buffer += "\n";
  2185. return buffer;
  2186. }
  2187. function program8(depth0,data) {
  2188. var buffer = "", stack1;
  2189. buffer += "\n\n <h1>\n <a id=\"dashboard-title\">";
  2190. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2191. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2192. buffer += escapeExpression(stack1)
  2193. + "</a>\n </h1>\n\n <p class=\"lead dashboard-lead\">\n <a id=\"dashboard-description\">";
  2194. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2195. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2196. buffer += escapeExpression(stack1)
  2197. + "</a>\n </p>\n\n <p class=\"dashboard-link\">\n <a id=\"dashboard-link\">";
  2198. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2199. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2200. buffer += escapeExpression(stack1)
  2201. + "</a>\n </p>\n\n ";
  2202. return buffer;
  2203. }
  2204. function program10(depth0,data) {
  2205. var buffer = "", stack1;
  2206. buffer += "\n\n ";
  2207. stack1 = helpers['if'].call(depth0, depth0.title, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
  2208. if(stack1 || stack1 === 0) { buffer += stack1; }
  2209. buffer += "\n\n ";
  2210. stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  2211. if(stack1 || stack1 === 0) { buffer += stack1; }
  2212. buffer += "\n\n ";
  2213. return buffer;
  2214. }
  2215. function program12(depth0,data) {
  2216. var buffer = "", stack1;
  2217. buffer += "\n\n ";
  2218. stack1 = helpers['if'].call(depth0, depth0.open, {hash:{},inverse:self.program(15, program15, data),fn:self.program(13, program13, data),data:data});
  2219. if(stack1 || stack1 === 0) { buffer += stack1; }
  2220. buffer += "\n\n ";
  2221. return buffer;
  2222. }
  2223. function program13(depth0,data) {
  2224. return "\n <a class=\"btn btn-large btn-new-project\" href=\"/projects/create\">New Project</a>\n ";
  2225. }
  2226. function program15(depth0,data) {
  2227. return "\n <h4 class=\"tooltips dashboard-closed\" \n data-placement=\"bottom\" data-original-title=\"Dashboard closed for creating projects\">Dashboard Closed</h4>\n ";
  2228. }
  2229. function program17(depth0,data) {
  2230. var buffer = "", stack1;
  2231. buffer += "\n\n ";
  2232. stack1 = helpers['if'].call(depth0, depth0.open, {hash:{},inverse:self.program(20, program20, data),fn:self.program(18, program18, data),data:data});
  2233. if(stack1 || stack1 === 0) { buffer += stack1; }
  2234. buffer += "\n\n ";
  2235. return buffer;
  2236. }
  2237. function program18(depth0,data) {
  2238. return "\n <a class=\"btn btn-large\" href=\"/login\">Login to create a project</a>\n ";
  2239. }
  2240. function program20(depth0,data) {
  2241. return "\n <a class=\"btn btn-large\" href=\"/login\">Login to join/follow projects</a>\n ";
  2242. }
  2243. stack1 = helpers['if'].call(depth0, depth0.readOnly, {hash:{},inverse:self.program(7, program7, data),fn:self.program(1, program1, data),data:data});
  2244. if(stack1 || stack1 === 0) { return stack1; }
  2245. else { return ''; }
  2246. })
  2247. ;
  2248. },
  2249. "dashboards.hbs.js": function (exports, module, require) {
  2250. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2251. this.compilerInfo = [4,'>= 1.0.0'];
  2252. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2253. var buffer = "", stack1, options, self=this, functionType="function", blockHelperMissing=helpers.blockHelperMissing;
  2254. function program1(depth0,data) {
  2255. return "\n <a class=\"btn btn-large\" href=\"/collections\">View Collections</a>\n";
  2256. }
  2257. function program3(depth0,data) {
  2258. return "\n <a class=\"btn btn-large\" href=\"/login\">Login to create collections</a>\n";
  2259. }
  2260. buffer += "<h1>Create collections</h1>\n<p class=\"lead\">\n Search through dashboards and add them to Collections\n</p>\n\n";
  2261. options = {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data};
  2262. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  2263. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2264. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2265. if(stack1 || stack1 === 0) { buffer += stack1; }
  2266. buffer += "\n";
  2267. return buffer;
  2268. })
  2269. ;
  2270. },
  2271. "header.hbs.js": function (exports, module, require) {
  2272. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2273. this.compilerInfo = [4,'>= 1.0.0'];
  2274. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2275. var buffer = "", stack1, options, self=this, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", blockHelperMissing=helpers.blockHelperMissing;
  2276. function program1(depth0,data) {
  2277. var buffer = "", stack1, stack2, options;
  2278. buffer += "\n <a class=\"btn-profile\" href=\"/users/profile\">\n <img class=\"avatar tooltips\" src=\"";
  2279. options = {hash:{},data:data};
  2280. buffer += escapeExpression(((stack1 = helpers.user || depth0.user),stack1 ? stack1.call(depth0, "picture", options) : helperMissing.call(depth0, "user", "picture", options)))
  2281. + "\" rel=\"tooltip\" data-placement=\"bottom\" data-original-title=\"Edit profile\">\n\n ";
  2282. options = {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data};
  2283. if (stack2 = helpers.isDashboardView) { stack2 = stack2.call(depth0, options); }
  2284. else { stack2 = depth0.isDashboardView; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
  2285. if (!helpers.isDashboardView) { stack2 = blockHelperMissing.call(depth0, stack2, options); }
  2286. if(stack2 || stack2 === 0) { buffer += stack2; }
  2287. buffer += "\n </a> \n <a class=\"btn logout\" href=\"/logout\" data-bypass>Logout</a>\n ";
  2288. return buffer;
  2289. }
  2290. function program2(depth0,data) {
  2291. var buffer = "", stack1;
  2292. buffer += "\n ";
  2293. stack1 = helpers['if'].call(depth0, depth0.isDashboardAdmin, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
  2294. if(stack1 || stack1 === 0) { buffer += stack1; }
  2295. buffer += "\n ";
  2296. return buffer;
  2297. }
  2298. function program3(depth0,data) {
  2299. return "\n <span class=\"admin-label\">Admin</span>\n ";
  2300. }
  2301. buffer += "<div class=\"search-ctn\"></div>\n\n<div class=\"createProject pull-right btn-group\">\n ";
  2302. options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
  2303. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  2304. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2305. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2306. if(stack1 || stack1 === 0) { buffer += stack1; }
  2307. buffer += "\n</div>\n\n<a class=\"logo\" href=\"";
  2308. if (stack1 = helpers.hackdashURL) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2309. else { stack1 = depth0.hackdashURL; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2310. buffer += escapeExpression(stack1)
  2311. + "\" data-bypass></a>\n\n<div class=\"page-ctn\"></div>\n<h1 class=\"page-title\"></h1>";
  2312. return buffer;
  2313. })
  2314. ;
  2315. },
  2316. "search.hbs.js": function (exports, module, require) {
  2317. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2318. this.compilerInfo = [4,'>= 1.0.0'];
  2319. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2320. var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
  2321. function program1(depth0,data) {
  2322. return "\n<div class=\"orderby\">\n <div class=\"btn-group\">\n <button data-option-value=\"name\" class=\"sort btn\">By Name</button>\n <button data-option-value=\"date\" class=\"sort btn\">By Date</button>\n <button data-option-value=\"showcase\" class=\"sort btn\">Showcase</button>\n </div>\n</div>\n";
  2323. }
  2324. buffer += "<i class=\"icon-large icon-search\"></i>\n<input id=\"searchInput\" type=\"text\" class=\"search-query input-large\" placeholder=\"";
  2325. if (stack1 = helpers.placeholder) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2326. else { stack1 = depth0.placeholder; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2327. buffer += escapeExpression(stack1)
  2328. + "\"/>\n\n";
  2329. options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
  2330. if (stack1 = helpers.isDashboardView) { stack1 = stack1.call(depth0, options); }
  2331. else { stack1 = depth0.isDashboardView; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2332. if (!helpers.isDashboardView) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2333. if(stack1 || stack1 === 0) { buffer += stack1; }
  2334. return buffer;
  2335. })
  2336. ;
  2337. }
  2338. }
  2339. },
  2340. "Home": {
  2341. "index.js": function (exports, module, require) {
  2342. var template = require("./templates/home.hbs")
  2343. , Dashboards = require("../../models/Dashboards");
  2344. module.exports = Backbone.Marionette.Layout.extend({
  2345. //--------------------------------------
  2346. //+ PUBLIC PROPERTIES / CONSTANTS
  2347. //--------------------------------------
  2348. className: "container-fluid",
  2349. template: template,
  2350. ui: {
  2351. "domain": "#domain",
  2352. "create": "#create-dashboard",
  2353. "projects": "#search-projects",
  2354. "collections": "#search-collections"
  2355. },
  2356. events: {
  2357. "keyup #domain": "validateDomain",
  2358. "click #create-dashboard": "createDashboard",
  2359. "keyup #search-projects": "checkSearchProjects",
  2360. "click #search-projects-btn": "searchProjects",
  2361. "keyup #search-collections": "checkSearchCollections",
  2362. "click #search-collections-btn": "searchCollections",
  2363. "click #create-collections-btn": "createCollections"
  2364. },
  2365. //--------------------------------------
  2366. //+ INHERITED / OVERRIDES
  2367. //--------------------------------------
  2368. //--------------------------------------
  2369. //+ PUBLIC METHODS / GETTERS / SETTERS
  2370. //--------------------------------------
  2371. //TODO: move to i18n
  2372. errors: {
  2373. "subdomain_invalid": "Subdomain invalid",
  2374. "subdomain_inuse": "Subdomain is in use"
  2375. },
  2376. //--------------------------------------
  2377. //+ EVENT HANDLERS
  2378. //--------------------------------------
  2379. validateDomain: function(){
  2380. var name = this.ui.domain.val();
  2381. this.cleanErrors();
  2382. if(/^[a-z0-9]{5,10}$/.test(name)) {
  2383. this.ui.domain.parent().addClass('success').removeClass('error');
  2384. this.ui.create.removeClass('disabled');
  2385. } else {
  2386. this.ui.domain.parent().addClass('error').removeClass('success');
  2387. this.ui.create.addClass('disabled');
  2388. }
  2389. },
  2390. createDashboard: function(){
  2391. var domain = this.ui.domain.val();
  2392. this.cleanErrors();
  2393. this.ui.create.button('loading');
  2394. var dash = new Dashboards([]);
  2395. dash.create({ domain: domain }, {
  2396. success: this.redirectToSubdomain.bind(this, domain),
  2397. error: this.showError.bind(this)
  2398. });
  2399. },
  2400. checkSearchProjects: function(e){
  2401. if (this.isEnterKey(e)){
  2402. this.searchProjects();
  2403. }
  2404. },
  2405. checkSearchCollections: function(e){
  2406. if (this.isEnterKey(e)){
  2407. this.searchCollections();
  2408. }
  2409. },
  2410. searchProjects: function(){
  2411. var q = this.ui.projects.val();
  2412. q = q ? "?q=" + q : "";
  2413. window.location = "/projects" + q;
  2414. },
  2415. searchCollections: function(){
  2416. var q = this.ui.collections.val();
  2417. q = q ? "?q=" + q : "";
  2418. window.location = "/collections" + q;
  2419. },
  2420. createCollections: function(){
  2421. window.location = "/dashboards";
  2422. },
  2423. showError: function(view, err){
  2424. this.ui.create.button('reset');
  2425. if (err.responseText === "OK"){
  2426. this.redirectToSubdomain(this.ui.domain.val());
  2427. return;
  2428. }
  2429. var error = JSON.parse(err.responseText).error;
  2430. this.ui.domain.parents('.control-group').addClass('error').removeClass('success');
  2431. this.ui.domain.after('<span class="help-inline">' + this.errors[error] + '</span>');
  2432. },
  2433. cleanErrors: function(){
  2434. $(".error", this.$el).removeClass("error").removeClass('success');
  2435. $("span.help-inline", this.$el).remove();
  2436. },
  2437. //--------------------------------------
  2438. //+ PRIVATE AND PROTECTED METHODS
  2439. //--------------------------------------
  2440. redirectToSubdomain: function(name){
  2441. window.location = "http://" + name + "." + hackdash.baseURL;
  2442. },
  2443. isEnterKey: function(e){
  2444. var key = e.keyCode || e.which;
  2445. return (key === 13);
  2446. }
  2447. });
  2448. },
  2449. "templates": {
  2450. "home.hbs.js": function (exports, module, require) {
  2451. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2452. this.compilerInfo = [4,'>= 1.0.0'];
  2453. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2454. var buffer = "", stack1, options, self=this, functionType="function", blockHelperMissing=helpers.blockHelperMissing;
  2455. function program1(depth0,data) {
  2456. return "\n <form>\n <p class=\"control-group\">\n <input class=\"input-xlarge\" id=\"domain\" maxlength=\"10\"\n placeholder=\"Hackathon domain Name (5-10 chars)\" type=\"text\">\n <label>(5-10 lowercase letters/numbers)</label>\n </p>\n\n <p>\n <input id=\"create-dashboard\" class=\"btn btn-large btn-custom disabled\" type=\"button\" value=\"Create a Dashboard\">\n </p>\n </form>\n ";
  2457. }
  2458. function program3(depth0,data) {
  2459. return "\n <p>\n <a class=\"btn btn-large btn-custom\" href=\"/login\">Log in to create a Hackathon</a>\n </p>\n ";
  2460. }
  2461. buffer += "\n<div class=\"row-fluid\">\n <div class=\"span12\">\n \n <section class=\"brand\">\n <header>\n <h1><a href=\"#\">HackDash</a></h1>\n </header>\n\n <div class=\"content\">\n <h2>Ideas for a hackathon</h2>\n <p>Upload your project. Add colaborators. Inform status. Share your app.</p>\n\n ";
  2462. options = {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data};
  2463. if (stack1 = helpers.isLoggedIn) { stack1 = stack1.call(depth0, options); }
  2464. else { stack1 = depth0.isLoggedIn; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2465. if (!helpers.isLoggedIn) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  2466. if(stack1 || stack1 === 0) { buffer += stack1; }
  2467. buffer += "\n </div>\n </section>\n </div>\n</div>\n\n<div class=\"row-fluid\">\n <div class=\"span12\">\n <div class=\"span6\">\n <section class=\"block\">\n <header>\n <h3>Find Projects</h3>\n <p>Search hackathon projects all over the world in one place.</p>\n </header>\n\n <div class=\"content span12\">\n <p class=\"control-group\">\n <input class=\"input-large search-box\" id=\"search-projects\"\n placeholder=\"name or description\" type=\"text\">\n <button class=\"btn btn-large btn-custom disabled search-btn\" id=\"search-projects-btn\">Search</button>\n </p>\n </div>\n </section>\n </div>\n\n <div class=\"span6\">\n <section class=\"block\">\n <header>\n <h3>Find Collections</h3>\n <p>Search and organize groups of dashboards with \"Collections\".</p>\n </header>\n\n <div class=\"content span12\">\n <p class=\"control-group\">\n <input class=\"input-large search-box\" id=\"search-collections\"\n placeholder=\"name or description\" type=\"text\">\n <button class=\"btn btn-large btn-custom disabled search-btn\" id=\"search-collections-btn\">Search</button>\n <button class=\"btn btn-large btn-custom disabled search-btn\" id=\"create-collections-btn\">Create</button>\n </p>\n </div>\n </section>\n </div>\n\n </div>\n</div>\n\n<div class=\"row-fluid\">\n <div class=\"span12\">\n <section class=\"block\">\n <header>\n <h3>About</h3>\n </header>\n\n <div class=\"content span11\">\n <p>The HackDash was born by accident and by a need.\n We were looking for platform to track ideas through\n hackathons in the line to the Hacks/Hackers Media\n Party organized by @HacksHackersBA where hackers\n and journalists share ideas. We spread the idea\n through Twitter and that was the context of the\n HackDash born. @blejman had an idea and\n @danzajdband was interested in implement that idea.\n So we started building the app hoping we can get to\n the Buenos Aires media party with something that\n doesn't suck. The Media Party Hackathon day came\n followed by a grateful surprise. Not only the\n people liked the HackDash implementation but a\n couple of coders added the improvement of the\n HackDash as a Hackaton project. After the Media\n Party we realized that this small app is filling a\n real need. The Dashboard has been used now in\n several ways like Node.js Argentina meetup,\n HacksHackersBA, La Nación DataFest and\n HackasHackersCL (using it as a Wordpress theme).\n Now, the HackDash will be an standard for\n hackathons through the PinLatAm program, for news\n innovation in Latin America. Create your own\n hackathon.</p>\n </div>\n </section>\n </div>\n</div>\n\n<div class=\"row-fluid\">\n <div class=\"span12\">\n <section class=\"block\">\n <header>\n <h3>Why Hackdash?</h3>\n </header>\n\n <div class=\"content\">\n <div class=\"row-fluid\">\n <div class=\"span10 offset1 brand-why\">\n <div class=\"span3\">\n <div class=\"icon quick\"></div>\n <h5>Quick and Easy</h5>\n </div>\n\n <div class=\"span3\">\n <div class=\"icon nerds\"></div>\n <h5>For Nerds</h5>\n </div>\n\n <div class=\"span3\">\n <div class=\"icon fast\"></div>\n <h5>Fast</h5>\n </div>\n\n <div class=\"span3\">\n <div class=\"icon geeks\"></div>\n <h5>Love &amp; Geeks</h5>\n </div>\n </div>\n </div>\n </div>\n </section>\n </div>\n</div>\n\n<div class=\"row-fluid\">\n <div class=\"span12\">\n <section class=\"block\">\n <header>\n <h3>Partners</h3>\n </header>\n\n <div class=\"content\">\n <div class=\"row-fluid\">\n <div class=\"span10 offset2 partners\">\n <div class=\"span5 hhba\"></div>\n <div class=\"span5 nxtp\"></div>\n </div>\n </div>\n </div>\n </section>\n </div>\n</div>\n";
  2468. return buffer;
  2469. })
  2470. ;
  2471. }
  2472. }
  2473. },
  2474. "Login.js": function (exports, module, require) {
  2475. /**
  2476. * VIEW: Login Modal
  2477. *
  2478. */
  2479. var template = require('./templates/login.hbs');
  2480. module.exports = Backbone.Marionette.ItemView.extend({
  2481. //--------------------------------------
  2482. //+ PUBLIC PROPERTIES / CONSTANTS
  2483. //--------------------------------------
  2484. className: "modal",
  2485. template: template,
  2486. //--------------------------------------
  2487. //+ INHERITED / OVERRIDES
  2488. //--------------------------------------
  2489. onClose: function(){
  2490. window.history.back();
  2491. }
  2492. //--------------------------------------
  2493. //+ PUBLIC METHODS / GETTERS / SETTERS
  2494. //--------------------------------------
  2495. //--------------------------------------
  2496. //+ EVENT HANDLERS
  2497. //--------------------------------------
  2498. //--------------------------------------
  2499. //+ PRIVATE AND PROTECTED METHODS
  2500. //--------------------------------------
  2501. });
  2502. },
  2503. "ModalRegion.js": function (exports, module, require) {
  2504. /**
  2505. * REGION: ModalRegion
  2506. * Used to manage Twitter Bootstrap Modals with Backbone Marionette Views
  2507. */
  2508. module.exports = Backbone.Marionette.Region.extend({
  2509. el: "#modals-container",
  2510. constructor: function(){
  2511. _.bindAll(this);
  2512. Backbone.Marionette.Region.prototype.constructor.apply(this, arguments);
  2513. this.on("show", this.showModal, this);
  2514. },
  2515. getEl: function(selector){
  2516. var $el = $(selector);
  2517. $el.on("hidden", this.close);
  2518. return $el;
  2519. },
  2520. showModal: function(view){
  2521. view.on("close", this.hideModal, this);
  2522. this.$el.modal('show');
  2523. },
  2524. hideModal: function(){
  2525. this.$el.modal('hide');
  2526. }
  2527. });
  2528. },
  2529. "Profile": {
  2530. "Card.js": function (exports, module, require) {
  2531. /**
  2532. * VIEW: ProfileCard
  2533. *
  2534. */
  2535. var template = require('./templates/card.hbs');
  2536. module.exports = Backbone.Marionette.ItemView.extend({
  2537. //--------------------------------------
  2538. //+ PUBLIC PROPERTIES / CONSTANTS
  2539. //--------------------------------------
  2540. className: "boxxy",
  2541. template: template,
  2542. modelEvents:{
  2543. "change": "render"
  2544. },
  2545. //--------------------------------------
  2546. //+ INHERITED / OVERRIDES
  2547. //--------------------------------------
  2548. //--------------------------------------
  2549. //+ PUBLIC METHODS / GETTERS / SETTERS
  2550. //--------------------------------------
  2551. //--------------------------------------
  2552. //+ EVENT HANDLERS
  2553. //--------------------------------------
  2554. //--------------------------------------
  2555. //+ PRIVATE AND PROTECTED METHODS
  2556. //--------------------------------------
  2557. });
  2558. },
  2559. "CardEdit.js": function (exports, module, require) {
  2560. /**
  2561. * VIEW: ProfileCard Edit
  2562. *
  2563. */
  2564. var template = require('./templates/cardEdit.hbs');
  2565. module.exports = Backbone.Marionette.ItemView.extend({
  2566. //--------------------------------------
  2567. //+ PUBLIC PROPERTIES / CONSTANTS
  2568. //--------------------------------------
  2569. className: "boxxy",
  2570. template: template,
  2571. ui: {
  2572. "name": "input[name=name]",
  2573. "email": "input[name=email]",
  2574. "bio": "textarea[name=bio]"
  2575. },
  2576. events: {
  2577. "click #save": "saveProfile",
  2578. "click #cancel": "cancel"
  2579. },
  2580. modelEvents:{
  2581. "change": "render"
  2582. },
  2583. //--------------------------------------
  2584. //+ INHERITED / OVERRIDES
  2585. //--------------------------------------
  2586. //--------------------------------------
  2587. //+ PUBLIC METHODS / GETTERS / SETTERS
  2588. //--------------------------------------
  2589. //--------------------------------------
  2590. //+ EVENT HANDLERS
  2591. //--------------------------------------
  2592. saveProfile: function(){
  2593. var toSave = {};
  2594. _.each(this.ui, function(ele, type){
  2595. toSave[type] = ele.val();
  2596. }, this);
  2597. this.cleanErrors();
  2598. $("#save", this.$el).button('loading');
  2599. this.model
  2600. .save(toSave, { patch: true, silent: true })
  2601. .error(this.showError.bind(this));
  2602. },
  2603. cancel: function(){
  2604. hackdash.app.router.navigate("/", { trigger: true, replace: true });
  2605. },
  2606. //--------------------------------------
  2607. //+ PRIVATE AND PROTECTED METHODS
  2608. //--------------------------------------
  2609. //TODO: move to i18n
  2610. errors: {
  2611. "name_required": "Name is required",
  2612. "email_required": "Email is required",
  2613. "email_invalid": "Invalid Email"
  2614. },
  2615. showError: function(err){
  2616. $("#save", this.$el).button('reset');
  2617. if (err.responseText === "OK"){
  2618. return;
  2619. }
  2620. var error = JSON.parse(err.responseText).error;
  2621. var ctrl = error.split("_")[0];
  2622. this.ui[ctrl].parents('.control-group').addClass('error');
  2623. this.ui[ctrl].after('<span class="help-inline">' + this.errors[error] + '</span>');
  2624. },
  2625. cleanErrors: function(){
  2626. $(".error", this.$el).removeClass("error");
  2627. $("span.help-inline", this.$el).remove();
  2628. }
  2629. });
  2630. },
  2631. "index.js": function (exports, module, require) {
  2632. var
  2633. template = require("./templates/profile.hbs")
  2634. , ProfileCard = require("./Card")
  2635. , ProfileCardEdit = require("./CardEdit")
  2636. , ProjectList = require("../Project/List");
  2637. module.exports = Backbone.Marionette.Layout.extend({
  2638. //--------------------------------------
  2639. //+ PUBLIC PROPERTIES / CONSTANTS
  2640. //--------------------------------------
  2641. className: "container profile-ctn",
  2642. template: template,
  2643. regions: {
  2644. "profileCard": ".profile-card",
  2645. "collections": ".collections-ctn",
  2646. "dashboards": ".dashboards-ctn",
  2647. "projects": ".projects-ctn",
  2648. "contributions": ".contributions-ctn",
  2649. "likes": ".likes-ctn",
  2650. },
  2651. ui: {
  2652. "collectionsLen": ".coll-length",
  2653. "dashboardsLen": ".dash-length",
  2654. "projectsLen": ".proj-length",
  2655. "contributionsLen": ".contrib-length",
  2656. "likesLen": ".likes-length"
  2657. },
  2658. //--------------------------------------
  2659. //+ INHERITED / OVERRIDES
  2660. //--------------------------------------
  2661. onRender: function(){
  2662. if (hackdash.user && this.model.get("_id") === hackdash.user._id){
  2663. this.profileCard.show(new ProfileCardEdit({
  2664. model: this.model
  2665. }));
  2666. }
  2667. else {
  2668. this.profileCard.show(new ProfileCard({
  2669. model: this.model
  2670. }));
  2671. }
  2672. this.collections.show(new ProjectList({
  2673. collection: this.model.get("collections"),
  2674. isCollection: true
  2675. }));
  2676. this.dashboards.show(new ProjectList({
  2677. collection: this.model.get("dashboards"),
  2678. isDashboard: true
  2679. }));
  2680. this.projects.show(new ProjectList({
  2681. collection: this.model.get("projects")
  2682. }));
  2683. this.contributions.show(new ProjectList({
  2684. collection: this.model.get("contributions")
  2685. }));
  2686. this.likes.show(new ProjectList({
  2687. collection: this.model.get("likes")
  2688. }));
  2689. $('.tooltips', this.$el).tooltip({});
  2690. this.model.get("collections").on("reset", this.updateCount.bind(this, "collections"));
  2691. this.model.get("dashboards").on("reset", this.updateCount.bind(this, "dashboards"));
  2692. this.model.get("projects").on("reset", this.updateCount.bind(this, "projects"));
  2693. this.model.get("contributions").on("reset", this.updateCount.bind(this, "contributions"));
  2694. this.model.get("likes").on("reset", this.updateCount.bind(this, "likes"));
  2695. },
  2696. //--------------------------------------
  2697. //+ PUBLIC METHODS / GETTERS / SETTERS
  2698. //--------------------------------------
  2699. //--------------------------------------
  2700. //+ EVENT HANDLERS
  2701. //--------------------------------------
  2702. updateCount: function(which){
  2703. this.ui[which + "Len"].text(this.model.get(which).length);
  2704. }
  2705. //--------------------------------------
  2706. //+ PRIVATE AND PROTECTED METHODS
  2707. //--------------------------------------
  2708. });
  2709. },
  2710. "templates": {
  2711. "card.hbs.js": function (exports, module, require) {
  2712. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2713. this.compilerInfo = [4,'>= 1.0.0'];
  2714. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2715. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  2716. buffer += "<h3 class=\"header\">\n <img src=\"";
  2717. if (stack1 = helpers.picture) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2718. else { stack1 = depth0.picture; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2719. buffer += escapeExpression(stack1)
  2720. + "\" style=\"margin-right: 10px;\" class=\"avatar\">\n ";
  2721. if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2722. else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2723. buffer += escapeExpression(stack1)
  2724. + "\n</h3>\n<div class=\"profileInfo\">\n <p><strong>Email: </strong>";
  2725. if (stack1 = helpers.email) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2726. else { stack1 = depth0.email; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2727. buffer += escapeExpression(stack1)
  2728. + "</p>\n <p><strong>Bio: </strong>";
  2729. if (stack1 = helpers.bio) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2730. else { stack1 = depth0.bio; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2731. buffer += escapeExpression(stack1)
  2732. + "</p>\n</div>";
  2733. return buffer;
  2734. })
  2735. ;
  2736. },
  2737. "cardEdit.hbs.js": function (exports, module, require) {
  2738. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2739. this.compilerInfo = [4,'>= 1.0.0'];
  2740. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2741. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  2742. buffer += "<h3 class=\"header\">Edit Your Profile</h3>\n<div>\n <form>\n <div class=\"form-content\">\n <div class=\"control-group\">\n <div class=\"controls\">\n <input name=\"name\" type=\"text\" placeholder=\"Name\" value=\"";
  2743. if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2744. else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2745. buffer += escapeExpression(stack1)
  2746. + "\" class=\"input-block-level\"/>\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\"> \n <input name=\"email\" type=\"text\" placeholder=\"Email\" value=\"";
  2747. if (stack1 = helpers.email) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2748. else { stack1 = depth0.email; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2749. buffer += escapeExpression(stack1)
  2750. + "\" class=\"input-block-level\"/>\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\">\n <textarea name=\"bio\" placeholder=\"Some about you\" class=\"input-block-level\">";
  2751. if (stack1 = helpers.bio) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  2752. else { stack1 = depth0.bio; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  2753. buffer += escapeExpression(stack1)
  2754. + "</textarea>\n </div>\n </div>\n </div>\n <div class=\"form-actions\">\n <input id=\"save\" type=\"button\" data-loading-text=\"saving..\" value=\"Save profile\" class=\"btn primary btn-success pull-left\"/>\n <a id=\"cancel\" class=\"cancel btn btn-cancel pull-right\">Cancel</a>\n </div>\n </form>\n</div>";
  2755. return buffer;
  2756. })
  2757. ;
  2758. },
  2759. "profile.hbs.js": function (exports, module, require) {
  2760. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  2761. this.compilerInfo = [4,'>= 1.0.0'];
  2762. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  2763. return "<div class=\"span6 span-center\">\n\n <div class=\"profile-card\"></div>\n\n <h4>My Collections (<span class=\"coll-length\">0</span>)</h4>\n <div class=\"collections-ctn\"></div>\n\n <h4>Dashboards (<span class=\"dash-length\">0</span>)</h4>\n <div class=\"dashboards-ctn\"></div>\n\n <h4>Projects created (<span class=\"proj-length\">0</span>)</h4>\n <div class=\"projects-ctn\"></div>\n\n <h4>Contributions (<span class=\"contrib-length\">0</span>)</h4>\n <div class=\"contributions-ctn\"></div>\n\n <h4>Likes (<span class=\"likes-length\">0</span>)</h4>\n <div class=\"likes-ctn\"></div>\n \n</div>\n";
  2764. })
  2765. ;
  2766. }
  2767. }
  2768. },
  2769. "Project": {
  2770. "Collection.js": function (exports, module, require) {
  2771. /**
  2772. * VIEW: Projects of an Instance
  2773. *
  2774. */
  2775. var Project = require('./index');
  2776. module.exports = Backbone.Marionette.CollectionView.extend({
  2777. //--------------------------------------
  2778. //+ PUBLIC PROPERTIES / CONSTANTS
  2779. //--------------------------------------
  2780. id: "projects",
  2781. className: "row projects",
  2782. itemView: Project,
  2783. collectionEvents: {
  2784. "remove": "render",
  2785. "sort:date": "sortByDate",
  2786. "sort:name": "sortByName",
  2787. "sort:showcase": "sortByShowcase"
  2788. },
  2789. gridSize: {
  2790. columnWidth: 300,
  2791. rowHeight: 220
  2792. },
  2793. //--------------------------------------
  2794. //+ INHERITED / OVERRIDES
  2795. //--------------------------------------
  2796. initialize: function(options){
  2797. this.showcaseMode = (options && options.showcaseMode) || false;
  2798. this.showcaseSort = (options && options.showcaseSort) || false;
  2799. },
  2800. onRender: function(){
  2801. var self = this;
  2802. _.defer(function(){
  2803. if (self.showcaseSort) {
  2804. self.updateIsotope("showcase", ".filter-active");
  2805. }
  2806. else {
  2807. self.updateIsotope();
  2808. }
  2809. if (self.showcaseMode){
  2810. self.startSortable();
  2811. }
  2812. });
  2813. },
  2814. //--------------------------------------
  2815. //+ PUBLIC METHODS / GETTERS / SETTERS
  2816. //--------------------------------------
  2817. updateShowcaseOrder: function(){
  2818. var itemElems = this.pckry.getItemElements();
  2819. var showcase = [];
  2820. for ( var i=0, len = itemElems.length; i < len; i++ ) {
  2821. var elem = itemElems[i];
  2822. $(elem).data('showcase', i);
  2823. var found = this.collection.where({ _id: elem.id, active: true });
  2824. if (found.length > 0){
  2825. found[0].set({
  2826. "showcase": i
  2827. }, { silent: true });
  2828. }
  2829. showcase.push(elem.id);
  2830. }
  2831. this.pckry.destroy();
  2832. return showcase;
  2833. },
  2834. //--------------------------------------
  2835. //+ EVENT HANDLERS
  2836. //--------------------------------------
  2837. sortByName: function(){
  2838. this.$el
  2839. .isotope({"filter": ""})
  2840. .isotope({"sortBy": "name"});
  2841. },
  2842. sortByDate: function(){
  2843. this.$el
  2844. .isotope({"filter": ""})
  2845. .isotope({"sortBy": "date"});
  2846. },
  2847. sortByShowcase: function(){
  2848. this.$el
  2849. .isotope({"filter": ".filter-active"})
  2850. .isotope({"sortBy": "showcase"});
  2851. },
  2852. //--------------------------------------
  2853. //+ PRIVATE AND PROTECTED METHODS
  2854. //--------------------------------------
  2855. isotopeInitialized: false,
  2856. updateIsotope: function(sortType, filterType){
  2857. var $projects = this.$el;
  2858. if (this.isotopeInitialized){
  2859. $projects.isotope("destroy");
  2860. }
  2861. $projects.isotope({
  2862. itemSelector: ".project"
  2863. , animationEngine: "jquery"
  2864. , resizable: true
  2865. , sortAscending: true
  2866. , cellsByColumn: this.gridSize
  2867. , getSortData : {
  2868. "name" : function ( $elem ) {
  2869. var name = $elem.data("name");
  2870. return name && name.toLowerCase() || "";
  2871. },
  2872. "date" : function ( $elem ) {
  2873. return $elem.data("date");
  2874. },
  2875. "showcase" : function ( $elem ) {
  2876. var showcase = $elem.data("showcase");
  2877. return (showcase && window.parseInt(showcase)) || 0;
  2878. },
  2879. }
  2880. , sortBy: sortType || "name"
  2881. , filter: filterType || ""
  2882. });
  2883. this.isotopeInitialized = true;
  2884. },
  2885. startSortable: function(){
  2886. var $projects = this.$el;
  2887. $projects.addClass("showcase");
  2888. this.sortByShowcase();
  2889. if (this.pckry){
  2890. this.pckry.destroy();
  2891. }
  2892. this.pckry = new Packery( $projects[0], this.gridSize);
  2893. var itemElems = this.pckry.getItemElements();
  2894. for ( var i=0, len = itemElems.length; i < len; i++ ) {
  2895. var elem = itemElems[i];
  2896. var draggie = new Draggabilly( elem );
  2897. this.pckry.bindDraggabillyEvents( draggie );
  2898. }
  2899. var self = this;
  2900. this.pckry.on( 'dragItemPositioned', function() {
  2901. self.model.isDirty = true;
  2902. });
  2903. }
  2904. });
  2905. },
  2906. "Edit.js": function (exports, module, require) {
  2907. /**
  2908. * VIEW: Project
  2909. *
  2910. */
  2911. var template = require('./templates/edit.hbs');
  2912. module.exports = Backbone.Marionette.ItemView.extend({
  2913. //--------------------------------------
  2914. //+ PUBLIC PROPERTIES / CONSTANTS
  2915. //--------------------------------------
  2916. className: "span6 span-center",
  2917. template: template,
  2918. ui: {
  2919. "title": "input[name=title]",
  2920. "description": "textarea[name=description]",
  2921. "link": "input[name=link]",
  2922. "tags": "input[name=tags]",
  2923. "status": "select[name=status]",
  2924. },
  2925. events: {
  2926. "click #ghImportBtn": "showGhImport",
  2927. "click #searchGh": "searchRepo",
  2928. "click #save": "save",
  2929. "click #cancel": "cancel"
  2930. },
  2931. templateHelpers: {
  2932. typeForm: function(){
  2933. return (this._id ? "Edit Project" : "Create Project" );
  2934. },
  2935. getTags: function(){
  2936. if (this.tags){
  2937. return this.tags.join(',');
  2938. }
  2939. },
  2940. statuses: function(){
  2941. return window.hackdash.statuses.split(",");
  2942. }
  2943. },
  2944. modelEvents: {
  2945. "change": "render"
  2946. },
  2947. //--------------------------------------
  2948. //+ INHERITED / OVERRIDES
  2949. //--------------------------------------
  2950. onDomRefresh: function(){
  2951. this.initSelect2();
  2952. this.initImageDrop();
  2953. },
  2954. //--------------------------------------
  2955. //+ PUBLIC METHODS / GETTERS / SETTERS
  2956. //--------------------------------------
  2957. //--------------------------------------
  2958. //+ EVENT HANDLERS
  2959. //--------------------------------------
  2960. showGhImport: function(e){
  2961. $(".gh-import", this.$el).removeClass('hidden');
  2962. $(e.currentTarget).remove();
  2963. e.preventDefault();
  2964. },
  2965. searchRepo: function(e){
  2966. var repo = $("#txt-repo", this.$el).val();
  2967. if(repo.length) {
  2968. $.ajax({
  2969. url: 'https://api.github.com/repos/' + repo,
  2970. dataType: 'json',
  2971. contentType: 'json',
  2972. context: this
  2973. }).done(this.fillGhProjectForm);
  2974. }
  2975. e.preventDefault();
  2976. },
  2977. save: function(){
  2978. var toSave = {
  2979. title: this.ui.title.val(),
  2980. description: this.ui.description.val(),
  2981. link: this.ui.link.val(),
  2982. tags: this.ui.tags.val().split(','),
  2983. status: this.ui.status.val(),
  2984. cover: this.model.get('cover')
  2985. };
  2986. this.cleanErrors();
  2987. $("#save", this.$el).button('loading');
  2988. this.model
  2989. .save(toSave, { patch: true, silent: true })
  2990. .success(this.redirect.bind(this))
  2991. .error(this.showError.bind(this));
  2992. },
  2993. cancel: function(){
  2994. this.redirect();
  2995. },
  2996. redirect: function(){
  2997. hackdash.app.router.navigate("/", { trigger: true, replace: true });
  2998. },
  2999. //--------------------------------------
  3000. //+ PRIVATE AND PROTECTED METHODS
  3001. //--------------------------------------
  3002. //TODO: move to i18n
  3003. errors: {
  3004. "title_required": "Title is required",
  3005. "description_required": "Description is required"
  3006. },
  3007. showError: function(err){
  3008. $("#save", this.$el).button('reset');
  3009. if (err.responseText === "OK"){
  3010. this.redirect();
  3011. return;
  3012. }
  3013. var error = JSON.parse(err.responseText).error;
  3014. var ctrl = error.split("_")[0];
  3015. this.ui[ctrl].parents('.control-group').addClass('error');
  3016. this.ui[ctrl].after('<span class="help-inline">' + this.errors[error] + '</span>');
  3017. },
  3018. cleanErrors: function(){
  3019. $(".error", this.$el).removeClass("error");
  3020. $("span.help-inline", this.$el).remove();
  3021. },
  3022. initSelect2: function(){
  3023. this.ui.status.select2({
  3024. minimumResultsForSearch: 10
  3025. });
  3026. $('a.select2-choice').attr('href', null);
  3027. this.ui.tags.select2({
  3028. tags:[],
  3029. formatNoMatches: function(){ return ''; },
  3030. maximumInputLength: 20,
  3031. tokenSeparators: [","]
  3032. });
  3033. },
  3034. initImageDrop: function(){
  3035. var self = this;
  3036. var $dragdrop = $('#dragdrop', this.$el);
  3037. var input = $('#cover_fall', $dragdrop);
  3038. input.on('click', function(e){
  3039. e.stopPropagation();
  3040. });
  3041. $dragdrop.on('click', function(e){
  3042. input.click();
  3043. e.preventDefault();
  3044. return false;
  3045. });
  3046. $dragdrop.filedrop({
  3047. fallback_id: 'cover_fall',
  3048. url: hackdash.apiURL + '/projects/cover',
  3049. paramname: 'cover',
  3050. allowedfiletypes: ['image/jpeg','image/png','image/gif'],
  3051. maxfiles: 1,
  3052. maxfilesize: 3,
  3053. dragOver: function () {
  3054. $dragdrop.css('background', 'rgb(226, 255, 226)');
  3055. },
  3056. dragLeave: function () {
  3057. $dragdrop.css('background', 'rgb(241, 241, 241)');
  3058. },
  3059. drop: function () {
  3060. $dragdrop.css('background', 'rgb(241, 241, 241)');
  3061. },
  3062. uploadFinished: function(i, file, res) {
  3063. self.model.set({ "cover": res.href }, { silent: true });
  3064. $dragdrop
  3065. .css('background', 'url(' + res.href + ')')
  3066. .addClass("project-image")
  3067. .children('p').hide();
  3068. }
  3069. });
  3070. },
  3071. fillGhProjectForm: function(project) {
  3072. this.ui.title.val(project.name);
  3073. this.ui.description.text(project.description);
  3074. this.ui.link.val(project.html_url);
  3075. this.ui.tags.select2("data", [{id: project.language, text:project.language}]);
  3076. this.ui.status.select2("val", "building");
  3077. }
  3078. });
  3079. },
  3080. "Full.js": function (exports, module, require) {
  3081. /**
  3082. * VIEW: Full Project view
  3083. *
  3084. */
  3085. var template = require('./templates/full.hbs');
  3086. module.exports = Backbone.Marionette.ItemView.extend({
  3087. //--------------------------------------
  3088. //+ PUBLIC PROPERTIES / CONSTANTS
  3089. //--------------------------------------
  3090. id: function(){
  3091. return this.model.get("_id");
  3092. },
  3093. className: "project tooltips",
  3094. template: template,
  3095. modelEvents: {
  3096. "change": "render"
  3097. },
  3098. //--------------------------------------
  3099. //+ INHERITED / OVERRIDES
  3100. //--------------------------------------
  3101. onRender: function(){
  3102. this.$el
  3103. .addClass(this.model.get("status"))
  3104. .attr({ "title": this.model.get("status") })
  3105. .tooltip({});
  3106. $('.tooltips', this.$el).tooltip({});
  3107. }
  3108. //--------------------------------------
  3109. //+ PUBLIC METHODS / GETTERS / SETTERS
  3110. //--------------------------------------
  3111. //--------------------------------------
  3112. //+ EVENT HANDLERS
  3113. //--------------------------------------
  3114. //--------------------------------------
  3115. //+ PRIVATE AND PROTECTED METHODS
  3116. //--------------------------------------
  3117. });
  3118. },
  3119. "Layout.js": function (exports, module, require) {
  3120. /**
  3121. * VIEW: Dashboard Projects Layout
  3122. *
  3123. */
  3124. var template = require('./templates/layout.hbs')
  3125. , ProjectsView = require('./Collection');
  3126. module.exports = Backbone.Marionette.Layout.extend({
  3127. //--------------------------------------
  3128. //+ PUBLIC PROPERTIES / CONSTANTS
  3129. //--------------------------------------
  3130. template: template,
  3131. ui: {
  3132. inactiveCtn: ".inactive-ctn"
  3133. },
  3134. regions: {
  3135. "dashboard": "#dashboard-projects",
  3136. "inactives": "#inactive-projects"
  3137. },
  3138. modelEvents:{
  3139. "edit:showcase": "onStartEditShowcase",
  3140. "end:showcase": "onEndEditShowcase",
  3141. "save:showcase": "onSaveEditShowcase"
  3142. },
  3143. //--------------------------------------
  3144. //+ INHERITED / OVERRIDES
  3145. //--------------------------------------
  3146. showcaseMode: false,
  3147. showcaseSort: false,
  3148. onRender: function(){
  3149. if (this.showcaseMode){
  3150. this.dashboard.show(new ProjectsView({
  3151. model: this.model,
  3152. collection: hackdash.app.projects.getActives(),
  3153. showcaseMode: true
  3154. }));
  3155. this.ui.inactiveCtn.removeClass("hide");
  3156. this.inactives.show(new ProjectsView({
  3157. model: this.model,
  3158. collection: hackdash.app.projects.getInactives()
  3159. }));
  3160. var self = this;
  3161. hackdash.app.projects.off("change:active").on("change:active", function(){
  3162. self.dashboard.currentView.collection = hackdash.app.projects.getActives();
  3163. self.inactives.currentView.collection = hackdash.app.projects.getInactives();
  3164. self.model.isDirty = true;
  3165. self.dashboard.currentView.render();
  3166. self.inactives.currentView.render();
  3167. });
  3168. }
  3169. else {
  3170. this.ui.inactiveCtn.addClass("hide");
  3171. this.dashboard.show(new ProjectsView({
  3172. model: this.model,
  3173. collection: hackdash.app.projects,
  3174. showcaseMode: false,
  3175. showcaseSort: this.showcaseSort
  3176. }));
  3177. }
  3178. },
  3179. //--------------------------------------
  3180. //+ PUBLIC METHODS / GETTERS / SETTERS
  3181. //--------------------------------------
  3182. //--------------------------------------
  3183. //+ EVENT HANDLERS
  3184. //--------------------------------------
  3185. onStartEditShowcase: function(){
  3186. this.showcaseMode = true;
  3187. this.render();
  3188. },
  3189. onSaveEditShowcase: function(){
  3190. var showcase = this.dashboard.currentView.updateShowcaseOrder();
  3191. this.model.save({ "showcase": showcase });
  3192. this.model.isDirty = false;
  3193. this.onEndEditShowcase();
  3194. },
  3195. onEndEditShowcase: function(){
  3196. this.model.isShowcaseMode = false;
  3197. this.model.trigger("change");
  3198. this.showcaseSort = true;
  3199. this.showcaseMode = false;
  3200. this.render();
  3201. },
  3202. //--------------------------------------
  3203. //+ PRIVATE AND PROTECTED METHODS
  3204. //--------------------------------------
  3205. });
  3206. },
  3207. "List.js": function (exports, module, require) {
  3208. /**
  3209. * VIEW: Projects of an Instance
  3210. *
  3211. */
  3212. var Project = require('./ListItem');
  3213. module.exports = Backbone.Marionette.CollectionView.extend({
  3214. //--------------------------------------
  3215. //+ PUBLIC PROPERTIES / CONSTANTS
  3216. //--------------------------------------
  3217. tagName: "ul",
  3218. itemView: Project,
  3219. itemViewOptions: function() {
  3220. return {
  3221. isDashboard: this.isDashboard,
  3222. isCollection: this.isCollection
  3223. };
  3224. },
  3225. showAll: false,
  3226. //--------------------------------------
  3227. //+ INHERITED / OVERRIDES
  3228. //--------------------------------------
  3229. initialize: function(options){
  3230. this.fullList = options.collection;
  3231. this.isDashboard = (options && options.isDashboard) || false;
  3232. this.isCollection = (options && options.isCollection) || false;
  3233. },
  3234. onBeforeRender: function(){
  3235. if (this.fullList.length > 5){
  3236. if (this.showAll) {
  3237. this.collection = this.fullList;
  3238. }
  3239. else {
  3240. this.collection = new Backbone.Collection(this.fullList.first(5));
  3241. }
  3242. }
  3243. },
  3244. onRender: function(){
  3245. $(".show-more", this.$el).add(".show-less", this.$el).remove();
  3246. if (this.fullList.length > 5){
  3247. var li;
  3248. if (this.showAll){
  3249. li = $('<li class="show-less">Show less</li>');
  3250. li.on("click", this.toggleAll.bind(this));
  3251. }
  3252. else {
  3253. li = $('<li class="show-more">Show more</li>');
  3254. li.on("click", this.toggleAll.bind(this));
  3255. }
  3256. this.$el.append(li);
  3257. }
  3258. },
  3259. //--------------------------------------
  3260. //+ PUBLIC METHODS / GETTERS / SETTERS
  3261. //--------------------------------------
  3262. //--------------------------------------
  3263. //+ EVENT HANDLERS
  3264. //--------------------------------------
  3265. toggleAll: function(){
  3266. this.showAll = !this.showAll;
  3267. this.render();
  3268. }
  3269. //--------------------------------------
  3270. //+ PRIVATE AND PROTECTED METHODS
  3271. //--------------------------------------
  3272. });
  3273. },
  3274. "ListItem.js": function (exports, module, require) {
  3275. /**
  3276. * VIEW: Project
  3277. *
  3278. */
  3279. var template = require('./templates/listItem.hbs');
  3280. module.exports = Backbone.Marionette.ItemView.extend({
  3281. //--------------------------------------
  3282. //+ PUBLIC PROPERTIES / CONSTANTS
  3283. //--------------------------------------
  3284. tagName: "li tooltips",
  3285. template: template,
  3286. //--------------------------------------
  3287. //+ INHERITED / OVERRIDES
  3288. //--------------------------------------
  3289. initialize: function(options){
  3290. this.isDashboard = (options && options.isDashboard) || false;
  3291. this.isCollection = (options && options.isCollection) || false;
  3292. },
  3293. onRender: function(){
  3294. this.$el
  3295. .addClass(this.model.get("status"))
  3296. .attr({
  3297. "title": this.model.get("status"),
  3298. "data-placement": "left"
  3299. })
  3300. .tooltip({});
  3301. },
  3302. serializeData: function(){
  3303. var url;
  3304. if (this.isDashboard){
  3305. url = "http://" + this.model.get("title") + "." + hackdash.baseURL;
  3306. }
  3307. else if(this.isCollection){
  3308. url = "http://" + hackdash.baseURL + "/collections/" + this.model.get("_id");
  3309. }
  3310. else {
  3311. url = "http://" + this.model.get("domain") + "." + hackdash.baseURL +
  3312. "/projects/" + this.model.get("_id");
  3313. }
  3314. return _.extend({
  3315. url: url
  3316. }, this.model.toJSON());
  3317. }
  3318. //--------------------------------------
  3319. //+ PUBLIC METHODS / GETTERS / SETTERS
  3320. //--------------------------------------
  3321. //--------------------------------------
  3322. //+ EVENT HANDLERS
  3323. //--------------------------------------
  3324. //--------------------------------------
  3325. //+ PRIVATE AND PROTECTED METHODS
  3326. //--------------------------------------
  3327. });
  3328. },
  3329. "index.js": function (exports, module, require) {
  3330. /**
  3331. * VIEW: Project
  3332. *
  3333. */
  3334. var template = require('./templates/project.hbs');
  3335. module.exports = Backbone.Marionette.ItemView.extend({
  3336. //--------------------------------------
  3337. //+ PUBLIC PROPERTIES / CONSTANTS
  3338. //--------------------------------------
  3339. id: function(){
  3340. return this.model.get("_id");
  3341. },
  3342. className: "project tooltips span4",
  3343. template: template,
  3344. ui: {
  3345. "switcher": ".switcher input"
  3346. },
  3347. events: {
  3348. "click .contributor a": "onContribute",
  3349. "click .follower a": "onFollow",
  3350. "click .remove a": "onRemove",
  3351. "click .edit a": "stopPropagation",
  3352. "click .demo a": "stopPropagation",
  3353. "click .switcher": "stopPropagation",
  3354. "click #contributors a": "stopPropagation"
  3355. },
  3356. templateHelpers: {
  3357. instanceURL: function(){
  3358. return "http://" + this.domain + "." + hackdash.baseURL;
  3359. },
  3360. showActions: function(){
  3361. return hackdash.user._id !== this.leader._id;
  3362. },
  3363. isAdminOrLeader: function(){
  3364. var user = hackdash.user;
  3365. return user._id === this.leader._id || user.admin_in.indexOf(this.domain) >= 0;
  3366. }
  3367. },
  3368. modelEvents: {
  3369. "change": "render"
  3370. },
  3371. //--------------------------------------
  3372. //+ INHERITED / OVERRIDES
  3373. //--------------------------------------
  3374. onRender: function(){
  3375. this.$el
  3376. .addClass(this.model.get("status"))
  3377. .attr({
  3378. "title": this.model.get("status")
  3379. , "data-name": this.model.get("title")
  3380. , "data-date": this.model.get("created_at")
  3381. , "data-showcase": this.model.get("showcase")
  3382. })
  3383. .tooltip({});
  3384. if (this.model.get("active")){
  3385. this.$el.addClass('filter-active');
  3386. }
  3387. else {
  3388. this.$el.removeClass('filter-active');
  3389. }
  3390. $('.tooltips', this.$el).tooltip({});
  3391. var url = "http://" + this.model.get("domain") + "." + hackdash.baseURL +
  3392. "/projects/" + this.model.get("_id");
  3393. this.$el.on("click", function(){
  3394. if (!$('.projects').hasClass("showcase")){
  3395. window.location = url;
  3396. }
  3397. });
  3398. this.initSwitcher();
  3399. },
  3400. serializeData: function(){
  3401. return _.extend({
  3402. isShowcaseMode: hackdash.app.dashboard && hackdash.app.dashboard.isShowcaseMode,
  3403. contributing: this.isContributor(),
  3404. following: this.isFollower()
  3405. }, this.model.toJSON());
  3406. },
  3407. //--------------------------------------
  3408. //+ PUBLIC METHODS / GETTERS / SETTERS
  3409. //--------------------------------------
  3410. //--------------------------------------
  3411. //+ EVENT HANDLERS
  3412. //--------------------------------------
  3413. stopPropagation: function(e){
  3414. e.stopPropagation();
  3415. },
  3416. onContribute: function(e){
  3417. if (this.isContributor()){
  3418. this.model.leave();
  3419. }
  3420. else {
  3421. this.model.join();
  3422. }
  3423. e.stopPropagation();
  3424. },
  3425. onFollow: function(e){
  3426. if (this.isFollower()){
  3427. this.model.unfollow();
  3428. }
  3429. else {
  3430. this.model.follow();
  3431. }
  3432. e.stopPropagation();
  3433. },
  3434. onRemove: function(e){
  3435. if (window.confirm("This project is going to be deleted. Are you sure?")){
  3436. this.model.destroy();
  3437. }
  3438. e.stopPropagation();
  3439. },
  3440. //--------------------------------------
  3441. //+ PRIVATE AND PROTECTED METHODS
  3442. //--------------------------------------
  3443. initSwitcher: function(){
  3444. var self = this;
  3445. this.ui.switcher
  3446. .bootstrapSwitch()
  3447. .on('switch-change', function (e, data) {
  3448. self.model.set("active", data.value);
  3449. });
  3450. },
  3451. isContributor: function(){
  3452. return this.userExist(this.model.get("contributors"));
  3453. },
  3454. isFollower: function(){
  3455. return this.userExist(this.model.get("followers"));
  3456. },
  3457. userExist: function(arr){
  3458. if (!hackdash.user){
  3459. return false;
  3460. }
  3461. var uid = hackdash.user._id;
  3462. return _.find(arr, function(usr){
  3463. return (usr._id === uid);
  3464. }) ? true : false;
  3465. }
  3466. });
  3467. },
  3468. "templates": {
  3469. "edit.hbs.js": function (exports, module, require) {
  3470. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3471. this.compilerInfo = [4,'>= 1.0.0'];
  3472. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3473. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
  3474. function program1(depth0,data) {
  3475. return "\n <div id=\"ghImportHolder\">\n <a id=\"ghImportBtn\">Import from Github</a>\n\n <div class=\"gh-import control-group hidden\">\n <div class=\"controls\">\n <input id=\"txt-repo\" type=\"text\" placeholder=\"repo user/name\" name=\"repo\" class=\"input-block-level\"/>\n <button id=\"searchGh\" class=\"btn\">Import</button>\n </div>\n </div>\n </div>\n ";
  3476. }
  3477. function program3(depth0,data) {
  3478. var buffer = "", stack1;
  3479. buffer += "style=\"background: url(";
  3480. if (stack1 = helpers.cover) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3481. else { stack1 = depth0.cover; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3482. buffer += escapeExpression(stack1)
  3483. + ");\" class=\"project-image\"";
  3484. return buffer;
  3485. }
  3486. function program5(depth0,data) {
  3487. var buffer = "";
  3488. buffer += "\n <option value=\""
  3489. + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
  3490. + "\">"
  3491. + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
  3492. + "</option>\n ";
  3493. return buffer;
  3494. }
  3495. buffer += "<div class=\"boxxy\">\n <h3 class=\"header\">";
  3496. if (stack1 = helpers.typeForm) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3497. else { stack1 = depth0.typeForm; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3498. buffer += escapeExpression(stack1)
  3499. + "</h3>\n <div>\n <form>\n <div class=\"form-content\">\n ";
  3500. stack1 = helpers.unless.call(depth0, depth0._id, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  3501. if(stack1 || stack1 === 0) { buffer += stack1; }
  3502. buffer += "\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <input type=\"text\" placeholder=\"Title\" name=\"title\" class=\"input-block-level\" value=\"";
  3503. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3504. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3505. buffer += escapeExpression(stack1)
  3506. + "\"/>\n </div>\n </div>\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <textarea id=\"description\" name=\"description\" rows=\"4\" maxlength=\"400\" placeholder=\"Description\" class=\"input-block-level\">";
  3507. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3508. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3509. buffer += escapeExpression(stack1)
  3510. + "</textarea>\n </div>\n </div>\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <div id=\"dragdrop\" ";
  3511. stack1 = helpers['if'].call(depth0, depth0.cover, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
  3512. if(stack1 || stack1 === 0) { buffer += stack1; }
  3513. buffer += "> \n <p>Drag Photo Here\n <input type=\"file\" name=\"cover_fall\" id=\"cover_fall\"/>\n </p>\n </div>\n </div>\n </div>\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <input type=\"text\" name=\"link\" id=\"link\" placeholder=\"Link\" class=\"input-block-level\" value=\"";
  3514. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3515. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3516. buffer += escapeExpression(stack1)
  3517. + "\"/>\n </div>\n </div>\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <input type=\"text\" name=\"tags\" id=\"tags\" placeholder=\"Tags\" style=\"width: 100%\" class=\"input-block-level\" value=\"";
  3518. if (stack1 = helpers.getTags) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3519. else { stack1 = depth0.getTags; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3520. buffer += escapeExpression(stack1)
  3521. + "\"/>\n </div>\n </div>\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <select name=\"status\" id=\"status\" style=\"width: 100%\" class=\"input-block-level\" value=\"";
  3522. if (stack1 = helpers.status) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3523. else { stack1 = depth0.status; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3524. buffer += escapeExpression(stack1)
  3525. + "\">\n ";
  3526. stack1 = helpers.each.call(depth0, depth0.statuses, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  3527. if(stack1 || stack1 === 0) { buffer += stack1; }
  3528. buffer += "\n </select>\n </div>\n </div>\n\n </div>\n\n <div class=\"form-actions\">\n <input id=\"save\" type=\"button\" value=\"Save\" class=\"btn primary btn-success pull-left\"/>\n <a id=\"cancel\" data-dismiss=\"modal\" class=\"cancel btn btn-cancel pull-right\">Cancel</a>\n </div>\n\n </form>\n </div>\n</div>";
  3529. return buffer;
  3530. })
  3531. ;
  3532. },
  3533. "full.hbs.js": function (exports, module, require) {
  3534. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3535. this.compilerInfo = [4,'>= 1.0.0'];
  3536. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3537. var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
  3538. function program1(depth0,data) {
  3539. var buffer = "", stack1;
  3540. buffer += "\n <a href=\"";
  3541. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3542. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3543. buffer += escapeExpression(stack1)
  3544. + "\">";
  3545. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3546. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3547. buffer += escapeExpression(stack1)
  3548. + "</a>\n ";
  3549. return buffer;
  3550. }
  3551. function program3(depth0,data) {
  3552. var buffer = "";
  3553. buffer += "\n <li>"
  3554. + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
  3555. + "</li>\n ";
  3556. return buffer;
  3557. }
  3558. function program5(depth0,data) {
  3559. var buffer = "", stack1;
  3560. buffer += "\n <a href=\"/users/";
  3561. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3562. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3563. buffer += escapeExpression(stack1)
  3564. + "\">\n <img class=\"tooltips\" rel=\"tooltip\" \n src=\"";
  3565. if (stack1 = helpers.picture) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3566. else { stack1 = depth0.picture; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3567. buffer += escapeExpression(stack1)
  3568. + "\" data-id=\"";
  3569. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3570. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3571. buffer += escapeExpression(stack1)
  3572. + "\" title=\"";
  3573. if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3574. else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3575. buffer += escapeExpression(stack1)
  3576. + "\">\n </a>\n ";
  3577. return buffer;
  3578. }
  3579. buffer += "<div class=\"well\">\n \n <div class=\"well-header\">\n <h3><a href=\"/\">";
  3580. if (stack1 = helpers.domain) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3581. else { stack1 = depth0.domain; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3582. buffer += escapeExpression(stack1)
  3583. + "</a></h3>\n <h3>";
  3584. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3585. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3586. buffer += escapeExpression(stack1)
  3587. + "</h3>\n <p>";
  3588. if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3589. else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3590. buffer += escapeExpression(stack1)
  3591. + "</p>\n ";
  3592. stack1 = helpers['if'].call(depth0, depth0.link, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  3593. if(stack1 || stack1 === 0) { buffer += stack1; }
  3594. buffer += "\n </div>\n\n <div class=\"row-fluid\">\n\n <div class=\"well-sidebar span4\">\n <h6>Created</h6><strong>";
  3595. options = {hash:{},data:data};
  3596. buffer += escapeExpression(((stack1 = helpers.timeAgo || depth0.timeAgo),stack1 ? stack1.call(depth0, depth0.created_at, options) : helperMissing.call(depth0, "timeAgo", depth0.created_at, options)))
  3597. + "</strong>\n <h6>State</h6><strong>";
  3598. if (stack2 = helpers.status) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
  3599. else { stack2 = depth0.status; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
  3600. buffer += escapeExpression(stack2)
  3601. + "</strong>\n <h6>Tags</h6>\n <ul>\n ";
  3602. stack2 = helpers.each.call(depth0, depth0.tags, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
  3603. if(stack2 || stack2 === 0) { buffer += stack2; }
  3604. buffer += "\n </ul>\n </div>\n\n <div class=\"well-content span8\">\n\n <div class=\"span4\">\n <h5>Managed by</h5>\n <a href=\"/users/"
  3605. + escapeExpression(((stack1 = ((stack1 = depth0.leader),stack1 == null || stack1 === false ? stack1 : stack1._id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
  3606. + "\">\n <img src=\""
  3607. + escapeExpression(((stack1 = ((stack1 = depth0.leader),stack1 == null || stack1 === false ? stack1 : stack1.picture)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
  3608. + "\" title=\""
  3609. + escapeExpression(((stack1 = ((stack1 = depth0.leader),stack1 == null || stack1 === false ? stack1 : stack1.name)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
  3610. + "\" rel=\"tooltip\" class=\"tooltips\"/>\n </a>\n </div>\n\n <div class=\"span4\">\n <h5>Contributors</h5>\n ";
  3611. stack2 = helpers.each.call(depth0, depth0.contributors, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  3612. if(stack2 || stack2 === 0) { buffer += stack2; }
  3613. buffer += "\n </div>\n\n <div class=\"span4\">\n <h5>"
  3614. + escapeExpression(((stack1 = ((stack1 = depth0.followers),stack1 == null || stack1 === false ? stack1 : stack1.length)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
  3615. + " Likes</h5>\n ";
  3616. stack2 = helpers.each.call(depth0, depth0.followers, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  3617. if(stack2 || stack2 === 0) { buffer += stack2; }
  3618. buffer += "\n </div>\n\n </div>\n\n <div id=\"disqus_thread\" class=\"well-header\"></div>\n <script src=\"/js/disqus.js\" disqus_shortname=\"";
  3619. if (stack2 = helpers.disqus_shortname) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
  3620. else { stack2 = depth0.disqus_shortname; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
  3621. buffer += escapeExpression(stack2)
  3622. + "\"></script>\n \n </div>\n</div>\n";
  3623. return buffer;
  3624. })
  3625. ;
  3626. },
  3627. "layout.hbs.js": function (exports, module, require) {
  3628. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3629. this.compilerInfo = [4,'>= 1.0.0'];
  3630. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3631. return "<div id=\"dashboard-projects\"></div>\n<div id=\"inactive-projects\" class=\"hide inactive-ctn\"></div>";
  3632. })
  3633. ;
  3634. },
  3635. "listItem.hbs.js": function (exports, module, require) {
  3636. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3637. this.compilerInfo = [4,'>= 1.0.0'];
  3638. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3639. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
  3640. buffer += "<a href=\"";
  3641. if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3642. else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3643. buffer += escapeExpression(stack1)
  3644. + "\" data-bypass>\n <div class=\"well\">\n ";
  3645. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3646. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3647. buffer += escapeExpression(stack1)
  3648. + "\n </div>\n</a>";
  3649. return buffer;
  3650. })
  3651. ;
  3652. },
  3653. "project.hbs.js": function (exports, module, require) {
  3654. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3655. this.compilerInfo = [4,'>= 1.0.0'];
  3656. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3657. var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing, helperMissing=helpers.helperMissing;
  3658. function program1(depth0,data) {
  3659. var buffer = "", stack1;
  3660. buffer += "\n <div class=\"project-image\" style=\"background-image: url('";
  3661. if (stack1 = helpers.cover) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3662. else { stack1 = depth0.cover; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3663. buffer += escapeExpression(stack1)
  3664. + "');\"></div>\n ";
  3665. return buffer;
  3666. }
  3667. function program3(depth0,data) {
  3668. var buffer = "", stack1;
  3669. buffer += "\n <h4><a href=\"";
  3670. if (stack1 = helpers.instanceURL) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3671. else { stack1 = depth0.instanceURL; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3672. buffer += escapeExpression(stack1)
  3673. + "\">";
  3674. if (stack1 = helpers.domain) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3675. else { stack1 = depth0.domain; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3676. buffer += escapeExpression(stack1)
  3677. + "</a></h4>\n ";
  3678. return buffer;
  3679. }
  3680. function program5(depth0,data) {
  3681. var buffer = "", stack1;
  3682. buffer += "\n <a href=\"/users/";
  3683. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3684. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3685. buffer += escapeExpression(stack1)
  3686. + "\">\n <img class=\"avatar tooltips\" rel=\"tooltip\" \n src=\"";
  3687. if (stack1 = helpers.picture) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3688. else { stack1 = depth0.picture; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3689. buffer += escapeExpression(stack1)
  3690. + "\" data-id=\"";
  3691. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3692. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3693. buffer += escapeExpression(stack1)
  3694. + "\" title=\"";
  3695. if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3696. else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3697. buffer += escapeExpression(stack1)
  3698. + "\">\n </a>\n ";
  3699. return buffer;
  3700. }
  3701. function program7(depth0,data) {
  3702. var buffer = "", stack1;
  3703. buffer += "\n <div class=\"pull-right demo\">\n <a href=\"";
  3704. if (stack1 = helpers.link) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3705. else { stack1 = depth0.link; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3706. buffer += escapeExpression(stack1)
  3707. + "\" target=\"_blank\" class=\"btn btn-link\" data-bypass>Demo</a>\n </div>\n ";
  3708. return buffer;
  3709. }
  3710. function program9(depth0,data) {
  3711. var buffer = "", stack1, options;
  3712. buffer += "\n\n ";
  3713. options = {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data};
  3714. if (stack1 = helpers.isDashboardView) { stack1 = stack1.call(depth0, options); }
  3715. else { stack1 = depth0.isDashboardView; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3716. if (!helpers.isDashboardView) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  3717. if(stack1 || stack1 === 0) { buffer += stack1; }
  3718. buffer += "\n\n ";
  3719. stack1 = helpers['if'].call(depth0, depth0.showActions, {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
  3720. if(stack1 || stack1 === 0) { buffer += stack1; }
  3721. buffer += "\n\n ";
  3722. return buffer;
  3723. }
  3724. function program10(depth0,data) {
  3725. var buffer = "", stack1;
  3726. buffer += "\n ";
  3727. stack1 = helpers['if'].call(depth0, depth0.isAdminOrLeader, {hash:{},inverse:self.noop,fn:self.program(11, program11, data),data:data});
  3728. if(stack1 || stack1 === 0) { buffer += stack1; }
  3729. buffer += "\n ";
  3730. return buffer;
  3731. }
  3732. function program11(depth0,data) {
  3733. var buffer = "", stack1;
  3734. buffer += "\n <div class=\"pull-right remove\">\n <a class=\"btn btn-link remove\">Remove</a>\n </div>\n <div class=\"pull-right edit\">\n <a class=\"btn btn-link edit\" href=\"/projects/";
  3735. if (stack1 = helpers._id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3736. else { stack1 = depth0._id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3737. buffer += escapeExpression(stack1)
  3738. + "/edit\">Edit</a>\n </div>\n ";
  3739. return buffer;
  3740. }
  3741. function program13(depth0,data) {
  3742. var buffer = "", stack1;
  3743. buffer += "\n <div class=\"pull-right contributor\">\n ";
  3744. stack1 = helpers['if'].call(depth0, depth0.contributing, {hash:{},inverse:self.program(16, program16, data),fn:self.program(14, program14, data),data:data});
  3745. if(stack1 || stack1 === 0) { buffer += stack1; }
  3746. buffer += "\n </div>\n <div class=\"pull-right follower\">\n ";
  3747. stack1 = helpers['if'].call(depth0, depth0.following, {hash:{},inverse:self.program(20, program20, data),fn:self.program(18, program18, data),data:data});
  3748. if(stack1 || stack1 === 0) { buffer += stack1; }
  3749. buffer += "\n </div>\n ";
  3750. return buffer;
  3751. }
  3752. function program14(depth0,data) {
  3753. return "\n <a class=\"btn btn-link leave\">Leave</a>\n ";
  3754. }
  3755. function program16(depth0,data) {
  3756. return "\n <a class=\"btn btn-link join\">Join</a>\n ";
  3757. }
  3758. function program18(depth0,data) {
  3759. return "\n <a class=\"btn btn-link unfollow\">Unfollow</a>\n ";
  3760. }
  3761. function program20(depth0,data) {
  3762. return "\n <a class=\"btn btn-link follow\">Follow</a>\n ";
  3763. }
  3764. function program22(depth0,data) {
  3765. var buffer = "", stack1, options;
  3766. buffer += "\n ";
  3767. options = {hash:{},inverse:self.noop,fn:self.program(23, program23, data),data:data};
  3768. if (stack1 = helpers.isDashboardView) { stack1 = stack1.call(depth0, options); }
  3769. else { stack1 = depth0.isDashboardView; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3770. if (!helpers.isDashboardView) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  3771. if(stack1 || stack1 === 0) { buffer += stack1; }
  3772. buffer += "\n ";
  3773. return buffer;
  3774. }
  3775. function program23(depth0,data) {
  3776. var buffer = "", stack1;
  3777. buffer += "\n ";
  3778. stack1 = helpers['if'].call(depth0, depth0.isShowcaseMode, {hash:{},inverse:self.noop,fn:self.program(24, program24, data),data:data});
  3779. if(stack1 || stack1 === 0) { buffer += stack1; }
  3780. buffer += "\n ";
  3781. return buffer;
  3782. }
  3783. function program24(depth0,data) {
  3784. var buffer = "", stack1;
  3785. buffer += "\n\n <div class=\"switcher tooltips\" data-placement=\"top\" data-original-title=\"Toggle visibility\">\n <input type=\"checkbox\" ";
  3786. stack1 = helpers['if'].call(depth0, depth0.active, {hash:{},inverse:self.noop,fn:self.program(25, program25, data),data:data});
  3787. if(stack1 || stack1 === 0) { buffer += stack1; }
  3788. buffer += " class=\"switch-small\">\n </div>\n\n ";
  3789. return buffer;
  3790. }
  3791. function program25(depth0,data) {
  3792. return "checked";
  3793. }
  3794. buffer += "<div class=\"well\">\n <div class=\"cover shadow\"> \n ";
  3795. stack1 = helpers['if'].call(depth0, depth0.cover, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  3796. if(stack1 || stack1 === 0) { buffer += stack1; }
  3797. buffer += "\n </div>\n <div class=\"well-content\">\n ";
  3798. options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
  3799. if (stack1 = helpers.isSearchView) { stack1 = stack1.call(depth0, options); }
  3800. else { stack1 = depth0.isSearchView; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3801. if (!helpers.isSearchView) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
  3802. if(stack1 || stack1 === 0) { buffer += stack1; }
  3803. buffer += "\n <h4>";
  3804. if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
  3805. else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
  3806. buffer += escapeExpression(stack1)
  3807. + "</h4>\n <br/>\n ";
  3808. options = {hash:{},data:data};
  3809. stack2 = ((stack1 = helpers.markdown || depth0.markdown),stack1 ? stack1.call(depth0, depth0.description, options) : helperMissing.call(depth0, "markdown", depth0.description, options));
  3810. if(stack2 || stack2 === 0) { buffer += stack2; }
  3811. buffer += "\n <div id=\"contributors\">\n ";
  3812. stack2 = helpers.each.call(depth0, depth0.contributors, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
  3813. if(stack2 || stack2 === 0) { buffer += stack2; }
  3814. buffer += "\n </div>\n </div>\n <div class=\"row-fluid footer-box\">\n <div class=\"aging activity created_at\">\n <i rel=\"tooltip\" title=\"";
  3815. options = {hash:{},data:data};
  3816. buffer += escapeExpression(((stack1 = helpers.timeAgo || depth0.timeAgo),stack1 ? stack1.call(depth0, depth0.created_at, options) : helperMissing.call(depth0, "timeAgo", depth0.created_at, options)))
  3817. + "\" class=\"tooltips icon-time icon-1\"></i>\n </div>\n <div class=\"activity people\">\n "
  3818. + escapeExpression(((stack1 = ((stack1 = depth0.followers),stack1 == null || stack1 === false ? stack1 : stack1.length)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
  3819. + " \n <a><i class=\"icon-heart\"></i></a>\n </div>\n\n ";
  3820. stack2 = helpers['if'].call(depth0, depth0.link, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
  3821. if(stack2 || stack2 === 0) { buffer += stack2; }
  3822. buffer += "\n\n ";
  3823. options = {hash:{},inverse:self.noop,fn:self.program(9, program9, data),data:data};
  3824. if (stack2 = helpers.isLoggedIn) { stack2 = stack2.call(depth0, options); }
  3825. else { stack2 = depth0.isLoggedIn; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
  3826. if (!helpers.isLoggedIn) { stack2 = blockHelperMissing.call(depth0, stack2, options); }
  3827. if(stack2 || stack2 === 0) { buffer += stack2; }
  3828. buffer += "\n \n </div>\n\n ";
  3829. options = {hash:{},inverse:self.noop,fn:self.program(22, program22, data),data:data};
  3830. if (stack2 = helpers.isLoggedIn) { stack2 = stack2.call(depth0, options); }
  3831. else { stack2 = depth0.isLoggedIn; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
  3832. if (!helpers.isLoggedIn) { stack2 = blockHelperMissing.call(depth0, stack2, options); }
  3833. if(stack2 || stack2 === 0) { buffer += stack2; }
  3834. buffer += "\n</div>\n";
  3835. return buffer;
  3836. })
  3837. ;
  3838. }
  3839. }
  3840. },
  3841. "templates": {
  3842. "login.hbs.js": function (exports, module, require) {
  3843. module.exports = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  3844. this.compilerInfo = [4,'>= 1.0.0'];
  3845. helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
  3846. var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
  3847. function program1(depth0,data) {
  3848. var buffer = "", stack1, options;
  3849. buffer += "\n <a href=\"/auth/"
  3850. + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
  3851. + "\" class=\"btn btn-large signup-btn signup-"
  3852. + escapeExpression((typeof depth0 === functionType ? depth0.apply(depth0) : depth0))
  3853. + "\" data-bypass>\n <i></i>Access with ";
  3854. options = {hash:{},data:data};
  3855. buffer += escapeExpression(((stack1 = helpers.firstUpper || depth0.firstUpper),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "firstUpper", depth0, options)))
  3856. + "\n </a>\n ";
  3857. return buffer;
  3858. }
  3859. buffer += "\n<div class=\"modal-header\">\n <button type=\"button\" data-dismiss=\"modal\" aria-hidden=\"true\" class=\"close\">×</button>\n <h3>Log in</h3>\n</div>\n<div class=\"row\">\n <div class=\"span4 offset1\">\n ";
  3860. stack1 = helpers.each.call(depth0, depth0.providers, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
  3861. if(stack1 || stack1 === 0) { buffer += stack1; }
  3862. buffer += "\n </div>\n</div>";
  3863. return buffer;
  3864. })
  3865. ;
  3866. }
  3867. }
  3868. }
  3869. }
  3870. }
  3871. })("client/app/index");