Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
20 - Create a template for new events and display it
- Loading branch information
Showing
4 changed files
with
130 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
(function() { | ||
|
||
define([], function() { | ||
var NewEvent, new_event; | ||
define(['text!templates/events/new_event.tmpl'], function(new_event_text) { | ||
var NewEvent, NewEventView, new_event, new_event_view; | ||
NewEvent = Backbone.Model.extend({ | ||
title: 'title', | ||
description: '', | ||
initialize: function() {} | ||
}); | ||
NewEventView = Backbone.View.extend({ | ||
el: '#new .current', | ||
initialize: function() { | ||
return {}; | ||
return this.template = Handlebars.compile(new_event_text); | ||
}, | ||
render: function() { | ||
var html_string; | ||
html_string = this.template({ | ||
display_name: new_event.get('display_name') | ||
}); | ||
$(this.el).html(html_string); | ||
return $("select").chosen(); | ||
} | ||
}); | ||
new_event = new NewEvent({ | ||
title: "Zajit do servisu", | ||
description: "Some text........" | ||
}); | ||
$("select").chosen(); | ||
return $("select").chosen().change(function() { | ||
return alert('fired by chosen'); | ||
display_name: "Nuria" | ||
}); | ||
new_event_view = new NewEventView(); | ||
return new_event_view.render(); | ||
/* | ||
members = $.getJSON "/members", (result) -> | ||
options = $("#options") | ||
$.each result, () -> | ||
options.append($("<option />")).val(this.id).text(this.display_name) | ||
*/ | ||
}); | ||
|
||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
|
||
<section class="container"> | ||
<form id="new_event" action="new_submit" method="get" accept-charset="utf-8"> | ||
<h3>New Event</h3> | ||
<input type="text" size="58" name="" value="" id="title" placeholder="Title:"> | ||
<textarea name="Name" rows="8" cols="40" id="description" placeholder="Description:"></textarea> | ||
|
||
<fieldset id="from" class=""> | ||
<legend>Start</legend> | ||
<input value="2012-2-31" type="date"> | ||
<input value="08:45" type="time"> | ||
</fieldset> | ||
|
||
<fieldset id="till" class=""> | ||
<legend>End</legend> | ||
<input value="" placeholder="" type="date"> | ||
<input value="" placeholder="" type="time"> | ||
</fieldset> | ||
|
||
<div class="wrapper"> | ||
<select id="options" data-placeholder="Choose a member..." multiple="multiple" style="width: 412px;"> | ||
<option value="id">{{display_name}}</option> | ||
|
||
</select> | ||
</div> | ||
|
||
<section class="controls"> | ||
<input type="submit" value="Create" class="create_button"> | ||
<input type="button" value="Cancel" class="save_button"> | ||
</section> | ||
</form> | ||
</section> |