From e0215421208d853e853f9c7b66add1e145982fbc Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Tue, 22 Nov 2011 17:33:09 +0100 Subject: Removing sections as special type of object Sections are changed into pure widget objects. Introduced IPA.composite_widget, basic widget for widget nesting (it's using IPA.widget_container). It's base class for section widgets. TODO: change old custom sections into custom fields and widgets. Note: usage of section in HBAC and SUDO is kept - whole logic will be removed in #1515 patch. https://fedorahosted.org/freeipa/ticket/2040 --- install/ui/details.js | 518 +++++++++----------------------------------------- 1 file changed, 92 insertions(+), 426 deletions(-) (limited to 'install/ui/details.js') diff --git a/install/ui/details.js b/install/ui/details.js index df14fd363..b84f7f468 100644 --- a/install/ui/details.js +++ b/install/ui/details.js @@ -4,6 +4,7 @@ * Pavel Zuna * Adam Young * Endi S. Dewata + * Petr Vobornik * * Copyright (C) 2010 Red Hat * see file 'COPYING' for use and warranty information @@ -162,295 +163,13 @@ IPA.section_builder = function(spec) { return that; }; -IPA.details_section = function(spec) { - - spec = spec || {}; - - var that = {}; - - that.name = spec.name || ''; - that.label = spec.label || ''; - that.entity = spec.entity; - that.fields = $.ordered_map(); - - that.dirty = false; - that.dirty_changed = IPA.observer(); - - that.undo = typeof spec.undo == 'undefined' ? true : spec.undo; - - var init = function() { - var fields = spec.fields || []; - that.add_fields(fields); - }; - - that.get_field = function(name) { - return that.fields.get(name); - }; - - that.add_field = function(field) { - field.entity = that.entity; - field.undo = that.undo; - that.fields.put(field.name, field); - field.dirty_changed.attach(that.field_dirty_changed); - return field; - }; - - that.add_fields = function(fields) { - for (var i=0; i', { - name: field.name, - title: field.label, - 'class': 'field' - }); - - if (field.hidden) { - field_container.css('display', 'none'); - } - - field_container.appendTo(container); - - field.create(field_container); - } - }; - - that.load = function(record) { - - that.record = record; - - var fields = that.fields.values; - for (var j=0; j', { - 'class': 'section-table' - }).appendTo(that.container); - - var fields = that.fields.values; - for (var i=0; i'); - that.add_row(field.name, tr); - - if (field.hidden) { - tr.css('display', 'none'); - } - - tr.appendTo(table); - - var td = $('', { - 'class': 'section-cell-label', - title: field.label - }).appendTo(tr); - - $('