Sha256: a72af7491913269532acc725a11343ce4028ccd7eab74a660c4d9ca378c86d78
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
Spontaneous.AddAliasDialogue = (function($, S) { var dom = S.Dom, Dialogue = Spontaneous.Dialogue; var AddAliasDialogue = new JS.Class(Dialogue, { initialize: function(box_view, type, position) { this.box_view = box_view; this.box_view.bind('entry_added', this.alias_added.bind(this)) this.type = type; this.insert_position = position; }, title: function() { return 'Add alias to “' + this.box_view.name() + '”'; }, buttons: function() { var btns = {}; btns["Add"] = this.add_alias.bind(this); return btns; }, uid: function() { return this.content.uid() + '!add-alias'; }, add_alias: function() { if (this.target) { this.box_view.add_alias(this.target.id, this.type, this.insert_position); } }, alias_added: function() { this.close(); }, select_target: function(target) { this.target = target; }, box_owner: function() { return this.box_view.box.container; }, box: function() { return this.box_view.box; }, body: function() { var editing = dom.div('#add-alias-dialogue') , outer = dom.div() , instructions = dom.p('.instructions') , __dialogue = this; instructions.html("Choose a target:"); editing.append(instructions, outer); Spontaneous.Ajax.get(['/targets', this.type.schema_id, this.box().id()].join('/'), this.targets_loaded.bind(this)); this._outer = outer; return editing; }, targets_loaded: function(targets) { var outer = this._outer, __dialogue = this; this.targets = targets; $.each(targets, function(i, target) { var d = dom.div('.type').html(target.title).click(function() { $('.type', outer).removeClass('selected'); __dialogue.select_target(target); $(this).addClass('selected');; }); outer.append(d) }); } }); return AddAliasDialogue; })(jQuery, Spontaneous);
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spontaneous-0.2.0.alpha2 | application/js/add_alias_dialogue.js |
spontaneous-0.2.0.alpha1 | application/js/add_alias_dialogue.js |