Tihomir Valkanov 2013-11-08 09:41:46 -06:00
Родитель 576063cf55 b73239d42c
Коммит 0d78a9f7ae
5 изменённых файлов: 115 добавлений и 23 удалений

Просмотреть файл

@ -10,7 +10,8 @@
<script src="scripts/app/identity-provider.js"></script>
<script src="scripts/app/main.js" type="text/javascript"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:light&v1' rel='stylesheet' type='text/css'>
<link href="http://fonts.googleapis.com/css?family=Open+Sans+Condensed:light&v1" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:light&v1" rel="stylesheet" type="text/css">
<link href="kendo/styles/kendo.mobile.all.min.css" rel="stylesheet" />
<link href="styles/main.css" rel="stylesheet" />
</head>

Просмотреть файл

@ -267,6 +267,9 @@ var app = (function () {
CoverImageURL: function () {
return AppHelper.resolvePictureUrl(this.get('CoverImage'));
},
CoverImageDisplay: function () {
return this.get('CoverImage') !== undefined ? "block" : "none";
},
ParticipantsCount: function () {
var participants = this.get('Participants');
//return participants.length;
@ -373,34 +376,70 @@ var app = (function () {
}());
// add activity view model
var addActivityViewModel = (function () {
var $newStatus;
var addEventViewModel = (function () {
var $eventTitle;
var $eventAllDay;
var $eventStartTime;
var $eventEndTime;
var $eventDescription;
var $eventMaxParticipants;
var $eventLocationDescription;
//var $eventLocationCoordinates;
var $eventTags;
var validator;
var init = function () {
validator = $('#enterStatus').kendoValidator().data("kendoValidator");
$newStatus = $('#newStatus');
validator = $('#add-event-form').kendoValidator().data("kendoValidator");
$eventTitle = $('#eventTitle');
$eventAllDay = $('#eventAllDay');
$eventStartTime = $('#eventStartTime');
$eventEndTime = $('#eventEndTime');
$eventDescription = $('#eventDescription');
$eventMaxParticipants = $('#eventMaxParticipants');
$eventLocationDescription = $('#eventLocationDescription');
//$eventLocationCoordinates = $('#eventLocationCoordinates');
$eventTags = $('#eventTags');
};
var show = function () {
$newStatus.val('');
$eventTitle.val("");
$eventStartTime.val(new Date().toJSON().slice(0,10));
$eventEndTime.val(new Date().toJSON().slice(0,10));
$eventDescription.val("");
$eventMaxParticipants.val("");
$eventLocationDescription.val("");
//$eventLocationCoordinates.val("");
$eventTags.val("");
validator.hideMessages();
};
var saveActivity = function () {
if (validator.validate()) {
var activities = activitiesModel.activities;
var activity = activities.add();
activity.Text = $newStatus.val();
activity.UserId = usersModel.currentUser.get('data').Id;
activities.one('sync', function () {
mobileApp.navigate('#:back');
});
activities.sync();
var saveEvent = function () {
/// todo include this if (validator.validate())
{
// add a new item
var events = EventsModel.events;
var ev = events.add();
ev.Title = $eventTitle.val();
ev.StartTime = $eventStartTime.val();
// todo ev.EndTime and AllDay
ev.Description = $eventDescription.val();
ev.MaxParticipants = ($eventMaxParticipants == '' || $eventMaxParticipants == 'unlimited') ? 0 : parseInt($eventMaxParticipants.val());
ev.LocationDescription = $eventLocationDescription.val();
//ev.LocationCoordinates = $eventLocationCoordinates.val();
ev.Tags = $eventTags.val().split(" ");
ev.Feed = '9dec1eb0-47ca-11e3-afbf-61834747fc11'; // hardcoded for now
ev.Organizer = this.me.data.Id;
// for (var p in ev)
// console.log(" ev." + p + ": " + ev[p]);
// for (var p2 in this.me.data)
// console.log(" me.data." + p2 + ": " + this.me.data[p2]);
events.sync();
mobileApp.navigate('#:back');
// or ???? events.one('sync', function () {mobileApp.navigate('#:back');});
}
};
return {
init: init,
show: show,
me: usersModel.currentUser,
saveActivity: saveActivity
saveEvent: saveEvent
};
}());
@ -408,9 +447,9 @@ var app = (function () {
viewModels: {
login: loginViewModel,
signup: singupViewModel,
addActivity: addActivityViewModel,
addEvent: addEventViewModel,
feed: feedViewModel,
event: eventViewModel
}
};
}());
}());

Просмотреть файл

@ -1,5 +1,5 @@
body {
font-family: Open Sans !important;
font-family: Open Sans!important;
}
#friendsApp.km-android .km-view
@ -577,4 +577,4 @@ textarea
background-image: url(images/icons/location_icon.png);
line-height: 17px;
padding-left: 20px;
}
}

Просмотреть файл

@ -0,0 +1,51 @@
<div data-role="view" id="add-event" data-layout="default" class="add-event-view" data-model="app.viewModels.addEvent"
data-init="app.viewModels.addEvent.init" data-show="app.viewModels.addEvent.show">
<header data-role="header">
<div data-role="navbar">
Add Event
<a data-align="left" data-role="backbutton">Cancel</a>
<a data-align="right" data-role="button" data-bind="click: saveEvent">Done</a>
</div>
</header>
<form id="add-event-form">
<ul data-role="listview" data-style="inset">
<li>
<label for="eventTitle">What</label>
<input type="text" id="eventTitle" placeholder="What's happening?" data-bind="value: Title"/> <!--required validationMessage="Please choose a name for your event"/-->
</li>
<li>
<label for="eventLocationDescription">Where</label>
<input type="text" id="eventLocationDescription" placeholder="Where to meet?" data-bind="value: LocationDescription"/>
</li>
<li style="margin-top:20px;">
<label for="eventStartTime">All-day</label>
<input type="checkbox" data-role="switch" id="eventAllDay" /><!--data-bind="value: AllDay"/-->
</li>
<li>
<label for="eventStartTime">Starts</label>
<input type="date" id="eventStartTime" data-bind="value: StartTime"/>
</li>
<li>
<label for="eventEndTime">Ends</label>
<input type="date" id="eventEndTime" data-bind="value: EndTime"/>
</li>
<li style="margin-top:20px;">
<label for="eventDescription">More info</label>
<input type="text" id="eventDescription" placeholder="Details, links, etc" data-bind="value: Description"/>
</li>
<li>
<label for="eventMaxParticipants">May join</label>
<input type="text" id="eventMaxParticipants" placeholder="unlimited" data-bind="value: MaxParticipants"/>
</li>
<!--<li>
<label for="eventLocationCoordinates">On the map</label>
<input type="text" id="eventLocationCoordinates" data-bind="value: LocationCoordinates"/>
</li>-->
<li>
<label for="eventTags">#Tags</label>
<input type="text" id="eventTags" placeholder="#lunch #italian" data-bind="value: Tags"/>
</li>
</ul>
</form>
</div>

Просмотреть файл

@ -4,6 +4,7 @@
<div class="nav-button" data-align="left" data-role="button" id="swipe-menu-btn"></div>
Event Feed
<div class="nav-button" data-align="right" data-role="button" id="search-btn"></div>
<a class="nav-button" data-align="right" data-role="button" href="views/addEventView.html">Add</a>
</div>
</header>
@ -28,10 +29,10 @@
<time class="timeSpan time-icon" style="float: right;">${StartTimeFormatted()}</time>
</div>
<div>
<img src="${CoverImageURL()}" style="width: 292px; height: 140px;" />
<img src="${CoverImageURL()}" style="width: 292px; height: 140px; display:${CoverImageDisplay()}}" />
</div>
<div class="user-share">
<a class="user-share-txt">${Description}</a>
</div>
</div>
</script>
</script>