Skip to content

Commit

Permalink
Fixed render issue general
Browse files Browse the repository at this point in the history
  • Loading branch information
David Amend committed Apr 22, 2012
1 parent 055272a commit 103296d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 50 deletions.
2 changes: 1 addition & 1 deletion _attachments/ApplicationScope.js
Expand Up @@ -27,7 +27,7 @@ var adventurio = adventurio || {
Login: {},
Signup : {},
Stories: {},
Story : {},
Story : {singleton : {}},
CreateStory : {}
},
reader : {
Expand Down
4 changes: 0 additions & 4 deletions _attachments/css/style.css
@@ -1,7 +1,3 @@
.ok_button {

}

.reader_index_content {
background-image: url('../images/dragon_03.jpg');
background-repeat: no-repeat;
Expand Down
35 changes: 10 additions & 25 deletions _attachments/index.html
Expand Up @@ -236,31 +236,16 @@ <h2>Login</h2>

<!-- Creator: Manage Story Menu -->
<div data-role="page" id="creator_stories_storyid" data-url="#whatever" data-position="inline" >
<div data-role="header" class="header">
<h2 class="title">Manage Story</h2>
</div>
<div data-role="content" class="reader_index_content" data-identity="{{storyId}}" >
<div class="creator_index_content">
<div class="ui-grid-a" >
<div class="ui-block-a" >
content 123
</div>
<ul data-role="listview" data-theme="g" class="ui-block-b transparent" data-inset="true">
</ul>

</div>
</div>
</div>
<form>
<!-- <label for="slider-0">Built Story: </label> -->
<input type="range" name="slider" id="slider-0" value="60" min="0" max="100" highlight="true" step="2" />
</form>

<div data-role="footer">
Footer

</div>
</div>
<div data-role="header" class="header">
<h2 class="title">Manage Story</h2>
</div>
<div data-role="content" >
<!-- template_menus_simple -->
</div>
<div data-role="footer">
Footer
</div>
</div>


<!--CREATOR: Own Stories List -->
Expand Down
3 changes: 2 additions & 1 deletion _attachments/src/adventurio/routers/MainRouter.js
Expand Up @@ -94,7 +94,8 @@ adventurio.routers.MainRouter = Backbone.Router.extend({
var newModel = new adventurio.models.StoryModel({
'_id' : storyId
});
new adventurio.views.creator.Story({

adventurio.views.creator.Story.singleton = new adventurio.views.creator.Story({
model : newModel
});
},
Expand Down
5 changes: 0 additions & 5 deletions _attachments/src/adventurio/views/creator/ManageStory.js
Expand Up @@ -4,7 +4,6 @@ adventurio.views.creator.ManageStory = adventurio.views.superClasses.Basic.exten
$().ready($.proxy(this.render, this));
},
events : {
// "click a" : "redirectPage"
},
render : function() {
var context = {
Expand All @@ -27,8 +26,4 @@ adventurio.views.creator.ManageStory = adventurio.views.superClasses.Basic.exten
};
this._super("render", [adventurio.templates.menus.Simple.compile(context), "manage title"]);
}
// ,redirectPage : function(event) {
// var dataUrl = $(event.currentTarget).attr("data-identity");
// adventurio.routers.MainRouter.singleton.navigate(dataUrl, {trigger: true});
// }
});
4 changes: 0 additions & 4 deletions _attachments/src/adventurio/views/creator/Story.js
Expand Up @@ -7,10 +7,6 @@ adventurio.views.creator.Story = adventurio.views.superClasses.Basic.extend({
render : function() {
this._super("render", [adventurio.templates.creator.Story.compile(this.model.toJSON()), this.model.get("name")]);
},
renderTemplate : function(htmlContent, headerTitle){
$('[data-role="content"]', this.el).html(htmlContent).trigger("create");
$('h1', this.el).text(headerTitle);
},
events : {
"click .submitButton" : "editStory",
},
Expand Down
26 changes: 16 additions & 10 deletions _attachments/src/adventurio/views/superClasses/Basic.js
Expand Up @@ -3,31 +3,37 @@ adventurio.views.superClasses.Basic = Backbone.View.extend({
options = options || {};
var role = typeof options['role'] == 'undefined' ? "page" : options['role'];

$content = $('[data-role="content"]', this.el)
$content = $('[data-role="content"]', this.el);
$content.html(htmlContent);


var firstTimeRendered = !$content.hasClass('ui-content');

$('h1', this.el).text(headerTitle);
$.mobile.changePage("#"+this.el.id, {
transition : 'slideup',
reverse : false,
changeHash : false,
role : role
// ,reloadPage : true
});

if(!firstTimeRendered){
$content.trigger("create");
}

// var $listview = $("ul", $content); // .first()
// var wasAlreadyRenderedByJQM = $listview.hasClass('ui-listview')
// if (!wasAlreadyRenderedByJQM) {
// $listview.listview();
// }

// var hasListview = typeof options['hasListview'] == 'undefined' ? false : options['hasListview'];
// if(hasListview){
var $listview = $("ul", $content); // .first()
var wasAlreadyRenderedByJQM = $listview.hasClass('ui-listview')
// $listview.hasClass('ui-block-b') || || $listview.hasClass(".ui-body-c")
if (!wasAlreadyRenderedByJQM) {
// try{
$listview.listview();
// try{
// $listview.listview('refresh');
// }catch(ExceptionHackForBackButton){ /*do nothing*/}
// });
// this.el.trigger('create');
}
console.log("end");
// this.el.trigger('create');
}
});

0 comments on commit 103296d

Please sign in to comment.