puffer 0.0.32 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +1 -26
  3. data/Gemfile.lock +66 -64
  4. data/README.md +34 -23
  5. data/Rakefile +1 -11
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/puffer/application.js +6 -1
  8. data/app/assets/javascripts/puffer/associations.js +18 -0
  9. data/app/assets/javascripts/puffer/puffer.js +7 -0
  10. data/app/assets/javascripts/puffer/right-calendar-src.js +19 -3
  11. data/app/assets/javascripts/puffer/right-dnd-src.js +591 -0
  12. data/app/assets/javascripts/puffer/right-in-edit-src.js +373 -0
  13. data/app/assets/javascripts/puffer/right-keys-src.js +87 -0
  14. data/app/assets/javascripts/puffer/{paginator.js → right-paginator-src.js} +0 -0
  15. data/app/assets/javascripts/puffer/right-slider-src.js +29 -32
  16. data/app/assets/javascripts/puffer/right-sortable-src.js +430 -0
  17. data/app/assets/javascripts/puffer/right-src.js +358 -99
  18. data/app/assets/stylesheets/puffer/puffer.css +29 -4
  19. data/app/components/base/form.html.erb +8 -14
  20. data/app/components/base_component.rb +1 -1
  21. data/app/components/boolean/form.html.erb +5 -3
  22. data/app/components/boolean/index.html.erb +6 -2
  23. data/app/components/boolean_component.rb +2 -2
  24. data/app/components/date_time/filter.html.erb +9 -0
  25. data/app/components/date_time/form.html.erb +8 -4
  26. data/app/components/date_time_component.rb +21 -5
  27. data/app/components/file/form.html.erb +8 -4
  28. data/app/components/hidden/form.html.erb +3 -1
  29. data/app/components/nested_attributes_many/form.html.erb +47 -0
  30. data/app/components/nested_attributes_many_component.rb +7 -0
  31. data/app/components/nested_attributes_one/form.html.erb +48 -0
  32. data/app/components/nested_attributes_one_component.rb +7 -0
  33. data/app/components/password/form.html.erb +8 -4
  34. data/app/components/password_component.rb +1 -1
  35. data/app/components/references_many/index.html.erb +1 -1
  36. data/app/components/references_one/choose.html.erb +1 -1
  37. data/app/components/references_one/form.html.erb +10 -9
  38. data/app/components/references_one_component.rb +0 -1
  39. data/app/components/render_component.rb +13 -0
  40. data/app/components/select/filter.html.erb +4 -2
  41. data/app/components/select/form.html.erb +8 -4
  42. data/app/components/text/form.html.erb +8 -4
  43. data/app/controllers/admin/sessions_controller.rb +1 -21
  44. data/app/controllers/puffer/base.rb +10 -3
  45. data/app/controllers/puffer/dashboard_base.rb +7 -1
  46. data/app/controllers/puffer/{sessions_base.rb → sessions/base.rb} +10 -7
  47. data/app/controllers/puffer/sessions/clearance.rb +29 -0
  48. data/app/controllers/puffer/{sessions_devise_base.rb → sessions/devise.rb} +1 -1
  49. data/app/controllers/puffer/sessions/simple.rb +28 -0
  50. data/app/controllers/puffer/tree_base.rb +1 -1
  51. data/app/models/puffer_user.rb +3 -0
  52. data/app/views/layouts/puffer.html.erb +3 -3
  53. data/app/views/puffer/base/_edit.html.erb +15 -0
  54. data/app/views/puffer/base/_index.html.erb +26 -0
  55. data/app/views/puffer/base/_show.html.erb +13 -0
  56. data/app/views/puffer/base/_table.html.erb +1 -1
  57. data/app/views/puffer/base/edit.html.erb +1 -15
  58. data/app/views/puffer/base/edit.js.erb +1 -0
  59. data/app/views/puffer/base/index.html.erb +1 -20
  60. data/app/views/puffer/base/index.js.erb +1 -0
  61. data/app/views/puffer/base/new.html.erb +1 -1
  62. data/app/views/puffer/base/show.html.erb +1 -22
  63. data/app/views/puffer/base/show.js.erb +1 -0
  64. data/app/views/puffer/base/update.js.erb +1 -0
  65. data/app/views/puffer/sessions/base/new.html.erb +11 -0
  66. data/app/views/puffer/tree_base/_record.html.erb +1 -1
  67. data/lib/puffer/component.rb +14 -47
  68. data/lib/puffer/controller/auth.rb +13 -9
  69. data/lib/puffer/controller/config.rb +18 -0
  70. data/lib/puffer/controller/mutate.rb +8 -8
  71. data/lib/puffer/engine.rb +5 -0
  72. data/lib/puffer/field.rb +5 -11
  73. data/lib/puffer/filters.rb +86 -56
  74. data/lib/puffer/helpers/component_helper.rb +24 -0
  75. data/lib/puffer/helpers/puffer_helper.rb +65 -0
  76. data/lib/puffer/helpers/puffer_tree_helper.rb +19 -0
  77. data/lib/puffer/orm_adapter/active_record.rb +40 -11
  78. data/lib/puffer/orm_adapter/base.rb +9 -0
  79. data/lib/puffer/orm_adapter/mongoid.rb +32 -9
  80. data/lib/puffer/resource/node.rb +2 -2
  81. data/lib/puffer/resource/routing.rb +30 -16
  82. data/lib/puffer/resource.rb +20 -20
  83. data/lib/puffer/version.rb +3 -0
  84. data/lib/puffer.rb +26 -5
  85. data/puffer.gemspec +34 -296
  86. data/spec/app/components/base_component_spec.rb +1 -1
  87. data/spec/app/components/boolean_component_spec.rb +2 -0
  88. data/spec/app/components/date_time_component_spec.rb +1 -0
  89. data/spec/app/components/file_component_spec.rb +1 -0
  90. data/spec/app/components/hidden_component_spec.rb +1 -0
  91. data/spec/app/components/password_component_spec.rb +2 -0
  92. data/spec/app/components/select_component_spec.rb +1 -0
  93. data/spec/app/components/string_component_spec.rb +1 -0
  94. data/spec/app/components/text_component_spec.rb +1 -0
  95. data/spec/dummy/app/controllers/admin/news_controller.rb +2 -0
  96. data/spec/dummy/app/controllers/admin/profiles_controller.rb +1 -1
  97. data/spec/dummy/app/controllers/admin/users_controller.rb +2 -0
  98. data/spec/dummy/app/controllers/orms/active_record_orm_primals_controller.rb +8 -0
  99. data/spec/dummy/app/helpers/news_helper.rb +7 -0
  100. data/spec/dummy/app/models/active_record_orm/has_many_reference.rb +5 -0
  101. data/spec/dummy/app/models/active_record_orm/has_one_reference.rb +5 -0
  102. data/spec/dummy/app/models/active_record_orm/primal.rb +4 -0
  103. data/spec/dummy/config/environments/development.rb +1 -1
  104. data/spec/dummy/db/migrate/20111120144025_create_active_record_orm_has_one_references.rb +10 -0
  105. data/spec/dummy/db/migrate/20111122203304_create_active_record_orm_has_many_references.rb +10 -0
  106. data/spec/dummy/db/schema.rb +15 -1
  107. data/spec/helpers/puffer_helper_spec.rb +1 -1
  108. data/spec/lib/fields_spec.rb +0 -9
  109. data/spec/lib/filters_spec.rb +4 -8
  110. data/spec/lib/orm_adapter/base_shared.rb +22 -0
  111. data/spec/spec_helper.rb +1 -1
  112. metadata +89 -60
  113. data/app/components/string/form.html.erb +0 -5
  114. data/app/helpers/puffer_helper.rb +0 -51
  115. data/app/helpers/puffer_tree_helper.rb +0 -15
  116. data/app/views/puffer/sessions_base/new.html.erb +0 -11
  117. data/lib/puffer/extensions/form.rb +0 -16
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/db/*.sqlite3
5
+ spec/dummy/log/*.log
6
+ spec/dummy/tmp/
7
+ *.orig
data/Gemfile CHANGED
@@ -1,28 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'rails', '~> 3.1.0'
4
- gem 'kaminari'
5
- gem 'orm_adapter'
6
-
7
- group :development, :test do
8
- gem "sqlite3"
9
- gem "mongoid"
10
- gem "bson_ext"
11
-
12
- gem 'devise'
13
-
14
- gem "rspec-rails"
15
- gem "capybara"
16
- gem 'database_cleaner'
17
- gem 'ammeter'
18
-
19
- gem 'guard'
20
- gem 'libnotify'
21
- gem 'guard-rspec'
22
-
23
- gem 'forgery'
24
- gem 'fabrication'
25
- gem "jeweler"
26
-
27
- gem 'nested_set'
28
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,33 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ puffer (0.1.0)
5
+ kaminari
6
+ orm_adapter
7
+ rails (~> 3.1.0)
8
+
1
9
  GEM
2
10
  remote: http://rubygems.org/
3
11
  specs:
4
- actionmailer (3.1.1)
5
- actionpack (= 3.1.1)
12
+ actionmailer (3.1.3)
13
+ actionpack (= 3.1.3)
6
14
  mail (~> 2.3.0)
7
- actionpack (3.1.1)
8
- activemodel (= 3.1.1)
9
- activesupport (= 3.1.1)
15
+ actionpack (3.1.3)
16
+ activemodel (= 3.1.3)
17
+ activesupport (= 3.1.3)
10
18
  builder (~> 3.0.0)
11
19
  erubis (~> 2.7.0)
12
20
  i18n (~> 0.6)
13
- rack (~> 1.3.2)
21
+ rack (~> 1.3.5)
14
22
  rack-cache (~> 1.1)
15
23
  rack-mount (~> 0.8.2)
16
24
  rack-test (~> 0.6.1)
17
- sprockets (~> 2.0.2)
18
- activemodel (3.1.1)
19
- activesupport (= 3.1.1)
25
+ sprockets (~> 2.0.3)
26
+ activemodel (3.1.3)
27
+ activesupport (= 3.1.3)
20
28
  builder (~> 3.0.0)
21
29
  i18n (~> 0.6)
22
- activerecord (3.1.1)
23
- activemodel (= 3.1.1)
24
- activesupport (= 3.1.1)
30
+ activerecord (3.1.3)
31
+ activemodel (= 3.1.3)
32
+ activesupport (= 3.1.3)
25
33
  arel (~> 2.2.1)
26
34
  tzinfo (~> 0.3.29)
27
- activeresource (3.1.1)
28
- activemodel (= 3.1.1)
29
- activesupport (= 3.1.1)
30
- activesupport (3.1.1)
35
+ activeresource (3.1.3)
36
+ activemodel (= 3.1.3)
37
+ activesupport (= 3.1.3)
38
+ activesupport (3.1.3)
31
39
  multi_json (~> 1.0)
32
40
  ammeter (0.2.1)
33
41
  activesupport (~> 3.0)
@@ -39,7 +47,7 @@ GEM
39
47
  bson (1.4.1)
40
48
  bson_ext (1.4.0)
41
49
  builder (3.0.0)
42
- capybara (1.1.1)
50
+ capybara (1.1.2)
43
51
  mime-types (>= 1.16)
44
52
  nokogiri (>= 1.3.3)
45
53
  rack (>= 1.0.0)
@@ -48,42 +56,37 @@ GEM
48
56
  xpath (~> 0.1.4)
49
57
  childprocess (0.2.2)
50
58
  ffi (~> 1.0.6)
51
- database_cleaner (0.6.7)
52
- devise (1.4.8)
59
+ database_cleaner (0.7.0)
60
+ devise (1.5.1)
53
61
  bcrypt-ruby (~> 3.0)
54
62
  orm_adapter (~> 0.0.3)
55
- warden (~> 1.0.3)
63
+ warden (~> 1.1)
56
64
  diff-lcs (1.1.3)
57
65
  erubis (2.7.0)
58
66
  fabrication (1.2.0)
59
- ffi (1.0.9)
67
+ ffi (1.0.11)
60
68
  forgery (0.5.0)
61
- git (1.2.5)
62
- guard (0.8.4)
69
+ guard (0.8.8)
63
70
  thor (~> 0.14.6)
64
- guard-rspec (0.5.0)
71
+ guard-rspec (0.5.5)
65
72
  guard (>= 0.8.4)
66
73
  hike (1.2.1)
67
74
  i18n (0.6.0)
68
- jeweler (1.6.4)
69
- bundler (~> 1.0)
70
- git (>= 1.2.5)
71
- rake
72
75
  json (1.6.1)
73
76
  json_pure (1.6.1)
74
77
  kaminari (0.12.4)
75
78
  rails (>= 3.0.0)
76
- libnotify (0.5.7)
79
+ libnotify (0.5.9)
77
80
  mail (2.3.0)
78
81
  i18n (>= 0.4.0)
79
82
  mime-types (~> 1.16)
80
83
  treetop (~> 1.4.8)
81
- mime-types (1.16)
84
+ mime-types (1.17.2)
82
85
  mongo (1.4.1)
83
86
  bson (= 1.4.1)
84
- mongoid (2.3.2)
87
+ mongoid (2.3.3)
85
88
  activemodel (~> 3.1)
86
- mongo (~> 1.4)
89
+ mongo (~> 1.3)
87
90
  tzinfo (~> 0.3.22)
88
91
  multi_json (1.0.3)
89
92
  nested_set (1.6.8)
@@ -91,8 +94,8 @@ GEM
91
94
  railties (>= 3.0.0)
92
95
  nokogiri (1.5.0)
93
96
  orm_adapter (0.0.5)
94
- polyglot (0.3.2)
95
- rack (1.3.4)
97
+ polyglot (0.3.3)
98
+ rack (1.3.5)
96
99
  rack-cache (1.1)
97
100
  rack (>= 0.4)
98
101
  rack-mount (0.8.3)
@@ -101,55 +104,56 @@ GEM
101
104
  rack
102
105
  rack-test (0.6.1)
103
106
  rack (>= 1.0)
104
- rails (3.1.1)
105
- actionmailer (= 3.1.1)
106
- actionpack (= 3.1.1)
107
- activerecord (= 3.1.1)
108
- activeresource (= 3.1.1)
109
- activesupport (= 3.1.1)
107
+ rails (3.1.3)
108
+ actionmailer (= 3.1.3)
109
+ actionpack (= 3.1.3)
110
+ activerecord (= 3.1.3)
111
+ activeresource (= 3.1.3)
112
+ activesupport (= 3.1.3)
110
113
  bundler (~> 1.0)
111
- railties (= 3.1.1)
112
- railties (3.1.1)
113
- actionpack (= 3.1.1)
114
- activesupport (= 3.1.1)
114
+ railties (= 3.1.3)
115
+ railties (3.1.3)
116
+ actionpack (= 3.1.3)
117
+ activesupport (= 3.1.3)
115
118
  rack-ssl (~> 1.3.2)
116
119
  rake (>= 0.8.7)
117
120
  rdoc (~> 3.4)
118
121
  thor (~> 0.14.6)
119
- rake (0.9.2)
120
- rdoc (3.10)
122
+ rake (0.9.2.2)
123
+ rdoc (3.11)
121
124
  json (~> 1.4)
122
- rspec (2.6.0)
123
- rspec-core (~> 2.6.0)
124
- rspec-expectations (~> 2.6.0)
125
- rspec-mocks (~> 2.6.0)
126
- rspec-core (2.6.4)
127
- rspec-expectations (2.6.0)
125
+ rspec (2.7.0)
126
+ rspec-core (~> 2.7.0)
127
+ rspec-expectations (~> 2.7.0)
128
+ rspec-mocks (~> 2.7.0)
129
+ rspec-core (2.7.1)
130
+ rspec-expectations (2.7.0)
128
131
  diff-lcs (~> 1.1.2)
129
- rspec-mocks (2.6.0)
130
- rspec-rails (2.6.1)
132
+ rspec-mocks (2.7.0)
133
+ rspec-rails (2.7.0)
131
134
  actionpack (~> 3.0)
132
135
  activesupport (~> 3.0)
133
136
  railties (~> 3.0)
134
- rspec (~> 2.6.0)
137
+ rspec (~> 2.7.0)
135
138
  rubyzip (0.9.4)
136
- selenium-webdriver (2.8.0)
139
+ selenium-webdriver (2.13.0)
137
140
  childprocess (>= 0.2.1)
138
- ffi (>= 1.0.7)
141
+ ffi (~> 1.0.9)
139
142
  json_pure
140
143
  rubyzip
141
- sprockets (2.0.2)
144
+ sprockets (2.0.3)
142
145
  hike (~> 1.2)
143
146
  rack (~> 1.0)
144
147
  tilt (~> 1.1, != 1.3.0)
145
148
  sqlite3 (1.3.4)
146
149
  thor (0.14.6)
147
150
  tilt (1.3.3)
151
+ timecop (0.3.5)
148
152
  treetop (1.4.10)
149
153
  polyglot
150
154
  polyglot (>= 0.3.1)
151
- tzinfo (0.3.30)
152
- warden (1.0.6)
155
+ tzinfo (0.3.31)
156
+ warden (1.1.0)
153
157
  rack (>= 1.0)
154
158
  xpath (0.1.4)
155
159
  nokogiri (~> 1.3)
@@ -167,12 +171,10 @@ DEPENDENCIES
167
171
  forgery
168
172
  guard
169
173
  guard-rspec
170
- jeweler
171
- kaminari
172
174
  libnotify
173
175
  mongoid
174
176
  nested_set
175
- orm_adapter
176
- rails (~> 3.1.0)
177
+ puffer!
177
178
  rspec-rails
178
179
  sqlite3
180
+ timecop
data/README.md CHANGED
@@ -1,18 +1,24 @@
1
- # Puffer - YARAI (Yet Another Rails Admin Interface). Rails 3.1 only.
1
+ # Puffer YARAI (Yet Another Rails Admin Interface)
2
2
 
3
- Puffer was created to help a project owner or moderators view and edit all the project's data models. It's compatible with Rails 3.1 only.
3
+ Puffer was created to help a project owner or moderators view and
4
+ edit all the project's data models.
5
+
6
+ **It's compatible with Rails 3.1 only.**
4
7
 
5
8
  ## Discussion and help
6
9
 
7
- puffer@conference.jabber.org
10
+ <xmpp:puffer@conference.jabber.org>
8
11
 
9
12
  ## Key features
10
13
 
11
- * Full Rails integration. Puffer has no configuration, just a DSL to create interfaces. And this DSL depends on Rails conventions.
12
- * Flexibility. Puffer designed to be as flexible as possible, so you can create your own modules easily.
13
- * I18n. Surely.
14
- * Puffer can support different ORMs or ODMs through orm_adapter.
15
- * Implemented full AR and Mongoid support.
14
+ * Full Ruby on Rails integration. Puffer has no configuration files, but a
15
+ DSL to define administration interfaces. This DSL follows the Rails
16
+ conventions.
17
+ * Flexibility. Puffer designed to provide much flexibility as possible,
18
+ so you can create your own extensions without any design issues.
19
+ * Internationalization. Surely, enjoy the native Rails i18n subsystem.
20
+ * Puffer supports different ORMs or ODMs through the `orm_adapter` gem.
21
+ Currently, we can work with ActiveRecord and Mongoid.
16
22
 
17
23
  ## Installation.
18
24
 
@@ -26,9 +32,9 @@ Or in Gemfile:
26
32
 
27
33
  ## Introduction.
28
34
 
29
- Let's assume this is the data structure of your project:
35
+ Let's assume this is the data structure of your application:
30
36
 
31
- ```
37
+ ```ruby
32
38
  create_table "users", :force => true do |t|
33
39
  t.string "email"
34
40
  t.string "password"
@@ -47,7 +53,7 @@ end
47
53
 
48
54
  And let's also assume your models look like this:
49
55
 
50
- ```
56
+ ```ruby
51
57
  class User < ActiveRecord::Base
52
58
  has_many :posts
53
59
  validates_presence_of :email, :password
@@ -60,7 +66,7 @@ class Profile < ActiveRecord::Base
60
66
  end
61
67
  ```
62
68
 
63
- First, let's generate Puffer controllers:
69
+ First, let's generate the Puffer controllers:
64
70
 
65
71
  `rails g puffer:controller User`
66
72
 
@@ -68,9 +74,9 @@ and
68
74
 
69
75
  `rails g puffer:controller Post`
70
76
 
71
- This will generate this:
77
+ This will generate the following code:
72
78
 
73
- ```
79
+ ```ruby
74
80
  class Admin::PostsController < Puffer::Base
75
81
  setup do
76
82
  group :posts
@@ -97,9 +103,9 @@ class Admin::PostsController < Puffer::Base
97
103
  end
98
104
  ```
99
105
 
100
- Puffer's controller DSL creates all the actions you need. Next step: routing.
106
+ Puffer's DSL creates all the actions you need. Next step is routing.
101
107
 
102
- ```
108
+ ```ruby
103
109
  namespace :admin do
104
110
  resources :users do
105
111
  resources :posts
@@ -108,21 +114,23 @@ namespace :admin do
108
114
  end
109
115
  ```
110
116
 
111
- Let me explain this feature. Puffer tracks all the nested resources. So, with this routing structure we can access, for example, only specified user's posts:
117
+ Let me explain this feature. Puffer tracks all the nested resources.
118
+ For instance, according to our routing definitions, we can access only
119
+ specified posts of our user:
112
120
 
113
121
  `/admin/users/1/post`
114
122
 
115
- Routing nesting defines admin interface resources nesting.
123
+ Routing nesting implies the admin resources nesting.
116
124
 
117
125
  ## Advanced usage
118
126
 
119
- Puffer can be used in other namespaces than admin:
127
+ Puffer can work in different namespaces:
120
128
 
121
129
  `rails g puffer:controller moderator/posts`
122
130
 
123
131
  And we'll get posts controller for moderators:
124
132
 
125
- ```
133
+ ```ruby
126
134
  class Moderator::PostsController < Puffer::Base
127
135
  before_filter :require_moderator
128
136
 
@@ -147,12 +155,15 @@ class Moderator::PostsController < Puffer::Base
147
155
  end
148
156
  ```
149
157
 
150
- As you can see, moderators can't destroy posts. The moderator's post controller is placed in the Posting tab of the admin interface.
158
+ As you can see, moderators can't destroy posts. The moderator's post
159
+ controller is placed in the Posting tab of the admin interface.
151
160
 
152
161
  Finally, don't forget about routing:
153
162
 
154
- ```
163
+ ```ruby
155
164
  namespace :moderator do
156
165
  resources :posts
157
166
  end
158
- ```
167
+ ```
168
+
169
+ Have a nice day and let Puffer rock for you.
data/Rakefile CHANGED
@@ -24,14 +24,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
24
24
  rdoc.rdoc_files.include('lib/**/*.rb')
25
25
  end
26
26
 
27
- require 'jeweler'
28
-
29
- Jeweler::Tasks.new do |gem|
30
- gem.name = "puffer"
31
- gem.summary = %Q{Admin interface builder}
32
- gem.description = %Q{In Soviet Russia puffer admins you}
33
- gem.email = "kinwizard@gmail.com"
34
- gem.homepage = "http://github.com/puffer/puffer"
35
- gem.authors = ["pyromaniac"]
36
- end
37
- Jeweler::GemcutterTasks.new
27
+ require "bundler/gem_tasks"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.32
1
+ 0.0.33
@@ -1,10 +1,15 @@
1
1
  //= require puffer/right-src
2
+ //= require puffer/right-dnd-src
3
+ //= require puffer/right-keys-src
2
4
  //= require puffer/right-dialog-src
3
5
  //= require puffer/right-slider-src
6
+ //= require puffer/right-in-edit-src
4
7
  //= require puffer/right-calendar-src
8
+ //= require puffer/right-sortable-src
5
9
  //= require puffer/right-autocompleter-src
6
- //= require puffer/paginator
10
+ //= require puffer/right-paginator-src
7
11
  //= require puffer/rails
8
12
  //= require puffer/puffer
13
+ //= require puffer/associations
9
14
 
10
15
  //= require_all ./puffer
@@ -0,0 +1,18 @@
1
+ "a[data-insert]".on('click', function(event) {
2
+ if (event.which != 1) return;
3
+
4
+ if (this.data('insert').element) {
5
+ var new_id = new Date().getTime();
6
+ $(this.data('insert').element).insert(this.data('insert').content.replace(/new_nested_index/g, new_id));
7
+ }
8
+ if (this.data('insert').remove) {
9
+ $(this.data('insert').remove).remove();
10
+ }
11
+ if (this.data('insert').show) {
12
+ $(this.data('insert').show).show();
13
+ }
14
+ if (this.data('insert').hide) {
15
+ $(this.data('insert').hide).hide();
16
+ }
17
+ event.stop();
18
+ });
@@ -19,4 +19,11 @@ var association_done = function(event) {
19
19
  }
20
20
 
21
21
  dialog.load(this.get('data-dialog-uri'));
22
+ });
23
+
24
+ 'a[data-new-dialog-uri]'.on('click', function(event) {
25
+ if (event.which != 1) return;
26
+ event.stop();
27
+
28
+ new Dialog({expandable: true}).load(this.get('data-new-dialog-uri'));
22
29
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * RightJS-UI Calendar v2.2.0
2
+ * RightJS-UI Calendar v2.3.0
3
3
  * http://rightjs.org/ui/calendar
4
4
  *
5
5
  * Copyright (C) 2009-2011 Nikolay Nemshilov
@@ -430,7 +430,7 @@ var Calendar = new Widget({
430
430
  include: [Toggler, Assignable],
431
431
 
432
432
  extend: {
433
- version: '2.2.0',
433
+ version: '2.3.0',
434
434
 
435
435
  EVENTS: $w('show hide change done'),
436
436
 
@@ -458,6 +458,8 @@ var Calendar = new Widget({
458
458
  update: null, // a reference to an input element to assign to
459
459
  trigger: null, // a reference to a trigger element that would be paired too
460
460
 
461
+ highlight: null, // a list of dates to highlight
462
+
461
463
  cssRule: '*[data-calendar]' // css rule for calendar related elements
462
464
  },
463
465
 
@@ -694,6 +696,12 @@ var Calendar = new Widget({
694
696
  this.assignTo(options.update, options.trigger);
695
697
  }
696
698
 
699
+ if (isArray(options.highlight)) {
700
+ options.highlight = R(options.highlight).map(function(date) {
701
+ return isString(date) ? this.parse(date) : date;
702
+ }, this);
703
+ }
704
+
697
705
  return this;
698
706
  },
699
707
 
@@ -900,6 +908,14 @@ var Month = new Class(Element, {
900
908
  cell.className = 'disabled';
901
909
  }
902
910
 
911
+ if (isArray(options.highlight)) {
912
+ if (options.highlight.first(function(d) {
913
+ return d.getFullYear() === date.getFullYear() &&
914
+ d.getMonth() === date.getMonth() &&
915
+ d.getDate() === date.getDate()
916
+ })) { cell.className += ' highlighted'; }
917
+ }
918
+
903
919
  week[day_num].date = new Date(date);
904
920
  }
905
921
 
@@ -1448,7 +1464,7 @@ $(document).on({
1448
1464
 
1449
1465
 
1450
1466
  var embed_style = document.createElement('style'),
1451
- embed_rules = document.createTextNode(".rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default} *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}div.rui-calendar .swaps,div.rui-calendar .greed,div.rui-calendar .timepicker,div.rui-calendar .buttons,div.rui-calendar table,div.rui-calendar table tr,div.rui-calendar table th,div.rui-calendar table td,div.rui-calendar table tbody,div.rui-calendar table thead,div.rui-calendar table caption{background:none;border:none;width:auto;height:auto;margin:0;padding:0}div.rui-calendar-inline{position:relative;display:inline-block; *display:inline; *zoom:1;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-calendar .swaps{position:relative}div.rui-calendar .swaps .rui-button{position:absolute;float:left;width:1em;padding:.15em .4em}div.rui-calendar .swaps .next-month{right:0em;_right:.5em}div.rui-calendar .swaps .prev-year{left:2.05em}div.rui-calendar .swaps .next-year{right:2.05em;_right:2.52em}div.rui-calendar .greed{border-spacing:0px;border-collapse:collapse;border-size:0}div.rui-calendar .greed td{vertical-align:top;padding-left:.4em}div.rui-calendar .greed>tbody>tr>td:first-child{padding:0}div.rui-calendar .month{margin-top:.2em;border-spacing:1px;border-collapse:separate}div.rui-calendar .month caption{text-align:center}div.rui-calendar .month th{color:#666;text-align:center}div.rui-calendar .month td{text-align:right;padding:.1em .3em;background-color:#FFF;border:1px solid #CCC;cursor:pointer;color:#555;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-calendar .month td:hover{background-color:#CCC;border-color:#AAA;color:#000}div.rui-calendar .month td.blank{background:transparent;cursor:default;border:none}div.rui-calendar .month td.selected{background-color:#BBB;border-color:#AAA;color:#222;font-weight:bold;padding:.1em .2em}div.rui-calendar .month td.disabled{color:#888;background:#EEE;border-color:#CCC;cursor:default}div.rui-calendar .timepicker{border-top:1px solid #ccc;margin-top:.3em;padding-top:.5em;text-align:center}div.rui-calendar .timepicker select{margin:0 .4em}div.rui-calendar .buttons{position:relative;margin-top:.5em}div.rui-calendar .buttons div.rui-button{width:4em;padding:.25em .5em}div.rui-calendar .buttons .done{position:absolute;right:0em;top:0}");
1467
+ embed_rules = document.createTextNode(".rui-panel{margin:0;padding:.5em;position:relative;background-color:#EEE;border:1px solid #BBB;border-radius:.3em;-moz-border-radius:.3em;-webkit-border-radius:.3em;box-shadow:.15em .3em .5em #BBB;-moz-box-shadow:.15em .3em .5em #BBB;-webkit-box-shadow:.15em .3em .5em #BBB;cursor:default} *.rui-button{display:inline-block; *display:inline; *zoom:1;height:1em;line-height:1em;margin:0;padding:.2em .5em;text-align:center;border:1px solid #CCC;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em;cursor:pointer;color:#333;background-color:#FFF;user-select:none;-moz-user-select:none;-webkit-user-select:none} *.rui-button:hover{color:#111;border-color:#999;background-color:#DDD;box-shadow:#888 0 0 .1em;-moz-box-shadow:#888 0 0 .1em;-webkit-box-shadow:#888 0 0 .1em} *.rui-button:active{color:#000;border-color:#777;text-indent:1px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none} *.rui-button-disabled, *.rui-button-disabled:hover, *.rui-button-disabled:active{color:#888;background:#DDD;border-color:#CCC;cursor:default;text-indent:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-re-anchor{margin:0;padding:0;background:none;border:none;float:none;display:inline;position:absolute;z-index:9999}div.rui-calendar .swaps,div.rui-calendar .greed,div.rui-calendar .timepicker,div.rui-calendar .buttons,div.rui-calendar table,div.rui-calendar table tr,div.rui-calendar table th,div.rui-calendar table td,div.rui-calendar table tbody,div.rui-calendar table thead,div.rui-calendar table caption{background:none;border:none;width:auto;height:auto;margin:0;padding:0}div.rui-calendar-inline{position:relative;display:inline-block; *display:inline; *zoom:1;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}div.rui-calendar .swaps{position:relative}div.rui-calendar .swaps .rui-button{position:absolute;float:left;width:1em;padding:.15em .4em}div.rui-calendar .swaps .next-month{right:0em;_right:.5em}div.rui-calendar .swaps .prev-year{left:2.05em}div.rui-calendar .swaps .next-year{right:2.05em;_right:2.52em}div.rui-calendar .greed{border-spacing:0px;border-collapse:collapse;border-size:0}div.rui-calendar .greed td{vertical-align:top;padding-left:.4em}div.rui-calendar .greed>tbody>tr>td:first-child{padding:0}div.rui-calendar .month{margin-top:.2em;border-spacing:1px;border-collapse:separate}div.rui-calendar .month caption{text-align:center}div.rui-calendar .month th{color:#666;text-align:center}div.rui-calendar .month td{text-align:right;padding:.1em .3em;background-color:#FFF;border:1px solid #CCC;cursor:pointer;color:#555;border-radius:.2em;-moz-border-radius:.2em;-webkit-border-radius:.2em}div.rui-calendar .month td:hover{background-color:#CCC;border-color:#AAA;color:#000}div.rui-calendar .month td.blank{background:transparent;cursor:default;border:none}div.rui-calendar .month td.selected{background-color:#BBB;border-color:#AAA;color:#222;font-weight:bold;padding:.1em .2em}div.rui-calendar .month td.disabled{color:#888;background:#EEE;border-color:#CCC;cursor:default}div.rui-calendar .month td.highlighted{background-color:#DDD;border-color:#bbb;color:#111}div.rui-calendar .timepicker{border-top:1px solid #ccc;margin-top:.3em;padding-top:.5em;text-align:center}div.rui-calendar .timepicker select{margin:0 .4em}div.rui-calendar .buttons{position:relative;margin-top:.5em}div.rui-calendar .buttons div.rui-button{width:4em;padding:.25em .5em}div.rui-calendar .buttons .done{position:absolute;right:0em;top:0}");
1452
1468
 
1453
1469
  embed_style.type = 'text/css';
1454
1470
  document.getElementsByTagName('head')[0].appendChild(embed_style);