rad_common_interface 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. data/Rakefile +1 -0
  2. data/app/static/demo/images/img1.jpg +0 -0
  3. data/app/static/demo/images/img1_200.jpg +0 -0
  4. data/app/static/demo/images/img1_icon.jpg +0 -0
  5. data/app/static/demo/images/img1_thumb.jpg +0 -0
  6. data/app/static/demo/images/img2.jpg +0 -0
  7. data/app/static/demo/images/img2_200.jpg +0 -0
  8. data/app/static/demo/images/img2_icon.jpg +0 -0
  9. data/app/static/demo/images/img2_thumb.jpg +0 -0
  10. data/app/static/demo/images/img3.jpg +0 -0
  11. data/app/static/demo/images/img3_200.jpg +0 -0
  12. data/app/static/demo/images/img3_icon.jpg +0 -0
  13. data/app/static/demo/images/img3_thumb.jpg +0 -0
  14. data/app/static/demo/images/img_big.jpg +0 -0
  15. data/app/static/demo/images/img_big_icon.jpg +0 -0
  16. data/app/static/demo/images/img_big_thum.jpg +0 -0
  17. data/app/static/demo/images/video_icon.png +0 -0
  18. data/app/static/face/attachments.js +85 -0
  19. data/app/static/face/dialogs.js +189 -0
  20. data/app/static/face/discussion.js +47 -0
  21. data/app/static/face/markup.js +53 -0
  22. data/app/static/face/more.js +33 -0
  23. data/app/static/face/table.js +24 -0
  24. data/app/static/face/tabs.js +26 -0
  25. data/app/static/face.css +8 -0
  26. data/app/static/face.js +109 -0
  27. data/app/static/lib/SimpleDialog/SimpleDialog.ContextMenu.js +36 -0
  28. data/app/static/lib/SimpleDialog/SimpleDialog.Image.js +121 -0
  29. data/app/static/lib/SimpleDialog/SimpleDialog.Mask.js +76 -0
  30. data/app/static/lib/SimpleDialog/SimpleDialog.Static.js +0 -0
  31. data/app/static/lib/SimpleDialog/SimpleDialog.css +12 -0
  32. data/app/static/lib/SimpleDialog/SimpleDialog.js +158 -0
  33. data/app/static/lib/ajax_file_uploading.js +33 -0
  34. data/app/static/themes/default/reset.css +127 -0
  35. data/app/static/themes/default/style/application.less +51 -0
  36. data/app/static/themes/default/style/aspects.less +15 -0
  37. data/app/static/themes/default/style/basic.less +49 -0
  38. data/app/static/themes/default/style/forms.less +34 -0
  39. data/app/static/themes/default/style/items.less +43 -0
  40. data/app/static/themes/default/style/markup.less +16 -0
  41. data/app/static/themes/default/style/micelaneous.less +10 -0
  42. data/app/static/themes/default/style/mixins.less +72 -0
  43. data/app/static/themes/default/style/styles.less +57 -0
  44. data/app/static/themes/default/style/tools.less +15 -0
  45. data/app/static/themes/default/style/variables.less +38 -0
  46. data/app/static/themes/default/style.css +944 -0
  47. data/app/static/themes/default/style.js +127 -0
  48. data/app/static/themes/default/style.less +22 -0
  49. data/app/static/vendor/flext.js +254 -0
  50. data/app/static/vendor/formalize/formalize.css +311 -0
  51. data/app/static/vendor/formalize/mootools.formalize.js +163 -0
  52. data/app/static/vendor/formalize/reset.css +171 -0
  53. data/app/static/vendor/iFrameFormRequest.js +95 -0
  54. data/app/static/vendor/mootools-more.js +4185 -0
  55. data/app/static/vendor/purr/purr.css +43 -0
  56. data/app/static/vendor/purr/purr.js +308 -0
  57. data/app/views/face/_attachments_tag.html.haml +17 -0
  58. data/app/views/rad/face/demo/commons/aspects.html.haml +32 -0
  59. data/app/views/rad/face/demo/commons/basic.html.haml +86 -0
  60. data/app/views/rad/face/demo/commons/forms.html.haml +57 -0
  61. data/app/views/rad/face/demo/commons/items.html.haml +32 -0
  62. data/app/views/rad/face/demo/commons/style.html.erb +111 -0
  63. data/app/views/rad/face/demo/dialogs/dialog.js.haml +1 -0
  64. data/app/views/rad/face/demo/dialogs/dialog_form.html.haml +7 -0
  65. data/app/views/rad/face/demo/dialogs/dialog_form.js.erb +1 -0
  66. data/app/views/rad/face/demo/dialogs/inplace/_element.html.haml +3 -0
  67. data/app/views/rad/face/demo/dialogs/inplace/_form.html.haml +3 -0
  68. data/app/views/rad/face/demo/dialogs/inplace.js.haml +1 -0
  69. data/app/views/rad/face/demo/dialogs/inplace_form.js.haml +2 -0
  70. data/app/views/rad/face/demo/dialogs/show.html.haml +27 -0
  71. data/app/views/rad/face/demo/helps/help.html.haml +1 -0
  72. data/app/views/rad/face/demo/helps/index.html.haml +25 -0
  73. data/app/views/rad/face/demo/layout.html.haml +3 -0
  74. data/app/views/rad/face/demo/layout.js.haml +11 -0
  75. data/app/views/rad/face/demo/shared/_comments.html.haml +11 -0
  76. data/app/views/rad/face/demo/shared/_core_tools.html.haml +6 -0
  77. data/app/views/rad/face/demo/shared/_line_previews.html.haml +40 -0
  78. data/app/views/rad/face/demo/shared/_paginator.html.haml +7 -0
  79. data/app/views/rad/face/demo/shared/_tools.html.haml +25 -0
  80. data/app/views/rad/face/demo/shared/_top_navigation_bottom.html.haml +34 -0
  81. data/app/views/rad/face/demo/sites/blog.html.haml +12 -0
  82. data/app/views/rad/face/demo/sites/home.html.haml +8 -0
  83. data/app/views/rad/face/demo/sites/post.html.haml +10 -0
  84. data/app/views/rad/face/demo/sites/style.html.haml +8 -0
  85. data/app/views/themes/default/application.html.haml +25 -0
  86. data/app/views/themes/default/basic_list.html.haml +2 -0
  87. data/app/views/themes/default/basic_list_item.html.haml +5 -0
  88. data/app/views/themes/default/bottom_panel.html.haml +16 -0
  89. data/app/views/themes/default/comment.html.haml +20 -0
  90. data/app/views/themes/default/controls.html.haml +3 -0
  91. data/app/views/themes/default/demo_metadata.rb +118 -0
  92. data/app/views/themes/default/details.html.haml +6 -0
  93. data/app/views/themes/default/discussion.html.haml +7 -0
  94. data/app/views/themes/default/divider.html.haml +2 -0
  95. data/app/views/themes/default/forms/errors.html.haml +4 -0
  96. data/app/views/themes/default/forms/field.html.haml +18 -0
  97. data/app/views/themes/default/forms/form.html.haml +4 -0
  98. data/app/views/themes/default/forms/line.html.haml +8 -0
  99. data/app/views/themes/default/help.html.haml +3 -0
  100. data/app/views/themes/default/html.html.haml +1 -0
  101. data/app/views/themes/default/index.html.haml +6 -0
  102. data/app/views/themes/default/item.html.haml +12 -0
  103. data/app/views/themes/default/layout_templates/dashboard.html.haml +1 -0
  104. data/app/views/themes/default/layout_templates/default.html.haml +22 -0
  105. data/app/views/themes/default/line.html.haml +21 -0
  106. data/app/views/themes/default/message.html.haml +2 -0
  107. data/app/views/themes/default/more.html.haml +8 -0
  108. data/app/views/themes/default/narrow.html.haml +2 -0
  109. data/app/views/themes/default/navigation.html.haml +16 -0
  110. data/app/views/themes/default/paginator.html.haml +8 -0
  111. data/app/views/themes/default/shared/details.html.haml +17 -0
  112. data/app/views/themes/default/table.html.haml +9 -0
  113. data/app/views/themes/default/table_row.html.haml +4 -0
  114. data/app/views/themes/default/tabs.html.haml +27 -0
  115. data/app/views/themes/default/tag_selector.html.haml +10 -0
  116. data/app/views/themes/default/text.html.haml +4 -0
  117. data/app/views/themes/default/thumb.html.haml +10 -0
  118. data/app/views/themes/default/title.html.haml +3 -0
  119. data/app/views/themes/default/tool.html.haml +5 -0
  120. data/app/views/themes/default/toolbar.html.haml +16 -0
  121. data/app/views/themes/default/top_panel.html.haml +18 -0
  122. metadata +153 -25
data/Rakefile CHANGED
@@ -4,6 +4,7 @@ project(
4
4
  name: "common_interface",
5
5
  official_name: "rad_common_interface",
6
6
  gem: true,
7
+ dirs: 'app',
7
8
  summary: "User Interface for Rad Framework",
8
9
 
9
10
  author: "Alexey Petrushin",
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,85 @@
1
+ //
2
+ // Attachments
3
+ //
4
+ // - if there's no any files in attachment it should display small file_input without any border or remove button
5
+ // - if there's files - files should have borders, remove buttons and be sortable, file_input
6
+ // should be last in chain and have border but not the remove button and not be sortable
7
+ // - if user select a file - file input should show remove button and became sortable and there should appear a new file_input - with border
8
+ // but without remove button and not be sortabe
9
+ //
10
+ Rad.Attachments = new Class({
11
+ initialize: function(element){
12
+ this.element = element;
13
+
14
+ // initializing attachments
15
+ var _this = this;
16
+ this.element.getElements('.l_item').each(function(attachment){
17
+ attachment.getElement('.l_remove_button').addEvent('click', function(){
18
+ attachment.destroy();
19
+ _this.update();
20
+ });
21
+ });
22
+
23
+ this.sortables = new Sortables();
24
+ this.addFileField();
25
+ this.update();
26
+ },
27
+
28
+ addFileField: function(){
29
+ var template = this.element.getElement('.l_file_field_template').get('value');
30
+ var fileField = template.toElements();
31
+ fileField.inject(this.element.getElements('.css_clear').last(), 'before');
32
+ fileField.addEvent('change', function(){
33
+ this.addFileField();
34
+ this.update();
35
+ }.bind(this));
36
+ fileField.getElement('.l_remove_button').addEvent('click', function(){
37
+ fileField.destroy();
38
+ this.update();
39
+ }.bind(this));
40
+ },
41
+
42
+ update: function(){
43
+ var items = this.element.getElements('.l_item');
44
+ var attachments = items.filter(function(item){
45
+ return !item.getElement('input[type=file]');
46
+ });
47
+ var filledFileInputs = items.filter(function(item){
48
+ var fileInput = item.getElement('input[type=file]');
49
+ return fileInput && !fileInput.get('value').blank();
50
+ });
51
+ var emptyFileInputs = items.filter(function(item){
52
+ var fileInput = item.getElement('input[type=file]');
53
+ return fileInput && fileInput.get('value').blank();
54
+ });
55
+
56
+ // clearing all
57
+ this.sortables.detach();
58
+ items.each(function(item){item.getElements('.l_remove_button').hide()});
59
+ items.removeClass('l_item_style').removeClass('l_empty_item_style');
60
+
61
+ // updating styles
62
+ if(items.size() > 1){
63
+ // displaying filled inputs as attachments
64
+ filledFileInputs.each(function(item){
65
+ var input = item.getElement('input');
66
+ var fname = input.get('value').replace(/^.*(\/|\\)/, '');
67
+ var attachmentStub = item.getElement('.l_attachment_stub');
68
+
69
+ input.hide();
70
+ attachmentStub.set('text', fname).show();
71
+ });
72
+
73
+ //
74
+ var removableAndSortableItems = Array.concat(attachments, filledFileInputs).flatten();
75
+ removableAndSortableItems.each(function(item){
76
+ item.addClass('l_item_style');
77
+ item.getElements('.l_remove_button').show()
78
+ });
79
+
80
+ emptyFileInputs.addClass('l_empty_item_style')
81
+ this.sortables = new Sortables();
82
+ this.sortables.addItems(removableAndSortableItems);
83
+ }
84
+ }
85
+ });
@@ -0,0 +1,189 @@
1
+ //
2
+ // Universal dialog form buttons
3
+ //
4
+ Rad.DialogButtons = new Class({
5
+ _initializeButtons: function(containerQ){
6
+ var container = containerQ.toElement(true);
7
+ // Universal Cancel Button (for General and AJAX forms)
8
+ container.getElements('.m_redirect_back_or_close_dialog').addEvent('click', function(event){
9
+ event.stop();
10
+ this.destroy();
11
+ }.bind(this));
12
+
13
+ // Universal Submit Button (for General and AJAX forms)
14
+ container.getElements('.m_submit_form_or_ajax_form').addEvent('click', function(event){
15
+ event.stop();
16
+ this.submit();
17
+ }.bind(this));
18
+ }
19
+ });
20
+
21
+
22
+ //
23
+ // Inplace
24
+ //
25
+ Rad.AbstractInplace = new Class({
26
+ Implements: [Events, Rad.DialogButtons],
27
+
28
+ wait: function(message){
29
+ message = message || "<p>Please wait ...</p>";
30
+ this.editor.getChildren().hide();
31
+ message.toElements(true).inject(this.editor);
32
+ },
33
+
34
+ submit: function(){
35
+ this.wait();
36
+ var form = this.editor.getElement('form');
37
+ rad.submitForm(form, {}, function(){this.destroy();}.bind(this));
38
+ },
39
+
40
+ edit: function(editorQ){
41
+ this.editor = editorQ.toElement(true);
42
+ this.editor.addClass('the_inplace_editor');
43
+ this._initializeButtons(this.editor);
44
+ }
45
+ });
46
+
47
+ Rad.EditInplace = new Class({
48
+ Extends: Rad.AbstractInplace,
49
+
50
+ initialize: function(elementQ){
51
+ this.element = elementQ.toElement(true);
52
+ },
53
+
54
+ destroy: function(){
55
+ this.element.show();
56
+ this.editor.destroy();
57
+ this.fireEvent('destroy');
58
+ },
59
+
60
+ edit: function(editorQ){
61
+ this.parent(editorQ);
62
+
63
+ this.element.hide();
64
+ this.editor.inject(this.element, 'after');
65
+
66
+ this.fireEvent('edit');
67
+ },
68
+
69
+ update: function(contentQ){
70
+ var content = contentQ.toElements(true);
71
+ content.replaces(this.element);
72
+ this.fireEvent('update');
73
+ }
74
+ });
75
+
76
+ Rad.AddInplace = new Class({
77
+ Extends: Rad.AbstractInplace,
78
+
79
+ initialize: function(containerQ){
80
+ this.container = containerQ.toElement(true);
81
+ },
82
+
83
+ destroy: function(){
84
+ this.editor.destroy();
85
+ this.fireEvent('destroy');
86
+ },
87
+
88
+ edit: function(editorQ){
89
+ this.parent(editorQ);
90
+
91
+ if(this.container) this.editor.inject(this.container);
92
+ this.fireEvent('edit');
93
+ },
94
+
95
+ update: function(contentQ){
96
+ var content = contentQ.toElements(true);
97
+ content.inject(this.container);
98
+ this.fireEvent('update');
99
+ }
100
+ });
101
+
102
+
103
+ //
104
+ // Dialog
105
+ //
106
+ Rad.Dialog = new Class({
107
+ Extends: SimpleDialog,
108
+ Implements: [SimpleDialog.OnlyOne, Rad.DialogButtons],
109
+
110
+ initialize: function(options){
111
+ options = options || {}
112
+ this.parent(options);
113
+ this.element.addClass('the_dialog');
114
+ this.onlyOne(this);
115
+ new SimpleDialog.Mask(this);
116
+ },
117
+
118
+ show: function(html){
119
+ this.parent(html);
120
+ this._initializeButtons(this.element);
121
+ },
122
+
123
+ submit: function(){
124
+ var form;
125
+ this.wait();
126
+ form = this.element.getElement('form');
127
+ // form can be removed only when form is posted, othervise it doesn't works with files
128
+ rad.submitForm(form, {}, function(){this.destroy();}.bind(this));
129
+ }
130
+ });
131
+
132
+
133
+ //
134
+ // Image dialog
135
+ //
136
+ Rad.ImageDialog = new Class({
137
+ Extends: SimpleDialog.Image,
138
+ Implements: [SimpleDialog.Autodestroy, SimpleDialog.OnlyOne],
139
+ initialize: function(options){
140
+ options = options || {}
141
+ this.parent(options);
142
+ this.element.addClass('the_image_dialog');
143
+ this.onlyOne(this);
144
+ this.autodestroy();
145
+ new SimpleDialog.Mask(this);
146
+ }
147
+ });
148
+
149
+
150
+ //
151
+ // Context menu
152
+ //
153
+ Rad.ContextMenu = new Class({
154
+ Extends: SimpleDialog.ContextMenu,
155
+ Implements: [SimpleDialog.Autodestroy, SimpleDialog.OnlyOne],
156
+ initialize: function(options){
157
+ options = options || {}
158
+ this.parent(options);
159
+ this.element.addClass('the_context_menu');
160
+ this.onlyOne(this);
161
+ this.autodestroy();
162
+ }
163
+ });
164
+
165
+
166
+ // TODO3 showVideosInDialog
167
+ // markup.getElements('a._video').addEvent 'click', (event) ->
168
+ // event.stop()
169
+ // Slimbox.open this.get('href'), this.get('title')
170
+ // $.fancybox({
171
+ // 'padding' : 0,
172
+ // // 'autoScale' : false,
173
+ // 'transitionIn': 'none',
174
+ // 'transitionOut': 'none',
175
+ // 'title': this.title,
176
+ // // 'width' : 680,
177
+ // // 'height' : 495,
178
+ // 'href': this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
179
+ // // 'href' : "http://www.youtube.com/watch?v=M-cIjPOJdFM&amp;fs=1".replace(new RegExp("watch\\?v=", "i"), 'v/'),
180
+ // 'type': 'swf',
181
+ // 'swf': {
182
+ // 'wmode': 'transparent',
183
+ // 'allowfullscreen' : 'true'
184
+ // }
185
+ // });
186
+ //
187
+ // return false;
188
+ // });
189
+ // });
@@ -0,0 +1,47 @@
1
+ //
2
+ // Discussion
3
+ //
4
+ Rad.Discussion = new Class({
5
+ anew: function(formQ){
6
+ this._buildInplace().edit(formQ);
7
+ },
8
+ create: function(contentQ){
9
+ this._buildInplace().update(contentQ);
10
+ },
11
+ _buildInplace: function(){
12
+ var inplace = new Rad.AddInplace('.the_discussion .l_comments');
13
+ var control = '.the_discussion .l_controls'.toElements();
14
+ inplace.addEvents({
15
+ edit: control.hide.bind(control),
16
+ update: control.show.bind(control),
17
+ destroy: control.show.bind(control)
18
+ });
19
+ return inplace;
20
+ },
21
+ comment: function(commentQ){
22
+ return new Rad.Comment(this, commentQ);
23
+ }
24
+ });
25
+
26
+
27
+ //
28
+ // Comments
29
+ //
30
+ Rad.Comment = new Class({
31
+ initialize: function(discussion, commentQ){
32
+ this.discussion = discussion;
33
+ this.comment = commentQ.toElement(true);
34
+ },
35
+ destroy: function(){
36
+ this.comment.destroy();
37
+ },
38
+ update: function(contentQ){
39
+ this._buildInplace().update(contentQ);
40
+ },
41
+ edit: function(formQ){
42
+ this._buildInplace().edit(formQ);
43
+ },
44
+ _buildInplace: function(){
45
+ return new Rad.EditInplace(this.comment);
46
+ },
47
+ });
@@ -0,0 +1,53 @@
1
+ //
2
+ // Markup
3
+ //
4
+ Rad.Markup = new Class({
5
+ initialize: function(e){
6
+ this.element = e;
7
+ this.allignImagesToLeft();
8
+ this.showImagesInDialog();
9
+ },
10
+
11
+ // Images by default should be alligned to the left (wrapped inside .left div)
12
+ allignImagesToLeft: function(){
13
+ var images;
14
+ images = this.element.getElements('img');
15
+ // skipping images inside :div's with custom styles
16
+ images = images.reject(function(img){
17
+ var parent;
18
+ parent = img.getParents('div').first();
19
+ return (parent.get('tag') === 'div') && !parent.hasClass('m_markup');
20
+ });
21
+ images.each(function(img){
22
+ // wrapping image with outer link
23
+ img = img.getParent('a') || img;
24
+ (new Element('div.left')).wraps(img);
25
+ });
26
+ },
27
+
28
+ showImagesInDialog: function(){
29
+ var imageUrls, links, skip_classes;
30
+ skip_classes = ['_nobox', '_video'];
31
+
32
+ // selecting links with images
33
+ links = this.element.getElements('a').filter(function(a){
34
+ var child, children;
35
+ children = a.getChildren();
36
+ child = children.first();
37
+ return (children.size() === 1) && (child.get('tag') === 'img') && skip_classes.none(function(cls){return a.hasClass(cls);});
38
+ });
39
+ imageUrls = links.map(function(link){return link.get('href');});
40
+
41
+ // adding events
42
+ links.each(function(link, i){
43
+ link.addEvent('click', function(event){
44
+ var dialog;
45
+ event.stop();
46
+ dialog = new Rad.ImageDialog({
47
+ images: imageUrls
48
+ });
49
+ dialog.show(imageUrls[i]);
50
+ });
51
+ });
52
+ }
53
+ });
@@ -0,0 +1,33 @@
1
+ //
2
+ // More
3
+ //
4
+ Rad.More = new Class({
5
+ initialize: function(element){
6
+ this.element = element;
7
+ var id = this.element.getData('id');
8
+ this.core = $(id + '_core');
9
+ this.more = $(id + '_more');
10
+
11
+ if(!this.more) console.log("Rad.More: no content for '" + id + "'!");
12
+
13
+ // add event to button
14
+ element.addEvent('click', function(event){
15
+ event.stop();
16
+ Rad.More.opened_containers[id] = true;
17
+ this._show();
18
+ }.bind(this));
19
+
20
+ // if opened once, keep it open in all next ajax updates
21
+ if(Rad.More.opened_containers[id]) this._show();
22
+ },
23
+ _show: function(){
24
+ this.more.getChildren().reverse().each(function(e){
25
+ e.inject(this.element, 'after');
26
+ }.bind(this));
27
+ if(this.core) this.core.destroy();
28
+ this.more.destroy();
29
+ this.element.destroy();
30
+ window.fireEvent('updateStyle');
31
+ }
32
+ });
33
+ Rad.More.opened_containers = {};
@@ -0,0 +1,24 @@
1
+ //
2
+ // AJAX Table helpers
3
+ //
4
+ Rad.Table = new Class({
5
+ initialize: function(tableQ){
6
+ this.table = tableQ.toElement(true);
7
+ if(!this.table) throw("no table '" + tableQ + "'!");
8
+ this.tbody = this.table.getChild('tbody');
9
+ },
10
+ anew: function(form){rad.dialog().show(form);},
11
+ create: function(lineQ){lineQ.toElement(true).inject(this.tbody);},
12
+ edit: function(form){rad.dialog().show(form);},
13
+ line: function(lineQ){return new Rad.Table.Line(this, lineQ);}
14
+ });
15
+
16
+ Rad.Table.Line = new Class({
17
+ initialize: function(table, lineQ){
18
+ this.table = table;
19
+ this.tr = table.tbody.getChild(lineQ);
20
+ if(!this.tr) throw("no table row with '" + lineQ + "'!");
21
+ },
22
+ destroy: function(){this.tr.destroy();},
23
+ update: function(line){line.toElement(true).replaces(this.tr);}
24
+ });
@@ -0,0 +1,26 @@
1
+ //
2
+ // Tabs
3
+ //
4
+ Rad.Tabs = new Class({
5
+ initialize: function(tabsQ){
6
+ this.element = tabsQ.toElement(true);
7
+ var tabs = this.element.getElements('> .l_panel .l_item');
8
+ var contents = this.element.getElements('> .l_content .l_item');
9
+ tabs.each(function(tab){
10
+ var link = tab.getChild('a');
11
+ if(link && link.getData('content_id')){
12
+ link.addEvent('click', function(event){
13
+ event.stop();
14
+ var tab = this.getParent('.l_item');
15
+ tabs.each(function(e){
16
+ e == tab ? e.addClass('l_active') : e.removeClass('l_active');
17
+ });
18
+ contents.each(function(e){
19
+ e.get('id') == this.getData('content_id') ? e.show() : e.hide();
20
+ }.bind(this));
21
+ window.fireEvent('updateStyle');
22
+ });
23
+ };
24
+ });
25
+ }
26
+ });
@@ -0,0 +1,8 @@
1
+ /*
2
+ rad.assets.require '/lib/rad.css'
3
+
4
+ rad.assets.require '/vendor/purr/purr.css'
5
+ rad.assets.require '/vendor/formalize/formalize.css'
6
+
7
+ rad.assets.require '/lib/SimpleDialog/SimpleDialog.css'
8
+ */
@@ -0,0 +1,109 @@
1
+ //
2
+ // rad.assets.require '/lib/rad.js'
3
+ //
4
+ // rad.assets.require '/vendor/mootools-more.js'
5
+ // rad.assets.require '/vendor/iFrameFormRequest.js'
6
+ // rad.assets.require '/vendor/purr/purr.js'
7
+ // rad.assets.require '/vendor/flext.js'
8
+ // rad.assets.require '/vendor/formalize/mootools.formalize.js'
9
+ //
10
+ // rad.assets.require '/lib/SimpleDialog/SimpleDialog.js'
11
+ // rad.assets.require '/lib/SimpleDialog/SimpleDialog.Mask.js'
12
+ // rad.assets.require '/lib/SimpleDialog/SimpleDialog.Image.js'
13
+ // rad.assets.require '/lib/SimpleDialog/SimpleDialog.ContextMenu.js'
14
+ //
15
+ // rad.assets.require '/lib/ajax_file_uploading.js'
16
+ //
17
+ // rad.assets.require '/face/tabs.js'
18
+ // rad.assets.require '/face/table.js'
19
+ // rad.assets.require '/face/more.js'
20
+ // rad.assets.require '/face/markup.js'
21
+ // rad.assets.require '/face/dialogs.js'
22
+ // rad.assets.require '/face/discussion.js'
23
+ // rad.assets.require '/face/attachments.js'
24
+ //
25
+ // rad.assets.require '/themes/default/style.js'
26
+ //
27
+
28
+ Rad.implement({
29
+ // Table
30
+ table: function(tableQ){return new Rad.Table(tableQ);},
31
+
32
+ // Messages
33
+ info: function(message){Rad.messages.alert(message, {'highlight': false});},
34
+ error: function(message){Rad.messages.alert(message, {'highlight': false, 'hideAfter': false, 'className': 'error'});},
35
+
36
+ // Dialog
37
+ dialog: function(){
38
+ return new Rad.Dialog();
39
+ },
40
+
41
+ // Inplace Editor
42
+ inplace: function(elementQ){
43
+ return new Rad.EditInplace(elementQ);
44
+ },
45
+
46
+ // Context Menu
47
+ contextMenu: function(){
48
+ return new Rad.ContextMenu()
49
+ },
50
+
51
+ // Discussion
52
+ discussion: function(){
53
+ return new Rad.Discussion();
54
+ }
55
+ });
56
+
57
+ // Messages
58
+ Rad.messages = new Purr({'mode': 'bottom', 'position': 'right'});
59
+
60
+
61
+ //
62
+ // Initializations
63
+ //
64
+ window.addEvent('updated', function(){
65
+ // more button
66
+ $$('.the_more').applyOnce('the_more', function(more){new Rad.More(more)});
67
+
68
+ // markup
69
+ $$('.m_markup').applyOnce('m_markup', function(e){new Rad.Markup(e)});
70
+
71
+ // tabs
72
+ $$('.the_tabs').applyOnce('the_tabs', function(e){new Rad.Tabs(e)});
73
+
74
+ // context menu
75
+ $$('.the_context_menu_button').applyOnce('the_context_menu_button', function(button){
76
+ button.addEvent('click', function(event){
77
+ event.stop();
78
+ var content = $(button.getData('content_id'));
79
+ rad.contextMenu().show(event.page.x, event.page.y, content.get('html'))
80
+ });
81
+ });
82
+
83
+ // autosubmitting changes
84
+ $$('.m_autosubmit_on_change').applyOnce('m_autosubmit_on_change', function(e){
85
+ e.addEvent('change', function(){
86
+ rad.call(e.getData('action'), {
87
+ value: e.get('value'),
88
+ target: e.identify()
89
+ });
90
+ });
91
+ });
92
+
93
+ // form attachments
94
+ $$('.the_attachments').applyOnce('the_attachments', function(e){new Rad.Attachments(e)});
95
+ });
96
+
97
+ window.addEvent('updateStyle', function(){
98
+ // Flex TextArea
99
+ $$('textarea').each(function(e){
100
+ e.addClass('flext growme maxheight-400');
101
+ new Flext(e);
102
+ });
103
+
104
+ // Table
105
+ $$('.the_table').each(function(table){
106
+ table.getChildren('tbody tr').removeClass('l_even');
107
+ table.getChildren('tbody tr:even').addClass('l_even');
108
+ });
109
+ });
@@ -0,0 +1,36 @@
1
+ SimpleDialog.ContextMenu = new Class({
2
+ Extends: SimpleDialog,
3
+
4
+ show: function(x, y, html){
5
+ this.x = x;
6
+ this.y = y;
7
+ this.parent(html);
8
+ },
9
+
10
+ //
11
+ // Protected
12
+ //
13
+ _relocate: function(){
14
+ // var target_x = this.event.page.x; // this.target.getPosition().x + this.target.getOuterSize().x / 2;
15
+ // var target_y = this.event.page.y; // this.target.getPosition().y + this.target.getOuterSize().y / 2;
16
+
17
+ var border_bottom = window.getScroll().y + window.getSize().y;
18
+ var border_right = window.getSize().x // $$('.layout_content').first().getInnerSize().x
19
+
20
+ var offset = 0;
21
+ var psize = this.element.getOuterSize();
22
+ if((border_right - (offset * 2)) >= (this.x + psize.x)){
23
+ x = this.x + offset;
24
+ } else {
25
+ x = border_right - psize.x - (offset * 3);
26
+ }
27
+
28
+ if((border_bottom + (offset * 2)) >= (this.y + psize.y)){
29
+ y = this.y + offset;
30
+ } else {
31
+ y = this.y - psize.y - offset;
32
+ }
33
+
34
+ this.element.setStyles({left: x, top: y});
35
+ }
36
+ });