sproutcore 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +70 -2
- data/Manifest.txt +3 -15
- data/config/hoe.rb +1 -1
- data/frameworks/sproutcore/animation/animation.js +411 -0
- data/frameworks/sproutcore/controllers/array.js +68 -21
- data/frameworks/sproutcore/controllers/object.js +21 -2
- data/frameworks/sproutcore/drag/drag.js +13 -4
- data/frameworks/sproutcore/drag/drop_target.js +26 -19
- data/frameworks/sproutcore/english.lproj/core.css +4 -0
- data/frameworks/sproutcore/english.lproj/strings.js +5 -0
- data/frameworks/sproutcore/english.lproj/theme.css +5 -0
- data/frameworks/sproutcore/foundation/application.js +1 -2
- data/frameworks/sproutcore/foundation/set.js +31 -12
- data/frameworks/sproutcore/foundation/sorted_set.js +590 -0
- data/frameworks/sproutcore/foundation/string.js +43 -9
- data/frameworks/sproutcore/globals/window.js +34 -9
- data/frameworks/sproutcore/lib/button_views.rb +1 -0
- data/frameworks/sproutcore/lib/collection_view.rb +1 -0
- data/frameworks/sproutcore/lib/core_views.rb +3 -0
- data/frameworks/sproutcore/lib/index.rhtml +1 -1
- data/frameworks/sproutcore/mixins/collection_view_delegate.js +201 -0
- data/frameworks/sproutcore/mixins/observable.js +2 -7
- data/frameworks/sproutcore/models/record.js +1 -1
- data/frameworks/sproutcore/models/store.js +81 -28
- data/frameworks/sproutcore/tests/views/view/clippingFrame.rhtml +9 -6
- data/frameworks/sproutcore/views/collection/collection.js +649 -211
- data/frameworks/sproutcore/views/collection/grid.js +62 -26
- data/frameworks/sproutcore/views/collection/list.js +57 -21
- data/frameworks/sproutcore/views/collection/source_list.js +61 -13
- data/frameworks/sproutcore/views/image.js +7 -0
- data/frameworks/sproutcore/views/inline_text_field.js +4 -5
- data/frameworks/sproutcore/views/slider.js +2 -0
- data/frameworks/sproutcore/views/view.js +2 -2
- data/lib/sproutcore/build_tools/html_builder.rb +4 -6
- data/lib/sproutcore/build_tools/resource_builder.rb +32 -20
- data/lib/sproutcore/bundle.rb +130 -32
- data/lib/sproutcore/bundle_manifest.rb +24 -21
- data/lib/sproutcore/helpers/static_helper.rb +22 -9
- data/lib/sproutcore/merb/bundle_controller.rb +4 -3
- data/lib/sproutcore/version.rb +1 -1
- metadata +14 -17
- data/clients/view_builder/builders/builder.js +0 -339
- data/clients/view_builder/builders/button.js +0 -81
- data/clients/view_builder/controllers/document.js +0 -21
- data/clients/view_builder/core.js +0 -19
- data/clients/view_builder/english.lproj/body.css +0 -77
- data/clients/view_builder/english.lproj/body.rhtml +0 -39
- data/clients/view_builder/english.lproj/controls.css +0 -0
- data/clients/view_builder/english.lproj/strings.js +0 -14
- data/clients/view_builder/main.js +0 -38
- data/clients/view_builder/mixins/design_mode.js +0 -92
- data/clients/view_builder/tests/controllers/document.rhtml +0 -20
- data/clients/view_builder/tests/views/builder.rhtml +0 -20
- data/clients/view_builder/tests/views/palette.rhtml +0 -21
- data/clients/view_builder/views/builder.js +0 -26
- data/clients/view_builder/views/palette.js +0 -30
@@ -1,81 +0,0 @@
|
|
1
|
-
// ==========================================================================
|
2
|
-
// Button View Builder
|
3
|
-
// ==========================================================================
|
4
|
-
|
5
|
-
require('builders/builder') ;
|
6
|
-
|
7
|
-
/**
|
8
|
-
*/
|
9
|
-
SC.ButtonView.Builder = SC.Builder.extend({
|
10
|
-
|
11
|
-
_targetClass: 'SC.ButtonView',
|
12
|
-
|
13
|
-
/**
|
14
|
-
Defined by subclasses. If this is true, then the content of the view
|
15
|
-
is the HTML generated by children.
|
16
|
-
*/
|
17
|
-
isContainer: NO,
|
18
|
-
|
19
|
-
/**
|
20
|
-
Defined by subclasses. If true, then views will be generated with an
|
21
|
-
outletFor() attached to them.
|
22
|
-
*/
|
23
|
-
isOutletView: YES,
|
24
|
-
|
25
|
-
/**
|
26
|
-
The default profile. New records will inherit a cloned set of these
|
27
|
-
attributes.
|
28
|
-
*/
|
29
|
-
defaultAttributes: {
|
30
|
-
propertySettings: {},
|
31
|
-
bindSettings: {},
|
32
|
-
attributeSettings: {},
|
33
|
-
htmlTemplate: '<{%TagName%}{%Attributes%}><span class="button-inner"><span class="label">{%Content%}</span></span></{%TagName%}>',
|
34
|
-
cssClassNames: ['sc-button-view', 'regular', 'normal'],
|
35
|
-
lazyOutlet: NO,
|
36
|
-
tagName: 'a',
|
37
|
-
|
38
|
-
title: 'Hello!'
|
39
|
-
},
|
40
|
-
|
41
|
-
init: function() {
|
42
|
-
arguments.callee.base.apply(this) ;
|
43
|
-
if (this.get('newRecord')) {
|
44
|
-
var attrs = this._deepClone(this.get('defaultAttributes'));
|
45
|
-
attrs.name = attrs.targetClass = this._targetClass ;
|
46
|
-
attrs.guid = attrs.htmlId = 'id%@'.fmt(Date.now().toString());
|
47
|
-
this.updateAttributes(attrs, YES, YES);
|
48
|
-
}
|
49
|
-
},
|
50
|
-
|
51
|
-
/**
|
52
|
-
Invoked just before the attributes are written out. You can add anything
|
53
|
-
you want here.
|
54
|
-
*/
|
55
|
-
prepareAttributes: function(attrs) {
|
56
|
-
return attrs ;
|
57
|
-
},
|
58
|
-
|
59
|
-
/**
|
60
|
-
Invoked just before the class name is set. Add anything you want here.
|
61
|
-
*/
|
62
|
-
prepareClassNames: function(classNames) {
|
63
|
-
return classNames ;
|
64
|
-
},
|
65
|
-
|
66
|
-
/**
|
67
|
-
Invoked just before outlets are added and the final JS is generated. Add
|
68
|
-
anything here you might pull from specialized preferences.
|
69
|
-
*/
|
70
|
-
prepareProperties: function(props) { return props; },
|
71
|
-
|
72
|
-
/**
|
73
|
-
Invoked just before bindings are blended into properties. Add your own.
|
74
|
-
*/
|
75
|
-
prepareBindings: function(binds) { return binds; },
|
76
|
-
|
77
|
-
innerHtml: function() {
|
78
|
-
return this.get('title') ;
|
79
|
-
}.property('title')
|
80
|
-
|
81
|
-
}) ;
|
@@ -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,39 +0,0 @@
|
|
1
|
-
<% content_for('body') do %>
|
2
|
-
|
3
|
-
<% split_view :workspace, :class => 'sc-app-workspace footer', :direction => :horizontal do %>
|
4
|
-
<% view :sidebar, :outlet => true do %>
|
5
|
-
<% scroll_view :source_list, :outlet => true do %>
|
6
|
-
<%= source_list_view :outlet => true,
|
7
|
-
:content_value_key => :name,
|
8
|
-
:group_visible_key => true,
|
9
|
-
:content_icon_key => :icon %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= split_divider_view :outlet => true, :width => 5 %>
|
14
|
-
|
15
|
-
<% split_view :document_view, :outlet => true, :direction => :vertical do %>
|
16
|
-
<% view :editor, :outlet => true do %>
|
17
|
-
<%= button_view :outlet => true, :view => 'SC.BuilderView' %>
|
18
|
-
<% end %>
|
19
|
-
<%= split_divider_view :outlet => true, :width => 5 %>
|
20
|
-
<% scroll_view :outlet => true do %>
|
21
|
-
CONTENTS
|
22
|
-
<% end %>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<% view :header, :class => 'sc-footer sc-square-theme' do %>
|
28
|
-
<div class="left app-label">
|
29
|
-
<img src="<%= static_url('images/sproutcore-logo.png') %>" />ViewBuilder
|
30
|
-
</div>
|
31
|
-
<div class="center">
|
32
|
-
</div>
|
33
|
-
<div class="right">
|
34
|
-
<%= button_view :outlet => true, :title => "Library" %>
|
35
|
-
<%= button_view :outlet => true, :title => "Options" %>
|
36
|
-
</div>
|
37
|
-
<% end %>
|
38
|
-
|
39
|
-
<% 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,92 +0,0 @@
|
|
1
|
-
// ==========================================================================
|
2
|
-
// SC.Buildable
|
3
|
-
// ==========================================================================
|
4
|
-
|
5
|
-
/**
|
6
|
-
Applying this mixin allows you to put a view into design mode. When a view
|
7
|
-
is in design mode, mouse selection and some keyboard handling will be
|
8
|
-
overridden to allow you to place and edit the contents of the view.
|
9
|
-
|
10
|
-
Mode designMode properties begin with the words "designMode" to separate
|
11
|
-
them from other properties that might exist on the view.
|
12
|
-
*/
|
13
|
-
SC.DesignMode = {
|
14
|
-
|
15
|
-
/**
|
16
|
-
If YES, then view will display selection handles and other state to
|
17
|
-
indicate that the item can be edited.
|
18
|
-
*/
|
19
|
-
designModeIsSelected: NO,
|
20
|
-
|
21
|
-
/**
|
22
|
-
If YES, design mode is enabled. Otherwise, the view will behave like
|
23
|
-
normal.
|
24
|
-
*/
|
25
|
-
designModeIsEnabled: NO,
|
26
|
-
|
27
|
-
// return the state for design mode methods
|
28
|
-
designModeState: function() {
|
29
|
-
if (!this._designModeState) this._designModeState = {} ;
|
30
|
-
return this._designModeState ;
|
31
|
-
},
|
32
|
-
|
33
|
-
/**
|
34
|
-
Whenever a view goes into design mode, this will trigger to swap out the
|
35
|
-
event handler methods on the view with design mode methods.
|
36
|
-
*/
|
37
|
-
_designModeIsEnabledObserver: function() {
|
38
|
-
var isEnabled = this.get('designModeIsEnabled') ;
|
39
|
-
if (isEnabled === this.get('_designModeIsEnabled')) return ;
|
40
|
-
|
41
|
-
// swap methods in and out
|
42
|
-
var state = this.designModeState() ;
|
43
|
-
var orig = state.savedMethods = state.savedMethods || {} ;
|
44
|
-
var methods = SC.DesignModeMethods;
|
45
|
-
|
46
|
-
// save original methods and replace with new ones or restore
|
47
|
-
for(var key in methods) {
|
48
|
-
if (!methods.hasOwnProperty(key)) continue ;
|
49
|
-
if (isEnabled) {
|
50
|
-
orig[key] = this[key] ;
|
51
|
-
this[key] = methods[key] ;
|
52
|
-
} else {
|
53
|
-
this[key] = orig[key] ;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}.observes('designModeIsEnabled')
|
57
|
-
|
58
|
-
};
|
59
|
-
|
60
|
-
/**
|
61
|
-
These methods are swapped out on a view when you put it into design mode.
|
62
|
-
*/
|
63
|
-
SC.DesignModeMethods = {
|
64
|
-
// allow dragging around...
|
65
|
-
mouseDown: function(evt) {
|
66
|
-
var state = this.designModeState() ;
|
67
|
-
|
68
|
-
// select if needed
|
69
|
-
if (!this.get('designModeIsSelected')) {
|
70
|
-
this.set('designModeIsSelected', YES) ;
|
71
|
-
}
|
72
|
-
|
73
|
-
// save info for dragging.
|
74
|
-
state._mouseDownLoc = Event.pointerLocation(evt) ;
|
75
|
-
state._mouseDownFrame = this.get('frame') ;
|
76
|
-
return YES ; // allow dragging
|
77
|
-
},
|
78
|
-
|
79
|
-
mouseDragged: function(evt) {
|
80
|
-
var state = this.designModeState() ;
|
81
|
-
|
82
|
-
var loc = Event.pointerLocation(evt) ;
|
83
|
-
var f = {
|
84
|
-
x: state._mouseDownFrame.x + loc.x - state._mouseDownLoc.x,
|
85
|
-
y: state._mouseDownFrame.y + loc.y - state._mouseDownLoc.y
|
86
|
-
};
|
87
|
-
|
88
|
-
this.set('frame', f) ;
|
89
|
-
},
|
90
|
-
|
91
|
-
mouseUp: function(evt) { return YES ; }
|
92
|
-
} ;
|
@@ -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,21 +0,0 @@
|
|
1
|
-
<% # ========================================================================
|
2
|
-
# ViewBuilder.PaletteView Unit Test
|
3
|
-
# ========================================================================
|
4
|
-
%>
|
5
|
-
<% content_for('final') do %>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
|
9
|
-
Test.context("ViewBuilder.PaletteView",{
|
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
|
-
|
19
|
-
</script>
|
20
|
-
|
21
|
-
<% end %>
|