inline_forms 1.6.33 → 1.6.35
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.
- checksums.yaml +15 -7
- data/.gitignore +5 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +72 -59
- data/bin/inline_forms +9 -389
- data/bin/inline_forms_app_template.rb +322 -0
- data/inline_forms.gemspec +6 -6
- data/lib/app/assets/javascripts/ckeditor/config.js +11 -14
- data/lib/inline_forms/version.rb +1 -1
- metadata +82 -101
checksums.yaml
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: !binary |-
|
|
4
|
+
MzU3YTZkNzc1OWZkYzEwMTk4OWE0YzFlOWZlZWE1NzNlMTliZTI3Nw==
|
|
5
|
+
data.tar.gz: !binary |-
|
|
6
|
+
NWE4ZmQ4ZGM4NWVmNjc3Njk1M2NiZjU5NzRiOTVmYmFkNzc0YTZkMQ==
|
|
7
|
+
!binary "U0hBNTEy":
|
|
8
|
+
metadata.gz: !binary |-
|
|
9
|
+
ZWI5N2ZlNTU1Y2U3Mjc5Yjc3MDkzMmIzMTNiMzNiOWM0YmZlN2ViNjg5NGQz
|
|
10
|
+
ODQyZjk5ZmVmNWYyZDc1OTJlMDZiMzExYTU3NzkwYTU1M2EwZWFmZmY4MzA2
|
|
11
|
+
ZDg5MGMyYmY4YWE3NTYyODEwOWU5ZGM0YWNkM2FlN2NiYmFjOWE=
|
|
12
|
+
data.tar.gz: !binary |-
|
|
13
|
+
N2ZjNjQ4ZWZjZGNjNzgxYTQxOGUwYjU4M2FiZmI0MzZlNjE3NTE4YmQ3NmNi
|
|
14
|
+
YTA1OGQ2ZGFiZWNhMjAwZjM0NTUwMGYxOGViOWEwYzM4Y2YxNjZmNGQzOWVl
|
|
15
|
+
YWQ4NDZlYTg3MWM3MWZjMWFiYmNiODlkNzNmZWM4YjEwOTZlYzQ=
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,88 +1,101 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
inline_forms (1.
|
|
4
|
+
inline_forms (1.6.35)
|
|
5
|
+
rails (= 3.2.12)
|
|
6
|
+
rails-i18n (~> 3.0.0)
|
|
7
|
+
rvm
|
|
8
|
+
thor
|
|
9
|
+
validation_hints
|
|
5
10
|
|
|
6
11
|
GEM
|
|
7
|
-
remote: http://rubygems.org/
|
|
12
|
+
remote: http://www.rubygems.org/
|
|
8
13
|
specs:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
actionmailer (3.2.12)
|
|
15
|
+
actionpack (= 3.2.12)
|
|
16
|
+
mail (~> 2.4.4)
|
|
17
|
+
actionpack (3.2.12)
|
|
18
|
+
activemodel (= 3.2.12)
|
|
19
|
+
activesupport (= 3.2.12)
|
|
12
20
|
builder (~> 3.0.0)
|
|
13
21
|
erubis (~> 2.7.0)
|
|
14
|
-
|
|
15
|
-
rack (~> 1.
|
|
16
|
-
rack-cache (~> 1.
|
|
17
|
-
rack-mount (~> 0.8.2)
|
|
22
|
+
journey (~> 1.0.4)
|
|
23
|
+
rack (~> 1.4.5)
|
|
24
|
+
rack-cache (~> 1.2)
|
|
18
25
|
rack-test (~> 0.6.1)
|
|
19
|
-
sprockets (~> 2.
|
|
20
|
-
activemodel (3.
|
|
21
|
-
activesupport (= 3.
|
|
26
|
+
sprockets (~> 2.2.1)
|
|
27
|
+
activemodel (3.2.12)
|
|
28
|
+
activesupport (= 3.2.12)
|
|
22
29
|
builder (~> 3.0.0)
|
|
30
|
+
activerecord (3.2.12)
|
|
31
|
+
activemodel (= 3.2.12)
|
|
32
|
+
activesupport (= 3.2.12)
|
|
33
|
+
arel (~> 3.0.2)
|
|
34
|
+
tzinfo (~> 0.3.29)
|
|
35
|
+
activeresource (3.2.12)
|
|
36
|
+
activemodel (= 3.2.12)
|
|
37
|
+
activesupport (= 3.2.12)
|
|
38
|
+
activesupport (3.2.12)
|
|
23
39
|
i18n (~> 0.6)
|
|
24
|
-
activesupport (3.1.1)
|
|
25
40
|
multi_json (~> 1.0)
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
arel (3.0.3)
|
|
42
|
+
builder (3.0.4)
|
|
28
43
|
erubis (2.7.0)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
hike (1.2.3)
|
|
45
|
+
i18n (0.6.9)
|
|
46
|
+
journey (1.0.4)
|
|
47
|
+
json (1.8.1)
|
|
48
|
+
mail (2.4.4)
|
|
49
|
+
i18n (>= 0.4.0)
|
|
50
|
+
mime-types (~> 1.16)
|
|
51
|
+
treetop (~> 1.4.8)
|
|
52
|
+
mime-types (1.25.1)
|
|
53
|
+
multi_json (1.8.2)
|
|
54
|
+
polyglot (0.3.3)
|
|
55
|
+
rack (1.4.5)
|
|
56
|
+
rack-cache (1.2)
|
|
40
57
|
rack (>= 0.4)
|
|
41
|
-
rack-
|
|
42
|
-
rack (>= 1.0.0)
|
|
43
|
-
rack-ssl (1.3.2)
|
|
58
|
+
rack-ssl (1.3.3)
|
|
44
59
|
rack
|
|
45
|
-
rack-test (0.6.
|
|
60
|
+
rack-test (0.6.2)
|
|
46
61
|
rack (>= 1.0)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
rails (3.2.12)
|
|
63
|
+
actionmailer (= 3.2.12)
|
|
64
|
+
actionpack (= 3.2.12)
|
|
65
|
+
activerecord (= 3.2.12)
|
|
66
|
+
activeresource (= 3.2.12)
|
|
67
|
+
activesupport (= 3.2.12)
|
|
68
|
+
bundler (~> 1.0)
|
|
69
|
+
railties (= 3.2.12)
|
|
70
|
+
rails-i18n (3.0.0)
|
|
71
|
+
i18n (~> 0.5)
|
|
72
|
+
rails (>= 3.0.0, < 4.0.0)
|
|
73
|
+
railties (3.2.12)
|
|
74
|
+
actionpack (= 3.2.12)
|
|
75
|
+
activesupport (= 3.2.12)
|
|
50
76
|
rack-ssl (~> 1.3.2)
|
|
51
77
|
rake (>= 0.8.7)
|
|
52
78
|
rdoc (~> 3.4)
|
|
53
|
-
thor (
|
|
54
|
-
rake (
|
|
55
|
-
|
|
56
|
-
rdoc (3.10)
|
|
79
|
+
thor (>= 0.14.6, < 2.0)
|
|
80
|
+
rake (10.1.0)
|
|
81
|
+
rdoc (3.12.2)
|
|
57
82
|
json (~> 1.4)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
rspec-expectations (~> 2.6.0)
|
|
61
|
-
rspec-mocks (~> 2.6.0)
|
|
62
|
-
rspec-core (2.6.4)
|
|
63
|
-
rspec-expectations (2.6.0)
|
|
64
|
-
diff-lcs (~> 1.1.2)
|
|
65
|
-
rspec-mocks (2.6.0)
|
|
66
|
-
rspec-rails (2.6.1)
|
|
67
|
-
actionpack (~> 3.0)
|
|
68
|
-
activesupport (~> 3.0)
|
|
69
|
-
railties (~> 3.0)
|
|
70
|
-
rspec (~> 2.6.0)
|
|
71
|
-
shoulda (2.11.3)
|
|
72
|
-
sprockets (2.0.2)
|
|
83
|
+
rvm (1.11.3.8)
|
|
84
|
+
sprockets (2.2.2)
|
|
73
85
|
hike (~> 1.2)
|
|
86
|
+
multi_json (~> 1.0)
|
|
74
87
|
rack (~> 1.0)
|
|
75
88
|
tilt (~> 1.1, != 1.3.0)
|
|
76
|
-
thor (0.
|
|
77
|
-
tilt (1.
|
|
89
|
+
thor (0.18.1)
|
|
90
|
+
tilt (1.4.1)
|
|
91
|
+
treetop (1.4.15)
|
|
92
|
+
polyglot
|
|
93
|
+
polyglot (>= 0.3.1)
|
|
94
|
+
tzinfo (0.3.38)
|
|
95
|
+
validation_hints (0.2.0)
|
|
78
96
|
|
|
79
97
|
PLATFORMS
|
|
80
98
|
ruby
|
|
81
99
|
|
|
82
100
|
DEPENDENCIES
|
|
83
|
-
bundler (~> 1.0.0)
|
|
84
101
|
inline_forms!
|
|
85
|
-
jeweler (~> 1.5.2)
|
|
86
|
-
rcov
|
|
87
|
-
rspec-rails
|
|
88
|
-
shoulda
|
data/bin/inline_forms
CHANGED
|
@@ -90,401 +90,21 @@ module InlineForms
|
|
|
90
90
|
if dry_run?
|
|
91
91
|
empty_directory(app_name)
|
|
92
92
|
else
|
|
93
|
-
|
|
94
|
-
say "Rails could not create the app '#{app_name}', maybe because it is a reserved word...", :red
|
|
95
|
-
exit 1
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
ruby_version = (%x[rvm current]).gsub(/@.*/,'')
|
|
100
|
-
create_file "#{app_name}/.ruby-version", "#{ruby_version.chop}@#{app_name}"
|
|
101
|
-
|
|
102
|
-
say "chdir: '#{app_name}'...", :green
|
|
103
|
-
RVM.chdir(app_name) do
|
|
104
|
-
RVM.gemset_use! app_name
|
|
105
|
-
say "- Working directory is now #{`pwd`}"
|
|
106
|
-
say "- RVM gemset is now #{%x[rvm current]}"
|
|
107
|
-
|
|
108
|
-
create_file "#{app_name}/Gemfile", <<-END_GEMFILE.strip_heredoc_with_indent
|
|
109
|
-
# generated by inline_forms v#{VERSION}
|
|
110
|
-
|
|
111
|
-
source 'http://rubygems.org'
|
|
112
|
-
|
|
113
|
-
gem 'rails', '3.2.12'
|
|
114
|
-
gem 'rake', '10.0.4'
|
|
115
|
-
gem 'jquery-rails', '~> 2.3.0'
|
|
116
|
-
gem 'jquery-ui-rails'
|
|
117
|
-
gem 'capistrano'
|
|
118
|
-
gem 'will_paginate', :git => 'git://github.com/acesuares/will_paginate.git'
|
|
119
|
-
gem 'tabs_on_rails', :git => 'git://github.com/acesuares/tabs_on_rails.git', :branch => 'update_remote'
|
|
120
|
-
gem 'ckeditor', :git => 'git://github.com/acesuares/ckeditor.git', :branch => 'master'
|
|
121
|
-
gem 'cancan', :git => 'git://github.com/acesuares/cancan.git', :branch => '2.0'
|
|
122
|
-
gem 'carrierwave'
|
|
123
|
-
gem 'remotipart', '~> 1.0'
|
|
124
|
-
gem 'paper_trail'
|
|
125
|
-
gem 'devise'
|
|
126
|
-
gem 'inline_forms'
|
|
127
|
-
gem 'validation_hints'
|
|
128
|
-
gem 'mini_magick'
|
|
129
|
-
gem 'jquery-ui-rails'
|
|
130
|
-
gem 'yaml_db'
|
|
131
|
-
gem 'rails-i18n'
|
|
132
|
-
gem 'i18n-active_record', :git => 'git://github.com/acesuares/i18n-active_record.git'
|
|
133
|
-
gem 'unicorn'
|
|
134
|
-
gem 'rvm'
|
|
135
|
-
gem 'rvm-capistrano'
|
|
136
|
-
|
|
137
|
-
# Include everything needed to run rake, tests, features, etc.
|
|
138
|
-
group :development do
|
|
139
|
-
gem 'sqlite3'
|
|
140
|
-
gem 'rspec-rails'
|
|
141
|
-
gem 'shoulda', '>= 0'
|
|
142
|
-
gem 'bundler'
|
|
143
|
-
gem 'jeweler'
|
|
144
|
-
# gem 'rcov', '>= 0'
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
# these are just for production
|
|
148
|
-
group :production do
|
|
149
|
-
gem 'mysql2'
|
|
150
|
-
gem 'therubyracer'
|
|
151
|
-
gem 'uglifier', '>= 1.0.3'
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
group :assets do
|
|
155
|
-
gem 'sass-rails', '~> 3.2.3'
|
|
156
|
-
gem 'coffee-rails', '~> 3.2.1'
|
|
157
|
-
gem 'uglifier', '>= 1.0.3'
|
|
158
|
-
gem 'compass-rails' # you need this or you get an err
|
|
159
|
-
gem 'zurb-foundation', '~> 4.0.0'
|
|
160
|
-
end
|
|
161
|
-
END_GEMFILE
|
|
162
|
-
|
|
163
|
-
say "- Running bundle..."
|
|
164
|
-
run("bundle") unless dry_run?
|
|
165
|
-
|
|
166
|
-
say "- Database setup: creating config/database.yml with development database #{database}"
|
|
167
|
-
remove_file "#{app_name}/config/database.yml" # the one that 'rails _3.2.12_ new' created
|
|
168
|
-
if using_sqlite?
|
|
169
|
-
create_file "#{app_name}/config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
170
|
-
development:
|
|
171
|
-
adapter: sqlite3
|
|
172
|
-
database: db/development.sqlite3
|
|
173
|
-
pool: 5
|
|
174
|
-
timeout: 5000
|
|
175
|
-
|
|
176
|
-
END_DATABASEYML
|
|
177
|
-
else
|
|
178
|
-
create_file "#{app_name}/config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
179
|
-
development:
|
|
180
|
-
adapter: mysql2
|
|
181
|
-
database: #{app_name}_dev
|
|
182
|
-
username: #{app_name}
|
|
183
|
-
password: #{app_name}
|
|
184
|
-
|
|
185
|
-
END_DATABASEYML
|
|
186
|
-
end
|
|
187
|
-
append_file "#{app_name}/config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
188
|
-
production:
|
|
189
|
-
adapter: mysql2
|
|
190
|
-
database: #{app_name}_p
|
|
191
|
-
username: #{app_name}
|
|
192
|
-
password: #{app_name}444
|
|
193
|
-
END_DATABASEYML
|
|
194
|
-
|
|
195
|
-
say "- Devise install..."
|
|
196
|
-
run "bundle exec rails g devise:install" unless dry_run?
|
|
197
|
-
|
|
198
|
-
say "- Devise User model install with added name and locale field..."
|
|
199
|
-
run "bundle exec rails g devise User name:string locale:string" unless dry_run?
|
|
200
|
-
|
|
201
|
-
say "- Replace Devise route and add path_prefix..."
|
|
202
|
-
gsub_file "#{app_name}/config/routes.rb", /devise_for :users/, "devise_for :users, :path_prefix => 'auth'"
|
|
203
|
-
insert_into_file "#{app_name}/config/routes.rb", <<-ROUTE.strip_heredoc_with_indent(2), :after => "devise_for :users, :path_prefix => 'auth'\n"
|
|
204
|
-
resources :users do
|
|
205
|
-
post 'revert', :on => :member
|
|
206
|
-
end
|
|
207
|
-
ROUTE
|
|
208
|
-
|
|
209
|
-
say "- Create User Controller..."
|
|
210
|
-
create_file "#{app_name}/app/controllers/users_controller.rb", <<-USERS_CONTROLLER.strip_heredoc_with_indent
|
|
211
|
-
class UsersController < InlineFormsController
|
|
212
|
-
set_tab :user
|
|
213
|
-
end
|
|
214
|
-
USERS_CONTROLLER
|
|
215
|
-
|
|
216
|
-
say "- Recreate User Model..."
|
|
217
|
-
remove_file "#{app_name}/app/models/user.rb" # the one that 'devise:install' created
|
|
218
|
-
create_file "#{app_name}/app/models/user.rb", <<-USER_MODEL.strip_heredoc_with_indent
|
|
219
|
-
class User < ActiveRecord::Base
|
|
220
|
-
|
|
221
|
-
# devise options
|
|
222
|
-
devise :database_authenticatable
|
|
223
|
-
# devise :registerable # uncomment this if you want people to be able to register
|
|
224
|
-
devise :recoverable
|
|
225
|
-
devise :rememberable
|
|
226
|
-
devise :trackable
|
|
227
|
-
devise :validatable
|
|
228
|
-
# devise :token_authenticatable
|
|
229
|
-
# devise :confirmable,
|
|
230
|
-
# devise :lockable
|
|
231
|
-
# devise :timeoutable
|
|
232
|
-
# devise :omniauthable
|
|
233
|
-
|
|
234
|
-
# Setup accessible (or protected) attributes for your model
|
|
235
|
-
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :locale
|
|
236
|
-
attr_writer :inline_forms_attribute_list
|
|
237
|
-
|
|
238
|
-
# validations
|
|
239
|
-
validates :name, :presence => true
|
|
240
|
-
|
|
241
|
-
# pagination
|
|
242
|
-
attr_reader :per_page
|
|
243
|
-
@per_page = 7
|
|
244
|
-
|
|
245
|
-
has_paper_trail
|
|
246
|
-
|
|
247
|
-
def _presentation
|
|
248
|
-
"\#{name}"
|
|
249
|
-
end
|
|
250
|
-
|
|
251
|
-
def inline_forms_attribute_list
|
|
252
|
-
@inline_forms_attribute_list ||= [
|
|
253
|
-
[ :name , 'name', :text_field ],
|
|
254
|
-
[ :email , 'email', :text_field ],
|
|
255
|
-
[ :password , 'Nieuw wachtwoord', :devise_password_field ],
|
|
256
|
-
[ :encrypted_password , 'encrypted_password', :info ],
|
|
257
|
-
[ :reset_password_token , 'reset_password_token', :info ],
|
|
258
|
-
[ :reset_password_sent_at , 'reset_password_sent_at', :info],
|
|
259
|
-
[ :remember_created_at , 'remember_created_at', :info ],
|
|
260
|
-
[ :sign_in_count , 'sign_in_count', :info ],
|
|
261
|
-
[ :current_sign_in_at , 'current_sign_in_at', :info ],
|
|
262
|
-
[ :last_sign_in_at , 'last_sign_in_at', :info ],
|
|
263
|
-
[ :current_sign_in_ip , 'current_sign_in_ip', :info ],
|
|
264
|
-
[ :last_sign_in_ip , 'last_sign_in_ip', :info ],
|
|
265
|
-
[ :created_at , 'created_at', :info ],
|
|
266
|
-
[ :updated_at , 'updated_at', :info ],
|
|
267
|
-
]
|
|
268
|
-
end
|
|
269
|
-
|
|
270
|
-
def self.not_accessible_through_html?
|
|
271
|
-
false
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def self.order_by_clause
|
|
275
|
-
'name'
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
end
|
|
279
|
-
USER_MODEL
|
|
280
|
-
|
|
281
|
-
say "- Install ckeditor..."
|
|
282
|
-
run "bundle exec rails g ckeditor:install" unless dry_run?
|
|
283
|
-
|
|
284
|
-
say "- Create ckeditor config.js"
|
|
285
|
-
copy_file "lib/app/assets/javascripts/ckeditor/config.js", "#{app_name}/app/assets/javascripts/ckeditor/config.js"
|
|
286
|
-
|
|
287
|
-
say "- Add remotipart to application.js..."
|
|
288
|
-
create_file "#{app_name}/app/assets/javascripts/application.js", "//= require_tree .\n" if dry_run?
|
|
289
|
-
insert_into_file "#{app_name}/app/assets/javascripts/application.js", "//= require jquery.remotipart\n", :before => "//= require_tree .\n"
|
|
290
|
-
|
|
291
|
-
say "- Paper_trail install..."
|
|
292
|
-
run "bundle exec rails g paper_trail:install" unless dry_run?
|
|
293
|
-
|
|
294
|
-
say "- Installaing ZURB Foundation..."
|
|
295
|
-
run "bundle exec rails g foundation:install"
|
|
296
|
-
|
|
297
|
-
say "- Generate models and tables and views for translations..."
|
|
298
|
-
run 'bundle exec rails g inline_forms InlineFormsLocale name:string inline_forms_translations:belongs_to _enabled:yes _presentation:\'#{name}\''
|
|
299
|
-
run 'bundle exec rails g inline_forms InlineFormsKey name:string inline_forms_translations:has_many inline_forms_translations:associated _enabled:yes _presentation:\'#{name}\''
|
|
300
|
-
run 'bundle exec rails g inline_forms InlineFormsTranslation inline_forms_key:belongs_to inline_forms_locale:dropdown value:text interpolations:text is_proc:boolean _presentation:\'#{value}\''
|
|
301
|
-
|
|
302
|
-
sleep 1 # to get unique migration number
|
|
303
|
-
create_file "#{app_name}/db/migrate/" +
|
|
304
|
-
Time.now.utc.strftime("%Y%m%d%H%M%S") +
|
|
305
|
-
"_" +
|
|
306
|
-
"inline_forms_create_view_for_translations.rb", <<-VIEW_MIGRATION.strip_heredoc_with_indent
|
|
307
|
-
class InlineFormsCreateViewForTranslations < ActiveRecord::Migration
|
|
308
|
-
|
|
309
|
-
def self.up
|
|
310
|
-
execute 'CREATE VIEW translations
|
|
311
|
-
AS
|
|
312
|
-
SELECT L.name AS locale,
|
|
313
|
-
K.name AS thekey,
|
|
314
|
-
T.value AS value,
|
|
315
|
-
T.interpolations AS interpolations,
|
|
316
|
-
T.is_proc AS is_proc
|
|
317
|
-
FROM inline_forms_keys K, inline_forms_locales L, inline_forms_translations T
|
|
318
|
-
WHERE T.inline_forms_key_id = K.id AND T.inline_forms_locale_id = L.id '
|
|
319
|
-
end
|
|
320
|
-
|
|
321
|
-
def self.down
|
|
322
|
-
execute 'DROP VIEW translations'
|
|
323
|
-
end
|
|
324
|
-
|
|
325
|
-
end
|
|
326
|
-
VIEW_MIGRATION
|
|
327
|
-
|
|
328
|
-
say "- Migrating Database"
|
|
329
|
-
run "bundle exec rake db:migrate" unless (dry_run? || !using_sqlite?)
|
|
330
|
-
|
|
331
|
-
say "- Adding admin user with email: #{email}, password: #{password} to seeds.rb"
|
|
332
|
-
append_to_file "#{app_name}/db/seeds.rb", "User.new({ :email => '#{email}', :name => 'Admin', :password => '#{password}', :password_confirmation => '#{password}'}).save"
|
|
333
|
-
|
|
334
|
-
say "- Seeding the database"
|
|
335
|
-
run "bundle exec rake db:seed" unless (dry_run? || !using_sqlite?)
|
|
336
|
-
|
|
337
|
-
say "- Creating header in app/views/inline_forms/_header.html.erb..."
|
|
338
|
-
create_file "#{app_name}/app/views/inline_forms/_header.html.erb", <<-END_HEADER.strip_heredoc_with_indent
|
|
339
|
-
<div id='Header'>
|
|
340
|
-
<div id='title'>
|
|
341
|
-
#{app_name} v<%= inline_forms_version -%>
|
|
342
|
-
</div>
|
|
343
|
-
<% if current_user -%>
|
|
344
|
-
<div id='logout'>
|
|
345
|
-
<%= link_to \"Afmelden: \#{current_user.name}\", destroy_user_session_path, :method => :delete %>
|
|
346
|
-
</div>
|
|
347
|
-
<% end -%>
|
|
348
|
-
<div style='clear: both;'></div>
|
|
349
|
-
</div>
|
|
350
|
-
END_HEADER
|
|
351
|
-
|
|
352
|
-
say "- Recreating ApplicationHelper to set application_name and application_title..."
|
|
353
|
-
remove_file "#{app_name}/app/helpers/application_helper.rb" # the one that 'rails new' created
|
|
354
|
-
create_file "#{app_name}/app/helpers/application_helper.rb", <<-END_APPHELPER.strip_heredoc_with_indent
|
|
355
|
-
module ApplicationHelper
|
|
356
|
-
def application_name
|
|
357
|
-
'#{app_name}'
|
|
358
|
-
end
|
|
359
|
-
def application_title
|
|
360
|
-
'#{app_name}'
|
|
361
|
-
end
|
|
362
|
-
end
|
|
363
|
-
END_APPHELPER
|
|
364
|
-
|
|
365
|
-
say "- Recreating ApplicationController to add devise, cancan, I18n stuff..."
|
|
366
|
-
remove_file "#{app_name}/app/controllers/application_controller.rb" # the one that 'rails new' created
|
|
367
|
-
create_file "#{app_name}/app/controllers/application_controller.rb", <<-END_APPCONTROLLER.strip_heredoc_with_indent
|
|
368
|
-
class ApplicationController < InlineFormsApplicationController
|
|
369
|
-
protect_from_forgery
|
|
370
|
-
|
|
371
|
-
# Comment next two lines if you don't want Devise authentication
|
|
372
|
-
before_filter :authenticate_user!
|
|
373
|
-
layout 'devise' if :devise_controller?
|
|
374
|
-
|
|
375
|
-
# Comment next 6 lines if you want CanCan authorization
|
|
376
|
-
enable_authorization :unless => :devise_controller?
|
|
377
|
-
|
|
378
|
-
rescue_from CanCan::Unauthorized do |exception|
|
|
379
|
-
sign_out :user if user_signed_in?
|
|
380
|
-
redirect_to new_user_session_path, :alert => exception.message
|
|
381
|
-
end
|
|
382
|
-
|
|
383
|
-
# Uncomment next line if you want I18n (based on subdomain)
|
|
384
|
-
# before_filter :set_locale
|
|
385
|
-
|
|
386
|
-
# Uncomment next line and specify default locale
|
|
387
|
-
# I18n.default_locale = :en
|
|
388
|
-
|
|
389
|
-
# Uncomment next line and specify available locales
|
|
390
|
-
# I18n.available_locales = [ :en, :nl, :pp ]
|
|
391
|
-
|
|
392
|
-
# Uncomment next nine line if you want locale based on subdomain, like 'it.example.com, de.example.com'
|
|
393
|
-
# def set_locale
|
|
394
|
-
# I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
|
395
|
-
# end
|
|
396
|
-
#
|
|
397
|
-
# def extract_locale_from_subdomain
|
|
398
|
-
# locale = request.subdomains.first
|
|
399
|
-
# return nil if locale.nil?
|
|
400
|
-
# I18n.available_locales.include?(locale.to_sym) ? locale.to_s : nil
|
|
401
|
-
# end
|
|
402
|
-
end
|
|
403
|
-
END_APPCONTROLLER
|
|
404
|
-
|
|
405
|
-
say "- Creating Ability model so that the user with id = 1 can access all..."
|
|
406
|
-
create_file "#{app_name}/app/models/ability.rb", <<-END_ABILITY.strip_heredoc_with_indent
|
|
407
|
-
class Ability
|
|
408
|
-
include CanCan::Ability
|
|
409
|
-
|
|
410
|
-
def initialize(user)
|
|
411
|
-
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
|
412
|
-
|
|
413
|
-
user ||= user.new # guest user
|
|
414
|
-
|
|
415
|
-
if user.id == 1 #quick hack
|
|
416
|
-
can :access, :all
|
|
417
|
-
else
|
|
418
|
-
# put restrictions for other users here
|
|
419
|
-
end
|
|
420
|
-
end
|
|
421
|
-
end
|
|
422
|
-
END_ABILITY
|
|
423
|
-
|
|
424
|
-
# create environments/production.rb if it's a dry run
|
|
425
|
-
create_file "#{app_name}/config/environments/production.rb", " # config.assets.precompile += %w( search.js )\nend\n" if dry_run?
|
|
426
|
-
|
|
427
|
-
say "- Injecting precompile assets stuff in environments/production.rb..."
|
|
428
|
-
insert_into_file "#{app_name}/config/environments/production.rb",
|
|
429
|
-
" config.assets.precompile += %w(inline_forms_application.js inline_forms_application.css devise.css)\n",
|
|
430
|
-
:after => " # config.assets.precompile += %w( search.js )\n"
|
|
431
|
-
|
|
432
|
-
say "- Injecting devise mailer stuff in environments/production.rb..."
|
|
433
|
-
insert_into_file "#{app_name}/config/environments/production.rb", <<-DEVISE_MAILER_STUFF.strip_heredoc_with_indent(2), :before => "end\n"
|
|
434
|
-
|
|
435
|
-
# for devise
|
|
436
|
-
config.action_mailer.default_url_options = { :protocol => 'https', :host => 'YOURHOSTNAME' }
|
|
437
|
-
config.action_mailer.delivery_method = :smtp
|
|
438
|
-
config.action_mailer.smtp_settings = {
|
|
439
|
-
:address => 'YOURMAILSERVER',
|
|
440
|
-
:enable_starttls_auto => true,
|
|
441
|
-
:password => 'YOURPASSWORD',
|
|
442
|
-
:user_name => 'YOURUSERNAME'
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
DEVISE_MAILER_STUFF
|
|
446
|
-
|
|
447
|
-
say "- Setting config.assets.compile to true in environments/production.rb (needed for ckeditor)..."
|
|
448
|
-
insert_into_file "#{app_name}/config/environments/production.rb", " config.assets.compile = false\n", :before => "end\n" if dry_run?
|
|
449
|
-
gsub_file "#{app_name}/config/environments/production.rb", /config.assets.compile = false/, "config.assets.compile = true"
|
|
450
|
-
|
|
451
|
-
say "- Capify..."
|
|
452
|
-
run 'capify .'
|
|
453
|
-
remove_file "#{app_name}/config/deploy.rb" # remove the file capify created!
|
|
454
|
-
copy_file "lib/generators/templates/deploy.rb", "#{app_name}/config/deploy.rb"
|
|
455
|
-
|
|
456
|
-
say "- Unicorn Config..."
|
|
457
|
-
copy_file "lib/generators/templates/unicorn.rb", "#{app_name}/config/unicorn.rb"
|
|
93
|
+
empty_directory(app_name)
|
|
458
94
|
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
insert_into_file "#{app_name}/.gitignore", <<-GITIGNORE.strip_heredoc_with_indent, :after => "/tmp\n"
|
|
463
|
-
# netbeans
|
|
464
|
-
nbproject
|
|
465
|
-
# remotipart uploads
|
|
466
|
-
public/uploads
|
|
467
|
-
GITIGNORE
|
|
95
|
+
ruby_version = (%x[rvm current]).gsub(/@.*/,'')
|
|
96
|
+
create_file "#{app_name}/.ruby-version", ruby_version
|
|
97
|
+
create_file "#{app_name}/.ruby-gemset", app_name
|
|
468
98
|
|
|
469
|
-
|
|
470
|
-
run 'git commit -a -m " * Initial"'
|
|
99
|
+
app_template_file = File.join(File.dirname(__FILE__), 'inline_forms_app_template.rb')
|
|
471
100
|
|
|
472
|
-
if
|
|
473
|
-
say "
|
|
474
|
-
|
|
475
|
-
run 'bundle exec rails generate uploader Image'
|
|
476
|
-
run 'bundle exec rails g inline_forms Apartment name:string title:string description:text pictures:has_many pictures:associated _enabled:yes _presentation:\'#{name}\''
|
|
477
|
-
run 'bundle exec rake db:migrate'
|
|
478
|
-
say "\nDone! Now point your browser to http://localhost:3000/apartments !", :yellow
|
|
479
|
-
say "\nPress ctlr-C to quit...", :yellow
|
|
480
|
-
run 'bundle exec rails s'
|
|
481
|
-
else
|
|
482
|
-
say "\nDone! Now make your tables with 'bundle exec rails g inline_forms ...", :yellow
|
|
483
|
-
#say "- Don't forget: edit .rvmrc, config/{routes.rb, deploy.rb}, .git/config, delete public/index.html\n"
|
|
101
|
+
if ! run("rails _3.2.12_ new #{app_name} -m #{app_template_file} --skip-bundle --skip-gemfile --skip-test-unit")
|
|
102
|
+
say "Rails could not create the app '#{app_name}', maybe because it is a reserved word...", :red
|
|
103
|
+
exit 1
|
|
484
104
|
end
|
|
485
|
-
|
|
486
105
|
end
|
|
487
106
|
end
|
|
107
|
+
|
|
488
108
|
Creator.start
|
|
489
109
|
end
|
|
490
110
|
end
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
say "- Working directory is now #{`pwd`}"
|
|
2
|
+
say "- RVM gemset is now #{%x[rvm current]}"
|
|
3
|
+
|
|
4
|
+
create_file 'Gemfile', '# created by inline_forms\n'
|
|
5
|
+
add_source 'https://rubygems.org'
|
|
6
|
+
gem 'rails', '3.2.12'
|
|
7
|
+
gem 'rake', '10.0.4'
|
|
8
|
+
gem 'jquery-rails', '~> 2.3.0'
|
|
9
|
+
gem 'jquery-ui-rails'
|
|
10
|
+
gem 'capistrano'
|
|
11
|
+
gem 'will_paginate', :git => 'git://github.com/acesuares/will_paginate.git'
|
|
12
|
+
gem 'tabs_on_rails', :git => 'git://github.com/acesuares/tabs_on_rails.git', :branch => 'update_remote'
|
|
13
|
+
gem 'ckeditor'
|
|
14
|
+
gem 'cancan', :git => 'git://github.com/acesuares/cancan.git', :branch => '2.0'
|
|
15
|
+
gem 'carrierwave'
|
|
16
|
+
gem 'remotipart', '~> 1.0'
|
|
17
|
+
gem 'paper_trail'
|
|
18
|
+
gem 'devise'
|
|
19
|
+
gem 'inline_forms'
|
|
20
|
+
gem 'validation_hints'
|
|
21
|
+
gem 'mini_magick'
|
|
22
|
+
gem 'jquery-ui-rails'
|
|
23
|
+
gem 'yaml_db'
|
|
24
|
+
gem 'rails-i18n'
|
|
25
|
+
gem 'i18n-active_record', :git => 'git://github.com/acesuares/i18n-active_record.git'
|
|
26
|
+
gem 'unicorn'
|
|
27
|
+
gem 'rvm'
|
|
28
|
+
gem 'rvm-capistrano'
|
|
29
|
+
|
|
30
|
+
gem_group :development do
|
|
31
|
+
gem 'sqlite3'
|
|
32
|
+
gem 'rspec-rails'
|
|
33
|
+
gem 'shoulda', '>= 0'
|
|
34
|
+
gem 'bundler'
|
|
35
|
+
gem 'jeweler'
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
gem_group :production do
|
|
39
|
+
gem 'mysql2'
|
|
40
|
+
gem 'therubyracer'
|
|
41
|
+
gem 'uglifier', '>= 1.0.3'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
gem_group :assets do
|
|
45
|
+
gem 'sass-rails', '~> 3.2.3'
|
|
46
|
+
gem 'coffee-rails', '~> 3.2.1'
|
|
47
|
+
gem 'uglifier', '>= 1.0.3'
|
|
48
|
+
gem 'compass-rails' # you need this or you get an err
|
|
49
|
+
gem 'zurb-foundation', '~> 4.0.0'
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
say "- Running bundle..."
|
|
53
|
+
run "bundle install"
|
|
54
|
+
|
|
55
|
+
say "- Database setup: creating config/database.yml with development database #{database}"
|
|
56
|
+
remove_file "config/database.yml" # the one that 'rails _3.2.12_ new' created
|
|
57
|
+
if using_sqlite?
|
|
58
|
+
create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
59
|
+
development:
|
|
60
|
+
adapter: sqlite3
|
|
61
|
+
database: db/development.sqlite3
|
|
62
|
+
pool: 5
|
|
63
|
+
timeout: 5000
|
|
64
|
+
|
|
65
|
+
END_DATABASEYML
|
|
66
|
+
else
|
|
67
|
+
create_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
68
|
+
development:
|
|
69
|
+
adapter: mysql2
|
|
70
|
+
database: #{app_name}_dev
|
|
71
|
+
username: #{app_name}
|
|
72
|
+
password: #{app_name}
|
|
73
|
+
|
|
74
|
+
END_DATABASEYML
|
|
75
|
+
end
|
|
76
|
+
append_file "config/database.yml", <<-END_DATABASEYML.strip_heredoc_with_indent
|
|
77
|
+
production:
|
|
78
|
+
adapter: mysql2
|
|
79
|
+
database: #{app_name}_p
|
|
80
|
+
username: #{app_name}
|
|
81
|
+
password: #{app_name}444
|
|
82
|
+
END_DATABASEYML
|
|
83
|
+
|
|
84
|
+
say "- Devise install..."
|
|
85
|
+
run "bundle exec rails g devise:install"
|
|
86
|
+
|
|
87
|
+
say "- Devise User model install with added name and locale field..."
|
|
88
|
+
run "bundle exec rails g devise User name:string locale:string"
|
|
89
|
+
|
|
90
|
+
say "- Replace Devise route and add path_prefix..."
|
|
91
|
+
gsub_file "config/routes.rb", /devise_for :users/, "devise_for :users, :path_prefix => 'auth'"
|
|
92
|
+
insert_into_file "config/routes.rb", <<-ROUTE.strip_heredoc_with_indent(2), :after => "devise_for :users, :path_prefix => 'auth'\n"
|
|
93
|
+
resources :users do
|
|
94
|
+
post 'revert', :on => :member
|
|
95
|
+
end
|
|
96
|
+
ROUTE
|
|
97
|
+
|
|
98
|
+
say "- Create User Controller..."
|
|
99
|
+
create_file "app/controllers/users_controller.rb", <<-USERS_CONTROLLER.strip_heredoc_with_indent
|
|
100
|
+
class UsersController < InlineFormsController
|
|
101
|
+
set_tab :user
|
|
102
|
+
end
|
|
103
|
+
USERS_CONTROLLER
|
|
104
|
+
|
|
105
|
+
say "- Recreate User Model..."
|
|
106
|
+
remove_file "app/models/user.rb" # the one that 'devise:install' created
|
|
107
|
+
create_file "app/models/user.rb", <<-USER_MODEL.strip_heredoc_with_indent
|
|
108
|
+
class User < ActiveRecord::Base
|
|
109
|
+
|
|
110
|
+
# devise options
|
|
111
|
+
devise :database_authenticatable
|
|
112
|
+
# devise :registerable # uncomment this if you want people to be able to register
|
|
113
|
+
devise :recoverable
|
|
114
|
+
devise :rememberable
|
|
115
|
+
devise :trackable
|
|
116
|
+
devise :validatable
|
|
117
|
+
# devise :token_authenticatable
|
|
118
|
+
# devise :confirmable,
|
|
119
|
+
# devise :lockable
|
|
120
|
+
# devise :timeoutable
|
|
121
|
+
# devise :omniauthable
|
|
122
|
+
|
|
123
|
+
# Setup accessible (or protected) attributes for your model
|
|
124
|
+
attr_accessible :email, :password, :password_confirmation, :remember_me, :name, :locale
|
|
125
|
+
attr_writer :inline_forms_attribute_list
|
|
126
|
+
|
|
127
|
+
# validations
|
|
128
|
+
validates :name, :presence => true
|
|
129
|
+
|
|
130
|
+
# pagination
|
|
131
|
+
attr_reader :per_page
|
|
132
|
+
@per_page = 7
|
|
133
|
+
|
|
134
|
+
has_paper_trail
|
|
135
|
+
|
|
136
|
+
def _presentation
|
|
137
|
+
"\#{name}"
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def inline_forms_attribute_list
|
|
141
|
+
@inline_forms_attribute_list ||= [
|
|
142
|
+
[ :name , 'name', :text_field ],
|
|
143
|
+
[ :email , 'email', :text_field ],
|
|
144
|
+
[ :password , 'Nieuw wachtwoord', :devise_password_field ],
|
|
145
|
+
[ :encrypted_password , 'encrypted_password', :info ],
|
|
146
|
+
[ :reset_password_token , 'reset_password_token', :info ],
|
|
147
|
+
[ :reset_password_sent_at , 'reset_password_sent_at', :info],
|
|
148
|
+
[ :remember_created_at , 'remember_created_at', :info ],
|
|
149
|
+
[ :sign_in_count , 'sign_in_count', :info ],
|
|
150
|
+
[ :current_sign_in_at , 'current_sign_in_at', :info ],
|
|
151
|
+
[ :last_sign_in_at , 'last_sign_in_at', :info ],
|
|
152
|
+
[ :current_sign_in_ip , 'current_sign_in_ip', :info ],
|
|
153
|
+
[ :last_sign_in_ip , 'last_sign_in_ip', :info ],
|
|
154
|
+
[ :created_at , 'created_at', :info ],
|
|
155
|
+
[ :updated_at , 'updated_at', :info ],
|
|
156
|
+
]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def self.not_accessible_through_html?
|
|
160
|
+
false
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def self.order_by_clause
|
|
164
|
+
'name'
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
end
|
|
168
|
+
USER_MODEL
|
|
169
|
+
|
|
170
|
+
say "- Install ckeditor..."
|
|
171
|
+
generate "ckeditor", "install"
|
|
172
|
+
|
|
173
|
+
say "- Mount Ckeditor::Engine to routes..."
|
|
174
|
+
route "mount Ckeditor::Engine => '/ckeditor'"
|
|
175
|
+
|
|
176
|
+
say "- Add ckeditor autoload_paths to application.rb..."
|
|
177
|
+
application "config.autoload_paths += %W(\#{config.root}/app/models/ckeditor)"
|
|
178
|
+
|
|
179
|
+
say "- Add ckeditor/init to application.js..."
|
|
180
|
+
insert_into_file "app/assets/javascripts/application.js",
|
|
181
|
+
"//= require ckeditor/init\n",
|
|
182
|
+
:before => "//= require_tree .\n"
|
|
183
|
+
|
|
184
|
+
say "- Create ckeditor config.js"
|
|
185
|
+
copy_file "lib/app/assets/javascripts/ckeditor/config.js", "app/assets/javascripts/ckeditor/config.js"
|
|
186
|
+
|
|
187
|
+
say "- Add remotipart to application.js..."
|
|
188
|
+
insert_into_file "app/assets/javascripts/application.js", "//= require jquery.remotipart\n", :before => "//= require_tree .\n"
|
|
189
|
+
|
|
190
|
+
say "- Paper_trail install..."
|
|
191
|
+
generate "paper_trail", "install"
|
|
192
|
+
|
|
193
|
+
say "- Installaing ZURB Foundation..."
|
|
194
|
+
generate "foundation", "install"
|
|
195
|
+
|
|
196
|
+
say "- Generate models and tables and views for translations..."
|
|
197
|
+
generate "inline_forms", "InlineFormsLocale name:string inline_forms_translations:belongs_to _enabled:yes _presentation:\#{name}"
|
|
198
|
+
generate "inline_forms", "InlineFormsKey name:string inline_forms_translations:has_many inline_forms_translations:associated _enabled:yes _presentation:\#{name}'"
|
|
199
|
+
generate "inline_forms", "InlineFormsTranslation inline_forms_key:belongs_to inline_forms_locale:dropdown value:text interpolations:text is_proc:boolean _presentation:\#{value}'"
|
|
200
|
+
|
|
201
|
+
sleep 1 # to get unique migration number
|
|
202
|
+
create_file "db/migrate/" +
|
|
203
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S") +
|
|
204
|
+
"_" +
|
|
205
|
+
"inline_forms_create_view_for_translations.rb", <<-VIEW_MIGRATION.strip_heredoc_with_indent
|
|
206
|
+
class InlineFormsCreateViewForTranslations < ActiveRecord::Migration
|
|
207
|
+
|
|
208
|
+
def self.up
|
|
209
|
+
execute 'CREATE VIEW translations
|
|
210
|
+
AS
|
|
211
|
+
SELECT L.name AS locale,
|
|
212
|
+
K.name AS thekey,
|
|
213
|
+
T.value AS value,
|
|
214
|
+
T.interpolations AS interpolations,
|
|
215
|
+
T.is_proc AS is_proc
|
|
216
|
+
FROM inline_forms_keys K, inline_forms_locales L, inline_forms_translations T
|
|
217
|
+
WHERE T.inline_forms_key_id = K.id AND T.inline_forms_locale_id = L.id '
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def self.down
|
|
221
|
+
execute 'DROP VIEW translations'
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
end
|
|
225
|
+
VIEW_MIGRATION
|
|
226
|
+
|
|
227
|
+
say "- Migrating Database (only when using sqlite)"
|
|
228
|
+
run "bundle exec rake db:migrate" if using_sqlite?
|
|
229
|
+
|
|
230
|
+
say "- Adding admin user with email: #{email}, password: #{password} to seeds.rb"
|
|
231
|
+
append_to_file "db/seeds.rb", "User.create({ :email => '#{email}', :name => 'Admin', :password => '#{password}', :password_confirmation => '#{password}'}, :without_protection => true)"
|
|
232
|
+
|
|
233
|
+
say "- Seeding the database (only when using sqlite)"
|
|
234
|
+
run "bundle exec rake db:seed" if using_sqlite?
|
|
235
|
+
|
|
236
|
+
say "- Creating header in app/views/inline_forms/_header.html.erb..."
|
|
237
|
+
create_file "app/views/inline_forms/_header.html.erb", <<-END_HEADER.strip_heredoc_with_indent
|
|
238
|
+
<div id='Header'>
|
|
239
|
+
<div id='title'>
|
|
240
|
+
#{app_name} v<%= inline_forms_version -%>
|
|
241
|
+
</div>
|
|
242
|
+
<% if current_user -%>
|
|
243
|
+
<div id='logout'>
|
|
244
|
+
<%= link_to \"Afmelden: \#{current_user.name}\", destroy_user_session_path, :method => :delete %>
|
|
245
|
+
</div>
|
|
246
|
+
<% end -%>
|
|
247
|
+
<div style='clear: both;'></div>
|
|
248
|
+
</div>
|
|
249
|
+
END_HEADER
|
|
250
|
+
|
|
251
|
+
say "- Recreating ApplicationHelper to set application_name and application_title..."
|
|
252
|
+
remove_file "app/helpers/application_helper.rb" # the one that 'rails new' created
|
|
253
|
+
create_file "app/helpers/application_helper.rb", <<-END_APPHELPER.strip_heredoc_with_indent
|
|
254
|
+
module ApplicationHelper
|
|
255
|
+
def application_name
|
|
256
|
+
'#{app_name}'
|
|
257
|
+
end
|
|
258
|
+
def application_title
|
|
259
|
+
'#{app_name}'
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
END_APPHELPER
|
|
263
|
+
|
|
264
|
+
say "- Recreating ApplicationController to add devise, cancan, I18n stuff..."
|
|
265
|
+
remove_file "app/controllers/application_controller.rb" # the one that 'rails new' created
|
|
266
|
+
create_file "app/controllers/application_controller.rb", <<-END_APPCONTROLLER.strip_heredoc_with_indent
|
|
267
|
+
class ApplicationController < InlineFormsApplicationController
|
|
268
|
+
protect_from_forgery
|
|
269
|
+
|
|
270
|
+
# Comment next two lines if you don't want Devise authentication
|
|
271
|
+
before_filter :authenticate_user!
|
|
272
|
+
layout 'devise' if :devise_controller?
|
|
273
|
+
|
|
274
|
+
# Comment next 6 lines if you want CanCan authorization
|
|
275
|
+
enable_authorization :unless => :devise_controller?
|
|
276
|
+
|
|
277
|
+
rescue_from CanCan::Unauthorized do |exception|
|
|
278
|
+
sign_out :user if user_signed_in?
|
|
279
|
+
redirect_to new_user_session_path, :alert => exception.message
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# Uncomment next line if you want I18n (based on subdomain)
|
|
283
|
+
# before_filter :set_locale
|
|
284
|
+
|
|
285
|
+
# Uncomment next line and specify default locale
|
|
286
|
+
# I18n.default_locale = :en
|
|
287
|
+
|
|
288
|
+
# Uncomment next line and specify available locales
|
|
289
|
+
# I18n.available_locales = [ :en, :nl, :pp ]
|
|
290
|
+
|
|
291
|
+
# Uncomment next nine line if you want locale based on subdomain, like 'it.example.com, de.example.com'
|
|
292
|
+
# def set_locale
|
|
293
|
+
# I18n.locale = extract_locale_from_subdomain || I18n.default_locale
|
|
294
|
+
# end
|
|
295
|
+
#
|
|
296
|
+
# def extract_locale_from_subdomain
|
|
297
|
+
# locale = request.subdomains.first
|
|
298
|
+
# return nil if locale.nil?
|
|
299
|
+
# I18n.available_locales.include?(locale.to_sym) ? locale.to_s : nil
|
|
300
|
+
# end
|
|
301
|
+
end
|
|
302
|
+
END_APPCONTROLLER
|
|
303
|
+
|
|
304
|
+
say "- Creating Ability model so that the user with id = 1 can access all..."
|
|
305
|
+
create_file "app/models/ability.rb", <<-END_ABILITY.strip_heredoc_with_indent
|
|
306
|
+
class Ability
|
|
307
|
+
include CanCan::Ability
|
|
308
|
+
|
|
309
|
+
def initialize(user)
|
|
310
|
+
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
|
311
|
+
|
|
312
|
+
user ||= user.new # guest user
|
|
313
|
+
|
|
314
|
+
if user.id == 1 #quick hack
|
|
315
|
+
can :access, :all
|
|
316
|
+
else
|
|
317
|
+
# put restrictions for other users here
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
END_ABILITY
|
|
322
|
+
|
data/inline_forms.gemspec
CHANGED
|
@@ -24,13 +24,13 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_dependency('thor')
|
|
25
25
|
s.add_dependency('validation_hints')
|
|
26
26
|
s.add_dependency('rails', '3.2.12')
|
|
27
|
-
s.add_dependency('rails-i18n')
|
|
27
|
+
s.add_dependency('rails-i18n', '~> 3.0.0')
|
|
28
28
|
|
|
29
|
-
s.add_development_dependency(%q<rspec-rails
|
|
30
|
-
s.add_development_dependency(%q<shoulda
|
|
31
|
-
s.add_development_dependency(%q<bundler
|
|
32
|
-
s.add_development_dependency(%q<jeweler
|
|
33
|
-
s.add_development_dependency(%q<rcov
|
|
29
|
+
# s.add_development_dependency(%q<rspec-rails>)
|
|
30
|
+
# s.add_development_dependency(%q<shoulda>)
|
|
31
|
+
# s.add_development_dependency(%q<bundler>)
|
|
32
|
+
# s.add_development_dependency(%q<jeweler>)
|
|
33
|
+
# s.add_development_dependency(%q<rcov>)
|
|
34
34
|
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -46,29 +46,26 @@ CKEDITOR.editorConfig = function( config )
|
|
|
46
46
|
|
|
47
47
|
/* Extra plugins */
|
|
48
48
|
// works only with en, ru, uk locales
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
config.height = '400px';
|
|
52
|
-
config.width = '600px';
|
|
53
|
-
|
|
49
|
+
// config.extraPlugins = "embed,attachment";
|
|
54
50
|
|
|
51
|
+
config.height = 400;
|
|
52
|
+
config.width = 600;
|
|
55
53
|
|
|
56
54
|
config.language = 'nl';
|
|
57
55
|
|
|
58
|
-
/* Toolbars */
|
|
59
|
-
|
|
60
|
-
config.toolbar = 'Minimal';
|
|
56
|
+
/* Toolbars */
|
|
61
57
|
|
|
62
58
|
config.toolbarCanCollapse = false;
|
|
63
59
|
|
|
64
60
|
config.toolbar_Minimal =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
[
|
|
62
|
+
['Format','-','Bold','Italic','-','NumberedList','BulletedList','-','Link'],
|
|
63
|
+
['PasteFromWord','Source','Undo','Redo','RemoveFormat'],
|
|
64
|
+
];
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
config.toolbar_None =
|
|
67
|
+
[ '-' ];
|
|
72
68
|
|
|
69
|
+
config.toolbar = 'Minimal';
|
|
73
70
|
|
|
74
71
|
};
|
data/lib/inline_forms/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,115 +1,95 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inline_forms
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.6.35
|
|
5
5
|
platform: ruby
|
|
6
|
-
authors:
|
|
6
|
+
authors:
|
|
7
7
|
- Ace Suares
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- !ruby/object:Gem::Dependency
|
|
11
|
+
date: 2013-12-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: rvm
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: "0"
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ! '>='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
23
20
|
type: :runtime
|
|
24
|
-
version_requirements: *id001
|
|
25
|
-
- !ruby/object:Gem::Dependency
|
|
26
|
-
name: thor
|
|
27
21
|
prerelease: false
|
|
28
|
-
|
|
29
|
-
requirements:
|
|
30
|
-
-
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ! '>='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: thor
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ! '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
31
34
|
type: :runtime
|
|
32
|
-
version_requirements: *id003
|
|
33
|
-
- !ruby/object:Gem::Dependency
|
|
34
|
-
name: validation_hints
|
|
35
35
|
prerelease: false
|
|
36
|
-
|
|
37
|
-
requirements:
|
|
38
|
-
-
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ! '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: validation_hints
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ! '>='
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
39
48
|
type: :runtime
|
|
40
|
-
version_requirements: *id004
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rails
|
|
43
49
|
prerelease: false
|
|
44
|
-
|
|
45
|
-
requirements:
|
|
46
|
-
- -
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ! '>='
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
48
61
|
version: 3.2.12
|
|
49
62
|
type: :runtime
|
|
50
|
-
version_requirements: *id005
|
|
51
|
-
- !ruby/object:Gem::Dependency
|
|
52
|
-
name: rails-i18n
|
|
53
|
-
prerelease: false
|
|
54
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
|
55
|
-
requirements:
|
|
56
|
-
- *id002
|
|
57
|
-
type: :runtime
|
|
58
|
-
version_requirements: *id006
|
|
59
|
-
- !ruby/object:Gem::Dependency
|
|
60
|
-
name: rspec-rails
|
|
61
|
-
prerelease: false
|
|
62
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
|
63
|
-
requirements:
|
|
64
|
-
- *id002
|
|
65
|
-
type: :development
|
|
66
|
-
version_requirements: *id007
|
|
67
|
-
- !ruby/object:Gem::Dependency
|
|
68
|
-
name: shoulda
|
|
69
|
-
prerelease: false
|
|
70
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- *id002
|
|
73
|
-
type: :development
|
|
74
|
-
version_requirements: *id008
|
|
75
|
-
- !ruby/object:Gem::Dependency
|
|
76
|
-
name: bundler
|
|
77
63
|
prerelease: false
|
|
78
|
-
|
|
79
|
-
requirements:
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 3.2.12
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rails-i18n
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
80
73
|
- - ~>
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version:
|
|
83
|
-
type: :
|
|
84
|
-
version_requirements: *id009
|
|
85
|
-
- !ruby/object:Gem::Dependency
|
|
86
|
-
name: jeweler
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: 3.0.0
|
|
76
|
+
type: :runtime
|
|
87
77
|
prerelease: false
|
|
88
|
-
|
|
89
|
-
requirements:
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
90
80
|
- - ~>
|
|
91
|
-
- !ruby/object:Gem::Version
|
|
92
|
-
version:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
name: rcov
|
|
97
|
-
prerelease: false
|
|
98
|
-
requirement: &id011 !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- *id002
|
|
101
|
-
type: :development
|
|
102
|
-
version_requirements: *id011
|
|
103
|
-
description: Inline Forms aims to ease the setup of forms that provide inline editing. The field list can be specified in the model.
|
|
104
|
-
email:
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 3.0.0
|
|
83
|
+
description: Inline Forms aims to ease the setup of forms that provide inline editing.
|
|
84
|
+
The field list can be specified in the model.
|
|
85
|
+
email:
|
|
105
86
|
- ace@suares.com
|
|
106
|
-
executables:
|
|
87
|
+
executables:
|
|
107
88
|
- inline_forms
|
|
89
|
+
- inline_forms_app_template.rb
|
|
108
90
|
extensions: []
|
|
109
|
-
|
|
110
91
|
extra_rdoc_files: []
|
|
111
|
-
|
|
112
|
-
files:
|
|
92
|
+
files:
|
|
113
93
|
- .document
|
|
114
94
|
- .gitignore
|
|
115
95
|
- Gemfile
|
|
@@ -118,6 +98,7 @@ files:
|
|
|
118
98
|
- README.rdoc
|
|
119
99
|
- Rakefile
|
|
120
100
|
- bin/inline_forms
|
|
101
|
+
- bin/inline_forms_app_template.rb
|
|
121
102
|
- inline_forms.gemspec
|
|
122
103
|
- lib/app/assets/images/add.png
|
|
123
104
|
- lib/app/assets/images/close.png
|
|
@@ -222,27 +203,27 @@ files:
|
|
|
222
203
|
- lib/otherstuff/mkrole
|
|
223
204
|
- lib/otherstuff/roles_users.sql
|
|
224
205
|
homepage: http://github.com/acesuares/inline_forms
|
|
225
|
-
licenses:
|
|
206
|
+
licenses:
|
|
226
207
|
- MIT
|
|
227
208
|
metadata: {}
|
|
228
|
-
|
|
229
209
|
post_install_message:
|
|
230
210
|
rdoc_options: []
|
|
231
|
-
|
|
232
|
-
require_paths:
|
|
211
|
+
require_paths:
|
|
233
212
|
- lib
|
|
234
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
235
|
-
requirements:
|
|
236
|
-
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
213
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
|
+
requirements:
|
|
215
|
+
- - ! '>='
|
|
216
|
+
- !ruby/object:Gem::Version
|
|
217
|
+
version: '0'
|
|
218
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - ! '>='
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '0'
|
|
240
223
|
requirements: []
|
|
241
|
-
|
|
242
224
|
rubyforge_project: inline_forms
|
|
243
225
|
rubygems_version: 2.0.3
|
|
244
226
|
signing_key:
|
|
245
227
|
specification_version: 4
|
|
246
228
|
summary: Inline editing of forms.
|
|
247
229
|
test_files: []
|
|
248
|
-
|