sproutcore 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/History.txt +33 -0
  2. data/Manifest.txt +3 -14
  3. data/clients/sc_docs/controllers/docs.js +1 -0
  4. data/clients/sc_docs/core.js +1 -1
  5. data/clients/sc_test_runner/controllers/runner.js +5 -0
  6. data/clients/sc_test_runner/core.js +1 -1
  7. data/frameworks/sproutcore/english.lproj/core.css +41 -0
  8. data/frameworks/sproutcore/english.lproj/theme.css +20 -0
  9. data/frameworks/sproutcore/foundation/animator.js +11 -2
  10. data/frameworks/sproutcore/foundation/date.js +2 -2
  11. data/frameworks/sproutcore/foundation/object.js +2 -2
  12. data/frameworks/sproutcore/foundation/server.js +4 -3
  13. data/frameworks/sproutcore/foundation/set.js +1 -1
  14. data/frameworks/sproutcore/foundation/unittest.js +12 -9
  15. data/frameworks/sproutcore/lib/collection_view.rb +1 -0
  16. data/frameworks/sproutcore/lib/core_views.rb +4 -0
  17. data/frameworks/sproutcore/mixins/editable.js +144 -0
  18. data/frameworks/sproutcore/mixins/inline_editor_delegate.js +72 -0
  19. data/frameworks/sproutcore/mixins/observable.js +45 -16
  20. data/frameworks/sproutcore/mixins/scrollable.js +0 -1
  21. data/frameworks/sproutcore/tests/controllers/controller.rhtml +12 -12
  22. data/frameworks/sproutcore/tests/controllers/object.rhtml +2 -2
  23. data/frameworks/sproutcore/views/collection/collection.js +122 -68
  24. data/frameworks/sproutcore/views/collection/source_list.js +5 -0
  25. data/frameworks/sproutcore/views/field/text_field.js +7 -1
  26. data/frameworks/sproutcore/views/inline_text_field.js +397 -0
  27. data/frameworks/sproutcore/views/label.js +78 -68
  28. data/frameworks/sproutcore/views/list_item.js +184 -31
  29. data/frameworks/sproutcore/views/view.js +41 -9
  30. data/generators/client/templates/core.js +1 -1
  31. data/generators/client/templates/english.lproj/body.css +74 -0
  32. data/generators/framework/templates/core.js +1 -1
  33. data/lib/sproutcore/version.rb +1 -1
  34. metadata +5 -16
  35. data/clients/view_builder/builders/builder.js +0 -339
  36. data/clients/view_builder/builders/button.js +0 -81
  37. data/clients/view_builder/controllers/document.js +0 -21
  38. data/clients/view_builder/core.js +0 -19
  39. data/clients/view_builder/english.lproj/body.css +0 -77
  40. data/clients/view_builder/english.lproj/body.rhtml +0 -41
  41. data/clients/view_builder/english.lproj/controls.css +0 -0
  42. data/clients/view_builder/english.lproj/strings.js +0 -14
  43. data/clients/view_builder/main.js +0 -38
  44. data/clients/view_builder/tests/controllers/document.rhtml +0 -20
  45. data/clients/view_builder/tests/views/builder.rhtml +0 -20
  46. data/clients/view_builder/views/builder.js +0 -23
  47. data/frameworks/sproutcore/english.lproj/inline_text_editor.css +0 -21
  48. data/frameworks/sproutcore/views/inline_text_editor.js +0 -96
@@ -1,21 +0,0 @@
1
- // ==========================================================================
2
- // ViewBuilder.DocumentController
3
- // ==========================================================================
4
-
5
- require('core');
6
-
7
- /** @class
8
-
9
- (Document Your View Here)
10
-
11
- @extends SC.Object
12
- @author AuthorName
13
- @version 0.1
14
- @static
15
- */
16
- ViewBuilder.documentController = SC.Object.create(
17
- /** @scope ViewBuilder.documentController */ {
18
-
19
- rootView: null
20
-
21
- }) ;
@@ -1,19 +0,0 @@
1
- // ==========================================================================
2
- // ViewBuilder
3
- // ==========================================================================
4
-
5
- ViewBuilder = SC.Object.create({
6
-
7
- // This will create the server for your application. Add any namespaces
8
- // your model objects are defined in to the prefix array.
9
- server: SC.Server.create({ prefix: ['ViewBuilder'] }),
10
-
11
- // When you are in development mode, this array will be populated with
12
- // any fixtures you create for testing and loaded automatically in your
13
- // main method. When in production, this will be an empty array.
14
- FIXTURES: [],
15
-
16
- // Any keys in this array will be instantiated automatically from main.
17
- controllers: [],
18
-
19
- }) ;
@@ -1,77 +0,0 @@
1
- /* @override
2
- http://localhost:4020/static/photos/en/_cache/body-1208305764.css
3
- http://localhost:4020/static/photos/en/_cache/body-1208344721.css
4
- http://localhost:4020/static/view_builder/en/_cache/body-1208631407.css
5
- http://localhost:4020/static/view_builder/en/_cache/body-1208631886.css
6
- http://localhost:4020/static/view_builder/en/_cache/body-1208632215.css
7
- http://localhost:4020/static/view_builder/en/_cache/body-1208632366.css
8
- */
9
-
10
- /* @group Core */
11
-
12
- body {
13
- position: absolute ;
14
- left: 0;
15
- right: 0;
16
- top: 0;
17
- bottom: 0;
18
- padding: 0;
19
- margin: 0;
20
- overflow: hidden ;
21
- }
22
-
23
- .workspace .sidebar {
24
- position: absolute;
25
- left: 0;
26
- top: 0;
27
- width: 200px;
28
- bottom: 0;
29
- }
30
-
31
- .sc-theme .workspace.horizontal .sc-split-divider-view {
32
- position: absolute;
33
- left: 200px;
34
- top: 0;
35
- bottom: 0;
36
- }
37
-
38
- .workspace .document_view {
39
- position: absolute;
40
- left: 205px;
41
- right: 0;
42
- top: 0;
43
- bottom: 0;
44
- border: none ;
45
- background-color: #aaa ;
46
- }
47
-
48
- .left.app-label {
49
- font-weight: bold ;
50
- padding-bottom: 9px;
51
- text-shadow: white 0px 1px 0px;
52
- }
53
-
54
- .app-label img {
55
- width: 27px;
56
- height: 27px;
57
- vertical-align: middle;
58
- position: relative ;
59
- top: -3px;
60
- margin-right: 2px;
61
- }
62
-
63
- /* @end */
64
-
65
- /* @group Sidebar */
66
-
67
- .sidebar .source_list {
68
- position: absolute ;
69
- top: 0;
70
- left: 0;
71
- right: 0;
72
- bottom: 0;
73
- border: none ;
74
- }
75
-
76
- /* @end */
77
-
@@ -1,41 +0,0 @@
1
- <% content_for('body') do %>
2
-
3
- <% view :header, :class => 'sc-header sc-square-theme' do %>
4
- <div class="left app-label">
5
- <img src="<%= static_url('images/sproutcore-logo.png') %>" />ViewBuilder
6
- </div>
7
- <div class="center">
8
- </div>
9
- <div class="right">
10
- </div>
11
- <% end %>
12
-
13
-
14
- <% split_view :workspace, :class => 'sc-app-workspace header footer', :direction => :horizontal do %>
15
- <% view :sidebar, :outlet => true do %>
16
- <% scroll_view :source_list, :outlet => true do %>
17
- <%= source_list_view :outlet => true,
18
- :content_value_key => :name,
19
- :group_visible_key => true,
20
- :content_icon_key => :icon %>
21
- <% end %>
22
- <% end %>
23
-
24
- <%= split_divider_view :outlet => true, :width => 5 %>
25
-
26
- <% scroll_view :document_view, :outlet => true do %>
27
- <%= view :builder_view, :outlet => true, :view => 'SC.BuilderView', :bind => { :content => 'ViewBuilder.documentController.rootView' } %>
28
- <% end %>
29
-
30
- <% end %>
31
-
32
- <% view :footer, :class => 'sc-footer sc-square-theme' do %>
33
- <div class="left">
34
- </div>
35
- <div class="center"></div>
36
- <div class="right">
37
- </div>
38
- <% end %>
39
-
40
-
41
- <% end %>
File without changes
@@ -1,14 +0,0 @@
1
- // ==========================================================================
2
- // ViewBuilder English Strings
3
- // ==========================================================================
4
-
5
- // Place strings you want to localize here. In your app, use the key and
6
- // localize it using "key string".loc(). HINT: For your key names, use the
7
- // english string with an underscore in front. This way you can still see
8
- // how your UI will look and you'll notice right away when something needs a
9
- // localized string added to this file!
10
- //
11
- Object.extend(String.English,{
12
- // "_String Key": "Localized String"
13
- }) ;
14
-
@@ -1,38 +0,0 @@
1
- // ==========================================================================
2
- // ViewBuilder
3
- // ==========================================================================
4
-
5
- // This is the function that will start your app running. The default
6
- // implementation will load any fixtures you have created then instantiate
7
- // your controllers and awake the elements on your page.
8
- //
9
- // As you develop your application you will probably want to override this.
10
- // See comments for some pointers on what to do next.
11
- //
12
- function main() {
13
-
14
- // Step 1: Load Your Model Data
15
- // The default code here will load the fixtures you have defined.
16
- // Comment out the preload line and add something to refresh from the server
17
- // when you are ready to pull data from your server.
18
- ViewBuilder.server.preload(ViewBuilder.FIXTURES) ;
19
-
20
- // TODO: refresh() any collections you have created to get their records.
21
- // ex: ViewBuilder.contacts.refresh() ;
22
-
23
- // Step 2: Instantiate Your Views
24
- // The default code just activates all the views you have on the page. If
25
- // your app gets any level of complexity, you should just get the views you
26
- // need to show the app in the first place, to speed things up.
27
- SC.page.awake() ;
28
-
29
- // Step 3. Set the content property on your primary controller.
30
- // This will make your app come alive!
31
-
32
- // TODO: Set the content property on your primary controller
33
- // ex: ViewBuilder.contactsController.set('content',ViewBuilder.contacts);
34
- var v = SC.ButtonView.Builder.newBuilder() ;
35
- ViewBuilder.documentController.set('rootView', v) ;
36
- } ;
37
-
38
-
@@ -1,20 +0,0 @@
1
- <% # ========================================================================
2
- # ViewBuilder.DocumentController Unit Test
3
- # ========================================================================
4
- %>
5
- <% content_for('final') do %>
6
-
7
- <script>
8
-
9
- Test.context("ViewBuilder.DocumentController",{
10
-
11
- "TODO: Add your own tests here": function() {
12
- true.shouldEqual(true) ;
13
- }
14
-
15
- }) ;
16
-
17
- if (window.main && (appMain = main)) main = null ;
18
- </script>
19
-
20
- <% end %>
@@ -1,20 +0,0 @@
1
- <% # ========================================================================
2
- # ViewBuilder.BuilderView Unit Test
3
- # ========================================================================
4
- %>
5
- <% content_for('final') do %>
6
-
7
- <script>
8
-
9
- Test.context("ViewBuilder.BuilderView",{
10
-
11
- "TODO: Add your own tests here": function() {
12
- true.shouldEqual(true) ;
13
- }
14
-
15
- }) ;
16
-
17
- if (window.main && (appMain = main)) main = null ;
18
- </script>
19
-
20
- <% end %>
@@ -1,23 +0,0 @@
1
- // ==========================================================================
2
- // ViewBuilder.BuilderView
3
- // ==========================================================================
4
-
5
- require('core');
6
-
7
- /** @class
8
-
9
- A BuilderView displays the visible and editable portion of a view. You
10
- can plug any generic builder record into a view and it will display the
11
- content. If the builder is a container, it will also allow you to add
12
- child views to the container.
13
-
14
- @extends SC.View
15
- @author AuthorName
16
- @version 0.1
17
- */
18
- SC.BuilderView = SC.View.extend(
19
- /** @scope ViewBuilder.BuilderView.prototype */ {
20
-
21
- // TODO: Add your own code here.
22
-
23
- }) ;
@@ -1,21 +0,0 @@
1
- .inline_editor
2
- {
3
- position: relative;
4
- }
5
- .inline_editor_field
6
- {
7
- margin: 0;
8
- padding: 0;
9
-
10
- resize: none;
11
- white-space: nowrap;
12
- border: none;
13
- font-family: inherit;
14
- font-size: inherit;
15
- line-height: inherit;
16
- }
17
- .inline_editor_sizer
18
- {
19
- visibility: hidden;
20
- position: absolute;
21
- }
@@ -1,96 +0,0 @@
1
- // ========================================================================
2
- // SproutCore
3
- // copyright 2006-2008 Sprout Systems, Inc.
4
- // ========================================================================
5
-
6
- SC.inlineTextEditor = SC.View.extend({
7
-
8
- multiline: true,
9
-
10
- emptyElement: [
11
- '<div class="inline_editor">',
12
- '<div class="inline_editor_sizer"></div>',
13
- '<textarea class="inline_editor_field" wrap="off"></textarea>',
14
- //'<input type="text" class="inline_editor_field" />',
15
- '</div>'
16
- ].join(''),
17
-
18
- /**
19
- * Set the size of the textarea to the width and height of the text value
20
- */
21
- render: function()
22
- {
23
- var editor = this.get('rootElement');
24
- var sizer = editor.childNodes[0];
25
- var field = editor.childNodes[1];
26
-
27
- // XSS attack waiting to happen... escape the form input;
28
- var text = (this.field.get('value') || '').escapeHTML();
29
- // we don't want the text to wrap inside of the sizer...
30
- text = text.replace(/ /g, "&nbsp;");
31
- // convert the textarea's newlines into something comparable for the sizer div
32
- // appending a space to give a line with no text a visible height.
33
- text = text.replace(/\n/g, "<br />&nbsp;");
34
-
35
- // get the text size
36
- sizer.innerHTML = text || "&nbsp;";
37
- var w = sizer.offsetWidth;
38
- var h = sizer.offsetHeight;
39
-
40
- // add it to the editor w/ some wiggle room to prevent
41
- // the textarea's scrollbars from fickering
42
- field.style.width = (w + 20) + "px";
43
- field.style.height = (h + 5) + "px";
44
- },
45
-
46
-
47
- outlets: ['field'],
48
- field: SC.TextFieldView.extend({
49
-
50
- mouseDown: function(e)
51
- {
52
- e._stopWhenHandled = false;
53
- return this.owner.get('parentNode').get('isEditing');
54
- },
55
-
56
- /**
57
- * resize the editor whenever the field value changes
58
- * @private
59
- * @observes value
60
- */
61
- valueObserver: function()
62
- {
63
- this.owner.render();
64
- }.observes('value'),
65
-
66
- willRemoveFromParent: function()
67
- {
68
- // [Safari] if you don't take key focus away from an element before you remove it from the DOM
69
- // key events are no longer sent to the browser.
70
- this.get('rootElement').blur();
71
- },
72
- willLoseFirstResponder: function()
73
- {
74
- // should have been covered by willRemoveFromParent, but this was needed too.
75
- this.get('rootElement').blur();
76
- var parentNode = this.owner.get('parentNode');
77
- if ( parentNode )
78
- {
79
- if (parentNode.get('isEditing')) parentNode.endInlineEdit();
80
- }
81
- },
82
-
83
- cancel: function()
84
- {
85
- var parentNode = this.owner.get('parentNode');
86
- if (parentNode && parentNode.cancel) parentNode.cancel();
87
- },
88
- insertNewline: function()
89
- {
90
- var parentNode = this.owner.get('parentNode');
91
- if (parentNode && parentNode.insertNewline) parentNode.insertNewline();
92
- }
93
-
94
- }).outletFor('.inline_editor_field?')
95
-
96
- }).viewFor(null);