Sha256: 780f500cf9f1cc14c4f3f10f4c7e9dedb0b6ee0e353dc87550b6de102b27d55d
Contents?: true
Size: 1.52 KB
Versions: 9
Compression:
Stored size: 1.52 KB
Contents
Spontaneous.AddHomeDialogue = (function($, S) { var dom = S.Dom, Dialogue = Spontaneous.Dialogue; var AddHomeDialogue = new JS.Class(Dialogue, { initialize: function(types) { this.types = types; }, title: function() { return "Create site home page"; }, width: function() { return '50%'; }, buttons: function() { var btns = {}; btns["Create"] = this.create_home.bind(this); return btns; }, uid: function() { return this.content.uid() + '!editing'; }, create_home: function() { if (this.type) { S.Ajax.post('/root', {'type':this.type.schema_id}, this.home_created.bind(this)); } }, home_created: function(data) { window.location.href = S.Ajax.namespace }, select_type: function(type) { this.type = type; }, body: function() { var editing = dom.div('#create-home-dialogue'), outer = dom.div(), instructions = dom.p('.instructions'), types = this.types, __dialogue = this; instructions.html("You don't have a home page. Please choose a type below and hit <span class=\"button\">Create</span> to add one") $.each(types, function(i, type) { if (type.is_page()) { var d = dom.div('.type').text(type.title).click(function() { $('.type', outer).removeClass('selected'); __dialogue.select_type(type); $(this).addClass('selected');; }); outer.append(d) } }); editing.append(instructions, outer) return editing; }, cancel_button: function() { return false; }, }); return AddHomeDialogue; })(jQuery, Spontaneous);
Version data entries
9 entries across 9 versions & 1 rubygems