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/add.js | 37 ++- install/ui/automount.js | 6 +- install/ui/details.js | 518 +++++++-------------------------------- install/ui/dialog.js | 152 +++++------- install/ui/dns.js | 75 +++--- install/ui/group.js | 4 +- install/ui/host.js | 12 +- install/ui/rule.js | 8 +- install/ui/service.js | 6 +- install/ui/sudo.js | 36 +-- install/ui/test/details_tests.js | 4 +- install/ui/user.js | 4 +- install/ui/widget.js | 165 +++++++++++++ 13 files changed, 402 insertions(+), 625 deletions(-) diff --git a/install/ui/add.js b/install/ui/add.js index c9d5e46bb..032302e30 100644 --- a/install/ui/add.js +++ b/install/ui/add.js @@ -127,31 +127,24 @@ IPA.entity_adder_dialog = function(spec) { var record = {}; that.save(record); - var sections = that.sections.values; - for (var i=0; i * 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); - - $('