formagic 0.1.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/formagic/form.coffee +31 -11
  3. data/app/assets/javascripts/formagic/inputs/checkbox.coffee +1 -0
  4. data/app/assets/javascripts/formagic/inputs/date.coffee +28 -3
  5. data/app/assets/javascripts/formagic/inputs/datetime.coffee +30 -2
  6. data/app/assets/javascripts/formagic/inputs/document.coffee +110 -0
  7. data/app/assets/javascripts/formagic/inputs/documents.coffee +39 -13
  8. data/app/assets/javascripts/formagic/inputs/documents_reorder.coffee +1 -1
  9. data/app/assets/javascripts/formagic/inputs/file.coffee +3 -0
  10. data/app/assets/javascripts/formagic/inputs/html.coffee +1 -0
  11. data/app/assets/javascripts/formagic/inputs/redactor.coffee +1 -0
  12. data/app/assets/javascripts/formagic/inputs/redactor_character.coffee +16 -14
  13. data/app/assets/javascripts/formagic/inputs/select2.coffee +1 -1
  14. data/app/assets/javascripts/formagic/inputs/string.coffee +5 -4
  15. data/app/assets/javascripts/formagic/inputs/text.coffee +4 -3
  16. data/app/assets/javascripts/formagic/inputs/url.coffee +37 -0
  17. data/app/assets/javascripts/formagic.coffee +2 -1
  18. data/app/assets/javascripts/vendor/ace.js +811 -577
  19. data/app/assets/javascripts/vendor/mode-html.js +24 -25
  20. data/app/assets/javascripts/vendor/mode-markdown.js +25 -26
  21. data/app/assets/javascripts/vendor/redactor.table.js +338 -0
  22. data/app/assets/stylesheets/formagic/date.scss +1 -0
  23. data/app/assets/stylesheets/formagic/file.scss +7 -0
  24. data/app/assets/stylesheets/formagic/form.scss +15 -10
  25. data/app/assets/stylesheets/formagic/image.scss +4 -0
  26. data/app/assets/stylesheets/formagic/label.scss +27 -0
  27. data/app/assets/stylesheets/formagic/nested-form.scss +3 -3
  28. data/app/assets/stylesheets/formagic/select2.scss +19 -1
  29. data/app/assets/stylesheets/formagic.scss +2 -1
  30. data/lib/formagic/version.rb +1 -1
  31. metadata +6 -3
  32. /data/app/assets/stylesheets/formagic/{redactor.scss → redactor1.scss} +0 -0
@@ -475,6 +475,19 @@ var initContext = function(editor) {
475
475
  };
476
476
  };
477
477
 
478
+ var getWrapped = function(selection, selected, opening, closing) {
479
+ var rowDiff = selection.end.row - selection.start.row;
480
+ return {
481
+ text: opening + selected + closing,
482
+ selection: [
483
+ 0,
484
+ selection.start.column + 1,
485
+ rowDiff,
486
+ selection.end.column + (rowDiff ? 0 : 1)
487
+ ]
488
+ };
489
+ };
490
+
478
491
  var CstyleBehaviour = function() {
479
492
  this.add("braces", "insertion", function(state, action, editor, session, text) {
480
493
  var cursor = editor.getCursorPosition();
@@ -484,10 +497,7 @@ var CstyleBehaviour = function() {
484
497
  var selection = editor.getSelectionRange();
485
498
  var selected = session.doc.getTextRange(selection);
486
499
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
- return {
488
- text: '{' + selected + '}',
489
- selection: false
490
- };
500
+ return getWrapped(selection, selected, '{', '}');
491
501
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
502
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
503
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -567,10 +577,7 @@ var CstyleBehaviour = function() {
567
577
  var selection = editor.getSelectionRange();
568
578
  var selected = session.doc.getTextRange(selection);
569
579
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
- return {
571
- text: '(' + selected + ')',
572
- selection: false
573
- };
580
+ return getWrapped(selection, selected, '(', ')');
574
581
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
582
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
583
  return {
@@ -615,10 +622,7 @@ var CstyleBehaviour = function() {
615
622
  var selection = editor.getSelectionRange();
616
623
  var selected = session.doc.getTextRange(selection);
617
624
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
- return {
619
- text: '[' + selected + ']',
620
- selection: false
621
- };
625
+ return getWrapped(selection, selected, '[', ']');
622
626
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
627
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
628
  return {
@@ -664,10 +668,7 @@ var CstyleBehaviour = function() {
664
668
  var selection = editor.getSelectionRange();
665
669
  var selected = session.doc.getTextRange(selection);
666
670
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
- return {
668
- text: quote + selected + quote,
669
- selection: false
670
- };
671
+ return getWrapped(selection, selected, quote, quote);
671
672
  } else if (!selected) {
672
673
  var cursor = editor.getCursorPosition();
673
674
  var line = session.doc.getLine(cursor.row);
@@ -679,8 +680,8 @@ var CstyleBehaviour = function() {
679
680
  if (leftChar == "\\" && token && /escape/.test(token.type))
680
681
  return null;
681
682
 
682
- var stringBefore = token && /string/.test(token.type);
683
- var stringAfter = !rightToken || /string/.test(rightToken.type);
683
+ var stringBefore = token && /string|escape/.test(token.type);
684
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
684
685
 
685
686
  var pair;
686
687
  if (rightChar == quote) {
@@ -821,7 +822,7 @@ oop.inherits(FoldMode, BaseFoldMode);
821
822
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
822
823
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
823
824
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
824
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
825
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
825
826
  this._getFoldWidgetBase = this.getFoldWidget;
826
827
  this.getFoldWidget = function(session, foldStyle, row) {
827
828
  var line = session.getLine(row);
@@ -909,13 +910,12 @@ oop.inherits(FoldMode, BaseFoldMode);
909
910
 
910
911
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
911
912
  };
912
-
913
913
  this.getCommentRegionBlock = function(session, line, row) {
914
914
  var startColumn = line.search(/\s*$/);
915
915
  var maxRow = session.getLength();
916
916
  var startRow = row;
917
917
 
918
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
918
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
919
919
  var depth = 1;
920
920
  while (++row < maxRow) {
921
921
  line = session.getLine(row);
@@ -1323,8 +1323,7 @@ var oop = require("../lib/oop");
1323
1323
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1324
1324
 
1325
1325
  var XmlHighlightRules = function(normalize) {
1326
-
1327
- var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1326
+ var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
1328
1327
 
1329
1328
  this.$rules = {
1330
1329
  start : [
@@ -1566,7 +1565,7 @@ var HtmlHighlightRules = function() {
1566
1565
  include : "tag_whitespace"
1567
1566
  }, {
1568
1567
  token : "entity.other.attribute-name.xml",
1569
- regex : "[-_a-zA-Z0-9:]+"
1568
+ regex : "[-_a-zA-Z0-9:.]+"
1570
1569
  }, {
1571
1570
  token : "keyword.operator.attribute-equals.xml",
1572
1571
  regex : "=",
@@ -1590,7 +1589,7 @@ var HtmlHighlightRules = function() {
1590
1589
  return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1591
1590
  "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1592
1591
  },
1593
- regex : "(</?)([-_a-zA-Z0-9:]+)",
1592
+ regex : "(</?)([-_a-zA-Z0-9:.]+)",
1594
1593
  next: "tag_stuff"
1595
1594
  }],
1596
1595
  tag_stuff: [
@@ -475,6 +475,19 @@ var initContext = function(editor) {
475
475
  };
476
476
  };
477
477
 
478
+ var getWrapped = function(selection, selected, opening, closing) {
479
+ var rowDiff = selection.end.row - selection.start.row;
480
+ return {
481
+ text: opening + selected + closing,
482
+ selection: [
483
+ 0,
484
+ selection.start.column + 1,
485
+ rowDiff,
486
+ selection.end.column + (rowDiff ? 0 : 1)
487
+ ]
488
+ };
489
+ };
490
+
478
491
  var CstyleBehaviour = function() {
479
492
  this.add("braces", "insertion", function(state, action, editor, session, text) {
480
493
  var cursor = editor.getCursorPosition();
@@ -484,10 +497,7 @@ var CstyleBehaviour = function() {
484
497
  var selection = editor.getSelectionRange();
485
498
  var selected = session.doc.getTextRange(selection);
486
499
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
- return {
488
- text: '{' + selected + '}',
489
- selection: false
490
- };
500
+ return getWrapped(selection, selected, '{', '}');
491
501
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
502
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
503
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -567,10 +577,7 @@ var CstyleBehaviour = function() {
567
577
  var selection = editor.getSelectionRange();
568
578
  var selected = session.doc.getTextRange(selection);
569
579
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
- return {
571
- text: '(' + selected + ')',
572
- selection: false
573
- };
580
+ return getWrapped(selection, selected, '(', ')');
574
581
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
582
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
583
  return {
@@ -615,10 +622,7 @@ var CstyleBehaviour = function() {
615
622
  var selection = editor.getSelectionRange();
616
623
  var selected = session.doc.getTextRange(selection);
617
624
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
- return {
619
- text: '[' + selected + ']',
620
- selection: false
621
- };
625
+ return getWrapped(selection, selected, '[', ']');
622
626
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
627
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
628
  return {
@@ -664,10 +668,7 @@ var CstyleBehaviour = function() {
664
668
  var selection = editor.getSelectionRange();
665
669
  var selected = session.doc.getTextRange(selection);
666
670
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
- return {
668
- text: quote + selected + quote,
669
- selection: false
670
- };
671
+ return getWrapped(selection, selected, quote, quote);
671
672
  } else if (!selected) {
672
673
  var cursor = editor.getCursorPosition();
673
674
  var line = session.doc.getLine(cursor.row);
@@ -679,8 +680,8 @@ var CstyleBehaviour = function() {
679
680
  if (leftChar == "\\" && token && /escape/.test(token.type))
680
681
  return null;
681
682
 
682
- var stringBefore = token && /string/.test(token.type);
683
- var stringAfter = !rightToken || /string/.test(rightToken.type);
683
+ var stringBefore = token && /string|escape/.test(token.type);
684
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
684
685
 
685
686
  var pair;
686
687
  if (rightChar == quote) {
@@ -821,7 +822,7 @@ oop.inherits(FoldMode, BaseFoldMode);
821
822
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
822
823
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
823
824
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
824
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
825
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
825
826
  this._getFoldWidgetBase = this.getFoldWidget;
826
827
  this.getFoldWidget = function(session, foldStyle, row) {
827
828
  var line = session.getLine(row);
@@ -909,13 +910,12 @@ oop.inherits(FoldMode, BaseFoldMode);
909
910
 
910
911
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
911
912
  };
912
-
913
913
  this.getCommentRegionBlock = function(session, line, row) {
914
914
  var startColumn = line.search(/\s*$/);
915
915
  var maxRow = session.getLength();
916
916
  var startRow = row;
917
917
 
918
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
918
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
919
919
  var depth = 1;
920
920
  while (++row < maxRow) {
921
921
  line = session.getLine(row);
@@ -1031,8 +1031,7 @@ var oop = require("../lib/oop");
1031
1031
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1032
1032
 
1033
1033
  var XmlHighlightRules = function(normalize) {
1034
-
1035
- var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1034
+ var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
1036
1035
 
1037
1036
  this.$rules = {
1038
1037
  start : [
@@ -1666,7 +1665,7 @@ oop.inherits(Mode, TextMode);
1666
1665
 
1667
1666
  this.blockComment = {start: "<!--", end: "-->"};
1668
1667
 
1669
- this.createWorker = function(session) {
1668
+ this.createWorker = function(session) {
1670
1669
  var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
1671
1670
  worker.attachToDocument(session.getDocument());
1672
1671
 
@@ -2016,7 +2015,7 @@ var HtmlHighlightRules = function() {
2016
2015
  include : "tag_whitespace"
2017
2016
  }, {
2018
2017
  token : "entity.other.attribute-name.xml",
2019
- regex : "[-_a-zA-Z0-9:]+"
2018
+ regex : "[-_a-zA-Z0-9:.]+"
2020
2019
  }, {
2021
2020
  token : "keyword.operator.attribute-equals.xml",
2022
2021
  regex : "=",
@@ -2040,7 +2039,7 @@ var HtmlHighlightRules = function() {
2040
2039
  return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
2041
2040
  "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
2042
2041
  },
2043
- regex : "(</?)([-_a-zA-Z0-9:]+)",
2042
+ regex : "(</?)([-_a-zA-Z0-9:.]+)",
2044
2043
  next: "tag_stuff"
2045
2044
  }],
2046
2045
  tag_stuff: [
@@ -0,0 +1,338 @@
1
+ if (!RedactorPlugins) var RedactorPlugins = {};
2
+
3
+ (function($)
4
+ {
5
+ RedactorPlugins.table = function()
6
+ {
7
+ return {
8
+ getTemplate: function()
9
+ {
10
+ return String()
11
+ + '<section id="redactor-modal-table-insert">'
12
+ + '<label>' + this.lang.get('rows') + '</label>'
13
+ + '<input type="text" size="5" value="2" id="redactor-table-rows" />'
14
+ + '<label>' + this.lang.get('columns') + '</label>'
15
+ + '<input type="text" size="5" value="3" id="redactor-table-columns" />'
16
+ + '</section>';
17
+ },
18
+ init: function()
19
+ {
20
+
21
+ var dropdown = {};
22
+
23
+ dropdown.insert_table = { title: this.lang.get('insert_table'), func: this.table.show };
24
+ dropdown.insert_row_above = { title: this.lang.get('insert_row_above'), func: this.table.addRowAbove };
25
+ dropdown.insert_row_below = { title: this.lang.get('insert_row_below'), func: this.table.addRowBelow };
26
+ dropdown.insert_column_left = { title: this.lang.get('insert_column_left'), func: this.table.addColumnLeft };
27
+ dropdown.insert_column_right = { title: this.lang.get('insert_column_right'), func: this.table.addColumnRight };
28
+ dropdown.add_head = { title: this.lang.get('add_head'), func: this.table.addHead };
29
+ dropdown.delete_head = { title: this.lang.get('delete_head'), func: this.table.deleteHead };
30
+ dropdown.delete_column = { title: this.lang.get('delete_column'), func: this.table.deleteColumn };
31
+ dropdown.delete_row = { title: this.lang.get('delete_row'), func: this.table.deleteRow };
32
+ dropdown.delete_table = { title: this.lang.get('delete_table'), func: this.table.deleteTable };
33
+
34
+ this.observe.addButton('td', 'table');
35
+ this.observe.addButton('th', 'table');
36
+
37
+ var button = this.button.addBefore('link', 'table', this.lang.get('table'));
38
+ this.button.addDropdown(button, dropdown);
39
+ },
40
+ show: function()
41
+ {
42
+ this.modal.addTemplate('table', this.table.getTemplate());
43
+
44
+ this.modal.load('table', this.lang.get('insert_table'), 300);
45
+ this.modal.createCancelButton();
46
+
47
+ var button = this.modal.createActionButton(this.lang.get('insert'));
48
+ button.on('click', this.table.insert);
49
+
50
+ this.selection.save();
51
+ this.modal.show();
52
+
53
+ $('#redactor-table-rows').focus();
54
+
55
+ },
56
+ insert: function()
57
+ {
58
+ this.placeholder.remove();
59
+ this.clean.cleanEmptyParagraph();
60
+
61
+ var rows = $('#redactor-table-rows').val(),
62
+ columns = $('#redactor-table-columns').val(),
63
+ $tableBox = $('<div>'),
64
+ tableId = Math.floor(Math.random() * 99999),
65
+ $table = $('<table id="table' + tableId + '"><tbody></tbody></table>'),
66
+ i, $row, z, $column;
67
+
68
+ for (i = 0; i < rows; i++)
69
+ {
70
+ $row = $('<tr>');
71
+
72
+ for (z = 0; z < columns; z++)
73
+ {
74
+ $column = $('<td>' + this.opts.invisibleSpace + '</td>');
75
+
76
+ // set the focus to the first td
77
+ if (i === 0 && z === 0)
78
+ {
79
+ $column.append(this.selection.getMarker());
80
+ }
81
+
82
+ $($row).append($column);
83
+ }
84
+
85
+ $table.append($row);
86
+ }
87
+
88
+ $tableBox.append($table);
89
+ var html = $tableBox.html();
90
+
91
+ this.modal.close();
92
+ this.selection.restore();
93
+
94
+ if (this.table.getTable()) return;
95
+
96
+ this.buffer.set();
97
+
98
+ var current = this.selection.getBlock() || this.selection.getCurrent();
99
+ if (current && current.tagName != 'BODY')
100
+ {
101
+ if (current.tagName == 'LI') current = $(current).closest('ul, ol');
102
+ $(current).after(html);
103
+ }
104
+ else
105
+ {
106
+ this.insert.html(html, false);
107
+ }
108
+
109
+ this.selection.restore();
110
+
111
+ var table = this.$editor.find('#table' + tableId);
112
+
113
+ if (!this.opts.linebreaks && (this.utils.browser('mozilla') || this.utils.browser('msie')))
114
+ {
115
+ var $next = table.next();
116
+ if ($next.length === 0)
117
+ {
118
+ table.after(this.opts.emptyHtml);
119
+ }
120
+ }
121
+
122
+ this.observe.buttons();
123
+
124
+ table.find('span.redactor-selection-marker').remove();
125
+ table.removeAttr('id');
126
+
127
+ this.code.sync();
128
+ this.core.setCallback('insertedTable', table);
129
+ },
130
+ getTable: function()
131
+ {
132
+ var $table = $(this.selection.getParent()).closest('table');
133
+
134
+ if (!this.utils.isRedactorParent($table)) return false;
135
+ if ($table.size() === 0) return false;
136
+
137
+ return $table;
138
+ },
139
+ restoreAfterDelete: function($table)
140
+ {
141
+ this.selection.restore();
142
+ $table.find('span.redactor-selection-marker').remove();
143
+ this.code.sync();
144
+ },
145
+ deleteTable: function()
146
+ {
147
+ var $table = this.table.getTable();
148
+ if (!$table) return;
149
+
150
+ this.buffer.set();
151
+
152
+
153
+ var $next = $table.next();
154
+ if (!this.opts.linebreaks && $next.length !== 0)
155
+ {
156
+ this.caret.setStart($next);
157
+ }
158
+ else
159
+ {
160
+ this.caret.setAfter($table);
161
+ }
162
+
163
+
164
+ $table.remove();
165
+
166
+ this.code.sync();
167
+ },
168
+ deleteRow: function()
169
+ {
170
+ var $table = this.table.getTable();
171
+ if (!$table) return;
172
+
173
+ var $current = $(this.selection.getCurrent());
174
+
175
+ this.buffer.set();
176
+
177
+ var $current_tr = $current.closest('tr');
178
+ var $focus_tr = $current_tr.prev().length ? $current_tr.prev() : $current_tr.next();
179
+ if ($focus_tr.length)
180
+ {
181
+ var $focus_td = $focus_tr.children('td, th').first();
182
+ if ($focus_td.length) $focus_td.prepend(this.selection.getMarker());
183
+ }
184
+
185
+ $current_tr.remove();
186
+ this.table.restoreAfterDelete($table);
187
+ },
188
+ deleteColumn: function()
189
+ {
190
+ var $table = this.table.getTable();
191
+ if (!$table) return;
192
+
193
+ this.buffer.set();
194
+
195
+ var $current = $(this.selection.getCurrent());
196
+ var $current_td = $current.closest('td, th');
197
+ var index = $current_td[0].cellIndex;
198
+
199
+ $table.find('tr').each($.proxy(function(i, elem)
200
+ {
201
+ var $elem = $(elem);
202
+ var focusIndex = index - 1 < 0 ? index + 1 : index - 1;
203
+ if (i === 0) $elem.find('td, th').eq(focusIndex).prepend(this.selection.getMarker());
204
+
205
+ $elem.find('td, th').eq(index).remove();
206
+
207
+ }, this));
208
+
209
+ this.table.restoreAfterDelete($table);
210
+ },
211
+ addHead: function()
212
+ {
213
+ var $table = this.table.getTable();
214
+ if (!$table) return;
215
+
216
+ this.buffer.set();
217
+
218
+ if ($table.find('thead').size() !== 0)
219
+ {
220
+ this.table.deleteHead();
221
+ return;
222
+ }
223
+
224
+ var tr = $table.find('tr').first().clone();
225
+ tr.find('td').replaceWith($.proxy(function()
226
+ {
227
+ return $('<th>').html(this.opts.invisibleSpace);
228
+ }, this));
229
+
230
+ $thead = $('<thead></thead>').append(tr);
231
+ $table.prepend($thead);
232
+
233
+ this.code.sync();
234
+
235
+ },
236
+ deleteHead: function()
237
+ {
238
+ var $table = this.table.getTable();
239
+ if (!$table) return;
240
+
241
+ var $thead = $table.find('thead');
242
+ if ($thead.size() === 0) return;
243
+
244
+ this.buffer.set();
245
+
246
+ $thead.remove();
247
+ this.code.sync();
248
+ },
249
+ addRowAbove: function()
250
+ {
251
+ this.table.addRow('before');
252
+ },
253
+ addRowBelow: function()
254
+ {
255
+ this.table.addRow('after');
256
+ },
257
+ addColumnLeft: function()
258
+ {
259
+ this.table.addColumn('before');
260
+ },
261
+ addColumnRight: function()
262
+ {
263
+ this.table.addColumn('after');
264
+ },
265
+ addRow: function(type)
266
+ {
267
+ var $table = this.table.getTable();
268
+ if (!$table) return;
269
+
270
+ this.buffer.set();
271
+
272
+ var $current = $(this.selection.getCurrent());
273
+ var $current_tr = $current.closest('tr');
274
+ var new_tr = $current_tr.clone();
275
+
276
+ new_tr.find('th').replaceWith(function()
277
+ {
278
+ var $td = $('<td>');
279
+ $td[0].attributes = this.attributes;
280
+
281
+ return $td.append($(this).contents());
282
+ });
283
+
284
+ new_tr.find('td').html(this.opts.invisibleSpace);
285
+
286
+ if (type == 'after')
287
+ {
288
+ $current_tr.after(new_tr);
289
+ }
290
+ else
291
+ {
292
+ $current_tr.before(new_tr);
293
+ }
294
+
295
+ this.code.sync();
296
+ },
297
+ addColumn: function (type)
298
+ {
299
+ var $table = this.table.getTable();
300
+ if (!$table) return;
301
+
302
+ var index = 0;
303
+ var current = $(this.selection.getCurrent());
304
+
305
+ this.buffer.set();
306
+
307
+ var $current_tr = current.closest('tr');
308
+ var $current_td = current.closest('td, th');
309
+
310
+ $current_tr.find('td, th').each($.proxy(function(i, elem)
311
+ {
312
+ if ($(elem)[0] === $current_td[0]) index = i;
313
+
314
+ }, this));
315
+
316
+ $table.find('tr').each($.proxy(function(i, elem)
317
+ {
318
+ var $current = $(elem).find('td, th').eq(index);
319
+
320
+ var td = $current.clone();
321
+ td.html(this.opts.invisibleSpace);
322
+
323
+ if (type == 'after')
324
+ {
325
+ $current.after(td);
326
+ }
327
+ else
328
+ {
329
+ $current.before(td);
330
+ }
331
+
332
+ }, this));
333
+
334
+ this.code.sync();
335
+ }
336
+ };
337
+ };
338
+ })(jQuery);
@@ -9,6 +9,7 @@
9
9
  .form .input-stacked input.input-datetime-time { width: auto; display: inline-block; }
10
10
 
11
11
  .input-date-label { display: inline-block; min-width: 7em; cursor: pointer; }
12
+ .input-date-label .placeholder { color: $lightColor; }
12
13
  .input-timedate-at { color: $stableColor; margin: 0 .25em; }
13
14
 
14
15
  .dd_ .dd_sw_ .dd_nav_.dd_prev_ { background-image: image-url('datedropper/prev.png'); }
@@ -26,4 +26,11 @@
26
26
  &:hover { background-color: $positiveColor; &:before { color: $white; } }
27
27
  }
28
28
 
29
+ .input-file.input-disabled {
30
+ min-height : inherit;
31
+ input,
32
+ label {
33
+ display : none;
34
+ }
35
+ }
29
36
  }
@@ -2,11 +2,7 @@
2
2
 
3
3
  .form {
4
4
 
5
- // label
6
-
7
- label { display: block; }
8
-
9
- // general
5
+ // General
10
6
 
11
7
  .input-stacked {
12
8
  @include position(relative); padding: .5em 1em .9em;
@@ -17,20 +13,29 @@
17
13
  .label { display: block; line-height: 1.8; color: $stableColor; }
18
14
  }
19
15
 
20
- // validation error
16
+ // Validation error
21
17
 
22
18
  .error-message { color: $assertiveColor; font-size: .8em; margin-left: .5em; }
23
19
 
24
- // required
20
+ // Required
25
21
 
26
22
  .input-required .label:before { content: '*'; color: $assertiveColor; @include position(absolute, null null null .38em); }
27
23
 
28
- // disabled
24
+ // Disabled
29
25
 
30
- .input-disabled { textarea, input { color: $stableColor; } }
26
+ .input-disabled { textarea, input { color: lighten($black, 20%); } }
31
27
 
32
- // character counter
28
+ // Character counter
33
29
 
34
30
  .input-character-counter { font-size: .8em; margin-left: .5em; &.exceeds { color: $assertiveColor; } }
35
31
 
32
+ // Information box
33
+
34
+ .form-information {
35
+ margin : 1em 1em 0;
36
+ padding : 1em;
37
+ background : $neutralColor;
38
+ text-align : center;
39
+ }
40
+
36
41
  }
@@ -16,4 +16,8 @@
16
16
  }
17
17
  }
18
18
 
19
+ .input-image.input-disabled {
20
+ min-height : 102px;
21
+ }
22
+
19
23
  }