├── .gitignore ├── LICENSE ├── README ├── Resources ├── KS_nav_ui.png ├── KS_nav_views.png ├── android │ ├── appicon.png │ └── default.png ├── app.js ├── iphone │ ├── Default.png │ └── appicon.png └── js │ ├── generic_window.coffee │ ├── generic_window.js │ ├── main.coffee │ ├── main.js │ ├── win1.js │ └── win2.js └── tiapp.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 John Lynch and Rigel Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | 'Software'), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Titanium CoffeeScript Sample App 2 | 3 | This app demonstrates one technique for using CoffeeScript to build Titanium Mobile applications. 4 | 5 | For more information, see the blog post at http://www.rigelgroupllc.com/blog/2010/08/31/building-iphone-apps-with-titanium-and-coffeescript/ 6 | 7 | 8 | -------------------------------------------------------------------------------- /Resources/KS_nav_ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/KS_nav_ui.png -------------------------------------------------------------------------------- /Resources/KS_nav_views.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/KS_nav_views.png -------------------------------------------------------------------------------- /Resources/android/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/android/appicon.png -------------------------------------------------------------------------------- /Resources/android/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/android/default.png -------------------------------------------------------------------------------- /Resources/app.js: -------------------------------------------------------------------------------- 1 | var root = {}; 2 | Ti.include('js/generic_window.js'); 3 | Ti.include('js/main.js'); -------------------------------------------------------------------------------- /Resources/iphone/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/iphone/Default.png -------------------------------------------------------------------------------- /Resources/iphone/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnthethird/titanium-coffeescript-sample/b0a700c0dc42e1cf44da53a68008d4bffef635b9/Resources/iphone/appicon.png -------------------------------------------------------------------------------- /Resources/js/generic_window.coffee: -------------------------------------------------------------------------------- 1 | #generic_window.coffee 2 | class GenericWindow 3 | constructor: (theTitle, theText) -> 4 | # Save off the context of this object to a local var 'self' 5 | self = this 6 | @custom1 = "Default Value" 7 | @win = Ti.UI.createWindow({title:theTitle,backgroundColor:'#fff'}) 8 | label = Titanium.UI.createLabel({ 9 | color: '#999', 10 | text: theText, 11 | font: { 12 | fontSize: 20, 13 | fontFamily: 'Helvetica Neue' 14 | }, 15 | textAlign: 'center', 16 | width: 'auto' 17 | }) 18 | @win.add(label); 19 | 20 | @win.addEventListener('click', () -> 21 | alert(self.custom1) 22 | ) 23 | 24 | root.GenericWindow = GenericWindow -------------------------------------------------------------------------------- /Resources/js/generic_window.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var GenericWindow; 3 | GenericWindow = function(theTitle, theText) { 4 | var label, self; 5 | self = this; 6 | this.custom1 = "Default Value"; 7 | this.win = Ti.UI.createWindow({ 8 | title: theTitle, 9 | backgroundColor: '#fff' 10 | }); 11 | label = Titanium.UI.createLabel({ 12 | color: '#999', 13 | text: theText, 14 | font: { 15 | fontSize: 20, 16 | fontFamily: 'Helvetica Neue' 17 | }, 18 | textAlign: 'center', 19 | width: 'auto' 20 | }); 21 | this.win.add(label); 22 | this.win.addEventListener('click', function() { 23 | return alert(self.custom1); 24 | }); 25 | return this; 26 | }; 27 | root.GenericWindow = GenericWindow; 28 | })(); 29 | -------------------------------------------------------------------------------- /Resources/js/main.coffee: -------------------------------------------------------------------------------- 1 | #main.coffee 2 | tabGroup = Titanium.UI.createTabGroup({ barColor:'#336699'}) 3 | Titanium.UI.setBackgroundColor('#000') 4 | 5 | root.Win1 = new root.GenericWindow('Win1','I am Window 1') 6 | 7 | tab1 = Titanium.UI.createTab({ 8 | icon:'KS_nav_views.png', 9 | title:'Win1', 10 | window: root.Win1.win 11 | }) 12 | tabGroup.addTab(tab1) 13 | 14 | root.Win2 = new root.GenericWindow('Win2','I am Window 2') 15 | tab2 = Titanium.UI.createTab({ 16 | icon:'KS_nav_views.png', 17 | title:'Win2', 18 | window: root.Win2.win 19 | }) 20 | tabGroup.addTab(tab2) 21 | 22 | tabGroup.open({transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT}) -------------------------------------------------------------------------------- /Resources/js/main.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var tab1, tab2, tabGroup; 3 | tabGroup = Titanium.UI.createTabGroup({ 4 | barColor: '#336699' 5 | }); 6 | Titanium.UI.setBackgroundColor('#000'); 7 | root.Win1 = new root.GenericWindow('Win1', 'I am Window 1'); 8 | tab1 = Titanium.UI.createTab({ 9 | icon: 'KS_nav_views.png', 10 | title: 'Win1', 11 | window: root.Win1.win 12 | }); 13 | tabGroup.addTab(tab1); 14 | root.Win2 = new root.GenericWindow('Win2', 'I am Window 2'); 15 | tab2 = Titanium.UI.createTab({ 16 | icon: 'KS_nav_views.png', 17 | title: 'Win2', 18 | window: root.Win2.win 19 | }); 20 | tabGroup.addTab(tab2); 21 | tabGroup.open({ 22 | transition: Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT 23 | }); 24 | })(); 25 | -------------------------------------------------------------------------------- /Resources/js/win1.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var GenericWindow; 3 | GenericWindow = function(theTitle, theText) { 4 | var label; 5 | this.custom1 = "Default Value"; 6 | this.win = Ti.UI.createWindow({ 7 | title: theTitle, 8 | backgroundColor: '#fff' 9 | }); 10 | label = Titanium.UI.createLabel({ 11 | color: '#999', 12 | text: theText, 13 | font: { 14 | fontSize: 20, 15 | fontFamily: 'Helvetica Neue' 16 | }, 17 | textAlign: 'center', 18 | width: 'auto' 19 | }); 20 | this.win.add(label); 21 | return this; 22 | }; 23 | root.GenericWindow = GenericWindow; 24 | })(); 25 | -------------------------------------------------------------------------------- /Resources/js/win2.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var Win2; 3 | Win2 = function() { 4 | var label; 5 | this.win = Titanium.UI.createWindow({ 6 | title: 'Window2', 7 | backgroundColor: '#fff' 8 | }); 9 | label = Titanium.UI.createLabel({ 10 | color: '#999', 11 | text: 'I am Window 2', 12 | font: { 13 | fontSize: 20, 14 | fontFamily: 'Helvetica Neue' 15 | }, 16 | textAlign: 'center', 17 | width: 'auto' 18 | }); 19 | this.win.add(label); 20 | return this; 21 | }; 22 | root.Win2 = Win2; 23 | })(); 24 | -------------------------------------------------------------------------------- /tiapp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | titanium-coffeescript-sample 4 | titanium-coffeescript-sample 5 | 1.0 6 | rigelgroupllc.com 7 | rigelgroupllc.com 8 | not specified 9 | not specified 10 | appicon.png 11 | false 12 | false 13 | default 14 | false 15 | false 16 | false 17 | true 18 | 369bb809-a700-4024-a3b4-0421cf2b9907 19 | 20 | --------------------------------------------------------------------------------