under-os 0.0.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +16 -0
- data/README.md +70 -0
- data/Rakefile +24 -0
- data/app/config.rb +4 -0
- data/app/layouts/alerts.html +8 -0
- data/app/layouts/calculator.html +26 -0
- data/app/layouts/collections.html +7 -0
- data/app/layouts/home.html +14 -0
- data/app/layouts/http.html +8 -0
- data/app/layouts/inputs.html +44 -0
- data/app/layouts/lockers.html +6 -0
- data/app/layouts/navbar.html +9 -0
- data/app/layouts/scrolls.html +42 -0
- data/app/layouts/sidebars.html +17 -0
- data/app/pages/alerts_page.rb +14 -0
- data/app/pages/calculator_page.rb +36 -0
- data/app/pages/collections_page.rb +9 -0
- data/app/pages/home_page.rb +11 -0
- data/app/pages/http_page.rb +33 -0
- data/app/pages/inputs_page.rb +9 -0
- data/app/pages/lockers_page.rb +16 -0
- data/app/pages/navbar_page.rb +19 -0
- data/app/pages/scrolls_page.rb +5 -0
- data/app/pages/sidebars_page.rb +42 -0
- data/app/pages/stuff_page.rb +35 -0
- data/app/styles/application.css +25 -0
- data/app/styles/calculator.css +37 -0
- data/app/styles/collections.css +19 -0
- data/app/styles/home.css +0 -0
- data/app/styles/http.css +24 -0
- data/app/styles/inputs.css +47 -0
- data/app/styles/scrolls.css +67 -0
- data/app/styles/sidebars.css +19 -0
- data/lib/assets/fontawesome-webfont.ttf +0 -0
- data/lib/assets/under-os.css +115 -0
- data/lib/under-os.rb +9 -1
- data/lib/under_os/app.rb +33 -0
- data/lib/under_os/color.rb +176 -0
- data/lib/under_os/config.rb +28 -1
- data/lib/under_os/core/kernel.rb +16 -0
- data/lib/under_os/core/numeric.rb +23 -0
- data/lib/under_os/core/string.rb +40 -0
- data/lib/under_os/delegate.rb +3 -2
- data/lib/under_os/events.rb +85 -0
- data/lib/under_os/file.rb +110 -0
- data/lib/under_os/history.rb +50 -0
- data/lib/under_os/http/receiver.rb +44 -0
- data/lib/under_os/http/request.rb +89 -0
- data/lib/under_os/http/response.rb +24 -0
- data/lib/under_os/http/session.rb +49 -0
- data/lib/under_os/http.rb +5 -0
- data/lib/under_os/page/builder.rb +96 -0
- data/lib/under_os/page/layout.rb +43 -0
- data/lib/under_os/page/matcher.rb +83 -0
- data/lib/under_os/page/stylesheet.rb +67 -0
- data/lib/under_os/page.rb +153 -0
- data/lib/under_os/parser/css.rb +37 -0
- data/lib/under_os/parser/html.rb +97 -0
- data/lib/under_os/parser.rb +24 -0
- data/lib/under_os/point.rb +47 -0
- data/lib/under_os/screen.rb +9 -0
- data/lib/under_os/timer.rb +65 -0
- data/lib/under_os/ui/alert.rb +52 -0
- data/lib/under_os/ui/button.rb +22 -0
- data/lib/under_os/ui/collection/cell.rb +21 -0
- data/lib/under_os/ui/collection/delegate.rb +68 -0
- data/lib/under_os/ui/collection/item.rb +32 -0
- data/lib/under_os/ui/collection/layout.rb +43 -0
- data/lib/under_os/ui/collection/styles.rb +15 -0
- data/lib/under_os/ui/collection.rb +63 -0
- data/lib/under_os/ui/icon/awesome.rb +376 -0
- data/lib/under_os/ui/icon/engine.rb +10 -0
- data/lib/under_os/ui/icon.rb +42 -0
- data/lib/under_os/ui/image.rb +30 -0
- data/lib/under_os/ui/input.rb +41 -0
- data/lib/under_os/ui/label.rb +21 -0
- data/lib/under_os/ui/locker.rb +42 -0
- data/lib/under_os/ui/navbar.rb +115 -0
- data/lib/under_os/ui/progress.rb +17 -0
- data/lib/under_os/ui/scroll.rb +41 -0
- data/lib/under_os/ui/select.rb +98 -0
- data/lib/under_os/ui/sidebar.rb +45 -0
- data/lib/under_os/ui/slider.rb +49 -0
- data/lib/under_os/ui/spinner.rb +23 -0
- data/lib/under_os/ui/style/fonts.rb +60 -0
- data/lib/under_os/ui/style/margins.rb +160 -0
- data/lib/under_os/ui/style/outlining.rb +98 -0
- data/lib/under_os/ui/style/positioning.rb +169 -0
- data/lib/under_os/ui/style.rb +21 -0
- data/lib/under_os/ui/switch.rb +29 -0
- data/lib/under_os/ui/textarea.rb +14 -0
- data/lib/under_os/ui/utils/animation.rb +99 -0
- data/lib/under_os/ui/utils/commons.rb +70 -0
- data/lib/under_os/ui/utils/dimensions.rb +37 -0
- data/lib/under_os/ui/utils/editable.rb +43 -0
- data/lib/under_os/ui/utils/events.rb +75 -0
- data/lib/under_os/ui/utils/manipulation.rb +44 -0
- data/lib/under_os/ui/utils/position.rb +21 -0
- data/lib/under_os/ui/utils/size.rb +21 -0
- data/lib/under_os/ui/utils/styles.rb +89 -0
- data/lib/under_os/ui/utils/traversing.rb +44 -0
- data/lib/under_os/ui/utils/wrap.rb +77 -0
- data/lib/under_os/ui/view.rb +31 -0
- data/lib/under_os/ui.rb +3 -0
- data/lib/under_os.rb +2 -2
- data/resources/Default-568h@2x.png +0 -0
- data/resources/test.png +0 -0
- data/spec/assets/app.css +13 -0
- data/spec/assets/test.css +7 -0
- data/spec/assets/test.html +3 -0
- data/spec/assets/test_page.rb +2 -0
- data/spec/lib/core/numeric_spec.rb +37 -0
- data/spec/lib/core/string_spec.rb +87 -0
- data/spec/lib/under_os/color_spec.rb +133 -0
- data/spec/lib/under_os/events_spec.rb +71 -0
- data/spec/lib/under_os/file_spec.rb +98 -0
- data/spec/lib/under_os/page/builder_spec.rb +128 -0
- data/spec/lib/under_os/page/layout_spec.rb +18 -0
- data/spec/lib/under_os/page/matcher_spec.rb +154 -0
- data/spec/lib/under_os/page/stylesheet_spec.rb +83 -0
- data/spec/lib/under_os/page_spec.rb +5 -0
- data/spec/lib/under_os/parser/css_spec.rb +77 -0
- data/spec/lib/under_os/parser/html_spec.rb +152 -0
- data/spec/lib/under_os/parser_spec.rb +16 -0
- data/spec/lib/under_os/point_spec.rb +54 -0
- data/spec/lib/under_os/screen_spec.rb +11 -0
- data/spec/lib/under_os/timer_spec.rb +93 -0
- data/spec/lib/under_os/ui/button_spec.rb +5 -0
- data/spec/lib/under_os/ui/collection_spec.rb +19 -0
- data/spec/lib/under_os/ui/icon_spec.rb +26 -0
- data/spec/lib/under_os/ui/image_spec.rb +39 -0
- data/spec/lib/under_os/ui/input_spec.rb +77 -0
- data/spec/lib/under_os/ui/label_spec.rb +22 -0
- data/spec/lib/under_os/ui/locker_spec.rb +31 -0
- data/spec/lib/under_os/ui/progress_spec.rb +31 -0
- data/spec/lib/under_os/ui/scroll_spec.rb +40 -0
- data/spec/lib/under_os/ui/select_spec.rb +131 -0
- data/spec/lib/under_os/ui/sidebar_spec.rb +35 -0
- data/spec/lib/under_os/ui/slider_spec.rb +65 -0
- data/spec/lib/under_os/ui/spinner_spec.rb +57 -0
- data/spec/lib/under_os/ui/style/fonts_spec.rb +73 -0
- data/spec/lib/under_os/ui/style/margins_spec.rb +106 -0
- data/spec/lib/under_os/ui/style/outlining_spec.rb +69 -0
- data/spec/lib/under_os/ui/style/positioning_spec.rb +69 -0
- data/spec/lib/under_os/ui/style_spec.rb +19 -0
- data/spec/lib/under_os/ui/switch_spec.rb +56 -0
- data/spec/lib/under_os/ui/textarea_spec.rb +30 -0
- data/spec/lib/under_os/ui/utils/commons_spec.rb +81 -0
- data/spec/lib/under_os/ui/utils/manipulation_spec.rb +130 -0
- data/spec/lib/under_os/ui/utils/styles_spec.rb +140 -0
- data/spec/lib/under_os/ui/utils/traversing_spec.rb +124 -0
- data/spec/lib/under_os/ui/utils/wrap_spec.rb +69 -0
- data/spec/lib/under_os/ui/view_spec.rb +39 -0
- data/under-os.gemspec +32 -0
- metadata +225 -11
- data/lib/under_os/application.rb +0 -16
- data/lib/under_os/window.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fd9a1ae79f101e53c35741c6935b5eca5353da6
|
4
|
+
data.tar.gz: 44943f17a76499bd0bb3b3fc80f5b52cb0ea5c5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ac6a73d2fe135c0df1cce46b4b20880dbd4a826f857fa25a308b6d4d62f3465369a446ef7c92c98b5253129bf9f52379bcfd59a246a8c6a0da53170581008d3
|
7
|
+
data.tar.gz: 27607c0bf2e284d6cc39cd06b45e6f71913329dbcbc14b1225b29f731c0af8755d2bd75ec8bc166e2ef6765e3643d406de9c258f67d37e5dffbaeb69691f84b5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Under OS
|
2
|
+
|
3
|
+
An experiment to build a thin web-like wrapper over iOS using rubymotion
|
4
|
+
|
5
|
+
The idea is to use incapsulation instead of monkey patching and build the
|
6
|
+
entire development platform correctly and from scratch.
|
7
|
+
|
8
|
+
The result should be a webbish like ifrastructure that uses ruby instead
|
9
|
+
of JavaScript and compiles into native code in the end.
|
10
|
+
|
11
|
+
That's gonna be legendary!
|
12
|
+
|
13
|
+
## How To Use
|
14
|
+
|
15
|
+
1) install the `under-os` gem
|
16
|
+
|
17
|
+
```
|
18
|
+
gem install under-os
|
19
|
+
```
|
20
|
+
|
21
|
+
2) Clone the RubyMotion template in place
|
22
|
+
|
23
|
+
```
|
24
|
+
mkdir -p ~/Library/RubyMotion/template/uos
|
25
|
+
git clone https://github.com/under-os/under-os-template.git ~/Library/RubyMotion/template/uos
|
26
|
+
```
|
27
|
+
|
28
|
+
3) Make a new app using the `uos` template
|
29
|
+
|
30
|
+
```
|
31
|
+
motion create test --template=uos
|
32
|
+
```
|
33
|
+
|
34
|
+
Now, Run it!
|
35
|
+
|
36
|
+
```
|
37
|
+
cd test && rake
|
38
|
+
```
|
39
|
+
|
40
|
+
## What's What
|
41
|
+
|
42
|
+
* `app/layouts` - where you keep your HTML layouts
|
43
|
+
* `app/pages` - where the page scripts live
|
44
|
+
* `app/styles` - where the CSS files go
|
45
|
+
* `app/models` - where your data models chill
|
46
|
+
* `app/views` - where you keep your custom views/components classes
|
47
|
+
|
48
|
+
|
49
|
+
# Copyright & License
|
50
|
+
|
51
|
+
All code in this library is released under the terms of the MIT license
|
52
|
+
|
53
|
+
Copyright (C) 2013 Nikolay Nemshilov
|
54
|
+
|
55
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
56
|
+
of this software and associated documentation files (the "Software"), to deal
|
57
|
+
in the Software without restriction, including without limitation the rights
|
58
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
59
|
+
of the Software, and to permit persons to whom the Software is furnished to do so,
|
60
|
+
subject to the following conditions:
|
61
|
+
|
62
|
+
The above copyright notice and this permission notice shall be included in all
|
63
|
+
copies or substantial portions of the Software.
|
64
|
+
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
66
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
67
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
68
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
69
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
70
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift("/Library/RubyMotion/lib")
|
3
|
+
require 'motion/project/template/ios'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.require
|
6
|
+
|
7
|
+
require 'under-os'
|
8
|
+
|
9
|
+
Motion::Project::App.setup do |app|
|
10
|
+
app.name = 'uos-demo'
|
11
|
+
app.identifier = 'com.under-os.demo'
|
12
|
+
app.specs_dir = './spec/lib'
|
13
|
+
app.version = UnderOs::VERSION
|
14
|
+
|
15
|
+
app.codesign_certificate = ENV['RUBYMOTION_CERTIFICATE']
|
16
|
+
app.provisioning_profile = ENV['RUBYMOTION_PROFILE']
|
17
|
+
|
18
|
+
if ARGV[0] == 'spec'
|
19
|
+
app.name = 'uos-spec'
|
20
|
+
app.identifier = 'com.under-os.spec'
|
21
|
+
app.files << 'spec/assets/test_page.rb'
|
22
|
+
app.resources_dirs.unshift "./spec/assets/"
|
23
|
+
end
|
24
|
+
end
|
data/app/config.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
<page title="Calculator">
|
2
|
+
<label id="result">0</label>
|
3
|
+
|
4
|
+
<button class="row5 col1 top">C</button>
|
5
|
+
<button class="row5 col2 top">±</button>
|
6
|
+
<button class="row5 col3 top">%</button>
|
7
|
+
|
8
|
+
<button class="row5 col4 ops">÷</button>
|
9
|
+
<button class="row4 col4 ops">×</button>
|
10
|
+
<button class="row3 col4 ops">-</button>
|
11
|
+
<button class="row2 col4 ops">+</button>
|
12
|
+
<button class="row1 col4 ops">=</button>
|
13
|
+
|
14
|
+
<button class="row4 col3">9</button>
|
15
|
+
<button class="row4 col2">8</button>
|
16
|
+
<button class="row4 col1">7</button>
|
17
|
+
<button class="row3 col3">6</button>
|
18
|
+
<button class="row3 col2">5</button>
|
19
|
+
<button class="row3 col1">4</button>
|
20
|
+
<button class="row2 col3">3</button>
|
21
|
+
<button class="row2 col2">2</button>
|
22
|
+
<button class="row2 col1">1</button>
|
23
|
+
<button class="row1 col1 double">0</button>
|
24
|
+
|
25
|
+
<button class="row1 col3">.</button>
|
26
|
+
</page>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<page title="Home">
|
2
|
+
<view id="buttons">
|
3
|
+
<button id="b1" data-page="stuff">Various Stuff</button>
|
4
|
+
<button id="b2" data-page="calculator">Calculator Demo</button>
|
5
|
+
<button id="b3" data-page="inputs">Inputs Demo</button>
|
6
|
+
<button id="b4" data-page="sidebars">Sidebar Demo</button>
|
7
|
+
<button id="b5" data-page="scrolls">Scrolls Demo</button>
|
8
|
+
<button id="b6" data-page="navbar">Navbar Demo</button>
|
9
|
+
<button id="b7" data-page="alerts">Alerts Demo</button>
|
10
|
+
<button id="b8" data-page="lockers">Lockers Demo</button>
|
11
|
+
<button id="b9" data-page="http">HTTP Demo</button>
|
12
|
+
<button id="b10" data-page="collections">Collections</button>
|
13
|
+
</view>
|
14
|
+
</page>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<page title="Inputs Demo">
|
2
|
+
<input placeholder="Tap here" />
|
3
|
+
<textarea>some value</textarea>
|
4
|
+
|
5
|
+
<slider min="0" max="100" value="40" />
|
6
|
+
|
7
|
+
<switch checked="true" />
|
8
|
+
|
9
|
+
<progress value="0.6" />
|
10
|
+
|
11
|
+
<spinner />
|
12
|
+
|
13
|
+
<view id="select-buttons">
|
14
|
+
<button id="show-single-select">Single Select</button>
|
15
|
+
<button id="show-multi-select" >Multi Select</button>
|
16
|
+
</view>
|
17
|
+
|
18
|
+
<select id="single-select">
|
19
|
+
<option value="1">One</option>
|
20
|
+
<option value="2">Two</option>
|
21
|
+
<option value="3">Three</option>
|
22
|
+
<option value="4">Four</option>
|
23
|
+
<option value="5">Five</option>
|
24
|
+
<option value="6">Six</option>
|
25
|
+
<option value="7">Seven</option>
|
26
|
+
</select>
|
27
|
+
|
28
|
+
<select id="multi-select">
|
29
|
+
<optgroup>
|
30
|
+
<option value="1">One</option>
|
31
|
+
<option value="2">Two</option>
|
32
|
+
<option value="3">Three</option>
|
33
|
+
<option value="4">Four</option>
|
34
|
+
<option value="5">Five</option>
|
35
|
+
</optgroup>
|
36
|
+
|
37
|
+
<optgroup>
|
38
|
+
<option>Sandwitch</option>
|
39
|
+
<option>Pizza</option>
|
40
|
+
<option>Cola</option>
|
41
|
+
<option>Balloon</option>
|
42
|
+
</optgroup>
|
43
|
+
</select>
|
44
|
+
</page>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<page title="Navigation" fullscreen="false">
|
2
|
+
<view id="buttons">
|
3
|
+
<button id="b1" data-icons="edit">Edit Native</button>
|
4
|
+
<button id="b2" data-icons="trash">Trash Native</button>
|
5
|
+
<button id="b3" data-icons="edit,trash">Edit And Trash</button>
|
6
|
+
<button id="b4" data-icons="nothing,custom">Custom Titles</button>
|
7
|
+
<button id="b5" data-icons="edit,save,trash" class="icons">UOS Icons</button>
|
8
|
+
</view>
|
9
|
+
</page>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<page title="Scrolls Demo">
|
2
|
+
|
3
|
+
<scroll id="horizontal">
|
4
|
+
<button class="b0">0</button>
|
5
|
+
<button class="b1">1</button>
|
6
|
+
<button class="b2">2</button>
|
7
|
+
<button class="b3">3</button>
|
8
|
+
<button class="b4">4</button>
|
9
|
+
<button class="b5">5</button>
|
10
|
+
<button class="b6">6</button>
|
11
|
+
<button class="b7">7</button>
|
12
|
+
<button class="b8">8</button>
|
13
|
+
<button class="b9">9</button>
|
14
|
+
</scroll>
|
15
|
+
|
16
|
+
<scroll id="vertical">
|
17
|
+
<button class="b0">0</button>
|
18
|
+
<button class="b1">1</button>
|
19
|
+
<button class="b2">2</button>
|
20
|
+
<button class="b3">3</button>
|
21
|
+
<button class="b4">4</button>
|
22
|
+
<button class="b5">5</button>
|
23
|
+
<button class="b6">6</button>
|
24
|
+
<button class="b7">7</button>
|
25
|
+
<button class="b8">8</button>
|
26
|
+
<button class="b9">9</button>
|
27
|
+
</scroll>
|
28
|
+
|
29
|
+
<scroll id="both">
|
30
|
+
<button class="b0">0</button>
|
31
|
+
<button class="b1">1</button>
|
32
|
+
<button class="b2">2</button>
|
33
|
+
<button class="b3">3</button>
|
34
|
+
<button class="b4">4</button>
|
35
|
+
<button class="b5">5</button>
|
36
|
+
<button class="b6">6</button>
|
37
|
+
<button class="b7">7</button>
|
38
|
+
<button class="b8">8</button>
|
39
|
+
<button class="b9">9</button>
|
40
|
+
</scroll>
|
41
|
+
|
42
|
+
</page>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<page title="Sidebars">
|
2
|
+
<view id="buttons">
|
3
|
+
<button id="top"> From Top </button>
|
4
|
+
<button id="left"> From Left </button>
|
5
|
+
<button id="right"> From Right </button>
|
6
|
+
<button id="bottom"> From Bottom </button>
|
7
|
+
</view>
|
8
|
+
|
9
|
+
<sidebar id='test'>
|
10
|
+
<label>Hello World!</label>
|
11
|
+
|
12
|
+
<button id="b1">Hello!</button>
|
13
|
+
<button id="b2">Ohay!</button>
|
14
|
+
<button id="b3">Hey!</button>
|
15
|
+
<button id="b4">Hi!</button>
|
16
|
+
</sidebar>
|
17
|
+
</page>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AlertsPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
find('#buttons button').each_with_index do |button, index|
|
4
|
+
button.on :tap do
|
5
|
+
case index
|
6
|
+
when 1 then Alert.new(title: "Error", message: button.text)
|
7
|
+
when 2 then Alert.new(message: button.text, button: "Doh...")
|
8
|
+
when 3 then Alert.new(message: button.text, buttons: ["Option 1", "Option 2"])
|
9
|
+
else Alert.new(button.text)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class CalculatorPage < UnderOs::Page
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@label = first('#result')
|
5
|
+
|
6
|
+
find('button').each do |b|
|
7
|
+
b.on(:tap){|e| handle_tap(e)}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def handle_tap(event)
|
12
|
+
case event.target.text
|
13
|
+
when '0','1','2','3','4','5','6','7','8','9','.'
|
14
|
+
@label.text = '' if ['0', @first_value].include?(@label.text)
|
15
|
+
@label.text += event.target.text if @label.text.size < 18
|
16
|
+
when '÷','×','-','+'
|
17
|
+
@first_value = @label.text
|
18
|
+
@operator = {'÷'=>'/','×'=>'*','-'=>'-','+'=>'+'}[event.target.text]
|
19
|
+
when 'C'
|
20
|
+
@first_value = nil
|
21
|
+
@label.text = '0'
|
22
|
+
when '='
|
23
|
+
calculate
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def calculate
|
28
|
+
return if ! @first_value
|
29
|
+
|
30
|
+
values = [@first_value, @label.text]
|
31
|
+
values = values.any?{|v| v.include?('.')} ? values.map(&:to_f) : values.map(&:to_i)
|
32
|
+
|
33
|
+
@label.text = values[0].send(@operator, values[1]).to_s
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class HttpPage < UnderOs::Page
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
@search = first('#search-form input')
|
5
|
+
@result = first('img#result')
|
6
|
+
@locker = Locker.new
|
7
|
+
|
8
|
+
first('#search-form button').on(:tap) { search }
|
9
|
+
end
|
10
|
+
|
11
|
+
def search
|
12
|
+
@search.hide_keyboard
|
13
|
+
@locker.show
|
14
|
+
|
15
|
+
UnderOs::HTTP.get search_url do |response|
|
16
|
+
@result.load parse_first_image_url(response.body) do
|
17
|
+
@locker.hide
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def search_url
|
23
|
+
query = @search.value
|
24
|
+
query = 'puppy' if query.empty?
|
25
|
+
|
26
|
+
"https://www.google.com.au/search?q=#{query}&source=lnms&tbm=isch"
|
27
|
+
end
|
28
|
+
|
29
|
+
def parse_first_image_url(html)
|
30
|
+
html.scan(/imgurl=(http:\/\/[^&]+)/)[0][0]
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class InputsPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
@single_select = first('#single-select').on(:change){|e| e.target.hide}
|
4
|
+
@multi_select = first('#multi-select' ).on(:change){|e| e.target.hide}
|
5
|
+
|
6
|
+
first('#show-single-select').on(:tap){ @single_select.toggle }
|
7
|
+
first('#show-multi-select' ).on(:tap){ @multi_select.toggle }
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class LockersPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
first('#buttons #b1').on(:tap){ show_simple_locker }
|
4
|
+
first('#buttons #b2').on(:tap){ show_locker_with_label }
|
5
|
+
end
|
6
|
+
|
7
|
+
def show_simple_locker
|
8
|
+
@locker = Locker.new.show
|
9
|
+
2.seconds.later { @locker.hide }
|
10
|
+
end
|
11
|
+
|
12
|
+
def show_locker_with_label
|
13
|
+
@locker = Locker.new(text: "Wait...").show
|
14
|
+
2.seconds.later { @locker.hide }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class NavbarPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
find('#buttons button').each do |button|
|
4
|
+
button.on :tap do
|
5
|
+
if button.hasClass('icons')
|
6
|
+
navbar.right_buttons = @icons = button.data('icons').split(',').map do |type|
|
7
|
+
UnderOs::UI::Icon.new(type: type)
|
8
|
+
end
|
9
|
+
else
|
10
|
+
navbar.right_buttons = {}.tap do |hash|
|
11
|
+
button.data('icons').split(',').map do |type|
|
12
|
+
hash[type] = Proc.new{ p type }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class SidebarsPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
first('#top' ).on(:tap){ show_on_top }
|
4
|
+
first('#left' ).on(:tap){ show_on_left }
|
5
|
+
first('#right' ).on(:tap){ show_on_right }
|
6
|
+
first('#bottom').on(:tap){ show_on_bottom }
|
7
|
+
|
8
|
+
@sidebar = first('sidebar#test')
|
9
|
+
end
|
10
|
+
|
11
|
+
def show_on_top
|
12
|
+
return @sidebar.hide if @sidebar.visible?
|
13
|
+
|
14
|
+
@sidebar.location = :top
|
15
|
+
@sidebar.style.height = 100
|
16
|
+
@sidebar.show
|
17
|
+
end
|
18
|
+
|
19
|
+
def show_on_left
|
20
|
+
return @sidebar.hide if @sidebar.visible?
|
21
|
+
|
22
|
+
@sidebar.location = :left
|
23
|
+
@sidebar.style.width = 200
|
24
|
+
@sidebar.show
|
25
|
+
end
|
26
|
+
|
27
|
+
def show_on_right
|
28
|
+
return @sidebar.hide if @sidebar.visible?
|
29
|
+
|
30
|
+
@sidebar.location = :right
|
31
|
+
@sidebar.style.width = 200
|
32
|
+
@sidebar.show
|
33
|
+
end
|
34
|
+
|
35
|
+
def show_on_bottom
|
36
|
+
return @sidebar.hide if @sidebar.visible?
|
37
|
+
|
38
|
+
@sidebar.location = :bottom
|
39
|
+
@sidebar.style.height = 100
|
40
|
+
@sidebar.show
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class StuffPage < UnderOs::Page
|
2
|
+
def initialize
|
3
|
+
self.title = "Various Stuff"
|
4
|
+
|
5
|
+
@box = View.new(style: {
|
6
|
+
top: 50,
|
7
|
+
left: 50,
|
8
|
+
width: 100,
|
9
|
+
height: 100,
|
10
|
+
background: :red,
|
11
|
+
borderRadius: 10,
|
12
|
+
borderWidth: 2,
|
13
|
+
borderColor: :green
|
14
|
+
})
|
15
|
+
|
16
|
+
@box.on(:tap){ @box.fade_out.fade_in }
|
17
|
+
|
18
|
+
@b2 = View.new(style: {background: :blue})
|
19
|
+
@b2.size = {x: 50, y: 50}
|
20
|
+
@b2.position = {x: 25, y: 25}
|
21
|
+
|
22
|
+
@b2.on(:tap, :highlight)
|
23
|
+
|
24
|
+
insert @box.insert(@b2)
|
25
|
+
|
26
|
+
insert Button.new(text: 'Boo Hoo!').position(x: 100, y: 200)
|
27
|
+
|
28
|
+
insert Label.new(text: "Hey Label", style: {background: :red}).position({x: 100, y: 250})
|
29
|
+
|
30
|
+
insert Icon.new(:cog).position(x: 50, y: 300)
|
31
|
+
insert Icon.new(:trash).position(x: 100, y: 300)
|
32
|
+
insert Icon.new(:home).position(x: 150, y: 300)
|
33
|
+
insert Icon.new(:magic).position(x: 200, y: 300)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
page {
|
2
|
+
background: white;
|
3
|
+
}
|
4
|
+
|
5
|
+
#buttons {
|
6
|
+
top: 60;
|
7
|
+
left: 60;
|
8
|
+
width: 200;
|
9
|
+
height: 500;
|
10
|
+
}
|
11
|
+
|
12
|
+
#buttons button {
|
13
|
+
width: 100%;
|
14
|
+
}
|
15
|
+
|
16
|
+
#buttons button#b1 { top: 0; }
|
17
|
+
#buttons button#b2 { top: 50; }
|
18
|
+
#buttons button#b3 { top: 100; }
|
19
|
+
#buttons button#b4 { top: 150; }
|
20
|
+
#buttons button#b5 { top: 200; }
|
21
|
+
#buttons button#b6 { top: 250; }
|
22
|
+
#buttons button#b7 { top: 300; }
|
23
|
+
#buttons button#b8 { top: 350; }
|
24
|
+
#buttons button#b9 { top: 400; }
|
25
|
+
#buttons button#b10 { top: 450; }
|
@@ -0,0 +1,37 @@
|
|
1
|
+
page {
|
2
|
+
background-color: darkgray;
|
3
|
+
}
|
4
|
+
|
5
|
+
label {
|
6
|
+
left: 0;
|
7
|
+
top: 80;
|
8
|
+
color: white;
|
9
|
+
height: 80;
|
10
|
+
width: 320;
|
11
|
+
font-size: 80;
|
12
|
+
text-align: right;
|
13
|
+
}
|
14
|
+
|
15
|
+
button {
|
16
|
+
width: 79px;
|
17
|
+
height: 79px;
|
18
|
+
color: black;
|
19
|
+
background: white;
|
20
|
+
border-radius: 0px;
|
21
|
+
font-size: 40;
|
22
|
+
}
|
23
|
+
|
24
|
+
button.double { width: 159; }
|
25
|
+
button.ops { background: yellow; font-size: 20; }
|
26
|
+
button.top { background: lightgray; font-size: 20; }
|
27
|
+
|
28
|
+
.row1 { bottom: 0px; }
|
29
|
+
.row2 { bottom: 80px; }
|
30
|
+
.row3 { bottom: 160px; }
|
31
|
+
.row4 { bottom: 240px; }
|
32
|
+
.row5 { bottom: 320px; }
|
33
|
+
|
34
|
+
.col1 { left: 0; }
|
35
|
+
.col2 { left: 80; }
|
36
|
+
.col3 { left: 160; }
|
37
|
+
.col4 { left: 240; }
|
@@ -0,0 +1,19 @@
|
|
1
|
+
collection {
|
2
|
+
width: 100%;
|
3
|
+
height: 100%;
|
4
|
+
background: white;
|
5
|
+
}
|
6
|
+
|
7
|
+
collection item {
|
8
|
+
width: 106px;
|
9
|
+
height: 30px;
|
10
|
+
margin-bottom: 1px;
|
11
|
+
}
|
12
|
+
|
13
|
+
collection item label {
|
14
|
+
width: 100%;
|
15
|
+
height: 100%;
|
16
|
+
background: #eee;
|
17
|
+
border-radius: 2px;
|
18
|
+
text-align: center;
|
19
|
+
}
|
data/app/styles/home.css
ADDED
File without changes
|