Skip to content

Commit

Permalink
add speaker form and table views
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-dmytruk committed Nov 26, 2015
1 parent 4e15122 commit 3b63735
Show file tree
Hide file tree
Showing 23 changed files with 100 additions and 190 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/css/conflab.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ body {
}

.speaker h3 {

color: #286090;
}

.text {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ define([
this.container = options.container;
},

speakers: function () {
conference: function () {
var self = this;

require(['speakers/SpeakersLayoutView'], function (SpeakersLayoutView) {
self.container.show(new SpeakersLayoutView());
Radio.channel('menu').request('activate', {path: 'speakers'});
require(['conference/ConferenceLayoutView'], function (ConferenceLayoutView) {
self.container.show(new ConferenceLayoutView());
Radio.channel('menu').request('activate', {path: 'conference'});
});

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
define([
'backbone.marionette',
'text!speakers/SpeakersLayoutTemplate.html'
'text!conference/ConferenceLayoutTemplate.html'
], function (Marionette, template) {

'use strict';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
define([
'backbone.marionette',
'backbone.radio',
'conferences/ConferencesController'
], function (Marionette, Radio, ConferencesController) {
'conference/ConferenceController'
], function (Marionette, Radio, ConferenceController) {

'use strict';

return Marionette.AppRouter.extend({
initialize: function (options) {
Radio.channel('menu').request('add', {name: 'Conferences', path: 'conferences'});
this.controller = new ConferencesController({container: options.container});
Radio.channel('menu').request('add', {name: 'Conferences', path: 'conference'});
this.controller = new ConferenceController({container: options.container});
},

appRoutes: {
'conferences': 'conferences'
'conference': 'conference'
}

});


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,19 +240,19 @@ table.dataTable thead .sorting_desc_disabled {
table.dataTable thead .sorting_asc:after {
content: "\f0de";
float: right;
font-family: fontawesome;
font-family: fontawesome, serif;
}

table.dataTable thead .sorting_desc:after {
content: "\f0dd";
float: right;
font-family: fontawesome;
font-family: fontawesome, serif;
}

table.dataTable thead .sorting:after {
content: "\f0dc";
float: right;
font-family: fontawesome;
font-family: fontawesome, serif;
color: rgba(50,50,50,.5);
}

Expand Down
26 changes: 0 additions & 26 deletions src/main/resources/static/js/conferences/ConferencesController.js

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/resources/static/js/conferences/ConferencesLayoutView.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/main/resources/static/js/conflab.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ require([
'menu/MenuService',
'profile/ProfileRouter',
'speaker/SpeakerRouter',
'conferences/ConferencesRouter',
'conference/ConferenceRouter',
'auth/AuthRouter',
'auth/session/SessionService',
'backbone'
], function (C2CApplication, HomepageRouter, HeaderService, MenuService, ProfileRouter, SpeakersRouter, ConferencesRouter,
], function (C2CApplication, HomepageRouter, HeaderService, MenuService, ProfileRouter, SpeakersRouter, ConferenceRouter,
AuthRouter, SessionService) {

'use strict';
Expand Down Expand Up @@ -37,7 +37,7 @@ require([
container: app.layout.getRegion('main')
});

app.conferences = new ConferencesRouter({
app.conferences = new ConferenceRouter({
container: app.layout.getRegion('main')
});

Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/static/js/require.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ var require = {
"menu" : 'js/menu',
"header" : 'js/header',
"speaker" : 'js/speaker',
"conferences" : 'js/conferences',
"speakers" : 'js/speakers',
"conference" : 'js/conference',
"auth" : 'js/auth',
"text" : 'lib/requirejs-text/text',
"jquery" : 'lib/jquery/jquery.min',
Expand Down
28 changes: 24 additions & 4 deletions src/main/resources/static/js/speaker/SpeakerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,30 @@ define([
speaker: function () {
var self = this;

require(['speaker/SpeakerPageView', 'speaker/SpeakerCollection'], function (SpeakerPageView, SpeakerCollection) {
var collection = new SpeakerCollection();
self.container.show(new SpeakerPageView({collection: collection}));
Radio.channel('menu').request('activate', {path: 'speaker'});
require([
'speaker/Speaker',
'speaker/SpeakerCollection',
'speaker/SpeakerPageView',
'speaker/SpeakerTableView',
'speaker/SpeakerFormView'
],
function (Speaker,
SpeakerCollection,
SpeakerPageView,
SpeakerTableView,
SpeakerFormView) {
var pageView,
collection;

pageView = new SpeakerPageView();

collection = new SpeakerCollection();
self.container.show(pageView);

pageView.showChildView("table", new SpeakerTableView({collection: collection}));
pageView.showChildView("form", new SpeakerFormView({model: new Speaker()}));

Radio.channel('menu').request('activate', {path: 'speaker'});
});
}
});
Expand Down
21 changes: 21 additions & 0 deletions src/main/resources/static/js/speaker/SpeakerFormView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
define([
'text!speaker/SpeakerFormTemplate.html',
'backbone.marionette'
], function (template) {

'use strict';

return Marionette.ItemView.extend({
template: _.template(template),
bindings: {
'#email' : 'id',
'#name' : 'name',
'#position': 'position',
'#about' : 'about'
},

onRender: function () {
this.stickit();
}
});
});
9 changes: 9 additions & 0 deletions src/main/resources/static/js/speaker/SpeakerFormtemplate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="modal-body">
<label for="name">Full Name</label><input id="name" type="text" class="form-control" placeholder="Name" maxlength="255">
<label for="email">Email</label> <input id="email" type="email" class="form-control" placeholder="Email">
<label for="position">Position</label> <input id="position" type="text" class="form-control" placeholder="Position" maxlength="255">
<label for="about">About</label> <textarea class="form-control" rows="3" id="about" placeholder="Short story"></textarea>
</div>
<div class="modal-footer">
<button id="save-speaker-button" type="button" class="btn btn-success">Save</button>
</div>

This file was deleted.

3 changes: 3 additions & 0 deletions src/main/resources/static/js/speaker/SpeakerPageTemplate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div data-table-region></div>
<button id="add-speaker-button" type="button" class="btn btn-primary btn-lg">Add speaker</button>
<div data-form-region></div>
20 changes: 7 additions & 13 deletions src/main/resources/static/js/speaker/SpeakerPageView.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
define([
'speaker/SpeakerView',
'text!speaker/SpeakerLayoutTemplate.html',
'text!speaker/SpeakerPageTemplate.html',
'backbone.marionette'
], function (SpeakerView, template) {
], function (template) {

'use strict';

return Marionette.CollectionView.extend({
return Marionette.LayoutView.extend({
template: _.template(template),

childView: SpeakerView,
childViewContainer: '[data-table-region]',

onBeforeRender: loadData
regions : {
table : '[data-table-region]',
form : '[data-form-region]'
}
});

function loadData() {
this.collection.fetch();
}
});
2 changes: 1 addition & 1 deletion src/main/resources/static/js/speaker/SpeakerRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define([

return Marionette.AppRouter.extend({
initialize: function (options) {
Radio.channel('menu').request('add', {name: 'Speaker', path: 'speaker'});
Radio.channel('menu').request('add', {name: 'Speakers', path: 'speaker'});
this.controller = new SpeakerController({container: options.container});
},

Expand Down
17 changes: 17 additions & 0 deletions src/main/resources/static/js/speaker/SpeakerTableView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
define([
'speaker/SpeakerView',
'backbone.marionette'
], function (SpeakerView) {

'use strict';

return Marionette.CollectionView.extend({
childView: SpeakerView,

onBeforeRender: loadData
});

function loadData() {
this.collection.fetch();
}
});
1 change: 0 additions & 1 deletion src/main/resources/static/js/speaker/SpeakerTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ <h3 data-name></h3>

<p>
<span data-position></span>
<span data-email></span>
</p>

<p class="text" data-about></p>
Expand Down
22 changes: 0 additions & 22 deletions src/main/resources/static/js/speakers/SpeakersRouter.js

This file was deleted.

Loading

0 comments on commit 3b63735

Please sign in to comment.