bhf 0.6.25 → 0.6.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f826ec1cab0c75468cbe892bb70cc694a2cb9622
4
- data.tar.gz: dd15052e8817004eca77a99a373b9981a95eed6d
3
+ metadata.gz: 56521303606559bee75226e7d3402f8fa85a3ccb
4
+ data.tar.gz: 58d648baa45ae9591ece8d56bf0c3065417e21a7
5
5
  SHA512:
6
- metadata.gz: a9d417a62b0f4a47d97e3c306d7c51f3b53eaf1178f0e24075831996c3ce60678714e07d604a6bb54f0a824623e3b871ccab4d623fac705f9efee0a8a2bcbc20
7
- data.tar.gz: ebcba5e793e609b52b51b1b53a96849180d6e594c554eec566bc5a4cdc126c662753cb86f7d7936a8ed5c728a27c25409f6f678904534af1582097bf613cb67c
6
+ metadata.gz: 1065d976774a7529233fab6c9166b750b9ead007acc9e3b0ee5d567a93008f4b233edc8efbe51b1a2651f7ba83ee356cfc4225c248ec6343f0216ace7dc7fd99
7
+ data.tar.gz: d78b57e061c134bf1a561926b054d12833402bbec5e786e8b1b109c78bfcece6dd34300ca98e990df2ce80f4bc835346859df2122e35d1026352e110002bea8c
@@ -153,7 +153,7 @@ var initHelper = function(callback){
153
153
  }
154
154
  else if (mainForm) {
155
155
  ajaxEditOptions = Object.merge({
156
- successAndAdd: function(json){
156
+ onSuccessAndAdd: function(json){
157
157
  var relation = this.wrapElement.getPrevious('.relation');
158
158
  relation.getPrevious('.empty').addClass('hide');
159
159
  if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
@@ -165,10 +165,10 @@ var initHelper = function(callback){
165
165
  )
166
166
  );
167
167
  },
168
- successAndChange: function(json){
168
+ onSuccessAndChange: function(json){
169
169
  this.wrapElement.set('text', json.to_bhf_s || '');
170
170
  },
171
- successAndNext: function(json){
171
+ onSuccessAndNext: function(json){
172
172
  var a = this.wrapElement;
173
173
  var li = a.getParent('li');
174
174
  if ( ! li) {
@@ -212,7 +212,7 @@ var initHelper = function(callback){
212
212
  }
213
213
  else if (mainScope.hasClass('quick_edit_holder')) {
214
214
  ajaxEditOptions = Object.merge({
215
- successAndAdd: function(json){
215
+ onSuccessAndAdd: function(json){
216
216
  var relation = this.wrapElement.getPrevious('.relation');
217
217
  relation.getPrevious('.empty').addClass('hide');
218
218
  if (relation.hasClass('has_one') || relation.hasClass('embeds_one')) {
@@ -11,7 +11,6 @@ var AjaxEdit = new Class({
11
11
  initialize: function(_options){
12
12
  this.setOptions(_options);
13
13
  this.holder = new Element('div.quick_edit_holder');
14
-
15
14
  },
16
15
 
17
16
  startEdit: function(element, wrapElement){
@@ -619,6 +619,8 @@ footer
619
619
 
620
620
  input[type="submit"],
621
621
  .button
622
+ &.disabled
623
+ opacity: 0.4
622
624
  cursor: pointer
623
625
  display: inline-block
624
626
  padding: 6px 20px
@@ -644,6 +646,8 @@ input[type="submit"],
644
646
 
645
647
  input[type="submit"].alt_button,
646
648
  .alt_button
649
+ &.disabled
650
+ opacity: 0.4
647
651
  display: inline-block
648
652
  padding: 12px 50px
649
653
  +border-radius(4)
@@ -20,7 +20,7 @@ class Bhf::EmbedEntriesController < Bhf::EntriesController
20
20
 
21
21
  edit_path = edit_entry_embed_path(@platform.name, @model.get_embedded_parent(params[:entry_id]), @object)
22
22
  if @quick_edit
23
- render json: object_to_display_hash.merge(edit_path: edit_path), status: :ok
23
+ render json: object_to_bhf_display_hash.merge(edit_path: edit_path), status: :ok
24
24
  else
25
25
  redirect_back_or_default(edit_path, notice: set_message('create.success', @model))
26
26
  end
@@ -132,11 +132,18 @@ class Bhf::EntriesController < Bhf::ApplicationController
132
132
  reflection = @model.reflections[relation.to_sym]
133
133
 
134
134
  next unless ids.any?
135
+ relation_array = @object.send(relation)
135
136
  reflection.klass.unscoped.find(ids.keys).each do |relation_obj|
137
+ has_relation = relation_array.include?(relation_obj)
138
+
136
139
  if ids[relation_obj.id.to_s].blank?
137
- @object.send(relation).delete(relation_obj)
140
+ if has_relation
141
+ relation_array.delete(relation_obj)
142
+ end
138
143
  else
139
- @object.send(relation) << relation_obj
144
+ if ! has_relation
145
+ relation_array << relation_obj
146
+ end
140
147
  end
141
148
  end
142
149
  end
@@ -118,8 +118,8 @@ module Bhf
118
118
  parent = parent.find(parent_id) rescue nil
119
119
 
120
120
  if parent
121
- return parent unless block_given?
122
- return block.call(parent, meta)
121
+ return block.call(parent, meta) if block_given?
122
+ return parent
123
123
  end
124
124
  end
125
125
  end
@@ -131,7 +131,7 @@ module Bhf
131
131
  else
132
132
  meta.inverse_foreign_key.pluralize
133
133
  end.to_s
134
- if parent.relations[key_name].macro == :embeds_one
134
+ if parent.relations[key_name] and parent.relations[key_name].macro == :embeds_one
135
135
  parent.send("build_#{key_name}", params)
136
136
  else
137
137
  parent.send(key_name).build(params)
data/lib/bhf/settings.rb CHANGED
@@ -10,6 +10,9 @@ module Bhf
10
10
  obj << platform.keys.flatten
11
11
  end
12
12
  end.flatten!
13
+ if t.nil?
14
+ raise Exception.new("No Bhf Pages found")
15
+ end
13
16
  if t.uniq.length != t.length
14
17
  raise Exception.new("Platforms with identical names: '#{t.detect{ |e| t.count(e) > 1 }}'")
15
18
  end
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.25
4
+ version: 0.6.26
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-27 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails