clevic 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +182 -0
- data/Manifest.txt +7 -3
- data/README.txt +36 -23
- data/Rakefile +22 -7
- data/TODO +55 -45
- data/bin/clevic +7 -2
- data/config/hoe.rb +4 -2
- data/lib/clevic.rb +1 -0
- data/lib/clevic/browser.rb +38 -15
- data/lib/clevic/cache_table.rb +24 -8
- data/lib/clevic/db_options.rb +11 -8
- data/lib/clevic/delegates.rb +24 -13
- data/lib/clevic/extensions.rb +6 -2
- data/lib/clevic/field.rb +55 -6
- data/lib/clevic/item_delegate.rb +7 -6
- data/lib/clevic/model_builder.rb +35 -8
- data/lib/clevic/record.rb +28 -0
- data/lib/clevic/table_model.rb +21 -33
- data/lib/clevic/table_view.rb +48 -1
- data/lib/clevic/ui/browser.ui +4 -4
- data/lib/clevic/ui/browser_ui.rb +73 -74
- data/lib/clevic/ui/search_dialog_ui.rb +50 -51
- data/lib/clevic/version.rb +1 -1
- data/{accounts_models.rb → models/accounts_models.rb} +12 -12
- data/models/minimal_models.rb +19 -0
- data/models/times_models.rb +156 -0
- data/{times_models.rb → models/times_sqlite_models.rb} +10 -18
- data/{values_models.rb → models/values_models.rb} +2 -3
- data/script/console +1 -1
- data/sql/accounts.sql +48 -48
- data/sql/times.sql +25 -25
- data/sql/times_sqlite.sql +46 -0
- data/website/index.html +44 -18
- data/website/index.txt +8 -1
- data/website/template.html.erb +2 -1
- metadata +34 -8
@@ -0,0 +1,46 @@
|
|
1
|
+
CREATE TABLE activities (
|
2
|
+
id integer primary key autoincrement,
|
3
|
+
activity character varying(100),
|
4
|
+
active boolean DEFAULT true
|
5
|
+
);
|
6
|
+
|
7
|
+
CREATE TABLE entries (
|
8
|
+
id integer primary key autoincrement,
|
9
|
+
invoice_id integer,
|
10
|
+
project_id integer,
|
11
|
+
activity_id integer,
|
12
|
+
date date,
|
13
|
+
"start" time without time zone,
|
14
|
+
"end" time without time zone,
|
15
|
+
description text,
|
16
|
+
person character varying(30),
|
17
|
+
order_number character varying(40),
|
18
|
+
out_of_spec integer,
|
19
|
+
module character varying(100),
|
20
|
+
rate integer,
|
21
|
+
charge boolean DEFAULT true
|
22
|
+
);
|
23
|
+
|
24
|
+
|
25
|
+
CREATE TABLE invoices (
|
26
|
+
id integer primary key autoincrement,
|
27
|
+
date date,
|
28
|
+
client character varying(40),
|
29
|
+
invoice_number character varying(8),
|
30
|
+
status character varying(8),
|
31
|
+
billing character varying(15),
|
32
|
+
quote_date timestamp without time zone,
|
33
|
+
quote_amount money,
|
34
|
+
description character varying(100)
|
35
|
+
);
|
36
|
+
|
37
|
+
|
38
|
+
CREATE TABLE projects (
|
39
|
+
id integer primary key autoincrement,
|
40
|
+
project character varying(100),
|
41
|
+
description text,
|
42
|
+
order_number character varying(100),
|
43
|
+
client character varying(100),
|
44
|
+
rate integer,
|
45
|
+
active boolean default true
|
46
|
+
);
|
data/website/index.html
CHANGED
@@ -25,12 +25,39 @@
|
|
25
25
|
</script>
|
26
26
|
</head>
|
27
27
|
<body>
|
28
|
+
|
28
29
|
<div id="main">
|
29
30
|
<h1>Clevic</h1>
|
30
31
|
<p><a href="rdoc">RDoc</a> | <a href="http://rubyforge.org/projects/clevic/">Rubyforge Project</a></p>
|
31
32
|
|
32
33
|
|
33
|
-
<p>
|
34
|
+
<p>Code for inimal UI definition</p>
|
35
|
+
|
36
|
+
|
37
|
+
<pre><code>
|
38
|
+
require 'clevic.rb'
|
39
|
+
|
40
|
+
# db connection
|
41
|
+
Clevic::DbOptions.connect do
|
42
|
+
database 'accounts_test'
|
43
|
+
adapter :postgresql
|
44
|
+
username 'accounts'
|
45
|
+
end
|
46
|
+
|
47
|
+
# minimal definition to get combo boxes to show up
|
48
|
+
class Entry < Clevic::Record
|
49
|
+
belongs_to :debit, :class_name => 'Account', :foreign_key => 'debit_id'
|
50
|
+
belongs_to :credit, :class_name => 'Account', :foreign_key => 'credit_id'
|
51
|
+
end
|
52
|
+
|
53
|
+
# minimal definition to get sensible values in combo boxes
|
54
|
+
class Account < Clevic::Record
|
55
|
+
def to_s; name; end
|
56
|
+
end
|
57
|
+
|
58
|
+
</code></pre>
|
59
|
+
|
60
|
+
<p>Screenshot of a more fully defined UI with the foreign-key dropdown in place. Tabs contain
|
34
61
|
the two tables, model definition file is below the screenshot. The Entry
|
35
62
|
model has some code to do update the credit and debit fields when
|
36
63
|
the new item description is found in the table.</p>
|
@@ -42,16 +69,19 @@ the new item description is found in the table.</p>
|
|
42
69
|
<pre><code>
|
43
70
|
require 'clevic.rb'
|
44
71
|
|
45
|
-
# db connection
|
46
|
-
$options
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
72
|
+
# db connection
|
73
|
+
Clevic::DbOptions.connect( $options ) do
|
74
|
+
# use a different db for testing, so real data doesn't get broken.
|
75
|
+
if options[:database].nil? || options[:database].empty?
|
76
|
+
database( debug? ? :accounts_test : :accounts )
|
77
|
+
else
|
78
|
+
database options[:database]
|
79
|
+
end
|
80
|
+
adapter :postgresql
|
81
|
+
username 'accounts'
|
82
|
+
end
|
52
83
|
|
53
|
-
class Entry <
|
54
|
-
include ActiveRecord::Dirty
|
84
|
+
class Entry < Clevic::Record
|
55
85
|
belongs_to :debit, :class_name => 'Account', :foreign_key => 'debit_id'
|
56
86
|
belongs_to :credit, :class_name => 'Account', :foreign_key => 'credit_id'
|
57
87
|
|
@@ -59,9 +89,9 @@ class Entry < ActiveRecord::Base
|
|
59
89
|
def self.ui( parent )
|
60
90
|
Clevic::TableView.new( self, parent ).create_model do
|
61
91
|
plain :date, :sample => '88-WWW-99'
|
62
|
-
distinct :description, :conditions => "now() - date <= '1 year'", :sample => 'm' * 26
|
63
|
-
relational :debit,
|
64
|
-
relational :credit,
|
92
|
+
distinct :description, :conditions => "now() - date <= '1 year'", :sample => 'm' * 26
|
93
|
+
relational :debit, :display => 'name', :conditions => 'active = true', :order => 'lower(name)', :sample => 'Leilani Member Loan'
|
94
|
+
relational :credit, :display => 'name', :conditions => 'active = true', :order => 'lower(name)', :sample => 'Leilani Member Loan'
|
65
95
|
plain :amount, :sample => 999999.99
|
66
96
|
distinct :category
|
67
97
|
plain :cheque_number
|
@@ -116,8 +146,7 @@ class Entry < ActiveRecord::Base
|
|
116
146
|
end
|
117
147
|
end
|
118
148
|
|
119
|
-
class Account <
|
120
|
-
include ActiveRecord::Dirty
|
149
|
+
class Account < Clevic::Record
|
121
150
|
has_many :debits, :class_name => 'Entry', :foreign_key => 'debit_id'
|
122
151
|
has_many :credits, :class_name => 'Entry', :foreign_key => 'credit_id'
|
123
152
|
|
@@ -136,9 +165,6 @@ class Account < ActiveRecord::Base
|
|
136
165
|
end
|
137
166
|
end
|
138
167
|
|
139
|
-
# order of tab display
|
140
|
-
$options[:models] = [ Entry, Account ]
|
141
|
-
|
142
168
|
</code></pre>
|
143
169
|
|
144
170
|
<!-- insert site tracking codes here, like Google Urchin -->
|
data/website/index.txt
CHANGED
@@ -2,7 +2,14 @@ h1. Clevic
|
|
2
2
|
|
3
3
|
"RDoc":rdoc | "Rubyforge Project":http://rubyforge.org/projects/clevic/
|
4
4
|
|
5
|
-
|
5
|
+
Code for minimal UI definition
|
6
|
+
|
7
|
+
<pre><code>
|
8
|
+
<%= File.read 'models/minimal_models.rb' %>
|
9
|
+
</code></pre>
|
10
|
+
|
11
|
+
|
12
|
+
Screenshot of a more fully defined UI with the foreign-key dropdown in place. Tabs contain
|
6
13
|
the two tables, model definition file is below the screenshot. The Entry
|
7
14
|
model has some code to do update the credit and debit fields when
|
8
15
|
the new item description is found in the table.
|
data/website/template.html.erb
CHANGED
@@ -25,13 +25,14 @@
|
|
25
25
|
</script>
|
26
26
|
</head>
|
27
27
|
<body>
|
28
|
+
|
28
29
|
<div id="main">
|
29
30
|
<h1><%= title %></h1>
|
30
31
|
<%= body %>
|
31
32
|
</div>
|
32
33
|
|
33
34
|
<pre><code>
|
34
|
-
<%= File.read 'accounts_models.rb' %>
|
35
|
+
<%= File.read 'models/accounts_models.rb' %>
|
35
36
|
</code></pre>
|
36
37
|
|
37
38
|
<!-- insert site tracking codes here, like Google Urchin -->
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clevic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Anderson
|
@@ -9,27 +9,49 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-25 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: qtext
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
23
|
+
version: 0.4.1
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: activerecord
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
29
|
-
- - "
|
31
|
+
- - "="
|
30
32
|
- !ruby/object:Gem::Version
|
31
33
|
version: 2.0.2
|
32
34
|
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: fastercsv
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.2.3
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.7.0
|
54
|
+
version:
|
33
55
|
description: SQL table GUI with Qt
|
34
56
|
email:
|
35
57
|
- panic@semiosix.com
|
@@ -49,7 +71,6 @@ files:
|
|
49
71
|
- README.txt
|
50
72
|
- Rakefile
|
51
73
|
- TODO
|
52
|
-
- accounts_models.rb
|
53
74
|
- bin/clevic
|
54
75
|
- bin/import-times
|
55
76
|
- config/hoe.rb
|
@@ -67,6 +88,7 @@ files:
|
|
67
88
|
- lib/clevic/item_delegate.rb
|
68
89
|
- lib/clevic/model_builder.rb
|
69
90
|
- lib/clevic/model_column.rb
|
91
|
+
- lib/clevic/record.rb
|
70
92
|
- lib/clevic/search_dialog.rb
|
71
93
|
- lib/clevic/table_model.rb
|
72
94
|
- lib/clevic/table_view.rb
|
@@ -76,15 +98,19 @@ files:
|
|
76
98
|
- lib/clevic/ui/search_dialog.ui
|
77
99
|
- lib/clevic/ui/search_dialog_ui.rb
|
78
100
|
- lib/clevic/version.rb
|
101
|
+
- models/accounts_models.rb
|
102
|
+
- models/minimal_models.rb
|
103
|
+
- models/times_models.rb
|
104
|
+
- models/times_sqlite_models.rb
|
105
|
+
- models/values_models.rb
|
79
106
|
- script/console
|
80
107
|
- script/destroy
|
81
108
|
- script/generate
|
82
109
|
- script/txt2html
|
83
110
|
- sql/accounts.sql
|
84
111
|
- sql/times.sql
|
112
|
+
- sql/times_sqlite.sql
|
85
113
|
- tasks/website.rake
|
86
|
-
- times_models.rb
|
87
|
-
- values_models.rb
|
88
114
|
- website/index.html
|
89
115
|
- website/index.txt
|
90
116
|
- website/screenshot.png
|
@@ -113,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
139
|
requirements: []
|
114
140
|
|
115
141
|
rubyforge_project: clevic
|
116
|
-
rubygems_version: 1.
|
142
|
+
rubygems_version: 1.2.0
|
117
143
|
signing_key:
|
118
144
|
specification_version: 2
|
119
145
|
summary: SQL table GUI with Qt
|