Permalink
Browse files

Added additional functionality to the app so that UI testing will be …

…meaningful.
  • Loading branch information...
1 parent b7a83b2 commit a07efec0124067a753ef5c4a2d3f16d9b7f22378 @arthurakay arthurakay committed Dec 4, 2012
Showing with 122 additions and 1 deletion.
  1. +4 −0 app.js
  2. +19 −0 app/MeetupApiUtil.js
  3. +45 −0 app/controller/Event.js
  4. +15 −0 app/model/Rsvp.js
  5. +11 −0 app/store/Rsvps.js
  6. +2 −1 app/view/Events.js
  7. +26 −0 app/view/RsvpWindow.js
View
4 app.js
@@ -6,6 +6,10 @@ Ext.application({
autoCreateViewport: true,
name: 'ChicagoMeetup',
+ controllers : [
+ 'Event'
+ ],
+
requires : [
'ChicagoMeetup.MeetupApiUtil'
]
View
@@ -75,5 +75,24 @@ Ext.define('ChicagoMeetup.MeetupApiUtil', {
});
return 'http://api.meetup.com/events?' + queryString;
+ },
+
+ /**
+ *
+ * @param eventId
+ * @return {String}
+ */
+ getRsvpsUrl : function (eventId) {
+ var queryString = Ext.Object.toQueryString({
+ sign : true,
+ key : this.apiKey,
+ event_id : eventId,
+ order : 'event',
+ rsvp : 'yes',
+ format : 'json',
+ page : 200
+ });
+
+ return 'http://api.meetup.com/2/rsvps?' + queryString;
}
});
View
@@ -0,0 +1,45 @@
+Ext.define('ChicagoMeetup.controller.Event', {
+ extend : 'Ext.app.Controller',
+
+ requires : [
+ 'ChicagoMeetup.view.RsvpWindow',
+ 'ChicagoMeetup.store.Rsvps',
+ 'ChicagoMeetup.MeetupApiUtil'
+ ],
+
+ init : function () {
+ this.control({
+
+ 'grid' : {
+ 'itemdblclick' : this.onGridRowDlbClick
+ }
+
+ });
+ },
+
+ onGridRowDlbClick : function (thisGrid, record, item, e, eopts) {
+ var win = Ext.create('ChicagoMeetup.view.RsvpWindow', {
+ title : 'RSPVs for: ' + record.get('name')
+ });
+
+ var store = Ext.create('ChicagoMeetup.store.Rsvps', {
+ autoLoad : true,
+ proxy : {
+ type : 'jsonp',
+ autoAppendParams : false,
+ pageParam : undefined,
+ url : ChicagoMeetup.MeetupApiUtil.getRsvpsUrl(record.get('id')),
+
+ reader : {
+ type : 'json',
+ root : 'results'
+ }
+ }
+ });
+
+ var grid = win.down('grid');
+ grid.reconfigure(store);
+
+ win.show();
+ }
+});
View
@@ -0,0 +1,15 @@
+Ext.define('ChicagoMeetup.model.Rsvp', {
+ extend : 'Ext.data.Model',
+ fields : [
+ {
+ mapping : 'member.member_id',
+ name : 'id',
+ type : 'string'
+ },
+ {
+ mapping : 'member.name',
+ name : 'name',
+ type : 'string'
+ }
+ ]
+});
View
@@ -0,0 +1,11 @@
+Ext.define('ChicagoMeetup.store.Rsvps', {
+ extend : 'Ext.data.Store',
+
+ requires : [
+ 'ChicagoMeetup.model.Rsvp'
+ ],
+
+ storeId : 'RsvpStore',
+ model : 'ChicagoMeetup.model.Rsvp'
+
+});
View
@@ -15,7 +15,8 @@ Ext.define('ChicagoMeetup.view.Events', {
columns : [
{
dataIndex : 'date',
- text : 'Date'
+ text : 'Date',
+ width : 200
},
{
dataIndex : 'name',
View
@@ -0,0 +1,26 @@
+Ext.define('ChicagoMeetup.view.RsvpWindow', {
+ extend : 'Ext.window.Window',
+
+ requires : [
+ 'Ext.grid.Panel'
+ ],
+
+ height : 300,
+ width : 300,
+ modal : true,
+ title : 'RSVPs for the selected Meetup',
+ layout : 'fit',
+
+ items : [
+ {
+ xtype : 'grid',
+ columns : [
+ {
+ dataIndex : 'name',
+ text : 'Member Name',
+ flex : 1
+ }
+ ]
+ }
+ ]
+});

0 comments on commit a07efec

Please sign in to comment.