diff --git a/.gitignore b/.gitignore index d7e0de8..5760b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ server/*.js !app/assets/*/* +app/.idea/* +app/packages/demo/.idea/* diff --git a/Gruntfile.js b/Gruntfile.js index 26bc6e7..c2bc5ed 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,7 +49,7 @@ module.exports = function(grunt) { 'generators/**/*.coffee', 'server/*.coffee' ], - tasks: ['sass', 'coffee', 'server'] + tasks: ['coffee', 'server'] }, testacular: { diff --git a/app/app.coffee b/app/app.coffee index bc216e9..14b3321 100644 --- a/app/app.coffee +++ b/app/app.coffee @@ -2,7 +2,8 @@ define (require, exports, module) -> # Packages loading demoPackage = require 'packages/demo' - + orgteamPackage = require 'packages/org-team' + #Utils and other Utils = require 'shared/utils' @@ -17,6 +18,7 @@ define (require, exports, module) -> initialize: -> Utils.bindRoutes @, [ demoPackage.Controller + orgteamPackage.Controller ] unknownRoute: -> diff --git a/app/assets/css/main.css b/app/assets/css/main.css index 67ed738..e69de29 100644 --- a/app/assets/css/main.css +++ b/app/assets/css/main.css @@ -1,10 +0,0 @@ -body { - padding-top: 2px; - padding-bottom: 40px; } - -.table-users tbody td { - line-height: 36px; } -.table-users tfoot td.pagination-wrap { - background-color: #f8f8f8; } - .table-users tfoot td.pagination-wrap .pagination { - margin: 0px; } diff --git a/app/assets/json/orgs.json b/app/assets/json/orgs.json new file mode 100644 index 0000000..fa6a656 --- /dev/null +++ b/app/assets/json/orgs.json @@ -0,0 +1,20 @@ +[ + { + "id": 1, + "logo": "http://placehold.it/60x60", + "companyName": "Lohika", + "phone": "853-500-3367", + "email": "info@lohika.com", + "address": "37969, Alaska, Broome Streets", + "about": "Nulla sit tincidunt volutpat enim illum, autem ex iriure hendrerit iriure, volutpat eum vulputate diam. Luptatum, diam ad laoreet dolor commodo, ullamcorper dolore minim commodo ut, elit consequat iusto. Facilisi consequat, esse in vel iusto illum, eros dolor commodo consequat eum, vel dolore. Exerci euismod nisl, delenit ad blandit suscipit dolor, consectetuer dolore ad dolore." + }, + { + "id": 2, + "logo": "http://placehold.it/60x60", + "companyName": "Ciklum", + "phone": "841-471-3410", + "email": "info@ciklum.com", + "address": "28272, AmarilloAnaheim, Orchard Street", + "about": "Iusto et feugiat dolore dignissim minim, nulla dignissim molestie dolore dignissim, enim autem vulputate in. Vero, delenit vero commodo sit sed, qui blandit duis consequat vel, velit in et. Suscipit in, nonummy nonummy vulputate facilisis nonummy, at wisi ex duis qui, augue nisl. Velit consequat laoreet, zzril vel consectetuer magna duis, autem laoreet exerci amet nulla, sed. Ea ut dolor ut, wisi accumsan nulla et zzril, tation tation te facilisi zzril, autem sit amet at dolore, ad lobortis elit eros dolore, esse ex nostrud aliquip. Vel, accumsan at in odio diam." + } +] \ No newline at end of file diff --git a/app/config.coffee b/app/config.coffee index f136aaf..aaac348 100644 --- a/app/config.coffee +++ b/app/config.coffee @@ -40,5 +40,5 @@ require.config { 'sinon': 'assets/js/sinon-1.5.2' }, - packages: ['packages/demo', 'packages/organization'] + packages: ['packages/demo', 'packages/org-team'] } \ No newline at end of file diff --git a/app/packages/demo/main.coffee b/app/packages/demo/main.coffee index 46cac41..08adad2 100644 --- a/app/packages/demo/main.coffee +++ b/app/packages/demo/main.coffee @@ -6,13 +6,8 @@ define (require, exports, module)-> exports.Controller = class Controller extends BaseController routes: 'demo': 'demo' - 'demo/:id': 'demo' demo: -> console.log 'demo' - @currentView = new view.View( - model: new model.Model() - ) - $('#demo-box').html @currentView.render().$el return @ return diff --git a/app/packages/org-team/collections/collection.coffee b/app/packages/org-team/collections/collection.coffee new file mode 100644 index 0000000..2482542 --- /dev/null +++ b/app/packages/org-team/collections/collection.coffee @@ -0,0 +1,9 @@ +define (require, exports, module) -> + model = require '../models/model' + exports.Collection = Backbone.Collection.extend( + url: -> + '/org' + + model: model.Model + ) + return \ No newline at end of file diff --git a/app/packages/org-team/main.coffee b/app/packages/org-team/main.coffee new file mode 100644 index 0000000..0d33153 --- /dev/null +++ b/app/packages/org-team/main.coffee @@ -0,0 +1,27 @@ +define (require, exports, module)-> + orgsView = require './views/organizations' + orgView = require './views/organization' + BaseController = require 'shared/base_controller' + + exports.Controller = class Controller extends BaseController + routes: + 'org-team': 'getOrgsTeam' + 'org-team/:id': 'getOrgTeam' + + getOrgsTeam: -> + @orgsView = new orgsView.View + @orgsView.collection.fetch + success: (collection, resp, options) => + console.dir(collection) + $('#demo-box').html @orgsView.render().el + return @ + + getOrgTeam: (id)-> + @orgView = new orgView.View() + @orgView.model.set {id: id} + @orgView.model.fetch + success: (model, resp, options) => + $('#demo-box').html @orgView.render().el + return @ + + return \ No newline at end of file diff --git a/app/packages/org-team/models/model.coffee b/app/packages/org-team/models/model.coffee new file mode 100644 index 0000000..3cef906 --- /dev/null +++ b/app/packages/org-team/models/model.coffee @@ -0,0 +1,14 @@ +define (require, exports, module) -> + exports.Model = Backbone.Model.extend( + url: -> + "/org/#{@id}" + + defaults: + logo: "http://placehold.it/32x32", + companyName: "Test company name", + phone: "", + email: "", + address: "", + about: "" + ) + return \ No newline at end of file diff --git a/app/packages/org-team/spec/collection.coffee b/app/packages/org-team/spec/collection.coffee new file mode 100644 index 0000000..bb6282a --- /dev/null +++ b/app/packages/org-team/spec/collection.coffee @@ -0,0 +1,12 @@ +expect = chai.expect + +describe 'Test', -> + dep = null + + beforeEach (done) -> + require [], (_dep) -> + dep = _dep + done() + + it 'should be test', (done) -> + done() \ No newline at end of file diff --git a/app/packages/org-team/spec/main.coffee b/app/packages/org-team/spec/main.coffee new file mode 100644 index 0000000..bb6282a --- /dev/null +++ b/app/packages/org-team/spec/main.coffee @@ -0,0 +1,12 @@ +expect = chai.expect + +describe 'Test', -> + dep = null + + beforeEach (done) -> + require [], (_dep) -> + dep = _dep + done() + + it 'should be test', (done) -> + done() \ No newline at end of file diff --git a/app/packages/org-team/spec/model.coffee b/app/packages/org-team/spec/model.coffee new file mode 100644 index 0000000..bb6282a --- /dev/null +++ b/app/packages/org-team/spec/model.coffee @@ -0,0 +1,12 @@ +expect = chai.expect + +describe 'Test', -> + dep = null + + beforeEach (done) -> + require [], (_dep) -> + dep = _dep + done() + + it 'should be test', (done) -> + done() \ No newline at end of file diff --git a/app/packages/org-team/spec/view.coffee b/app/packages/org-team/spec/view.coffee new file mode 100644 index 0000000..bb6282a --- /dev/null +++ b/app/packages/org-team/spec/view.coffee @@ -0,0 +1,12 @@ +expect = chai.expect + +describe 'Test', -> + dep = null + + beforeEach (done) -> + require [], (_dep) -> + dep = _dep + done() + + it 'should be test', (done) -> + done() \ No newline at end of file diff --git a/app/packages/org-team/templates/organization.html b/app/packages/org-team/templates/organization.html new file mode 100644 index 0000000..ccba4cf --- /dev/null +++ b/app/packages/org-team/templates/organization.html @@ -0,0 +1,24 @@ +