mirror of
https://github.com/diaspora/diaspora.git
synced 2026-01-09 15:18:11 -05:00
MS DC template picker override
This commit is contained in:
@@ -8,24 +8,33 @@ app.pages.Framer = app.views.Base.extend({
|
||||
},
|
||||
|
||||
subviews : {
|
||||
".post-view" : "postView"
|
||||
".post-view" : "postView",
|
||||
".template-picker" : "templatePicker"
|
||||
},
|
||||
|
||||
initialize : function(){
|
||||
this.model = app.frame
|
||||
|
||||
var templateType = "status"
|
||||
this.model.bind("change", this.render, this)
|
||||
this.templatePicker = new app.views.TemplatePicker({ model: this.model })
|
||||
},
|
||||
|
||||
this.model.authorIsNotCurrentUser = function(){ return false }
|
||||
postView : function(){
|
||||
//we might be leaky like cray cray with this
|
||||
|
||||
this.postView = new app.views.Post({
|
||||
var templateType = this.model.get("templateName")
|
||||
|
||||
var postView = new app.views.Post({
|
||||
model : this.model,
|
||||
className : templateType + " post loaded",
|
||||
templateName : "post-viewer/content/" + templateType,
|
||||
attributes : {"data-template" : templateType}
|
||||
});
|
||||
|
||||
this.postView.feedbackView = new Backbone.View
|
||||
postView.feedbackView = new Backbone.View
|
||||
this.model.authorIsNotCurrentUser = function(){ return false }
|
||||
|
||||
return postView
|
||||
},
|
||||
|
||||
saveFrame : function(){
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<select name="template">
|
||||
{{#each templates}}
|
||||
<option value="{{.}}">{{.}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
33
public/javascripts/app/views/template_picker_view.js
Normal file
33
public/javascripts/app/views/template_picker_view.js
Normal file
@@ -0,0 +1,33 @@
|
||||
app.views.TemplatePicker = app.views.Base.extend({
|
||||
templateName : "template-picker",
|
||||
|
||||
initialize : function(){
|
||||
this.model.set({templateName : 'status'})
|
||||
},
|
||||
|
||||
events : {
|
||||
"change select" : "setModelTemplate"
|
||||
},
|
||||
|
||||
postRenderTemplate : function(){
|
||||
this.$("select[name=template]").val(this.model.get("templateName"))
|
||||
},
|
||||
|
||||
setModelTemplate : function(evt){
|
||||
this.model.set({"templateName": this.$("select[name=template]").val()})
|
||||
},
|
||||
|
||||
presenter : function() {
|
||||
return _.extend(this.defaultPresenter(), {
|
||||
templates : [
|
||||
"status-with-photo-backdrop",
|
||||
"note",
|
||||
"rich-media",
|
||||
"multi-photo",
|
||||
"photo-backdrop",
|
||||
"activity-streams-photo",
|
||||
"status"
|
||||
]
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user