Merge lp:~methanal-developers/methanal/dependency-styling into lp:methanal

Proposed by Jonathan Jacobs
Status: Merged
Approved by: Tristan Seligmann
Approved revision: 140
Merged at revision: 139
Proposed branch: lp:~methanal-developers/methanal/dependency-styling
Merge into: lp:methanal
Diff against target: 114 lines (+48/-10)
3 files modified
methanal/js/Methanal/View.js (+31/-10)
methanal/static/styles/methanal-ie.css (+4/-0)
methanal/static/styles/methanal.css (+13/-0)
To merge this branch: bzr merge lp:~methanal-developers/methanal/dependency-styling
Reviewer Review Type Date Requested Status
Tristan Seligmann Approve
Review via email: mp+29296@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Tristan Seligmann (mithrandi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'methanal/js/Methanal/View.js'
2--- methanal/js/Methanal/View.js 2010-03-09 08:57:31 +0000
3+++ methanal/js/Methanal/View.js 2010-07-06 14:35:37 +0000
4@@ -421,7 +421,6 @@
5 for (var name in self._depCache._inputToHandlers) {
6 var node = self.getControl(name).widgetParent.node;
7 Methanal.Util.addElementClass(node, 'dependancy-parent');
8- node.title = 'Other fields depend on this field';
9 }
10 self.refresh();
11 },
12@@ -946,6 +945,29 @@
13
14
15 /**
16+ * Set a widget as active.
17+ *
18+ * The widget's visibility is determined by whether it is active or not,
19+ * inactive widgets are not visible and their values are not used in form
20+ * submission.
21+ *
22+ * @type active: C{boolean}
23+ */
24+Methanal.View._setActive = function _setActive(widget, active) {
25+ widget.active = active;
26+ if (active) {
27+ Methanal.Util.removeElementClass(widget.node, 'hidden');
28+ } else {
29+ Methanal.Util.addElementClass(widget.node, 'hidden');
30+ }
31+ if (widget.widgetParent.checkActive) {
32+ widget.widgetParent.checkActive();
33+ }
34+};
35+
36+
37+
38+/**
39 * A generic container for form inputs.
40 */
41 Nevow.Athena.Widget.subclass(Methanal.View, 'InputContainer').methods(
42@@ -1010,12 +1032,7 @@
43 * @type active: C{boolean}
44 */
45 function setActive(self, active) {
46- self.active = active;
47- self.node.style.display = active ? 'block' : 'none';
48- Methanal.Util.addElementClass(self.node, 'dependancy-child');
49- if (self.widgetParent.checkActive) {
50- self.widgetParent.checkActive();
51- }
52+ Methanal.View._setActive(self, active);
53 },
54
55
56@@ -1056,6 +1073,12 @@
57 function clearError(self) {
58 Methanal.View.FormRow.upcall(self, 'clearError');
59 Methanal.Util.replaceNodeText(self._errorTextNode, '');
60+ },
61+
62+
63+ function setActive(self, active) {
64+ Methanal.View.FormRow.upcall(self, 'setActive', active);
65+ Methanal.Util.addElementClass(self.node, 'dependancy-child');
66 });
67
68
69@@ -1294,9 +1317,7 @@
70 * @type active: C{boolean}
71 */
72 function setActive(self, active) {
73- self.active = active;
74- self.node.style.display = active ? 'block' : 'none';
75- self.widgetParent.checkActive();
76+ Methanal.View._setActive(self, active);
77 self.getForm().validate(self);
78 },
79
80
81=== added file 'methanal/static/images/icons/dependency_parent.gif'
82Binary files methanal/static/images/icons/dependency_parent.gif 1970-01-01 00:00:00 +0000 and methanal/static/images/icons/dependency_parent.gif 2010-07-06 14:35:37 +0000 differ
83=== modified file 'methanal/static/styles/methanal-ie.css'
84--- methanal/static/styles/methanal-ie.css 2010-03-14 01:23:56 +0000
85+++ methanal/static/styles/methanal-ie.css 2010-07-06 14:35:37 +0000
86@@ -67,3 +67,7 @@
87 margin-bottom: -0.5em;
88 padding: 0.25em;
89 }
90+
91+.dependancy-parent {
92+ background-position: 3px center;
93+}
94
95=== modified file 'methanal/static/styles/methanal.css'
96--- methanal/static/styles/methanal.css 2010-03-14 01:24:31 +0000
97+++ methanal/static/styles/methanal.css 2010-07-06 14:35:37 +0000
98@@ -557,3 +557,16 @@
99 .hidden {
100 display: none !important;
101 }
102+
103+.dependancy-parent {
104+ border-left: 3px solid #6094a4;
105+ margin-left: -3px;
106+ background-image: url("/static/Methanal/images/icons/dependency_parent.gif");
107+ background-repeat: no-repeat;
108+ background-position: left center;
109+}
110+
111+.dependancy-child {
112+ border-left: 3px solid #9fc4cf;
113+ margin-left: -3px;
114+}

Subscribers

People subscribed via source and target branches