bhf 0.6.14 → 0.6.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 004d9921d3a9648914d5eab02339ffe511bffb8f
4
- data.tar.gz: 030b04fea3f166f78507b43a7ff7a371e85b6b0a
3
+ metadata.gz: 6396dd43cc2d51a062538a692225b11f26050f16
4
+ data.tar.gz: 0b633f0d8293dc708920b633d637b5d24816366c
5
5
  SHA512:
6
- metadata.gz: 210ecf0ca1cdef8f593cf8f983e9483e07e2a016fd59a23454531b811e00613770f9b8b0d8013a704235ee9ea503314a73c5327f08db166d57c79b83bedb8737
7
- data.tar.gz: 51a99231f6b1d30b273aa9309eeed2dc429d5fce22270a79570270515f0a06738b0e0f3deca7a6f5b2fb0bc5ed6d5b0769ed49db6002daa0808b56b033429103
6
+ metadata.gz: 45bd83105b6cb3243d96368f30e108bc0950d9591506a0b1d592418190f460c7103fbe2a655a5cf49408220636d1bcde7aeb0674a6611cb9d6ec50729402259a
7
+ data.tar.gz: d2ccfcae7e0cfa433abe7cecae13b8af14c00a3adeddabaa2488b90e55e0b2d1b8be521d508d581ed4464b5788ce9d226636096048c524691dd96f9fcb8a9f49
@@ -14,7 +14,7 @@ class Bhf::PagesController < Bhf::ApplicationController
14
14
 
15
15
  @platforms = platform_options.each_with_object([]) do |opts, obj|
16
16
  platform = Bhf::Platform.new(opts, @page, current_account)
17
- next if platform.model.bhf_embedded?
17
+ next if platform.model.bhf_embedded? || platform.table_hide?
18
18
  platform.pagination = Bhf::Pagination.new(platform.entries_per_page)
19
19
  paginate_platform_objects(platform)
20
20
  obj << platform
@@ -1,2 +1,2 @@
1
1
  = node f, field do
2
- WIP
2
+ = f.object.send(field.name).inspect
@@ -3,8 +3,9 @@
3
3
  .dl.content_box
4
4
  - @platform.definitions.each do |column|
5
5
  - tmp = column.field.show_type ? column.field.show_type : column.field.display_type
6
- = definition_item @object, column do
7
- = render(partial: "bhf/pages/macro/#{column.field.macro}/#{tmp}", locals: {column: column, object: @object})
6
+ - if ! @object.send(column.name).blank?
7
+ = definition_item @object, column do
8
+ = render(partial: "bhf/pages/macro/#{column.field.macro}/#{tmp}", locals: {column: column, object: @object})
8
9
 
9
10
  - if @platform.show_extra_fields and @platform.show_extra_fields.any?
10
11
  .content_box
@@ -1 +1 @@
1
- WIP
1
+ = f.object.send(field.name).inspect
@@ -1,3 +1,2 @@
1
- - # %h2= t('bhf.pages.headline')
2
1
  - @platforms.each do |platform|
3
2
  .platform= render partial: 'platform', locals: {platform: platform}
data/lib/bhf.rb CHANGED
@@ -6,7 +6,6 @@ require 'kaminari'
6
6
 
7
7
  module Bhf
8
8
  class Engine < Rails::Engine
9
-
10
9
  # Config defaults
11
10
  config.page_title = nil
12
11
  config.mount_at = 'bhf'
data/lib/bhf/data.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Bhf
2
2
  module Data
3
3
  class AbstractField
4
- attr_reader :name, :info, :macro, :display_type, :form_type, :show_type, :overwrite_type, :overwrite_display_type, :overwrite_show_type
4
+ attr_reader :name, :info, :macro, :link, :display_type, :form_type, :show_type, :overwrite_type, :overwrite_display_type, :overwrite_show_type
5
5
 
6
6
  def initialize(props)
7
7
  @name = props[:name]
@@ -12,6 +12,7 @@ module Bhf
12
12
  @overwrite_display_type = props[:display_type]
13
13
  @info = props[:info]
14
14
  @macro = :column
15
+ @link = props[:link].downcase.to_sym unless props[:link].blank?
15
16
  end
16
17
  end
17
18
 
@@ -48,7 +48,7 @@ module Bhf
48
48
  else
49
49
  self.class.to_s.humanize
50
50
  end
51
- return "#{klass_name} ID: #{send(self.class.primary_key)}" if attributes[self.class.primary_key]
51
+ return "#{klass_name} ID: #{send(self.class.bhf_primary_key)}" if attributes[self.class.bhf_primary_key]
52
52
  end
53
53
 
54
54
  self.to_s.humanize
data/lib/bhf/platform.rb CHANGED
@@ -30,6 +30,10 @@ module Bhf
30
30
  table_options(:search) != false
31
31
  end
32
32
 
33
+ def table_hide?
34
+ table_options(:hide) == true
35
+ end
36
+
33
37
  def search_field?
34
38
  table_options(:search_field) != false
35
39
  end
@@ -202,7 +206,8 @@ module Bhf
202
206
  form_type: form_options(:types, attr_name) || attr_name,
203
207
  display_type: table_options(:types, attr_name) || attr_name,
204
208
  show_type: show_options(:types, attr_name) || table_options(:types, attr_name) || attr_name,
205
- info: I18n.t("bhf.platforms.#{@name}.infos.#{attr_name}", default: '')
209
+ info: I18n.t("bhf.platforms.#{@name}.infos.#{attr_name}", default: ''),
210
+ link: form_options(:links, attr_name)
206
211
  })
207
212
  )
208
213
  end
@@ -3,19 +3,19 @@
3
3
  //= require ./mootools-more-1.4.0.1.js
4
4
  //= require ./mootools_ujs_ap
5
5
  //= require_tree ./classes/
6
+ var lang = document.html.get('lang');
7
+ if (lang === 'en') {
8
+ lang = 'en-US';
9
+ }
10
+ else {
11
+ lang = lang+'-'+lang.toUpperCase();
12
+ }
13
+ Locale.use(lang);
6
14
 
7
15
  var ajaxNote = new Ajaxify();
8
16
  var bhfInit = function(){
9
17
  var quickEdit = new AjaxEdit();
10
18
  ajaxNote.setup();
11
- var lang = document.html.get('lang');
12
- if (lang === 'en') {
13
- lang = 'en-US';
14
- }
15
- else {
16
- lang = lang+'-'+lang.toUpperCase();
17
- }
18
- Locale.use(lang);
19
19
  var wysiwyg = [];
20
20
  var setupJsForm = function(scope){
21
21
  scope.getElements('.wysiwyg').each(function(elem){
@@ -141,6 +141,9 @@ var bhfInit = function(){
141
141
  scope.getElements('.sortable').each(function(sortableElems){
142
142
  new Sortables(sortableElems, {
143
143
  handle: '.handle',
144
+ onFailure: function(invalidForm){
145
+ ajaxNote.failure();
146
+ },
144
147
  onStart: function(element, clone){
145
148
  element.addClass('dragged');
146
149
  },
@@ -159,6 +162,9 @@ var bhfInit = function(){
159
162
  new Request.HTML({
160
163
  method: 'get',
161
164
  url: href,
165
+ onFailure: function(invalidForm){
166
+ ajaxNote.failure();
167
+ },
162
168
  onSuccess: function(a, b, html, js){
163
169
  platform.innerHTML = html;
164
170
  if (callback) {
@@ -190,6 +196,9 @@ var bhfInit = function(){
190
196
  new Request.HTML({
191
197
  method: 'get',
192
198
  url: this.get('action'),
199
+ onFailure: function(invalidForm){
200
+ ajaxNote.failure();
201
+ },
193
202
  onSuccess: function(a, b, html){
194
203
  parent.innerHTML = html;
195
204
  setupSortables(parent);
@@ -221,6 +230,9 @@ var bhfInit = function(){
221
230
  });
222
231
 
223
232
  quickEdit.addEvents({
233
+ onFailure: function(invalidForm){
234
+ ajaxNote.failure();
235
+ },
224
236
  successAndChange: function(json){
225
237
  var tr = this.wrapElement;
226
238
  tr.getElements('td').each(function(td){
@@ -288,6 +300,9 @@ var bhfInit = function(){
288
300
  });
289
301
 
290
302
  quickEdit.addEvents({
303
+ onFailure: function(invalidForm){
304
+ ajaxNote.failure();
305
+ },
291
306
  successAndAdd: function(json){
292
307
  var relation = this.wrapElement.getPrevious('.relation');
293
308
  relation.getPrevious('.empty').addClass('hide');
@@ -44,6 +44,9 @@ var AjaxEdit = new Class({
44
44
  method: 'get',
45
45
  evalScripts: false,
46
46
  url: element.get('href'),
47
+ onFailure: function(invalidForm){
48
+ this.fireEvent('failure');
49
+ }.bind(this),
47
50
  onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript){
48
51
  this.injectForm(responseHTML);
49
52
  eval(responseJavaScript);
@@ -4,7 +4,12 @@ var Ajaxify = new Class({
4
4
  Implements: [Options, Events],
5
5
 
6
6
  options: {
7
- events: {
7
+ holder: new Element('div#ajax_holder'),
8
+ fadeOutDuration: 2000
9
+ },
10
+
11
+ initialize: function(_options) {
12
+ this.options.events = {
8
13
  loading: {
9
14
  name: 'ajax:loading',
10
15
  text: 'Loading…'
@@ -15,14 +20,9 @@ var Ajaxify = new Class({
15
20
  },
16
21
  failure: {
17
22
  name: 'ajax:failure',
18
- text: 'Oops, something went wrong…'
23
+ text: Locale.get('Notifications.failure')
19
24
  }
20
- },
21
- holder: new Element('div#ajax_holder'),
22
- fadeOutDuration: 2000
23
- },
24
-
25
- initialize: function(_options) {
25
+ };
26
26
  this.setOptions(_options);
27
27
  },
28
28
 
@@ -48,7 +48,7 @@ var Ajaxify = new Class({
48
48
  this.setMessage('success', true);
49
49
  },
50
50
  failure: function(xhr){
51
- this.setMessage('failure', true);
51
+ this.setMessage('failure', false);
52
52
  },
53
53
 
54
54
  setMessage: function(status, fadeOut) {
@@ -7,6 +7,7 @@ Locale.define('de-DE', 'DatePicker', {
7
7
  week: 'W'
8
8
  });
9
9
 
10
- Locale.define('de-DE', 'Messages', {
11
- warning: 'Etwas ist schief gelaufen!'
10
+ Locale.define('de-DE', 'Notifications', {
11
+ failure: 'Etwas ist schief gelaufen!'
12
12
  });
13
+
@@ -8,6 +8,6 @@ Locale.define('en-US', 'DatePicker', {
8
8
  });
9
9
 
10
10
 
11
- Locale.define('de-DE', 'Messages', {
12
- warning: 'Something went wrong!'
11
+ Locale.define('de-DE', 'Notifications', {
12
+ failure: 'Something went wrong!'
13
13
  });
@@ -99,6 +99,9 @@ header
99
99
  color: $g1
100
100
  a
101
101
  text-decoration: underline
102
+ .text
103
+ white-space: pre
104
+
102
105
  .default_table
103
106
  width: 100%
104
107
  td, th
@@ -931,8 +934,18 @@ input[type="submit"].alt_button,
931
934
  height: 100px
932
935
  opacity: 1
933
936
  top: -4px
934
-
935
-
937
+ &.failure
938
+ background-image: none
939
+ width: auto
940
+ opacity: 1
941
+ top: 0
942
+ text-indent: 0px
943
+ +transition-duration(0)
944
+ height: auto
945
+ color: white
946
+ padding: 20px
947
+ marign-left: -120px
948
+ font-weight: bold
936
949
 
937
950
 
938
951
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bhf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.14
4
+ version: 0.6.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Pawlik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-07 00:00:00.000000000 Z
11
+ date: 2013-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails