glimmer-dsl-libui 0.9.3 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +356 -10
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/rake_task/scaffold.rb +22 -9
- data/lib/glimmer/rake_task.rb +21 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 722844f182b70508ed2e98484db762ea72297e7e9634042b2d888ca5b8c65f99
|
4
|
+
data.tar.gz: 88e9f08337452b1d59b90a54f30f489c0acc02154f2b57991de7c5d08c1347fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cad7f6be9a53386679ff80bfbb0c763428e003dcbf07f812c3d76b4f0dc581239d6e376b2e70bef030bbe1ff64554dae4fc3be55e9618c8dda6bf8a72da51752
|
7
|
+
data.tar.gz: 34a2ef4fa8f372dd69e9de1f768197118a5c30fcc140f178d39285fd75326db7f2f8b76fe9faf8812c3f862d8652d931580124fd252147466f4c5fb3600e8c3f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.9.5
|
4
|
+
|
5
|
+
- Scaffold Custom Control via `glimmer scaffold:customcontrol[name,namespace]`
|
6
|
+
|
7
|
+
## 0.9.4
|
8
|
+
|
9
|
+
- Scaffold Custom Window via `glimmer scaffold:customwindow[name,namespace]`
|
10
|
+
|
3
11
|
## 0.9.3
|
4
12
|
|
5
13
|
- Application Scaffolding via `glimmer scaffold[app_name]` includes a Model layer
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.9.
|
1
|
+
# [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.9.5
|
2
2
|
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](http://www.digitalfukuoka.jp/topics/187?locale=ja))
|
3
3
|
### The Quickest Way From Zero To GUI
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
|
@@ -28,7 +28,7 @@ The main trade-off in using [Glimmer DSL for LibUI](https://rubygems.org/gems/gl
|
|
28
28
|
- Requiring the [least amount of syntax](#glimmer-gui-dsl-concepts) possible to build GUI
|
29
29
|
- [Custom Control](#custom-keywords) support
|
30
30
|
- [Bidirectional/Unidirectional Data-Binding](#data-binding) to declaratively wire and automatically synchronize GUI Views with Models
|
31
|
-
- [Scaffolding](scaffold-application) for new custom controls, apps, and gems
|
31
|
+
- [Scaffolding](#scaffold-application) for new custom windows/controls, apps, and gems
|
32
32
|
- [Far Future Plan] Native-Executable packaging on Mac, Windows, and Linux.
|
33
33
|
|
34
34
|
Hello, World!
|
@@ -351,6 +351,8 @@ Learn more about the differences between various [Glimmer](https://github.com/An
|
|
351
351
|
- [Run Application](#run-application)
|
352
352
|
- [Run Examples](#run-examples)
|
353
353
|
- [Scaffold Application](#scaffold-application)
|
354
|
+
- [Scaffold Custom Window](#scaffold-custom-window)
|
355
|
+
- [Scaffold Custom Control](#scaffold-custom-control)
|
354
356
|
- [Girb (Glimmer IRB)](#girb-glimmer-irb)
|
355
357
|
- [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
|
356
358
|
- [API](#api)
|
@@ -421,7 +423,7 @@ gem install glimmer-dsl-libui
|
|
421
423
|
Or install via Bundler `Gemfile`:
|
422
424
|
|
423
425
|
```ruby
|
424
|
-
gem 'glimmer-dsl-libui', '~> 0.9.
|
426
|
+
gem 'glimmer-dsl-libui', '~> 0.9.5'
|
425
427
|
```
|
426
428
|
|
427
429
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -625,7 +627,7 @@ Scaffold Glimmer DSL for LibUI application with this command:
|
|
625
627
|
glimmer "scaffold[app_name]"
|
626
628
|
```
|
627
629
|
|
628
|
-
That will generate the general MVC structure of a new Glimmer DSL for LibUI application.
|
630
|
+
That will automatically generate the general MVC structure of a new Glimmer DSL for LibUI application and launch the application when done.
|
629
631
|
|
630
632
|
For example, if we run:
|
631
633
|
|
@@ -659,6 +661,16 @@ Views live under `app/app_name/view` (e.g. `app/hello_world/view`)
|
|
659
661
|
|
660
662
|
Models live under `app/app_name/model` (e.g. `app/hello_world/model`)
|
661
663
|
|
664
|
+
The application runs automatically once scaffolding is done.
|
665
|
+
|
666
|
+
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
667
|
+
|
668
|
+
![glimmer-dsl-libui-mac-scaffold-app-preferences.png](images/glimmer-dsl-libui-mac-scaffold-app-preferences.png)
|
669
|
+
|
670
|
+
![glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png](images/glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png)
|
671
|
+
|
672
|
+
![glimmer-dsl-libui-mac-scaffold-app-about.png](images/glimmer-dsl-libui-mac-scaffold-app-about.png)
|
673
|
+
|
662
674
|
Once you step into the application directory, you can run it in one of multiple ways:
|
663
675
|
|
664
676
|
```
|
@@ -679,12 +691,6 @@ glimmer run
|
|
679
691
|
|
680
692
|
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
681
693
|
|
682
|
-
![glimmer-dsl-libui-mac-scaffold-app-preferences.png](images/glimmer-dsl-libui-mac-scaffold-app-preferences.png)
|
683
|
-
|
684
|
-
![glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png](images/glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png)
|
685
|
-
|
686
|
-
![glimmer-dsl-libui-mac-scaffold-app-about.png](images/glimmer-dsl-libui-mac-scaffold-app-about.png)
|
687
|
-
|
688
694
|
The application comes with the [juwelier](https://rubygems.org/gems/juwelier) gem for auto-generating an application gem from the app `Rakefile` and `Gemfile` configuration (no need to manually declare gems in a gemspec... just use `Gemfile` normally and [juwelier](https://rubygems.org/gems/juwelier) takes care of the rest by generating an app gemspec automatically from `Gemfile`).
|
689
695
|
|
690
696
|
You can package the newly scaffolded app as a Ruby gem by running this command:
|
@@ -725,6 +731,346 @@ hello_world
|
|
725
731
|
|
726
732
|
![glimmer-dsl-libui-mac-scaffold-app-initial-screen.png](images/glimmer-dsl-libui-mac-scaffold-app-initial-screen.png)
|
727
733
|
|
734
|
+
### Scaffold Custom Window
|
735
|
+
|
736
|
+
When you are in a scaffolded application, you can scaffold a new custom window (a window that you can put anything in to represent a view concept in your application) by running this command:
|
737
|
+
|
738
|
+
```
|
739
|
+
glimmer scaffold:customwindow[name,namespace]
|
740
|
+
```
|
741
|
+
|
742
|
+
The name represents the custom window view class name (it can be underscored, and Glimmer will automatically classify it).
|
743
|
+
|
744
|
+
The namespace is optional and represents the module that the custom window view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
|
745
|
+
|
746
|
+
You can also use the shorter `cw` alias for `customwindow`:
|
747
|
+
|
748
|
+
```
|
749
|
+
glimmer scaffold:cw[name,namespace]
|
750
|
+
```
|
751
|
+
|
752
|
+
For example by running this command under a `hello_world` application:
|
753
|
+
|
754
|
+
```
|
755
|
+
glimmer scaffold:cw[greeting_window]
|
756
|
+
```
|
757
|
+
|
758
|
+
That will generate this class under `app/hello_world/view/greeting_window`:
|
759
|
+
|
760
|
+
```ruby
|
761
|
+
class HelloWorld
|
762
|
+
module View
|
763
|
+
class GreetingWindow
|
764
|
+
include Glimmer::LibUI::CustomWindow
|
765
|
+
|
766
|
+
|
767
|
+
## Add options like the following to configure CustomWindow by outside consumers
|
768
|
+
#
|
769
|
+
# options :title, :background_color
|
770
|
+
# option :width, default: 320
|
771
|
+
# option :height, default: 240
|
772
|
+
|
773
|
+
## Use before_body block to pre-initialize variables to use in body and
|
774
|
+
# to setup application menu
|
775
|
+
#
|
776
|
+
# before_body do
|
777
|
+
#
|
778
|
+
# end
|
779
|
+
|
780
|
+
## Use after_body block to setup observers for controls in body
|
781
|
+
#
|
782
|
+
# after_body do
|
783
|
+
#
|
784
|
+
# end
|
785
|
+
|
786
|
+
## Add control content inside custom window body
|
787
|
+
## Top-most control must be a window or another custom window
|
788
|
+
#
|
789
|
+
body {
|
790
|
+
window {
|
791
|
+
# Replace example content below with custom window content
|
792
|
+
content_size 240, 240
|
793
|
+
title 'Hello World'
|
794
|
+
|
795
|
+
margined true
|
796
|
+
|
797
|
+
label {
|
798
|
+
text 'Hello World'
|
799
|
+
}
|
800
|
+
}
|
801
|
+
}
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|
805
|
+
```
|
806
|
+
|
807
|
+
When the generated file is required in another view (e.g. `require 'hello_world/view/greeting_window'`), the custom window keyword `greeting_window` become available and reusable, like by calling:
|
808
|
+
|
809
|
+
```ruby
|
810
|
+
greeting_window.show
|
811
|
+
```
|
812
|
+
|
813
|
+
Here is an example that generates a custom window with a namespace:
|
814
|
+
|
815
|
+
```
|
816
|
+
glimmer scaffold:cw[train,station]
|
817
|
+
```
|
818
|
+
|
819
|
+
That will generate this class under `app/station/view/train`:
|
820
|
+
|
821
|
+
```ruby
|
822
|
+
module Station
|
823
|
+
module View
|
824
|
+
class Train
|
825
|
+
include Glimmer::LibUI::CustomWindow
|
826
|
+
|
827
|
+
|
828
|
+
## Add options like the following to configure CustomWindow by outside consumers
|
829
|
+
#
|
830
|
+
# options :title, :background_color
|
831
|
+
# option :width, default: 320
|
832
|
+
# option :height, default: 240
|
833
|
+
|
834
|
+
## Use before_body block to pre-initialize variables to use in body and
|
835
|
+
# to setup application menu
|
836
|
+
#
|
837
|
+
# before_body do
|
838
|
+
#
|
839
|
+
# end
|
840
|
+
|
841
|
+
## Use after_body block to setup observers for controls in body
|
842
|
+
#
|
843
|
+
# after_body do
|
844
|
+
#
|
845
|
+
# end
|
846
|
+
|
847
|
+
## Add control content inside custom window body
|
848
|
+
## Top-most control must be a window or another custom window
|
849
|
+
#
|
850
|
+
body {
|
851
|
+
window {
|
852
|
+
# Replace example content below with custom window content
|
853
|
+
content_size 240, 240
|
854
|
+
title 'Station'
|
855
|
+
|
856
|
+
margined true
|
857
|
+
|
858
|
+
label {
|
859
|
+
text 'Station'
|
860
|
+
}
|
861
|
+
}
|
862
|
+
}
|
863
|
+
end
|
864
|
+
end
|
865
|
+
end
|
866
|
+
```
|
867
|
+
|
868
|
+
When that file is required in another view (e.g. `require 'station/view/train'`), the `train` keyword becomes available:
|
869
|
+
|
870
|
+
```ruby
|
871
|
+
train.show
|
872
|
+
```
|
873
|
+
|
874
|
+
If for whatever reason, you end up with 2 custom window views having the same name with different namespaces, then you can invoke the specific custom window you want by including the Ruby namespace in underscored format separated by double-underscores:
|
875
|
+
|
876
|
+
```ruby
|
877
|
+
station__view__train.show
|
878
|
+
```
|
879
|
+
|
880
|
+
Or another `train` custom window view:
|
881
|
+
|
882
|
+
```ruby
|
883
|
+
hello_world__view__train.show
|
884
|
+
```
|
885
|
+
|
886
|
+
### Scaffold Custom Control
|
887
|
+
|
888
|
+
When you are in a scaffolded application, you can scaffold a new custom control (a control that you can put anything in to represent a view concept in your application) by running this command:
|
889
|
+
|
890
|
+
```
|
891
|
+
glimmer scaffold:customcontrol[name,namespace]
|
892
|
+
```
|
893
|
+
|
894
|
+
The name represents the custom control view class name (it can be underscored, and Glimmer will automatically classify it).
|
895
|
+
|
896
|
+
The namespace is optional and represents the module that the custom control view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
|
897
|
+
|
898
|
+
You can also use the shorter `cc` alias for `customcontrol`:
|
899
|
+
|
900
|
+
```
|
901
|
+
glimmer scaffold:cc[name,namespace]
|
902
|
+
```
|
903
|
+
|
904
|
+
For example by running this command under a `hello_world` application:
|
905
|
+
|
906
|
+
```
|
907
|
+
glimmer scaffold:cw[model_form]
|
908
|
+
```
|
909
|
+
|
910
|
+
That will generate this class under `app/hello_world/view/model_form`:
|
911
|
+
|
912
|
+
```ruby
|
913
|
+
class HelloWorld
|
914
|
+
module View
|
915
|
+
class ModelForm
|
916
|
+
include Glimmer::LibUI::CustomControl
|
917
|
+
|
918
|
+
## Add options like the following to configure CustomControl by outside consumers
|
919
|
+
#
|
920
|
+
# options :custom_text, :background_color
|
921
|
+
# option :foreground_color, default: :red
|
922
|
+
|
923
|
+
# Replace example options with your own options
|
924
|
+
option :model
|
925
|
+
option :attributes
|
926
|
+
|
927
|
+
## Use before_body block to pre-initialize variables to use in body
|
928
|
+
#
|
929
|
+
#
|
930
|
+
before_body do
|
931
|
+
# Replace example code with your own before_body code
|
932
|
+
default_model_attributes = [:first_name, :last_name, :email]
|
933
|
+
default_model_class = Struct.new(*default_model_attributes)
|
934
|
+
self.model ||= default_model_class.new
|
935
|
+
self.attributes ||= default_model_attributes
|
936
|
+
end
|
937
|
+
|
938
|
+
## Use after_body block to setup observers for controls in body
|
939
|
+
#
|
940
|
+
# after_body do
|
941
|
+
#
|
942
|
+
# end
|
943
|
+
|
944
|
+
## Add control content under custom control body
|
945
|
+
##
|
946
|
+
## If you want to add a window as the top-most control,
|
947
|
+
## consider creating a custom window instead
|
948
|
+
## (Glimmer::LibUI::CustomWindow offers window convenience methods, like show and hide)
|
949
|
+
#
|
950
|
+
body {
|
951
|
+
# Replace example content (model_form custom control) with your own custom control content.
|
952
|
+
form {
|
953
|
+
attributes.each do |attribute|
|
954
|
+
entry { |e|
|
955
|
+
label attribute.to_s.underscore.split('_').map(&:capitalize).join(' ')
|
956
|
+
text <=> [model, attribute]
|
957
|
+
}
|
958
|
+
end
|
959
|
+
}
|
960
|
+
}
|
961
|
+
|
962
|
+
end
|
963
|
+
end
|
964
|
+
end
|
965
|
+
```
|
966
|
+
|
967
|
+
When the generated file is required in another view (e.g. `require 'hello_world/view/model_form'`), the custom control keyword `model_form` become available and reusable, like by calling:
|
968
|
+
|
969
|
+
```ruby
|
970
|
+
window {
|
971
|
+
vertical_box {
|
972
|
+
label('Form:')
|
973
|
+
model_form(model: some_model, attributes: array_of_attributes)
|
974
|
+
}
|
975
|
+
}
|
976
|
+
```
|
977
|
+
|
978
|
+
Here is an example that generates a custom control with a namespace:
|
979
|
+
|
980
|
+
```
|
981
|
+
glimmer scaffold:cw[model_form,common]
|
982
|
+
```
|
983
|
+
|
984
|
+
That will generate this class under `app/common/view/model_form`:
|
985
|
+
|
986
|
+
```ruby
|
987
|
+
module Common
|
988
|
+
module View
|
989
|
+
class ModelForm
|
990
|
+
include Glimmer::LibUI::CustomControl
|
991
|
+
|
992
|
+
## Add options like the following to configure CustomControl by outside consumers
|
993
|
+
#
|
994
|
+
# options :custom_text, :background_color
|
995
|
+
# option :foreground_color, default: :red
|
996
|
+
|
997
|
+
# Replace example options with your own options
|
998
|
+
option :model
|
999
|
+
option :attributes
|
1000
|
+
|
1001
|
+
## Use before_body block to pre-initialize variables to use in body
|
1002
|
+
#
|
1003
|
+
#
|
1004
|
+
before_body do
|
1005
|
+
# Replace example code with your own before_body code
|
1006
|
+
default_model_attributes = [:first_name, :last_name, :email]
|
1007
|
+
default_model_class = Struct.new(*default_model_attributes)
|
1008
|
+
self.model ||= default_model_class.new
|
1009
|
+
self.attributes ||= default_model_attributes
|
1010
|
+
end
|
1011
|
+
|
1012
|
+
## Use after_body block to setup observers for controls in body
|
1013
|
+
#
|
1014
|
+
# after_body do
|
1015
|
+
#
|
1016
|
+
# end
|
1017
|
+
|
1018
|
+
## Add control content under custom control body
|
1019
|
+
##
|
1020
|
+
## If you want to add a window as the top-most control,
|
1021
|
+
## consider creating a custom window instead
|
1022
|
+
## (Glimmer::LibUI::CustomWindow offers window convenience methods, like show and hide)
|
1023
|
+
#
|
1024
|
+
body {
|
1025
|
+
# Replace example content (model_form custom control) with your own custom control content.
|
1026
|
+
form {
|
1027
|
+
attributes.each do |attribute|
|
1028
|
+
entry { |e|
|
1029
|
+
label attribute.to_s.underscore.split('_').map(&:capitalize).join(' ')
|
1030
|
+
text <=> [model, attribute]
|
1031
|
+
}
|
1032
|
+
end
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
end
|
1037
|
+
end
|
1038
|
+
end
|
1039
|
+
```
|
1040
|
+
|
1041
|
+
When that file is required in another view (e.g. `require 'common/view/model_form'`), the `model_form` keyword becomes available:
|
1042
|
+
|
1043
|
+
```ruby
|
1044
|
+
window {
|
1045
|
+
vertical_box {
|
1046
|
+
label('Form:')
|
1047
|
+
model_form(model: some_model, attributes: array_of_attributes)
|
1048
|
+
}
|
1049
|
+
}
|
1050
|
+
```
|
1051
|
+
|
1052
|
+
If for whatever reason, you end up with 2 custom control views having the same name with different namespaces, then you can invoke the specific custom control you want by including the Ruby namespace in underscored format separated by double-underscores:
|
1053
|
+
|
1054
|
+
```ruby
|
1055
|
+
window {
|
1056
|
+
vertical_box {
|
1057
|
+
label('Form:')
|
1058
|
+
common__view__model_form(model: some_model, attributes: array_of_attributes)
|
1059
|
+
}
|
1060
|
+
}
|
1061
|
+
```
|
1062
|
+
|
1063
|
+
Or another `model_form` custom control view:
|
1064
|
+
|
1065
|
+
```ruby
|
1066
|
+
window {
|
1067
|
+
vertical_box {
|
1068
|
+
label('Form:')
|
1069
|
+
hello_world__view__model_form(model: some_model, attributes: array_of_attributes)
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
```
|
1073
|
+
|
728
1074
|
## Girb (Glimmer IRB)
|
729
1075
|
|
730
1076
|
You can run the `girb` command (`bin/girb` if you cloned the project locally) to do some quick and dirty experimentation and learning:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -155,7 +155,7 @@ module Glimmer
|
|
155
155
|
mkdir_p "app/#{file_name(app_name)}/model"
|
156
156
|
mkdir_p "app/#{file_name(app_name)}/view"
|
157
157
|
custom_window(class_name(app_name), current_dir_name, window_type, custom_window_class_name: 'Application')
|
158
|
-
|
158
|
+
app_model(current_dir_name)
|
159
159
|
|
160
160
|
mkdir_p 'icons/windows'
|
161
161
|
icon_file = "icons/windows/#{human_name(app_name)}.ico"
|
@@ -368,7 +368,7 @@ module Glimmer
|
|
368
368
|
puts 'Run `rake release` to release into rubygems.org once ready.'
|
369
369
|
end
|
370
370
|
|
371
|
-
def
|
371
|
+
def app_model(current_dir_name)
|
372
372
|
model_name = 'Greeting'
|
373
373
|
namespace ||= current_dir_name
|
374
374
|
root_dir = File.exist?('app') ? 'app' : 'lib'
|
@@ -639,7 +639,7 @@ require '#{current_dir_name}/model/greeting'
|
|
639
639
|
margined true
|
640
640
|
|
641
641
|
label {
|
642
|
-
text <= [@greeting, :text]
|
642
|
+
#{%i[gem app].include?(window_type) ? "text <= [@greeting, :text]" : "text '#{human_name(custom_window_name)}'"}
|
643
643
|
}
|
644
644
|
}
|
645
645
|
}
|
@@ -704,13 +704,21 @@ end
|
|
704
704
|
#
|
705
705
|
# options :custom_text, :background_color
|
706
706
|
# option :foreground_color, default: :red
|
707
|
+
|
708
|
+
# Replace example options with your own options
|
709
|
+
option :model
|
710
|
+
option :attributes
|
707
711
|
|
708
712
|
## Use before_body block to pre-initialize variables to use in body
|
709
713
|
#
|
710
714
|
#
|
711
|
-
|
712
|
-
|
713
|
-
|
715
|
+
before_body do
|
716
|
+
# Replace example code with your own before_body code
|
717
|
+
default_model_attributes = [:first_name, :last_name, :email]
|
718
|
+
default_model_class = Struct.new(*default_model_attributes)
|
719
|
+
self.model ||= default_model_class.new
|
720
|
+
self.attributes ||= default_model_attributes
|
721
|
+
end
|
714
722
|
|
715
723
|
## Use after_body block to setup observers for controls in body
|
716
724
|
#
|
@@ -725,9 +733,14 @@ end
|
|
725
733
|
## (Glimmer::LibUI::CustomWindow offers window convenience methods, like show and hide)
|
726
734
|
#
|
727
735
|
body {
|
728
|
-
# Replace example content
|
729
|
-
|
730
|
-
|
736
|
+
# Replace example content (model_form custom control) with your own custom control content.
|
737
|
+
form {
|
738
|
+
attributes.each do |attribute|
|
739
|
+
entry { |e|
|
740
|
+
label attribute.to_s.underscore.split('_').map(&:capitalize).join(' ')
|
741
|
+
text <=> [model, attribute]
|
742
|
+
}
|
743
|
+
end
|
731
744
|
}
|
732
745
|
}
|
733
746
|
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -93,26 +93,26 @@ namespace :glimmer do
|
|
93
93
|
Glimmer::RakeTask::Scaffold.app(args[:app_name])
|
94
94
|
end
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
96
|
+
namespace :scaffold do
|
97
|
+
desc 'Scaffold Glimmer::UI::CustomWindow subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cw]'
|
98
|
+
task :customwindow, [:name, :namespace] do |t, args|
|
99
|
+
require_relative 'rake_task/scaffold'
|
100
|
+
Glimmer::RakeTask::Scaffold.custom_window(args[:name], args[:namespace])
|
101
|
+
end
|
102
|
+
|
103
|
+
task :cw, [:name, :namespace] => :customwindow
|
104
|
+
task :custom_window, [:name, :namespace] => :customwindow
|
105
|
+
task :"custom-window", [:name, :namespace] => :customwindow
|
106
|
+
|
107
|
+
desc 'Scaffold Glimmer::UI::CustomControl subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cc]'
|
108
|
+
task :customcontrol, [:name, :namespace] do |t, args|
|
109
|
+
require_relative 'rake_task/scaffold'
|
110
|
+
Glimmer::RakeTask::Scaffold.custom_control(args[:name], args[:namespace])
|
111
|
+
end
|
112
|
+
|
113
|
+
task :cc, [:name, :namespace] => :customcontrol
|
114
|
+
task :custom_control, [:name, :namespace] => :customcontrol
|
115
|
+
task :"custom-control", [:name, :namespace] => :customcontrol
|
116
116
|
#
|
117
117
|
# desc 'Scaffold Glimmer::UI::CustomShape subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cs]'
|
118
118
|
# task :customshape, [:name, :namespace] do |t, args|
|
@@ -159,7 +159,7 @@ namespace :glimmer do
|
|
159
159
|
# task :custom_window_gem, [:name, :namespace] => 'gem:customwindow'
|
160
160
|
# task :custom_control_gem, [:name, :namespace] => 'gem:customcontrol'
|
161
161
|
# task :custom_shape_gem, [:name, :namespace] => 'gem:customshape'
|
162
|
-
|
162
|
+
end
|
163
163
|
|
164
164
|
namespace :list do
|
165
165
|
task :list_require do
|