bhf 0.7.16 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +16 -0
  3. data/Gemfile.lock +170 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.md +18 -0
  6. data/Rakefile +49 -0
  7. data/VERSION +1 -0
  8. data/app/assets/javascripts/bhf/application.js +41 -30
  9. data/app/assets/stylesheets/bhf/application.css.sass +19 -5
  10. data/app/controllers/bhf/application_controller.rb +7 -11
  11. data/app/controllers/bhf/embed_entries_controller.rb +16 -5
  12. data/app/controllers/bhf/entries_controller.rb +23 -5
  13. data/app/controllers/bhf/pages_controller.rb +4 -4
  14. data/app/helpers/bhf/frontend_helper.rb +1 -1
  15. data/app/views/bhf/_user.haml +2 -2
  16. data/app/views/bhf/application/index.haml +1 -1
  17. data/app/views/bhf/entries/_form.haml +7 -1
  18. data/app/views/bhf/entries/form/embeds_many/_static.haml +3 -3
  19. data/app/views/bhf/entries/form/embeds_one/_static.haml +3 -3
  20. data/app/views/bhf/entries/form/has_many/_static.haml +5 -2
  21. data/app/views/bhf/entries/form/has_one/_static.haml +1 -1
  22. data/app/views/bhf/pages/_platform.haml +5 -2
  23. data/app/views/bhf/pages/macro/column/_boolean.haml +1 -1
  24. data/app/views/layouts/bhf/application.haml +7 -5
  25. data/bhf.gemspec +200 -0
  26. data/config/locales/de.yml +8 -3
  27. data/config/locales/en.yml +8 -3
  28. data/lib/bhf.rb +23 -13
  29. data/lib/bhf/data.rb +2 -2
  30. data/lib/bhf/form.rb +5 -4
  31. data/lib/bhf/mongoid/document.rb +1 -2
  32. data/lib/bhf/platform.rb +40 -31
  33. data/lib/bhf/settings.rb +5 -4
  34. data/lib/bhf/{config_parser.rb → settings_parser.rb} +4 -4
  35. data/lib/rails/generators/bhf/templates/initializer.rb +12 -16
  36. data/test/database.yml +9 -0
  37. data/test/test_helper.rb +55 -0
  38. metadata +86 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29fb186c6102a0cb1b84f5513b67e5a669bcab2a
4
- data.tar.gz: 8ce8a99cfd1a2397d981b5e8162ff9f2bc226e7a
3
+ metadata.gz: 1366b2ceb6e65bcd2a739f3521e555bf9f6a036d
4
+ data.tar.gz: 27dbc45a52a99f8836128b1560f939f65043fba8
5
5
  SHA512:
6
- metadata.gz: c20a468692b5edba95a704aef66b930b381611caf152efc7c0b1455537ba7a1171e8da04e4ec8e38862e67e5d34d2fd2d076854ac999b27c8cb7e11ae8157f7a
7
- data.tar.gz: 7312dbc5e72879cd9fa38053e58854568901d3b50959fc3eccc9076b04e882280f214f60ec27010855cff8f824bb8173fd066bcb3fdcd7d1c0556bfcac68eee2
6
+ metadata.gz: 49b9b8d0b83fa398b7f1d2906e783170606f930fee4ce284d6b31366f6419563c6e9e171a4b41cc0744f335631058725353511135d25bbad4e587e43c7b6df76
7
+ data.tar.gz: d59d1a6b9b2c019a352748b91f64b7a90273ff155c854ec4586f3e22a4566293c0dc54c5dedf94f100f9eb2cf9675d7000e3daf4588ed31f3f7bc55b8654a7e3
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'rails', '~> 4.1.1'
4
+ gem 'turbolinks', '~> 2.1'
5
+ gem 'kaminari', '~> 0.15'
6
+ gem 'haml-rails', '~> 0.4'
7
+ gem 'sass-rails', '~> 4.0'
8
+
9
+
10
+ group :development do
11
+ gem 'shoulda', '~> 3.5'
12
+ gem 'rdoc', '~> 3.12'
13
+ gem 'bundler', '~> 1.0'
14
+ gem 'jeweler', '~> 2.0'
15
+ gem 'simplecov', '~> 0.8'
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,170 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ actionmailer (4.1.1)
5
+ actionpack (= 4.1.1)
6
+ actionview (= 4.1.1)
7
+ mail (~> 2.5.4)
8
+ actionpack (4.1.1)
9
+ actionview (= 4.1.1)
10
+ activesupport (= 4.1.1)
11
+ rack (~> 1.5.2)
12
+ rack-test (~> 0.6.2)
13
+ actionview (4.1.1)
14
+ activesupport (= 4.1.1)
15
+ builder (~> 3.1)
16
+ erubis (~> 2.7.0)
17
+ activemodel (4.1.1)
18
+ activesupport (= 4.1.1)
19
+ builder (~> 3.1)
20
+ activerecord (4.1.1)
21
+ activemodel (= 4.1.1)
22
+ activesupport (= 4.1.1)
23
+ arel (~> 5.0.0)
24
+ activesupport (4.1.1)
25
+ i18n (~> 0.6, >= 0.6.9)
26
+ json (~> 1.7, >= 1.7.7)
27
+ minitest (~> 5.1)
28
+ thread_safe (~> 0.1)
29
+ tzinfo (~> 1.1)
30
+ addressable (2.3.6)
31
+ arel (5.0.1.20140414130214)
32
+ builder (3.2.2)
33
+ coffee-rails (4.0.1)
34
+ coffee-script (>= 2.2.0)
35
+ railties (>= 4.0.0, < 5.0)
36
+ coffee-script (2.2.0)
37
+ coffee-script-source
38
+ execjs
39
+ coffee-script-source (1.7.0)
40
+ descendants_tracker (0.0.4)
41
+ thread_safe (~> 0.3, >= 0.3.1)
42
+ docile (1.1.3)
43
+ erubis (2.7.0)
44
+ execjs (2.2.0)
45
+ faraday (0.9.0)
46
+ multipart-post (>= 1.2, < 3)
47
+ git (1.2.7)
48
+ github_api (0.11.3)
49
+ addressable (~> 2.3)
50
+ descendants_tracker (~> 0.0.1)
51
+ faraday (~> 0.8, < 0.10)
52
+ hashie (>= 1.2)
53
+ multi_json (>= 1.7.5, < 2.0)
54
+ nokogiri (~> 1.6.0)
55
+ oauth2
56
+ haml (4.0.5)
57
+ tilt
58
+ haml-rails (0.5.3)
59
+ actionpack (>= 4.0.1)
60
+ activesupport (>= 4.0.1)
61
+ haml (>= 3.1, < 5.0)
62
+ railties (>= 4.0.1)
63
+ hashie (3.0.0)
64
+ highline (1.6.21)
65
+ hike (1.2.3)
66
+ i18n (0.6.9)
67
+ jeweler (2.0.1)
68
+ builder
69
+ bundler (>= 1.0)
70
+ git (>= 1.2.5)
71
+ github_api
72
+ highline (>= 1.6.15)
73
+ nokogiri (>= 1.5.10)
74
+ rake
75
+ rdoc
76
+ json (1.8.1)
77
+ jwt (1.0.0)
78
+ kaminari (0.15.1)
79
+ actionpack (>= 3.0.0)
80
+ activesupport (>= 3.0.0)
81
+ mail (2.5.4)
82
+ mime-types (~> 1.16)
83
+ treetop (~> 1.4.8)
84
+ mime-types (1.25.1)
85
+ mini_portile (0.6.0)
86
+ minitest (5.3.4)
87
+ multi_json (1.10.1)
88
+ multi_xml (0.5.5)
89
+ multipart-post (2.0.0)
90
+ nokogiri (1.6.2.1)
91
+ mini_portile (= 0.6.0)
92
+ oauth2 (0.9.4)
93
+ faraday (>= 0.8, < 0.10)
94
+ jwt (~> 1.0)
95
+ multi_json (~> 1.3)
96
+ multi_xml (~> 0.5)
97
+ rack (~> 1.2)
98
+ polyglot (0.3.5)
99
+ rack (1.5.2)
100
+ rack-test (0.6.2)
101
+ rack (>= 1.0)
102
+ rails (4.1.1)
103
+ actionmailer (= 4.1.1)
104
+ actionpack (= 4.1.1)
105
+ actionview (= 4.1.1)
106
+ activemodel (= 4.1.1)
107
+ activerecord (= 4.1.1)
108
+ activesupport (= 4.1.1)
109
+ bundler (>= 1.3.0, < 2.0)
110
+ railties (= 4.1.1)
111
+ sprockets-rails (~> 2.0)
112
+ railties (4.1.1)
113
+ actionpack (= 4.1.1)
114
+ activesupport (= 4.1.1)
115
+ rake (>= 0.8.7)
116
+ thor (>= 0.18.1, < 2.0)
117
+ rake (10.3.2)
118
+ rdoc (3.12.2)
119
+ json (~> 1.4)
120
+ sass (3.2.19)
121
+ sass-rails (4.0.3)
122
+ railties (>= 4.0.0, < 5.0)
123
+ sass (~> 3.2.0)
124
+ sprockets (~> 2.8, <= 2.11.0)
125
+ sprockets-rails (~> 2.0)
126
+ shoulda (3.5.0)
127
+ shoulda-context (~> 1.0, >= 1.0.1)
128
+ shoulda-matchers (>= 1.4.1, < 3.0)
129
+ shoulda-context (1.2.1)
130
+ shoulda-matchers (2.6.1)
131
+ activesupport (>= 3.0.0)
132
+ simplecov (0.8.2)
133
+ docile (~> 1.1.0)
134
+ multi_json
135
+ simplecov-html (~> 0.8.0)
136
+ simplecov-html (0.8.0)
137
+ sprockets (2.11.0)
138
+ hike (~> 1.2)
139
+ multi_json (~> 1.0)
140
+ rack (~> 1.0)
141
+ tilt (~> 1.1, != 1.3.0)
142
+ sprockets-rails (2.1.3)
143
+ actionpack (>= 3.0)
144
+ activesupport (>= 3.0)
145
+ sprockets (~> 2.8)
146
+ thor (0.19.1)
147
+ thread_safe (0.3.4)
148
+ tilt (1.4.1)
149
+ treetop (1.4.15)
150
+ polyglot
151
+ polyglot (>= 0.3.1)
152
+ turbolinks (2.2.2)
153
+ coffee-rails
154
+ tzinfo (1.2.1)
155
+ thread_safe (~> 0.1)
156
+
157
+ PLATFORMS
158
+ ruby
159
+
160
+ DEPENDENCIES
161
+ bundler (~> 1.0)
162
+ haml-rails (~> 0.4)
163
+ jeweler (~> 2.0)
164
+ kaminari (~> 0.15)
165
+ rails (~> 4.1.1)
166
+ rdoc (~> 3.12)
167
+ sass-rails (~> 4.0)
168
+ shoulda (~> 3.5)
169
+ simplecov (~> 0.8)
170
+ turbolinks (~> 2.1)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Anton Pawlik
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -0,0 +1,18 @@
1
+ # bhf
2
+
3
+ Description goes here.
4
+
5
+ ## Contributing to bhf
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ ## Copyright
16
+
17
+ Copyright (c) 2014 Anton Pawlik. See LICENSE.txt for
18
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ gem.name = 'bhf'
17
+ gem.homepage = 'http://antpaw.github.io/bhf'
18
+ gem.licenses = 'MIT'
19
+ gem.summary = 'Agnostic Rails backend'
20
+ gem.description = 'Gets you there on time'
21
+ gem.email = 'anton.pawlik@gmail.com'
22
+ gem.authors = ['Anton Pawlik']
23
+ end
24
+ Jeweler::RubygemsDotOrgTasks.new
25
+
26
+ require 'rake/testtask'
27
+ Rake::TestTask.new(:test) do |test|
28
+ test.libs << 'lib' << 'test'
29
+ test.pattern = 'test/**/test_*.rb'
30
+ test.verbose = true
31
+ end
32
+
33
+ desc "Code coverage detail"
34
+ task :simplecov do
35
+ ENV['COVERAGE'] = "true"
36
+ Rake::Task['test'].execute
37
+ end
38
+
39
+ task :default => :test
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "bhf #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.8.0
@@ -12,6 +12,7 @@ var initHelper = function(callback){
12
12
  window.addEvent('domready', scopedCallback);
13
13
  window.addEvent('platformUpdate', callback);
14
14
  window.addEvent('quickEditReady', callback);
15
+ window.addEvent('newQuickEditLink', callback);
15
16
  };
16
17
 
17
18
  (function(){
@@ -26,6 +27,40 @@ var initHelper = function(callback){
26
27
 
27
28
  var editStack = new AjaxEditStack();
28
29
 
30
+ var insertNewLi = function(relation, json){
31
+ var elems = [];
32
+ if (json.can_edit) {
33
+ elems.push(new Element('a.quick_edit', {text: json.to_bhf_s || '', href: json.edit_path}));
34
+ }
35
+ else {
36
+ elems.push(new Element('a', {text: json.to_bhf_s}));
37
+ }
38
+ if (json.can_delete) {
39
+ elems.push(new Element('a.delete', {html: '&times;' || '', href: json.delete_path, 'data-confirm': json.delete_confirm, 'data-remote': 'true'}))
40
+ }
41
+ var newLi = new Element('li').adopt(elems);
42
+ relation.adopt(newLi);
43
+ window.fireEvent('newQuickEditLink', [newLi]);
44
+ }
45
+ var setupDefaultDeleteQuickEditEvents = function(scope, options){
46
+ scope.addEvent('click:relay(.delete)', function(e){
47
+ e.target.addEvents({
48
+ 'ajax:success': function(html){
49
+ var relation = e.target.getParent('.relation');
50
+ if (relation.getElements('li').length < 2) {
51
+ relation.getPrevious('.empty').removeClass('hide');
52
+ if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
53
+ relation.getNext('.add_field').removeClass('hide');
54
+ }
55
+ }
56
+ e.target.getParent('li').dispose();
57
+ },
58
+ 'ajax:failure': function(html){
59
+ alert(Locale.get('Notifications.failure'));
60
+ }
61
+ });
62
+ });
63
+ }
29
64
 
30
65
  initHelper(function(mainScope){
31
66
  var areaSelect = mainScope.getElement('#area_select');
@@ -166,11 +201,7 @@ var initHelper = function(callback){
166
201
  if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
167
202
  relation.getNext('.add_field').addClass('hide');
168
203
  }
169
- relation.adopt(
170
- new Element('li').adopt(
171
- new Element('a.quick_edit', {text: json.to_bhf_s || '', href: json.edit_path})
172
- )
173
- );
204
+ insertNewLi(relation, json);
174
205
  },
175
206
  onSuccessAndChange: function(json){
176
207
  this.wrapElement.set('text', json.to_bhf_s || '');
@@ -193,29 +224,12 @@ var initHelper = function(callback){
193
224
  }
194
225
  }, sharedAjaxEditOptions);
195
226
 
196
- mainForm.getElements('.quick_edit').addEvent('click', function(e){
227
+ setupDefaultDeleteQuickEditEvents(mainForm, ajaxEditOptions);
228
+ mainForm.addEvent('click:relay(.quick_edit)', function(e){
197
229
  e.preventDefault();
198
-
199
230
  editStack.removeAllStacks();
200
231
  editStack.addEditBrick(ajaxEditOptions, this);
201
232
  });
202
- mainForm.getElements('.delete').addEvent('click', function(e){
203
- e.target.addEvents({
204
- 'ajax:success': function(html){
205
- var relation = e.target.getParent('.relation');
206
- if (relation.getElements('li').length < 2) {
207
- relation.getPrevious('.empty').removeClass('hide');
208
- if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
209
- relation.getNext('.add_field').removeClass('hide');
210
- }
211
- }
212
- e.target.getParent('li').dispose();
213
- },
214
- 'ajax:failure': function(html){
215
- alert(Locale.get('Notifications.failure'));
216
- }
217
- });
218
- });
219
233
  }
220
234
  else if (mainScope.hasClass('quick_edit_holder')) {
221
235
  ajaxEditOptions = Object.merge({
@@ -225,11 +239,7 @@ var initHelper = function(callback){
225
239
  if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
226
240
  relation.getNext('.add_field').addClass('hide');
227
241
  }
228
- relation.adopt(
229
- new Element('li').adopt(
230
- new Element('a.quick_edit', {text: json.to_bhf_s || '', href: json.edit_path})
231
- )
232
- );
242
+ insertNewLi(relation, json);
233
243
  },
234
244
  onSuccessAndChange: function(json){
235
245
  this.wrapElement.set('text', json.to_bhf_s || '');
@@ -240,7 +250,8 @@ var initHelper = function(callback){
240
250
  hideNext: true
241
251
  }, sharedAjaxEditOptions);
242
252
 
243
- mainScope.getElements('.quick_edit').addEvent('click', function(e){
253
+ setupDefaultDeleteQuickEditEvents(mainScope, ajaxEditOptions);
254
+ mainScope.addEvent('click:relay(.quick_edit)', function(e){
244
255
  e.preventDefault();
245
256
  editStack.addStack();
246
257
  editStack.addEditBrick(ajaxEditOptions, this);
@@ -309,13 +309,19 @@ table.data_table
309
309
  border-bottom: 1px solid $g3
310
310
  &.has_many,
311
311
  &.has_and_belongs_to_many,
312
- &.text
312
+ &.text,
313
+ &.primary_key.key_long
313
314
  max-width: 200px
314
315
  white-space: nowrap
315
316
  overflow: hidden
316
317
  a
317
318
  -webkit-mask-image: -webkit-gradient(linear, left top, right top, color-stop(70%,rgba($k1,1)), color-stop(95%,rgba($w1,0)))
318
-
319
+ &.primary_key.key_long
320
+ max-width: 50px
321
+ &:hover
322
+ max-width: none
323
+ a
324
+ -webkit-mask-image: none
319
325
  &.no_entries
320
326
  text-align: center
321
327
  text-transform: uppercase
@@ -453,7 +459,6 @@ table.data_table
453
459
  width: 200px
454
460
  min-height: 20px
455
461
  padding-top: 5px
456
- padding-bottom: 3px
457
462
 
458
463
  form
459
464
  .node
@@ -586,9 +591,18 @@ form
586
591
  line-height: 20px
587
592
  &:hover
588
593
  color: $r1
589
-
594
+
595
+ input[type="submit"]
596
+ margin-right: 20px
597
+ input[type="submit"].alt_button
598
+ background: $w1
599
+ color: $b1
600
+ font-weight: normal
601
+ +transition-duration(0)
602
+ &:active,
603
+ &:hover
604
+ color: $w1
590
605
  .cancel
591
- margin-left: 20px
592
606
  color: $g5
593
607
  &:hover
594
608
  color: $g6