Merge pull request #16 from misfir3/master
cookie view re-enabled, going ahead with pull
This commit is contained in:
commit
8330d411e3
@ -126,23 +126,10 @@
|
||||
</div>
|
||||
<hr />
|
||||
<div id="cookies-and-params">
|
||||
<div class="cookies-view">
|
||||
<div id="cookies-view">
|
||||
<h4>Cookies</h4>
|
||||
<!-- <div class="cookieContainer" ng-repeat="cookie in cookies">
|
||||
<table class="cookieTable table-striped table-nonfluid" >
|
||||
<thead>
|
||||
<tr><th class="col-sm-1"></th><th class="col-sm-1"></th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="(key, value) in cookie">
|
||||
<td>{{key}}</td>
|
||||
<td>{{value}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div> -->
|
||||
</div>
|
||||
<div id="paramsView"> <!--class="paramsView"-->
|
||||
<div id="params-view"> <!--class="paramsView"-->
|
||||
<h4>Params</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -738,7 +738,7 @@ cookie-container {
|
||||
|
||||
.cookie-table tr td, .params-table tr td {
|
||||
padding: 3px;
|
||||
max-width: 200px;
|
||||
max-width: 220px;
|
||||
font-size: x-small;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ define(['jquery',
|
||||
'goatApp/view/SolutionView',
|
||||
'goatApp/view/LessonHintView',
|
||||
'goatApp/view/HelpControlsView',
|
||||
'goatApp/view/CookieView',
|
||||
'goatApp/support/GoatUtils'
|
||||
],
|
||||
function($,
|
||||
@ -20,6 +21,7 @@ define(['jquery',
|
||||
SolutionView,
|
||||
LessonHintView,
|
||||
HelpControlsView,
|
||||
CookieView,
|
||||
GoatUtils
|
||||
) {
|
||||
'use strict'
|
||||
@ -77,6 +79,7 @@ define(['jquery',
|
||||
this.lessonHintView = new LessonHintView();
|
||||
this.listenToOnce(this.lessonHintView,'hints:loaded',this.areHelpsReady);
|
||||
//
|
||||
this.cookieView = new CookieView();
|
||||
this.hideShowHelps(null);
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/LessonCookieModel'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
LessonCookieModel) {
|
||||
return Backbone.Collection.extend({
|
||||
url:'service/cookie.mvc',
|
||||
model:LessonCookieModel
|
||||
});
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone'],
|
||||
function($,
|
||||
_,
|
||||
Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
});
|
||||
});
|
@ -0,0 +1,33 @@
|
||||
define(['jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'goatApp/model/LessonCookieCollection'],
|
||||
function($,
|
||||
_,
|
||||
Backbone,
|
||||
LessonCookieCollection) {
|
||||
return Backbone.View.extend({
|
||||
el:'#cookies-view',
|
||||
|
||||
initialize: function() {
|
||||
this.collection = new LessonCookieCollection();
|
||||
this.listenTo(this.collection,'reset',this.render)
|
||||
this.collection.fetch({reset:true});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
this.$el.html('')
|
||||
var cookieTable;
|
||||
this.collection.each(function(model) {
|
||||
cookieTable = $('<table>',{'class':'cookie-table table-striped table-nonfluid'});
|
||||
_.each(model.keys(), function(attribute) {
|
||||
var newRow = $('<tr>');
|
||||
newRow.append($('<th>',{text:_.escape(attribute)}))
|
||||
newRow.append($('<td>',{text:_.escape(model.get(attribute))}));
|
||||
cookieTable.append(newRow);
|
||||
});
|
||||
});
|
||||
this.$el.append(cookieTable);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user